Diff
Modified: trunk/LayoutTests/ChangeLog (164688 => 164689)
--- trunk/LayoutTests/ChangeLog 2014-02-26 02:28:52 UTC (rev 164688)
+++ trunk/LayoutTests/ChangeLog 2014-02-26 02:50:20 UTC (rev 164689)
@@ -1,3 +1,19 @@
+2014-02-25 Joseph Pecoraro <[email protected]>
+
+ 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.
+
2014-02-25 Samuel White <[email protected]>
Add accessibility search predicate support for AXOutlines
Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash-expected.txt (164688 => 164689)
--- 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)
@@ -1,6 +0,0 @@
-Tests that "console.profileEnd()" do not cause crash.
-Bug 105759.
-
-Profiles count: 2
-Titled profile found.
-
Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-parameterless-profile-end-crash.html (164688 => 164689)
--- 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)
@@ -1,49 +0,0 @@
-<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="" 105759.</a><br>
-<div id="output"></div>
-</p>
-</body>
-</html>
Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector-expected.txt (164688 => 164689)
--- 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)
@@ -1,6 +0,0 @@
-Tests that CPU profiling works.
-Doesn't open Inspector, uses console.profile....
-
-
-Found pageFunction
-
Deleted: trunk/LayoutTests/inspector-obsolete/profiler/cpu-profiler-profiling-without-inspector.html (164688 => 164689)
--- 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)
@@ -1,84 +0,0 @@
-<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 = ""
- 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>
Added: trunk/LayoutTests/inspector-protocol/profiler/console-profile-expected.txt (0 => 164689)
--- 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)
@@ -0,0 +1,4 @@
+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
+
Added: trunk/LayoutTests/inspector-protocol/profiler/console-profile.html (0 => 164689)
--- 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)
@@ -0,0 +1,87 @@
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<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>
Added: trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless-expected.txt (0 => 164689)
--- 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)
@@ -0,0 +1,5 @@
+Tests that "console.profileEnd()" does not cause crash.
+Bug 105759.
+SUCCESS: found 2 profile headers
+SUCCESS: titled profile found
+
Added: trunk/LayoutTests/inspector-protocol/profiler/console-profileEnd-parameterless.html (0 => 164689)
--- 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)
@@ -0,0 +1,66 @@
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<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="" 105759.</a><br>
+</p>
+</body>
+</html>