Title: [187269] trunk/LayoutTests
Revision
187269
Author
[email protected]
Date
2015-07-23 16:20:31 -0700 (Thu, 23 Jul 2015)

Log Message

Web Inspector: rewrite inspector-protocol/console tests to use new testing patterns
https://bugs.webkit.org/show_bug.cgi?id=147231

Reviewed by Joseph Pecoraro.

Restructure existing protocol tests for Console.messageAdded to use Promises and
modern event listener test interfaces. Add some new functionality to make it easier
install multiple protocol event listeners without clobbering.

This test also splits warnings-errors.html into two tests, one to cover CSS parser
warnings and one for _javascript_ parser and runtime errors.

* http/tests/inspector-protocol/resources/InspectorTest.js:
(InspectorTest.sendCommand): Support arguments packaged in an object. This style is preferable
in tests because it is very explicit about what functionality and messages are covered.

(InspectorTest.awaitEvent): Added. This is a single-shot event listener that resolves a
promise when the desired protocol event is dispatched.

(InspectorTest.addEventListener): Reimplemented, based on code from WebInspector.Object.
Allows multiple listeners to be registered for a single protocol event.

(InspectorTest.AsyncTestSuite.prototype.runTestCases):
(InspectorTest.AsyncTestSuite):
(InspectorTest.SyncTestSuite.prototype.runTestCases):
(InspectorTest.SyncTestSuite):
(InspectorTest.log): Improve the formatting of test suite/test case output.

(InspectorFrontendAPI.dispatchMessageAsync): Dispatch to an array of listeners if available.
(InspectorTest.importScript): Clarify that this method performs a synchronous load.
(.InspectorTest.eventHandler.eventName): Deleted.
* inspector-protocol/async-test-suite-expected.txt: Rebaseline whitespace.
* inspector-protocol/sync-test-suite-expected.txt: Rebaseline whitespace.
* inspector-protocol/console/console-message-expected.txt:
* inspector-protocol/console/console-message.html:
* inspector-protocol/console/css-source-locations-expected.txt: Added.
* inspector-protocol/console/css-source-locations.html: Added.
* inspector-protocol/console/js-source-locations-expected.txt: Added.
* inspector-protocol/console/js-source-locations.html: Added.
* inspector-protocol/console/warnings-errors-expected.txt: Removed.
* inspector-protocol/console/warnings-errors.html: Removed.
* inspector-protocol/runtime/getProperties-expected.txt: Rebaseline whitespace.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (187268 => 187269)


--- trunk/LayoutTests/ChangeLog	2015-07-23 23:16:07 UTC (rev 187268)
+++ trunk/LayoutTests/ChangeLog	2015-07-23 23:20:31 UTC (rev 187269)
@@ -1,3 +1,49 @@
+2015-07-23  Brian J. Burg  <[email protected]>
+
+        Web Inspector: rewrite inspector-protocol/console tests to use new testing patterns
+        https://bugs.webkit.org/show_bug.cgi?id=147231
+
+        Reviewed by Joseph Pecoraro.
+
+        Restructure existing protocol tests for Console.messageAdded to use Promises and
+        modern event listener test interfaces. Add some new functionality to make it easier
+        install multiple protocol event listeners without clobbering.
+
+        This test also splits warnings-errors.html into two tests, one to cover CSS parser
+        warnings and one for _javascript_ parser and runtime errors.
+
+        * http/tests/inspector-protocol/resources/InspectorTest.js:
+        (InspectorTest.sendCommand): Support arguments packaged in an object. This style is preferable
+        in tests because it is very explicit about what functionality and messages are covered.
+
+        (InspectorTest.awaitEvent): Added. This is a single-shot event listener that resolves a
+        promise when the desired protocol event is dispatched.
+
+        (InspectorTest.addEventListener): Reimplemented, based on code from WebInspector.Object.
+        Allows multiple listeners to be registered for a single protocol event.
+
+        (InspectorTest.AsyncTestSuite.prototype.runTestCases):
+        (InspectorTest.AsyncTestSuite):
+        (InspectorTest.SyncTestSuite.prototype.runTestCases):
+        (InspectorTest.SyncTestSuite):
+        (InspectorTest.log): Improve the formatting of test suite/test case output.
+
+        (InspectorFrontendAPI.dispatchMessageAsync): Dispatch to an array of listeners if available.
+        (InspectorTest.importScript): Clarify that this method performs a synchronous load.
+        (.InspectorTest.eventHandler.eventName): Deleted.
+        * inspector-protocol/async-test-suite-expected.txt: Rebaseline whitespace.
+        * inspector-protocol/sync-test-suite-expected.txt: Rebaseline whitespace.
+        * inspector-protocol/console/console-message-expected.txt:
+        * inspector-protocol/console/console-message.html:
+        * inspector-protocol/console/css-source-locations-expected.txt: Added.
+        * inspector-protocol/console/css-source-locations.html: Added.
+        * inspector-protocol/console/js-source-locations-expected.txt: Added.
+        * inspector-protocol/console/js-source-locations.html: Added.
+        * inspector-protocol/console/warnings-errors-expected.txt: Removed.
+        * inspector-protocol/console/warnings-errors.html: Removed.
+        * inspector-protocol/runtime/getProperties-expected.txt: Rebaseline whitespace.
+
+
 2015-07-23  Alexey Proskuryakov  <[email protected]>
 
         Windows test result gardening after Mac libxml changes.

Modified: trunk/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js (187268 => 187269)


--- trunk/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js	2015-07-23 23:16:07 UTC (rev 187268)
+++ trunk/LayoutTests/http/tests/inspector-protocol/resources/InspectorTest.js	2015-07-23 23:20:31 UTC (rev 187269)
@@ -29,12 +29,18 @@
 InspectorTest._dispatchTable = [];
 InspectorTest._requestId = -1;
 InspectorTest.eventHandler = {};
+InspectorTest.logCount = 0;
 
 InspectorTest.dumpInspectorProtocolMessages = false;
 InspectorTest.forceSyncDebugLogging = false;
 
-InspectorTest.sendCommand = function(method, params, handler)
+InspectorTest.sendCommand = function(methodOrObject, params, handler)
 {
+    // Allow new-style arguments object, as in awaitCommand.
+    var method = methodOrObject;
+    if (typeof methodOrObject === "object")
+        var {method, params, handler} = methodOrObject;
+
     this._dispatchTable[++this._requestId] = handler;
     var messageObject = {method, params, "id": this._requestId};
     this.sendMessage(messageObject);
@@ -52,6 +58,46 @@
     }.bind(this));
 }
 
+InspectorTest.awaitEvent = function(args)
+{
+    var {event} = args;
+    if (typeof event !== "string")
+        throw new Error("Event must be a string.");
+
+    return new Promise(function(resolve, reject) {
+        InspectorTest.eventHandler[event] = function(message) {
+            InspectorTest.eventHandler[event] = undefined;
+            resolve(message);
+        }
+    });
+}
+
+InspectorTest.addEventListener = function(eventTypeOrObject, listener)
+{
+    var event = eventTypeOrObject;
+    if (typeof eventTypeOrObject === "object")
+        var {event, listener} = eventTypeOrObject;
+
+    if (typeof event !== "string")
+        throw new Error("Event name must be a string.");
+
+    if (typeof listener !== "function")
+        throw new Error("Event listener must be callable.");
+
+    // Convert to an array of listeners.
+    var listeners = InspectorTest.eventHandler[event];
+    if (!listeners)
+        listeners = InspectorTest.eventHandler[event] = [];
+    else if (typeof listeners === "function")
+        listeners = InspectorTest.eventHandler[event] = [listeners];
+
+    // Prevent registering multiple times.
+    if (listeners.includes(listener))
+        throw new Error("Cannot register the same listener more than once.");
+
+    listeners.push(listener);
+}
+
 InspectorTest.sendMessage = function(messageObject)
 {
     // This matches the debug dumping in InspectorBackend, which is bypassed
@@ -87,9 +133,13 @@
         if (!handler)
             return;
 
-        if (typeof handler == "function")
+        if (typeof handler === "function")
             handler(messageObject);
-        else if (typeof handler === "object") {
+        else if (handler instanceof Array) {
+            handler.map(function(listener) {
+                listener.call(null, messageObject);
+            });
+        } else if (typeof handler === "object") {
             var {resolve, reject} = handler;
             if ("error" in messageObject)
                 reject(messageObject.error.message);
@@ -99,32 +149,6 @@
     }
 }
 
-/**
-* Registers an event handler for messages coming from the InspectorBackend.
-* If multiple callbacks are registered for the same event, it will chain the execution.
-* @param {string} event name
-* @param {function} handler to be executed
-* @param {boolean} execute the handler before all other handlers
-*/
-InspectorTest.addEventListener = function(eventName, callback, capture)
-{
-    if (!InspectorTest.eventHandler[eventName]) {
-        InspectorTest.eventHandler[eventName] = callback;
-        return;
-    }
-    var firstHandler = InspectorTest.eventHandler[eventName];
-    var secondHandler = callback;
-    if (capture) {
-        // Swap firstHandler with the new callback, so that we execute the callback first.
-        [firstHandler, secondHandler] = [secondHandler, firstHandler];
-    }
-    InspectorTest.eventHandler[eventName] = function(messageObject)
-    {
-        firstHandler(messageObject);
-        secondHandler(messageObject);
-    };
-}
-
 InspectorTest.AsyncTestSuite = class AsyncTestSuite {
     constructor(name) {
         if (!name || typeof name !== "string")
@@ -186,12 +210,19 @@
 
         this._startedRunning = true;
 
-        InspectorTest.log("Running test suite: " + this.name);
+        InspectorTest.log("");
+        InspectorTest.log("== Running test suite: " + this.name);
 
+        // Avoid adding newlines if nothing was logged.
+        var priorLogCount = InspectorTest.logCount;
         var suite = this;
-        var result = this.testcases.reduce(function(chain, testcase) {
+        var result = this.testcases.reduce(function(chain, testcase, i) {
             return chain.then(function() {
-                InspectorTest.log("Running test case: " + testcase.name);
+                if (i > 0 && priorLogCount + 1 < InspectorTest.logCount)
+                    InspectorTest.log("");
+
+                priorLogCount = InspectorTest.logCount;
+                InspectorTest.log("-- Running test case: " + testcase.name);
                 suite.runCount++;
                 return new Promise(testcase.test);
             });
@@ -206,7 +237,7 @@
             if (typeof message !== "string")
                 message = JSON.stringify(message);
 
-            InspectorTest.log("EXCEPTION: " + message);
+            InspectorTest.log("!! EXCEPTION: " + message);
             throw e; // Reject this promise by re-throwing the error.
         });
     }
@@ -267,11 +298,19 @@
 
         this._startedRunning = true;
 
-        InspectorTest.log("Running test suite: " + this.name);
+        InspectorTest.log("");
+        InspectorTest.log("== Running test suite: " + this.name);
 
+        var priorLogCount = InspectorTest.logCount;
         var suite = this;
-        for (var testcase of this.testcases) {
-            InspectorTest.log("Running test case: " + testcase.name);
+        for (var i = 0; i < this.testcases.length; i++) {
+            var testcase = this.testcases[i];
+            if (i > 0 && priorLogCount + 1 < InspectorTest.logCount)
+                InspectorTest.log("");
+
+            priorLogCount = InspectorTest.logCount;
+
+            InspectorTest.log("-- Running test case: " + testcase.name);
             suite.runCount++;
             try {
                 var result = testcase.test.call(null);
@@ -290,7 +329,7 @@
                 if (typeof message !== "string")
                     message = JSON.stringify(message);
 
-                InspectorTest.log("EXCEPTION: " + message);
+                InspectorTest.log("!! EXCEPTION: " + message);
                 return false;
             }
         }
@@ -302,6 +341,8 @@
 // Logs a message to test document.
 InspectorTest.log = function(message)
 {
+    ++InspectorTest.logCount;
+
     if (this.forceSyncDebugLogging)
         this.debugLog(message);
     else
@@ -341,7 +382,8 @@
 InspectorTest.importScript = function(scriptName)
 {
     var xhr = new XMLHttpRequest();
-    xhr.open("GET", scriptName, false);
+    var isAsyncRequest = false;
+    xhr.open("GET", scriptName, isAsyncRequest);
     xhr.send(null);
     if (xhr.status !== 0 && xhr.status !== 200)
         throw new Error("Invalid script URL: " + scriptName);

Modified: trunk/LayoutTests/inspector-protocol/async-test-suite-expected.txt (187268 => 187269)


--- trunk/LayoutTests/inspector-protocol/async-test-suite-expected.txt	2015-07-23 23:16:07 UTC (rev 187268)
+++ trunk/LayoutTests/inspector-protocol/async-test-suite-expected.txt	2015-07-23 23:20:31 UTC (rev 187269)
@@ -5,26 +5,29 @@
 PASS: test case should require string name.
 PASS: test case should require test function.
 PASS: should not be able to run empty test suite.
-Running test suite: AsyncTestSuite.RunTwiceSuite
+
+== Running test suite: AsyncTestSuite.RunTwiceSuite
 PASS: should not be able to run a test suite twice.
-Running test case: DummyTest0
-Running test suite: AsyncTestSuite.SequentialExecution
+-- Running test case: DummyTest0
+
+== Running test suite: AsyncTestSuite.SequentialExecution
 PASS: AsyncTestSuite.RunTestCases() should return a Promise.
-Running test case: DummyTest1
-Running test case: DummyTest2
-Running test case: DummyTest3
-Running test case: FailingTest4
-EXCEPTION: [object Object]
+-- Running test case: DummyTest1
+-- Running test case: DummyTest2
+-- Running test case: DummyTest3
+-- Running test case: FailingTest4
+!! EXCEPTION: [object Object]
 PASS: Promise from sequentialExecutionSuite.runTestCases() should reject when a test case fails.
 PASS: Promise from sequentialExecutionSuite.runTestCases() should reject without altering its result value.
 PASS: sequentialExecutionSuite should have executed four tests.
 PASS: sequentialExecutionSuite should have passed three tests.
 PASS: sequentialExecutionSuite should have failed 1 test.
 PASS: sequentialExecutionSuite should have skipped zero tests.
-Running test suite: AsyncTestSuite.AbortOnFailure
-Running test case: PassingTest5
-Running test case: FailingTest6
-EXCEPTION: {"token":666}
+
+== Running test suite: AsyncTestSuite.AbortOnFailure
+-- Running test case: PassingTest5
+-- Running test case: FailingTest6
+!! EXCEPTION: {"token":666}
 PASS: Promise from abortOnFailureSuite.runTestCases() should reject when a test case fails.
 PASS: Promise from abortOnFailureSuite.runTestCases() should reject without altering its result value.
 PASS: abortOnFailureSuite should have executed two tests.

Modified: trunk/LayoutTests/inspector-protocol/console/console-message-expected.txt (187268 => 187269)


--- trunk/LayoutTests/inspector-protocol/console/console-message-expected.txt	2015-07-23 23:16:07 UTC (rev 187268)
+++ trunk/LayoutTests/inspector-protocol/console/console-message-expected.txt	2015-07-23 23:20:31 UTC (rev 187269)
@@ -1,12 +1,48 @@
-CONSOLE MESSAGE: line 7: log
-CONSOLE MESSAGE: line 8: info
-CONSOLE MESSAGE: line 9: warn
-CONSOLE MESSAGE: line 10: error
-CONSOLE MESSAGE: line 11: debug
-Tests that console log messages make it to the frontend and have expected source, type, and levels.
-{"source":"console-api","level":"log","text":"log","location":"console-message.html:7:16","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"info","text":"info","location":"console-message.html:8:17","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"warning","text":"warn","location":"console-message.html:9:17","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"error","text":"error","location":"console-message.html:10:18","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"debug","text":"debug","location":"console-message.html:11:18","parameters":[{"type":"string"}]}
+CONSOLE MESSAGE: line 1: log
+CONSOLE MESSAGE: line 1: info
+CONSOLE MESSAGE: line 1: warn
+CONSOLE MESSAGE: line 1: error
+CONSOLE MESSAGE: line 1: debug
+Tests that console.log and related APIs cause Console.messageAdded events to be generated with correct source, type, level, and parameter types. 
 
+== Running test suite: Console.MessagesFromCommandLineAPI
+-- Running test case: ConsoleLogString
+Evaluating _expression_: console.log("log");
+PASS: ConsoleMessage type should be 'console-api'.
+PASS: ConsoleMessage level should be 'log'.
+PASS: ConsoleMessage text should be 'log'.
+PASS: ConsoleMessage parameters.length === 1
+PASS: ConsoleMessage parameter 0 should have type 'string'.
+
+-- Running test case: ConsoleInfoString
+Evaluating _expression_: console.info("info");
+PASS: ConsoleMessage type should be 'console-api'.
+PASS: ConsoleMessage level should be 'info'.
+PASS: ConsoleMessage text should be 'info'.
+PASS: ConsoleMessage parameters.length === 1
+PASS: ConsoleMessage parameter 0 should have type 'string'.
+
+-- Running test case: ConsoleWarnString
+Evaluating _expression_: console.warn("warn");
+PASS: ConsoleMessage type should be 'console-api'.
+PASS: ConsoleMessage level should be 'warning'.
+PASS: ConsoleMessage text should be 'warn'.
+PASS: ConsoleMessage parameters.length === 1
+PASS: ConsoleMessage parameter 0 should have type 'string'.
+
+-- Running test case: ConsoleErrorString
+Evaluating _expression_: console.error("error");
+PASS: ConsoleMessage type should be 'console-api'.
+PASS: ConsoleMessage level should be 'error'.
+PASS: ConsoleMessage text should be 'error'.
+PASS: ConsoleMessage parameters.length === 1
+PASS: ConsoleMessage parameter 0 should have type 'string'.
+
+-- Running test case: ConsoleDebugString
+Evaluating _expression_: console.debug("debug");
+PASS: ConsoleMessage type should be 'console-api'.
+PASS: ConsoleMessage level should be 'debug'.
+PASS: ConsoleMessage text should be 'debug'.
+PASS: ConsoleMessage parameters.length === 1
+PASS: ConsoleMessage parameter 0 should have type 'string'.
+

Modified: trunk/LayoutTests/inspector-protocol/console/console-message.html (187268 => 187269)


--- trunk/LayoutTests/inspector-protocol/console/console-message.html	2015-07-23 23:16:07 UTC (rev 187268)
+++ trunk/LayoutTests/inspector-protocol/console/console-message.html	2015-07-23 23:20:31 UTC (rev 187269)
@@ -5,7 +5,7 @@
 function generateSimpleConsoleMessages()
 {
     console.log("log");
-    console.info("info"); // Alias of log.
+    console.info("info");
     console.warn("warn");
     console.error("error");
     console.debug("debug");
@@ -13,28 +13,126 @@
 
 function test()
 {
+    var suite = new InspectorTest.AsyncTestSuite("Console.MessagesFromCommandLineAPI");
+
+    addConsoleTestCase({
+        name: "ConsoleLogString",
+        description: "Test `console.log(\"log\")`",
+        _expression_: 'console.log("log");',
+        expected: {
+            source: 'console-api',
+            level: 'log',
+            text: 'log',
+            parameters: ['string']
+        }
+    });
+
+    addConsoleTestCase({
+        name: "ConsoleInfoString",
+        description: "Test `console.info(\"info\")`",
+        _expression_: 'console.info("info");',
+        expected: {
+            source: 'console-api',
+            level: 'info',
+            text: 'info',
+            parameters: ['string']
+        }
+    });
+
+    addConsoleTestCase({
+        name: "ConsoleWarnString",
+        description: "Test `console.warn(\"warn\")`",
+        _expression_: 'console.warn("warn");',
+        expected: {
+            source: 'console-api',
+            level: 'warning',
+            text: 'warn',
+            parameters: ['string']
+        }
+    });
+
+    addConsoleTestCase({
+        name: "ConsoleErrorString",
+        description: "Test `console.error(\"error\")`",
+        _expression_: 'console.error("error");',
+        expected: {
+            source: 'console-api',
+            level: 'error',
+            text: 'error',
+            parameters: ['string']
+        }
+    });
+
+    addConsoleTestCase({
+        name: "ConsoleDebugString",
+        description: "Test `console.debug(\"debug\")`",
+        _expression_: 'console.debug("debug");',
+        expected: {
+            source: 'console-api',
+            level: 'debug',
+            text: 'debug',
+            parameters: ['string']
+        }
+    });
+
+    // Set up the console prior to running the test suite.
     InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
 
-    InspectorTest.sendCommand("Console.enable", {});
-    InspectorTest.sendCommand("Runtime.evaluate", {_expression_: "generateSimpleConsoleMessages()"});
+    InspectorTest.awaitCommand({
+        method: "Console.enable",
+        params: {}
+    })
+    .then(function() {
+        suite.runTestCasesAndFinish();
+    })
+    .catch(fatalError);
 
-    var consoleMessageCount = 0;
-    const expectedConsoleMessages = 5;
+    function fatalError(e) {
+        InspectorTest.log("Test failed with fatal error: " + JSON.stringify(e));
+        InspectorTest.completeTest();
+    }
 
-    InspectorTest.eventHandler["Console.messageAdded"] = function(messageObject)
-    {
-        var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
-        InspectorTest.log(JSON.stringify(simplifiedMessage));
+    function addConsoleTestCase(args) {
+        var {name, description, _expression_, expected} = args;
+        suite.addTestCase({
+            name,
+            description,
+            test: function(resolve, reject) {
+                InspectorTest.awaitEvent({
+                    event: "Console.messageAdded",
+                })
+                .then(function(messageObject) {
+                    var consoleMessage = messageObject.params.message;
+                    var {source, level, text, parameters} = consoleMessage;
+                    InspectorTest.assert(source === expected.source, "ConsoleMessage type should be '" + expected.source + "'.");
+                    InspectorTest.assert(level === expected.level, "ConsoleMessage level should be '" + expected.level + "'.");
+                    InspectorTest.assert(text === expected.text, "ConsoleMessage text should be '" + expected.text + "'.");
 
-        if (++consoleMessageCount === expectedConsoleMessages)
-            InspectorTest.completeTest();
+                    InspectorTest.assert(parameters.length === expected.parameters.length, "ConsoleMessage parameters.length === " + expected.parameters.length);
+                    for (var i = 0; i < parameters.length; ++i) {
+                        var expectedType = expected.parameters[i];
+                        InspectorTest.assert(parameters[i].type === expectedType, "ConsoleMessage parameter " + i + " should have type '" + expectedType + "'.");
+                    }
+                    resolve();
+                })
+                .catch(reject);
+
+                // Cause a messageAdded event to be generated.
+                InspectorTest.log("Evaluating _expression_: " + _expression_);
+                InspectorTest.sendCommand({
+                    method: "Runtime.evaluate",
+                    params: {_expression_}
+                });
+            }
+        });
     }
 }
 </script>
 </head>
 <body _onload_="runTest()">
 <p>
-Tests that console log messages make it to the frontend and have expected source, type, and levels.<br>
+Tests that <code>console.log</code> and related APIs cause <code>Console.messageAdded</code> events to be generated with correct source, type, level, and parameter types.
+<br>
 </p>
 </body>
 </html>

Added: trunk/LayoutTests/inspector-protocol/console/css-source-locations-expected.txt (0 => 187269)


--- trunk/LayoutTests/inspector-protocol/console/css-source-locations-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/console/css-source-locations-expected.txt	2015-07-23 23:20:31 UTC (rev 187269)
@@ -0,0 +1,9 @@
+Tests that CSS parser warnings from inline style tags and external stylesheets are sent to the console with correct line and column information.
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:5:20"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:6:14"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:7:7"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"css-source-locations.html:9:8"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:7"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:29"}
+{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:4:5"}
+

Added: trunk/LayoutTests/inspector-protocol/console/css-source-locations.html (0 => 187269)


--- trunk/LayoutTests/inspector-protocol/console/css-source-locations.html	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/console/css-source-locations.html	2015-07-23 23:20:31 UTC (rev 187269)
@@ -0,0 +1,48 @@
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<link rel="stylesheet" href=""
+  <style>    div { * color: red; }</style>
+<style>div { * color: red; }
+div { * color: red; }
+   div {
+       *
+       color:
+       red;
+   }
+</style>
+<script>
+function test()
+{
+    InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
+
+    var consoleMessageCount = 0;
+    const expectedConsoleMessageCount = 7;
+
+    // Due to the difficulty of testing inline style tags in a test case, this test
+    // is a reference test that contains serialized Console.messageAdded event data.
+    InspectorTest.addEventListener({
+        event: "Console.messageAdded",
+        listener: function(messageObject) {
+            var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
+            InspectorTest.log(JSON.stringify(simplifiedMessage));
+
+            if (++consoleMessageCount === expectedConsoleMessageCount)
+                InspectorTest.completeTest();
+        }
+    });
+
+    // Start the test.
+    InspectorTest.sendCommand({
+        method: "Console.enable",
+        params: {}
+    });
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>
+Tests that CSS parser warnings from inline style tags and external stylesheets are sent to the console with correct line and column information.<br>
+</p>
+</body>
+</html>

Added: trunk/LayoutTests/inspector-protocol/console/js-source-locations-expected.txt (0 => 187269)


--- trunk/LayoutTests/inspector-protocol/console/js-source-locations-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/console/js-source-locations-expected.txt	2015-07-23 23:20:31 UTC (rev 187269)
@@ -0,0 +1,18 @@
+CONSOLE MESSAGE: line 1: error script
+CONSOLE MESSAGE: line 1: warn script
+CONSOLE MESSAGE: line 5: error script
+CONSOLE MESSAGE: line 6: warn script
+CONSOLE MESSAGE: line 5: TypeError: undefined is not an object (evaluating '[].x.x')
+CONSOLE MESSAGE: line 7: warn 1
+CONSOLE MESSAGE: line 7: error 1
+CONSOLE MESSAGE: line 8: error 2
+Tests that _javascript_ errors and warnings from inline script tags and external files are sent to the console with correct line and column information.
+{"source":"console-api","level":"error","text":"error script","location":"errors.js:1:14","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"warning","text":"warn script","location":"errors.js:1:44","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"error","text":"error script","location":"errors.js:5:18","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"warning","text":"warn script","location":"errors.js:6:17","parameters":[{"type":"string"}]}
+{"source":"_javascript_","level":"error","text":"TypeError: undefined is not an object (evaluating '[].x.x')","location":"js-source-locations.html:5:18"}
+{"source":"console-api","level":"warning","text":"warn 1","location":"js-source-locations.html:7:13","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"error","text":"error 1","location":"js-source-locations.html:7:38","parameters":[{"type":"string"}]}
+{"source":"console-api","level":"error","text":"error 2","location":"js-source-locations.html:8:17","parameters":[{"type":"string"}]}
+

Added: trunk/LayoutTests/inspector-protocol/console/js-source-locations.html (0 => 187269)


--- trunk/LayoutTests/inspector-protocol/console/js-source-locations.html	                        (rev 0)
+++ trunk/LayoutTests/inspector-protocol/console/js-source-locations.html	2015-07-23 23:20:31 UTC (rev 187269)
@@ -0,0 +1,43 @@
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<script src="" type="text/_javascript_" charset="utf-8"></script>
+  <script>   [].x.x   </script>
+<script>
+console.warn("warn 1"); console.error("error 1");
+   console.error("error 2");
+</script>
+<script>
+function test()
+{
+    InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
+
+    var consoleMessageCount = 0;
+    const expectedConsoleMessageCount = 8;
+
+    // Due to the difficulty of testing inline script tags in a test case, this test
+    // is a reference test that contains serialized Console.messageAdded event data.
+    InspectorTest.addEventListener({
+        event: "Console.messageAdded",
+        listener: function(messageObject) {
+            var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
+            InspectorTest.log(JSON.stringify(simplifiedMessage));
+
+            if (++consoleMessageCount === expectedConsoleMessageCount)
+                InspectorTest.completeTest();
+        }
+    });
+
+    InspectorTest.sendCommand({
+        method: "Console.enable",
+        params: {}
+    });
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>
+Tests that _javascript_ errors and warnings from inline script tags and external files are sent to the console with correct line and column information.<br>
+</p>
+</body>
+</html>

Deleted: trunk/LayoutTests/inspector-protocol/console/warnings-errors-expected.txt (187268 => 187269)


--- trunk/LayoutTests/inspector-protocol/console/warnings-errors-expected.txt	2015-07-23 23:16:07 UTC (rev 187268)
+++ trunk/LayoutTests/inspector-protocol/console/warnings-errors-expected.txt	2015-07-23 23:20:31 UTC (rev 187269)
@@ -1,25 +0,0 @@
-CONSOLE MESSAGE: line 1: error script
-CONSOLE MESSAGE: line 1: warn script
-CONSOLE MESSAGE: line 5: error script
-CONSOLE MESSAGE: line 6: warn script
-CONSOLE MESSAGE: line 15: TypeError: undefined is not an object (evaluating '[].x.x')
-CONSOLE MESSAGE: line 17: warn 1
-CONSOLE MESSAGE: line 17: error 1
-CONSOLE MESSAGE: line 18: error 2
-Tests that CSS/_javascript_ errors and warnings are sent to the console with line and column information.
-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:5:20"}
-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:6:14"}
-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:7:7"}
-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"warnings-errors.html:9:8"}
-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:7"}
-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:1:29"}
-{"source":"css","level":"warning","text":"Invalid CSS property declaration at: *","location":"errors.css:4:5"}
-{"source":"console-api","level":"error","text":"error script","location":"errors.js:1:14","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"warning","text":"warn script","location":"errors.js:1:44","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"error","text":"error script","location":"errors.js:5:18","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"warning","text":"warn script","location":"errors.js:6:17","parameters":[{"type":"string"}]}
-{"source":"_javascript_","level":"error","text":"TypeError: undefined is not an object (evaluating '[].x.x')","location":"warnings-errors.html:15:18"}
-{"source":"console-api","level":"warning","text":"warn 1","location":"warnings-errors.html:17:13","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"error","text":"error 1","location":"warnings-errors.html:17:38","parameters":[{"type":"string"}]}
-{"source":"console-api","level":"error","text":"error 2","location":"warnings-errors.html:18:17","parameters":[{"type":"string"}]}
-

Deleted: trunk/LayoutTests/inspector-protocol/console/warnings-errors.html (187268 => 187269)


--- trunk/LayoutTests/inspector-protocol/console/warnings-errors.html	2015-07-23 23:16:07 UTC (rev 187268)
+++ trunk/LayoutTests/inspector-protocol/console/warnings-errors.html	2015-07-23 23:20:31 UTC (rev 187269)
@@ -1,46 +0,0 @@
-<html>
-<head>
-<script type="text/_javascript_" src=""
-<link rel="stylesheet" href=""
-  <style>    div { * color: red; }</style>
-<style>div { * color: red; }
-div { * color: red; }
-   div {
-       *
-       color:
-       red;
-   }
-</style>
-<script src="" type="text/_javascript_" charset="utf-8"></script>
-  <script>   [].x.x   </script>
-<script>
-console.warn("warn 1"); console.error("error 1");
-   console.error("error 2");
-</script>
-<script>
-function test()
-{
-    InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
-
-    InspectorTest.sendCommand("Console.enable", {});
-
-    var consoleMessageCount = 0;
-    const expectedConsoleMessages = 15;
-
-    InspectorTest.eventHandler["Console.messageAdded"] = function(messageObject)
-    {
-        var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
-        InspectorTest.log(JSON.stringify(simplifiedMessage));
-
-        if (++consoleMessageCount === expectedConsoleMessages)
-            InspectorTest.completeTest();
-    }
-}
-</script>
-</head>
-<body _onload_="runTest()">
-<p>
-Tests that CSS/_javascript_ errors and warnings are sent to the console with line and column information.<br>
-</p>
-</body>
-</html>

Modified: trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt (187268 => 187269)


--- trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt	2015-07-23 23:16:07 UTC (rev 187268)
+++ trunk/LayoutTests/inspector-protocol/runtime/getProperties-expected.txt	2015-07-23 23:20:31 UTC (rev 187269)
@@ -1,10 +1,12 @@
-Running test suite: Runtime.getProperties
-Running test case: CheckPropertiesOfWrapperObject
+
+== Running test suite: Runtime.getProperties
+-- Running test case: CheckPropertiesOfWrapperObject
 Evaluating _expression_: (function(){var r = Object(5); r.foo = 'cat';return r;})()
 Properties:
   __proto__ object Number
   foo string cat
-Running test case: CheckPropertiesOfArray
+
+-- Running test case: CheckPropertiesOfArray
 Evaluating _expression_: ['red', 'green', 'blue']
 Properties:
   __proto__ object Array
@@ -12,7 +14,8 @@
   1 string green
   2 string blue
   length number 3
-Running test case: CheckPropertiesOfBoundConstructor
+
+-- Running test case: CheckPropertiesOfBoundConstructor
 Evaluating _expression_: Number.bind({}, 5)
 Properties:
   __proto__ function function () {

Modified: trunk/LayoutTests/inspector-protocol/sync-test-suite-expected.txt (187268 => 187269)


--- trunk/LayoutTests/inspector-protocol/sync-test-suite-expected.txt	2015-07-23 23:16:07 UTC (rev 187268)
+++ trunk/LayoutTests/inspector-protocol/sync-test-suite-expected.txt	2015-07-23 23:20:31 UTC (rev 187269)
@@ -5,24 +5,27 @@
 PASS: test case should require string name.
 PASS: test case should require test function.
 PASS: should not be able to run empty test suite.
-Running test suite: SyncTestSuite.RunTwiceSuite
-Running test case: DummyTest0
+
+== Running test suite: SyncTestSuite.RunTwiceSuite
+-- Running test case: DummyTest0
 PASS: Return value of runTwiceSuite.runTestCases() should be true when all tests pass.
 PASS: should not be able to run a test suite twice.
-Running test suite: SyncTestSuite.SequentialExecution
-Running test case: DummyTest1
-Running test case: DummyTest2
-Running test case: DummyTest3
-Running test case: FailingTest4
-EXCEPTION: [object Object]
+
+== Running test suite: SyncTestSuite.SequentialExecution
+-- Running test case: DummyTest1
+-- Running test case: DummyTest2
+-- Running test case: DummyTest3
+-- Running test case: FailingTest4
+!! EXCEPTION: [object Object]
 PASS: Return value of sequentialExecutionSuite.runTestCases() should be false when a test case fails.
 PASS: sequentialExecutionSuite should have executed four tests.
 PASS: sequentialExecutionSuite should have passed three tests.
 PASS: sequentialExecutionSuite should have failed 1 test.
 PASS: sequentialExecutionSuite should have skipped zero tests.
-Running test suite: SyncTestSuite.AbortOnFailure
-Running test case: PassingTest5
-Running test case: FailingTest6
+
+== Running test suite: SyncTestSuite.AbortOnFailure
+-- Running test case: PassingTest5
+-- Running test case: FailingTest6
 PASS: Return value of abortOnFailureSuite.runTestCases() should be false when a test case fails.
 PASS: abortOnFailureSuite should have executed two tests.
 PASS: abortOnFailureSuite should have passed one test.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to