<!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>[164689] 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/164689">164689</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-02-25 18:50:20 -0800 (Tue, 25 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Port some profiler tests to inspector-protocol
https://bugs.webkit.org/show_bug.cgi?id=129353
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-02-25
Reviewed by Timothy Hatcher.
* inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt: Removed.
* inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html: Removed.
* inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt: Removed.
* inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html: Removed.
* inspector-protocol/profiler/console-profile-expected.txt: Added.
* inspector-protocol/profiler/console-profile.html: Added.
* inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt: Added.
* inspector-protocol/profiler/console-profileEnd-parameterless.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/inspector-protocol/profiler/</li>
<li><a href="#trunkLayoutTestsinspectorprotocolprofilerconsoleprofileexpectedtxt">trunk/LayoutTests/inspector-protocol/profiler/console-profile-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolprofilerconsoleprofilehtml">trunk/LayoutTests/inspector-protocol/profiler/console-profile.html</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolprofilerconsoleprofileEndparameterlessexpectedtxt">trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocolprofilerconsoleprofileEndparameterlesshtml">trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless.html</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorobsoleteprofilercpuprofilerparameterlessprofileendcrashexpectedtxt">trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorobsoleteprofilercpuprofilerparameterlessprofileendcrashhtml">trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html</a></li>
<li><a href="#trunkLayoutTestsinspectorobsoleteprofilercpuprofilerprofilingwithoutinspectorexpectedtxt">trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorobsoleteprofilercpuprofilerprofilingwithoutinspectorhtml">trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (164688 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-02-26 02:28:52 UTC (rev 164688)
+++ trunk/LayoutTests/ChangeLog        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-02-25 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Port some profiler tests to inspector-protocol
+ https://bugs.webkit.org/show_bug.cgi?id=129353
+
+ Reviewed by Timothy Hatcher.
+
+ * inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt: Removed.
+ * inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html: Removed.
+ * inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt: Removed.
+ * inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html: Removed.
+ * inspector-protocol/profiler/console-profile-expected.txt: Added.
+ * inspector-protocol/profiler/console-profile.html: Added.
+ * inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt: Added.
+ * inspector-protocol/profiler/console-profileEnd-parameterless.html: Added.
+
</ins><span class="cx"> 2014-02-25 Samuel White <samuel_white@apple.com>
</span><span class="cx">
</span><span class="cx"> Add accessibility search predicate support for AXOutlines
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorobsoleteprofilercpuprofilerparameterlessprofileendcrashexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt (164688 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt        2014-02-26 02:28:52 UTC (rev 164688)
+++ trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -1,6 +0,0 @@
</span><del>-Tests that "console.profileEnd()" do not cause crash.
-Bug 105759.
-
-Profiles count: 2
-Titled profile found.
-
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorobsoleteprofilercpuprofilerparameterlessprofileendcrashhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html (164688 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html        2014-02-26 02:28:52 UTC (rev 164688)
+++ trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -1,49 +0,0 @@
</span><del>-<html>
-<head>
-<script>
-
-if (window.testRunner)
- testRunner.dumpAsText();
-if (window.internals)
- internals.setJavaScriptProfilingEnabled(true);
-
-function pageFunction()
-{
- console.profile(); // Untitled
- console.profile("titled");
- console.profileEnd();
- console.profileEnd();
-}
-
-function startTest()
-{
- pageFunction();
- printResult();
- if (window.testRunner)
- testRunner.notifyDone();
-}
-
-function printResult()
-{
- var preElement = document.createElement("pre");
- preElement.appendChild(document.createTextNode("\n"));
-
- var profiles = console.profiles;
- preElement.appendChild(document.createTextNode("Profiles count: " + profiles.length + "\n"));
- for (var i = 0; i < profiles.length; ++i) {
- if (profiles[i].title === "titled")
- preElement.appendChild(document.createTextNode("Titled profile found.\n"));
- }
- document.getElementById("output").appendChild(preElement);
-}
-
-</script>
-</head>
-<body onload="startTest()">
-<p>
-Tests that "console.profileEnd()" do not cause crash.<br>
-<a href="https://bugs.webkit.org/show_bug.cgi?id=105759">Bug 105759.</a><br>
-<div id="output"></div>
-</p>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorobsoleteprofilercpuprofilerprofilingwithoutinspectorexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt (164688 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt        2014-02-26 02:28:52 UTC (rev 164688)
+++ trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -1,6 +0,0 @@
</span><del>-Tests that CPU profiling works.
-Doesn't open Inspector, uses console.profile....
-
-
-Found pageFunction
-
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorobsoleteprofilercpuprofilerprofilingwithoutinspectorhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html (164688 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html        2014-02-26 02:28:52 UTC (rev 164688)
+++ trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -1,84 +0,0 @@
</span><del>-<html>
-<head>
-<script>
-
-if (window.testRunner)
- testRunner.dumpAsText();
-if (window.internals)
- internals.setJavaScriptProfilingEnabled(true);
-
-function pageFunction()
-{
- console.profile("outer");
- console.profile("inner"); // [Chromium] Make sure we capture the current callstack.
- console.profileEnd("outer");
- console.profileEnd("inner");
-}
-
-function startTest()
-{
- pageFunction();
- printResult();
- if (window.testRunner)
- testRunner.notifyDone();
-}
-
-function printResult()
-{
- var preElement = document.createElement("pre");
- preElement.appendChild(document.createTextNode("\n"));
-
- var profiles = console.profiles;
- for (var i = 0; i < profiles.length; ++i) {
- var profile = profiles[i];
- if (profile.title !== "inner")
- continue;
- var functionName = "pageFunction";
- if (findFunctionInProfile(profile.head, functionName))
- preElement.appendChild(document.createTextNode("Found " + functionName));
- else {
- preElement.appendChild(document.createTextNode("!!! Not found " + functionName));
- preElement.appendChild(document.createTextNode("\n\n"));
- printProfileNodeWithoutTime(preElement, profile.head, "");
- }
- preElement.appendChild(document.createTextNode("\n"));
- }
-
- document.getElementById("output").appendChild(preElement);
-}
-
-function printProfileNodeWithoutTime(preElement, node, space)
-{
- if (!node.visible)
- return;
-
- var line = space + node.functionName + " (line " + node.lineNumber + ")\n";
- preElement.appendChild(document.createTextNode(line));
-
- var children = node.children();
- for (var i = 0; i < children.length; ++i)
- printProfileNodeWithoutTime(preElement, children[i], space + " ");
-}
-
-function findFunctionInProfile(node, functionName)
-{
- if (node.functionName === functionName)
- return true;
- var children = node.children();
- for (var i = 0; i < children.length; ++i)
- if (findFunctionInProfile(children[i], functionName))
- return true;
- return false;
-}
-
-</script>
-</head>
-<body onload="startTest()">
-<p>
-Tests that CPU profiling works.<br>
-Doesn't open Inspector, uses <b>console.profile...</b>.
-
-<div id="output"></div>
-</p>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolprofilerconsoleprofileexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/profiler/console-profile-expected.txt (0 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/profiler/console-profile-expected.txt         (rev 0)
+++ trunk/LayoutTests/inspector-protocol/profiler/console-profile-expected.txt        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+Tests that console.profile/profileEnd will record CPU profile when inspector front-end is connected.
+SUCCESS: retrieved 'inner' profile
+SUCCESS: found 'collectProfiles' function in the profile
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolprofilerconsoleprofilehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/profiler/console-profile.html (0 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/profiler/console-profile.html         (rev 0)
+++ trunk/LayoutTests/inspector-protocol/profiler/console-profile.html        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -0,0 +1,87 @@
</span><ins>+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
+<script>
+function collectProfiles()
+{
+ console.profile("outer");
+ console.profile("inner");
+ console.profileEnd("outer");
+ console.profileEnd("inner");
+}
+
+function test()
+{
+ function fail(message)
+ {
+ InspectorTest.log("FAIL: " + message);
+ InspectorTest.completeTest();
+ }
+
+ InspectorTest.sendCommand("Profiler.enable", {});
+ InspectorTest.sendCommand("Runtime.evaluate", {expression: "collectProfiles()"}, didCollectProfiles);
+
+ InspectorTest.eventHandler["Profiler.addProfileHeader"] = function(messageObject)
+ {
+ InspectorTest.log("FAIL: unexpected header = " + JSON.stringify(messageObject, null, 4));
+ }
+
+ function didCollectProfiles(messageObject)
+ {
+ InspectorTest.checkForError(messageObject);
+ InspectorTest.sendCommand("Profiler.getProfileHeaders", {}, didReceiveProfileHeaders);
+ }
+
+ function didReceiveProfileHeaders(messageObject)
+ {
+ InspectorTest.checkForError(messageObject);
+
+ var headers = messageObject["result"]["headers"];
+ if (!headers || headers.length !== 2) {
+ fail("Cannot retrive headers: " + JSON.stringify(messageObject, null, 4));
+ return;
+ }
+
+ for (var i = 0; i < headers.length; i++) {
+ if (headers[i].title === "inner") {
+ InspectorTest.sendCommand("Profiler.getCPUProfile", { uid: headers[i].uid }, didGetProfile);
+ return;
+ }
+ }
+
+ fail("Cannot find 'inner' profile header");
+ }
+
+ function didGetProfile(messageObject)
+ {
+ InspectorTest.checkForError(messageObject);
+ InspectorTest.log("SUCCESS: retrieved 'inner' profile");
+
+ var rootNodes = messageObject.result.profile.rootNodes;
+ if (!findFunctionInProfile(rootNodes, "collectProfiles")) {
+ fail("collectProfiles function not found in the profile: " + JSON.stringify(messageObject, null, 4));
+ return;
+ }
+
+ InspectorTest.log("SUCCESS: found 'collectProfiles' function in the profile");
+ InspectorTest.sendCommand("Profiler.clearProfiles", {});
+ InspectorTest.completeTest();
+ }
+
+ function findFunctionInProfile(rootNodes, functionName)
+ {
+ for (var i = 0; i < rootNodes.length; ++i)
+ if (rootNodes[i].functionName === functionName)
+ return true;
+
+ return false;
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>
+Tests that console.profile/profileEnd will record CPU profile when inspector front-end is connected.<br>
+</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolprofilerconsoleprofileEndparameterlessexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt (0 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt         (rev 0)
+++ trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+Tests that "console.profileEnd()" does not cause crash.
+Bug 105759.
+SUCCESS: found 2 profile headers
+SUCCESS: titled profile found
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocolprofilerconsoleprofileEndparameterlesshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless.html (0 => 164689)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless.html         (rev 0)
+++ trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless.html        2014-02-26 02:50:20 UTC (rev 164689)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+<html>
+<head>
+<script type="text/javascript" src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
+<script>
+function collectProfiles()
+{
+ console.profile();
+ console.profile("titled");
+ console.profileEnd();
+ console.profileEnd();
+}
+
+function test()
+{
+ function fail(message)
+ {
+ InspectorTest.log("FAIL: " + message);
+ InspectorTest.completeTest();
+ }
+
+ InspectorTest.sendCommand("Profiler.enable", {});
+ InspectorTest.sendCommand("Runtime.evaluate", {expression: "collectProfiles()"}, didCollectProfiles);
+
+ InspectorTest.eventHandler["Profiler.addProfileHeader"] = function(messageObject)
+ {
+ InspectorTest.log("FAIL: unexpected header = " + JSON.stringify(messageObject, null, 4));
+ }
+
+ function didCollectProfiles(messageObject)
+ {
+ InspectorTest.checkForError(messageObject);
+ InspectorTest.sendCommand("Profiler.getProfileHeaders", {}, didReceiveProfileHeaders);
+ }
+
+ function didReceiveProfileHeaders(messageObject)
+ {
+ InspectorTest.checkForError(messageObject);
+
+ var headers = messageObject["result"]["headers"];
+ if (!headers || headers.length !== 2) {
+ fail("Cannot retrive headers: " + JSON.stringify(messageObject, null, 4));
+ return;
+ }
+
+ InspectorTest.log("SUCCESS: found 2 profile headers");
+ for (var i = 0; i < headers.length; i++) {
+ if (headers[i].title === "titled") {
+ InspectorTest.log("SUCCESS: titled profile found");
+ InspectorTest.sendCommand("Profiler.clearProfiles", {});
+ InspectorTest.completeTest();
+ return;
+ }
+ }
+
+ fail("Cannot find titled profile");
+ }
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>
+Tests that "console.profileEnd()" does not cause crash.<br>
+<a href="https://bugs.webkit.org/show_bug.cgi?id=105759">Bug 105759.</a><br>
+</p>
+</body>
+</html>
</ins></span></pre>
</div>
</div>
</body>
</html>