<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[188019] trunk/LayoutTests</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/188019">188019</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-08-05 21:36:04 -0700 (Wed, 05 Aug 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: rewrite protocol test for console messages from X-Frame-Options
https://bugs.webkit.org/show_bug.cgi?id=147714
Patch by Brian Burg <bburg@apple.com> on 2015-08-05
Reviewed by Joseph Pecoraro.
Rewrite deny-X-FrameOption.html to use AsyncTestSuite, and hopefully address
the flakiness of the test. It is now in the inspector-protocol/console/ directory.
Extract the addConsoleTestCase helper to a shared file. Clean up console test
helpers and use a less awkward namespace for these helpers.
* TestExpectations: Unskip the deleted test, the new test should be less flaky.
* inspector-protocol/console/console-message.html:
* inspector-protocol/console/css-source-locations.html:
* inspector-protocol/console/js-source-locations.html:
* inspector-protocol/console/x-frame-options-message-expected.txt: Added.
* inspector-protocol/console/x-frame-options-message.html: Added.
* inspector-protocol/debugger/setBreakpoint-actions.html:
* inspector-protocol/debugger/setBreakpoint-options-exception.html:
* inspector-protocol/page/deny-X-FrameOption-expected.txt: Removed.
* inspector-protocol/page/deny-X-FrameOption.html: Removed.
* inspector-protocol/resources/console-helper.js: Removed.
* inspector-protocol/resources/console-test.js: Added.
(InspectorTest.Console.sanitizeConsoleMessage):
(InspectorTest.Console.addTestCase):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolconsoleconsolemessagehtml">trunk/LayoutTests/inspector-protocol/console/console-message.html</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolconsolecsssourcelocationshtml">trunk/LayoutTests/inspector-protocol/console/css-source-locations.html</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolconsolejssourcelocationshtml">trunk/LayoutTests/inspector-protocol/console/js-source-locations.html</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocoldebuggersetBreakpointactionshtml">trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-actions.html</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocoldebuggersetBreakpointoptionsexceptionhtml">trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-options-exception.html</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorprotocolconsolexframeoptionsmessageexpectedtxt">trunk/LayoutTests/inspector-protocol/console/x-frame-options-message-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolconsolexframeoptionsmessagehtml">trunk/LayoutTests/inspector-protocol/console/x-frame-options-message.html</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolresourcesconsoletestjs">trunk/LayoutTests/inspector-protocol/resources/console-test.js</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorprotocolpagedenyXFrameOptionexpectedtxt">trunk/LayoutTests/inspector-protocol/page/deny-X-FrameOption-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolpagedenyXFrameOptionhtml">trunk/LayoutTests/inspector-protocol/page/deny-X-FrameOption.html</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolresourcesconsolehelperjs">trunk/LayoutTests/inspector-protocol/resources/console-helper.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (188018 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-08-06 04:01:00 UTC (rev 188018)
+++ trunk/LayoutTests/ChangeLog        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2015-08-05 Brian Burg <bburg@apple.com>
+
+ Web Inspector: rewrite protocol test for console messages from X-Frame-Options
+ https://bugs.webkit.org/show_bug.cgi?id=147714
+
+ Reviewed by Joseph Pecoraro.
+
+ Rewrite deny-X-FrameOption.html to use AsyncTestSuite, and hopefully address
+ the flakiness of the test. It is now in the inspector-protocol/console/ directory.
+
+ Extract the addConsoleTestCase helper to a shared file. Clean up console test
+ helpers and use a less awkward namespace for these helpers.
+
+ * TestExpectations: Unskip the deleted test, the new test should be less flaky.
+ * inspector-protocol/console/console-message.html:
+ * inspector-protocol/console/css-source-locations.html:
+ * inspector-protocol/console/js-source-locations.html:
+ * inspector-protocol/console/x-frame-options-message-expected.txt: Added.
+ * inspector-protocol/console/x-frame-options-message.html: Added.
+ * inspector-protocol/debugger/setBreakpoint-actions.html:
+ * inspector-protocol/debugger/setBreakpoint-options-exception.html:
+ * inspector-protocol/page/deny-X-FrameOption-expected.txt: Removed.
+ * inspector-protocol/page/deny-X-FrameOption.html: Removed.
+ * inspector-protocol/resources/console-helper.js: Removed.
+ * inspector-protocol/resources/console-test.js: Added.
+ (InspectorTest.Console.sanitizeConsoleMessage):
+ (InspectorTest.Console.addTestCase):
+
</ins><span class="cx"> 2015-08-05 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> [ES6] Class parser does not allow methods named set and get.
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (188018 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2015-08-06 04:01:00 UTC (rev 188018)
+++ trunk/LayoutTests/TestExpectations        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -93,7 +93,6 @@
</span><span class="cx">
</span><span class="cx"> webkit.org/b/133761 inspector-protocol/debugger/breakpoint-action-detach.html [ Skip ]
</span><span class="cx"> webkit.org/b/129639 inspector-protocol/dom/dom-search-crash.html [ Skip ]
</span><del>-webkit.org/b/127414 inspector-protocol/page/deny-X-FrameOption.html [ Pass Failure ]
</del><span class="cx">
</span><span class="cx"> webkit.org/b/147502 inspector/debugger/break-on-uncaught-exception-throw-in-promise-rethrow-in-catch.html [ Skip ]
</span><span class="cx"> webkit.org/b/147502 inspector/debugger/break-on-uncaught-exception-throw-in-promise-then-with-catch.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolconsoleconsolemessagehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/console/console-message.html (188018 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/console/console-message.html        2015-08-06 04:01:00 UTC (rev 188018)
+++ trunk/LayoutTests/inspector-protocol/console/console-message.html        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -13,9 +13,11 @@
</span><span class="cx">
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><ins>+ InspectorTest.importScript("../../../../inspector-protocol/resources/console-test.js");
+
</ins><span class="cx"> var suite = new InspectorTest.AsyncTestSuite("Console.MessagesFromCommandLineAPI");
</span><span class="cx">
</span><del>- addConsoleTestCase({
</del><ins>+ InspectorTest.Console.addTestCase(suite, {
</ins><span class="cx"> name: "ConsoleLogString",
</span><span class="cx"> description: "Test `console.log(\"log\")`",
</span><span class="cx"> expression: 'console.log("log");',
</span><span class="lines">@@ -27,7 +29,7 @@
</span><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><del>- addConsoleTestCase({
</del><ins>+ InspectorTest.Console.addTestCase(suite, {
</ins><span class="cx"> name: "ConsoleInfoString",
</span><span class="cx"> description: "Test `console.info(\"info\")`",
</span><span class="cx"> expression: 'console.info("info");',
</span><span class="lines">@@ -39,7 +41,7 @@
</span><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><del>- addConsoleTestCase({
</del><ins>+ InspectorTest.Console.addTestCase(suite, {
</ins><span class="cx"> name: "ConsoleWarnString",
</span><span class="cx"> description: "Test `console.warn(\"warn\")`",
</span><span class="cx"> expression: 'console.warn("warn");',
</span><span class="lines">@@ -51,7 +53,7 @@
</span><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><del>- addConsoleTestCase({
</del><ins>+ InspectorTest.Console.addTestCase(suite, {
</ins><span class="cx"> name: "ConsoleErrorString",
</span><span class="cx"> description: "Test `console.error(\"error\")`",
</span><span class="cx"> expression: 'console.error("error");',
</span><span class="lines">@@ -63,7 +65,7 @@
</span><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><del>- addConsoleTestCase({
</del><ins>+ InspectorTest.Console.addTestCase(suite, {
</ins><span class="cx"> name: "ConsoleDebugString",
</span><span class="cx"> description: "Test `console.debug(\"debug\")`",
</span><span class="cx"> expression: 'console.debug("debug");',
</span><span class="lines">@@ -75,9 +77,6 @@
</span><span class="cx"> }
</span><span class="cx"> });
</span><span class="cx">
</span><del>- // Set up the console prior to running the test suite.
- InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
-
</del><span class="cx"> InspectorTest.awaitCommand({
</span><span class="cx"> method: "Console.enable",
</span><span class="cx"> params: {}
</span><span class="lines">@@ -91,41 +90,6 @@
</span><span class="cx"> InspectorTest.log("Test failed with fatal error: " + JSON.stringify(e));
</span><span class="cx"> InspectorTest.completeTest();
</span><span class="cx"> }
</span><del>-
- 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 + "'.");
-
- 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}
- });
- }
- });
- }
</del><span class="cx"> }
</span><span class="cx"> </script>
</span><span class="cx"> </head>
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolconsolecsssourcelocationshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/console/css-source-locations.html (188018 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/console/css-source-locations.html        2015-08-06 04:01:00 UTC (rev 188018)
+++ trunk/LayoutTests/inspector-protocol/console/css-source-locations.html        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
</del><ins>+ InspectorTest.importScript("../../../../inspector-protocol/resources/console-test.js");
</ins><span class="cx">
</span><span class="cx"> var consoleMessageCount = 0;
</span><span class="cx"> const expectedConsoleMessageCount = 7;
</span><span class="lines">@@ -24,8 +24,8 @@
</span><span class="cx"> InspectorTest.addEventListener({
</span><span class="cx"> event: "Console.messageAdded",
</span><span class="cx"> listener: function(messageObject) {
</span><del>- var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
- InspectorTest.log(JSON.stringify(simplifiedMessage));
</del><ins>+ var message = InspectorTest.Console.sanitizeConsoleMessage(messageObject);
+ InspectorTest.log(JSON.stringify(message));
</ins><span class="cx">
</span><span class="cx"> if (++consoleMessageCount === expectedConsoleMessageCount)
</span><span class="cx"> InspectorTest.completeTest();
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolconsolejssourcelocationshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/console/js-source-locations.html (188018 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/console/js-source-locations.html        2015-08-06 04:01:00 UTC (rev 188018)
+++ trunk/LayoutTests/inspector-protocol/console/js-source-locations.html        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -10,7 +10,7 @@
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
</del><ins>+ InspectorTest.importScript("../../../../inspector-protocol/resources/console-test.js");
</ins><span class="cx">
</span><span class="cx"> var consoleMessageCount = 0;
</span><span class="cx"> const expectedConsoleMessageCount = 8;
</span><span class="lines">@@ -20,8 +20,8 @@
</span><span class="cx"> InspectorTest.addEventListener({
</span><span class="cx"> event: "Console.messageAdded",
</span><span class="cx"> listener: function(messageObject) {
</span><del>- var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
- InspectorTest.log(JSON.stringify(simplifiedMessage));
</del><ins>+ var message = InspectorTest.Console.sanitizeConsoleMessage(messageObject);
+ InspectorTest.log(JSON.stringify(message));
</ins><span class="cx">
</span><span class="cx"> if (++consoleMessageCount === expectedConsoleMessageCount)
</span><span class="cx"> InspectorTest.completeTest();
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolconsolexframeoptionsmessageexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/console/x-frame-options-message-expected.txt (0 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/console/x-frame-options-message-expected.txt         (rev 0)
+++ trunk/LayoutTests/inspector-protocol/console/x-frame-options-message-expected.txt        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+CONSOLE MESSAGE: line 41: Refused to display 'x-frame-options-message.html' in a frame because it set 'X-Frame-Options' to 'deny'.
+
+
+== Running test suite: Console.XFrameOptionsMessages
+-- Running test case: XFrameOptionsDeny
+Evaluating expression: triggerXFrameOptionDeny();
+PASS: ConsoleMessage type should be 'security'.
+PASS: ConsoleMessage level should be 'error'.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolconsolexframeoptionsmessagehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/console/x-frame-options-message.html (0 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/console/x-frame-options-message.html         (rev 0)
+++ trunk/LayoutTests/inspector-protocol/console/x-frame-options-message.html        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
+<script>
+function test()
+{
+ InspectorTest.importScript("../../../../inspector-protocol/resources/console-test.js");
+
+ let suite = new InspectorTest.AsyncTestSuite("Console.XFrameOptionsMessages");
+
+ InspectorTest.Console.addTestCase(suite, {
+ name: "XFrameOptionsDeny",
+ description: "Ensure that a console message is logged when enforcing an X-Frame-Options policy. In this case, setting X-Frame-Options: 'deny' means the iframe does not want to be embedded in the test page.",
+ expression: "triggerXFrameOptionDeny();",
+ expected: {source: 'security', level: 'error'}
+ });
+
+ InspectorTest.awaitCommand({
+ method: "Console.enable",
+ params: {}
+ })
+ .then(function() {
+ suite.runTestCasesAndFinish();
+ })
+ .catch(fatalError);
+
+ function fatalError(e) {
+ InspectorTest.log("Test failed with fatal error: " + JSON.stringify(e));
+ InspectorTest.completeTest();
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+ <iframe id="denied"></iframe>
+ <script>
+ function triggerXFrameOptionDeny()
+ {
+ let deniedFrame = document.getElementById('denied');
+ let deniedDocument = deniedFrame.contentWindow.document;
+ deniedDocument.write('<meta http-equiv="X-Frame-Options" content="deny"/>');
+ }
+ </script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocoldebuggersetBreakpointactionshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-actions.html (188018 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-actions.html        2015-08-06 04:01:00 UTC (rev 188018)
+++ trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-actions.html        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
</del><ins>+ InspectorTest.importScript("../../../../inspector-protocol/resources/console-test.js");
</ins><span class="cx"> InspectorTest.importScript("../../../../inspector-protocol/resources/probe-helper.js");
</span><span class="cx">
</span><span class="cx"> InspectorTest.sendCommand("Console.enable", {});
</span><span class="lines">@@ -111,8 +111,8 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
- InspectorTest.log("PASS: Console Message: " + JSON.stringify(simplifiedMessage));
</del><ins>+ var message = InspectorTest.Console.sanitizeConsoleMessage(messageObject);
+ InspectorTest.log("PASS: Console Message: " + JSON.stringify(message));
</ins><span class="cx">
</span><span class="cx"> ++logCount;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocoldebuggersetBreakpointoptionsexceptionhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-options-exception.html (188018 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-options-exception.html        2015-08-06 04:01:00 UTC (rev 188018)
+++ trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-options-exception.html        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
</del><ins>+ InspectorTest.importScript("../../../../inspector-protocol/resources/console-test.js");
</ins><span class="cx">
</span><span class="cx"> InspectorTest.sendCommand("Console.enable", {});
</span><span class="cx"> InspectorTest.sendCommand("Debugger.enable", {});
</span><span class="lines">@@ -45,8 +45,8 @@
</span><span class="cx">
</span><span class="cx"> InspectorTest.eventHandler["Console.messageAdded"] = function(messageObject)
</span><span class="cx"> {
</span><del>- var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
- InspectorTest.log("PASS: Console Message: " + JSON.stringify(simplifiedMessage));
</del><ins>+ var message = InspectorTest.Console.sanitizeConsoleMessage(messageObject);
+ InspectorTest.log("PASS: Console Message: " + JSON.stringify(message));
</ins><span class="cx">
</span><span class="cx"> if (++logsSeen === expectedLogs)
</span><span class="cx"> InspectorTest.completeTest();
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolpagedenyXFrameOptionexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/inspector-protocol/page/deny-X-FrameOption-expected.txt (188018 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/page/deny-X-FrameOption-expected.txt        2015-08-06 04:01:00 UTC (rev 188018)
+++ trunk/LayoutTests/inspector-protocol/page/deny-X-FrameOption-expected.txt        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -1,4 +0,0 @@
</span><del>-CONSOLE MESSAGE: line 30: Refused to display 'deny-X-FrameOption.html' in a frame because it set 'X-Frame-Options' to 'deny'.
-
-deny-X-FrameOption.html:30:17
-
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolpagedenyXFrameOptionhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/inspector-protocol/page/deny-X-FrameOption.html (188018 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/page/deny-X-FrameOption.html        2015-08-06 04:01:00 UTC (rev 188018)
+++ trunk/LayoutTests/inspector-protocol/page/deny-X-FrameOption.html        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -1,35 +0,0 @@
</span><del>-<html>
-<head>
-<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
-<script>
-function test()
-{
- InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js");
- InspectorTest.sendCommand("Console.enable", {});
-
- InspectorTest.eventHandler["Console.messageAdded"] = function(messageObject)
- {
- var simplifiedMessage = ConsoleHelper.simplifiedConsoleMessage(messageObject);
- // FIXME The line and column values will be zeros until this fix:
- // https://bugs.webkit.org/show_bug.cgi?id=125340
- // After this probably we should update the expected.txt.
- InspectorTest.log(simplifiedMessage.location);
-
- InspectorTest.completeTest();
- }
-}
-</script>
-</head>
-<body onload="startTest()">
- <iframe id=foo></iframe>
- <script>
- function startTest()
- {
- var fooFrame = document.getElementById('foo');
- var fooDoc = fooFrame.contentWindow.document;
- fooDoc.write('<meta http-equiv="X-Frame-Options" content="deny"/>');
- runTest();
- }
- </script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolresourcesconsolehelperjs"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/inspector-protocol/resources/console-helper.js (188018 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/resources/console-helper.js        2015-08-06 04:01:00 UTC (rev 188018)
+++ trunk/LayoutTests/inspector-protocol/resources/console-helper.js        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -1,31 +0,0 @@
</span><del>-window.ConsoleHelper = {};
-
-ConsoleHelper.simplifiedConsoleMessage = function(messageObject)
-{
- function basename(url)
- {
- return url.substring(url.lastIndexOf("/") + 1) || "???";
- }
-
- var message = messageObject.params.message;
- var obj = {
- source: message.source,
- level: message.level,
- text: message.text,
- location: basename(message.url) + ":" + message.line + ":" + message.column
- };
-
- if (message.parameters) {
- var params = [];
- for (var i = 0; i < message.parameters.length; ++i) {
- var param = message.parameters[i];
- var o = {type: param.type};
- if (param.subtype)
- o.subtype = param.subtype;
- params.push(o);
- }
- obj.parameters = params;
- }
-
- return obj;
-}
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolresourcesconsoletestjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/resources/console-test.js (0 => 188019)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/resources/console-test.js         (rev 0)
+++ trunk/LayoutTests/inspector-protocol/resources/console-test.js        2015-08-06 04:36:04 UTC (rev 188019)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+InspectorTest.Console = {};
+
+InspectorTest.Console.sanitizeConsoleMessage = function(messageObject)
+{
+ function basename(url)
+ {
+ return url.substring(url.lastIndexOf("/") + 1) || "???";
+ }
+
+ var message = messageObject.params.message;
+ var obj = {
+ source: message.source,
+ level: message.level,
+ text: message.text,
+ location: basename(message.url) + ":" + message.line + ":" + message.column
+ };
+
+ if (message.parameters) {
+ var params = [];
+ for (var i = 0; i < message.parameters.length; ++i) {
+ var param = message.parameters[i];
+ var o = {type: param.type};
+ if (param.subtype)
+ o.subtype = param.subtype;
+ params.push(o);
+ }
+ obj.parameters = params;
+ }
+
+ return obj;
+}
+
+InspectorTest.Console.addTestCase = function(suite, args)
+{
+ if (!(suite instanceof InspectorTest.AsyncTestSuite))
+ throw new Error("Console test cases must be added to an async test suite.");
+
+ 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 + "'.");
+
+ if (expected.text)
+ InspectorTest.assert(text === expected.text, "ConsoleMessage text should be '" + expected.text + "'.");
+
+ if (expected.parameters) {
+ 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}
+ });
+ }
+ });
+}
</ins></span></pre>
</div>
</div>
</body>
</html>