2011-02-14 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Feb 2011 15:43:42 +0000 (15:43 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Feb 2011 15:43:42 +0000 (15:43 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: move timeline and highlighter tests to the new harness.
        https://bugs.webkit.org/show_bug.cgi?id=54390

        * inspector/cookie-resource-match.html:
        * inspector/elements-panel-search.html:
        * inspector/evaluate-in-frontend-expected.txt: Removed.
        * inspector/evaluate-in-frontend.html: Removed.
        * inspector/inspected-objects-not-overriden.html:
        * inspector/resources/timeline-iframe-data.html:
        * inspector/syntax-highlight-css.html:
        * inspector/syntax-highlight-html.html:
        * inspector/syntax-highlight-javascript-expected.txt:
        * inspector/syntax-highlight-javascript.html:
        * inspector/syntax-highlight.js:
        (initialize_SyntaxHighlight.InspectorTest.dumpSyntaxHighlight):
        (initialize_SyntaxHighlight):
        * inspector/timeline-enum-stability-expected.txt:
        * inspector/timeline-enum-stability.html:
        * inspector/timeline-event-dispatch.html:
        * inspector/timeline-layout-expected.txt:
        * inspector/timeline-layout.html:
        * inspector/timeline-mark-timeline.html:
        * inspector/timeline-network-resource-expected.txt:
        * inspector/timeline-network-resource.html:
        * inspector/timeline-network-resource.js:
        * inspector/timeline-paint.html:
        * inspector/timeline-parse-html-expected.txt:
        * inspector/timeline-parse-html.html:
        * inspector/timeline-recalculate-styles-expected.txt:
        * inspector/timeline-recalculate-styles.html:
        * inspector/timeline-script-tag-1-expected.txt:
        * inspector/timeline-script-tag-1.html:
        * inspector/timeline-script-tag-2-expected.txt:
        * inspector/timeline-script-tag-2.html:
        * inspector/timeline-script-tag-2.js:
        * inspector/timeline-test.js:
        (initialize_Timeline.InspectorTest.performActionsAndPrint.step1):
        (initialize_Timeline.InspectorTest.performActionsAndPrint.step2):
        (initialize_Timeline.InspectorTest.performActionsAndPrint.step3):
        (initialize_Timeline.InspectorTest.performActionsAndPrint):
        (initialize_Timeline.InspectorTest.printTimelineRecords):
        (initialize_Timeline.InspectorTest._timelineResults):
        (initialize_Timeline.InspectorTest.dumpTimelineRecord):
        (initialize_Timeline.InspectorTest.dumpTimelineRecords):
        (initialize_Timeline.InspectorTest.printTimelineRecordProperties):
        (initialize_Timeline.InspectorTest._timelineAgentTypeToString):
        (initialize_Timeline):
        * inspector/timeline-trivial.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@78477 268f45cc-cd09-0410-ab3c-d52691b4dbfc

34 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/cookie-resource-match.html
LayoutTests/inspector/elements-panel-search.html
LayoutTests/inspector/evaluate-in-frontend-expected.txt [deleted file]
LayoutTests/inspector/evaluate-in-frontend.html [deleted file]
LayoutTests/inspector/evaluate-in-page-expected.txt [new file with mode: 0644]
LayoutTests/inspector/evaluate-in-page.html [new file with mode: 0755]
LayoutTests/inspector/inspected-objects-not-overriden.html
LayoutTests/inspector/resources/timeline-iframe-data.html
LayoutTests/inspector/syntax-highlight-css.html
LayoutTests/inspector/syntax-highlight-html.html
LayoutTests/inspector/syntax-highlight-javascript.html
LayoutTests/inspector/syntax-highlight.js
LayoutTests/inspector/timeline-enum-stability-expected.txt
LayoutTests/inspector/timeline-enum-stability.html
LayoutTests/inspector/timeline-event-dispatch.html
LayoutTests/inspector/timeline-layout-expected.txt
LayoutTests/inspector/timeline-layout.html
LayoutTests/inspector/timeline-mark-timeline.html
LayoutTests/inspector/timeline-network-resource-expected.txt
LayoutTests/inspector/timeline-network-resource.html
LayoutTests/inspector/timeline-network-resource.js
LayoutTests/inspector/timeline-paint.html
LayoutTests/inspector/timeline-parse-html-expected.txt
LayoutTests/inspector/timeline-parse-html.html
LayoutTests/inspector/timeline-recalculate-styles-expected.txt
LayoutTests/inspector/timeline-recalculate-styles.html
LayoutTests/inspector/timeline-script-tag-1-expected.txt
LayoutTests/inspector/timeline-script-tag-1.html
LayoutTests/inspector/timeline-script-tag-2-expected.txt
LayoutTests/inspector/timeline-script-tag-2.html
LayoutTests/inspector/timeline-script-tag-2.js
LayoutTests/inspector/timeline-test.js
LayoutTests/inspector/timeline-trivial.html

index ed7d2c0..b0c7db9 100644 (file)
@@ -1,5 +1,58 @@
 2011-02-14  Pavel Feldman  <pfeldman@chromium.org>
 
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: move timeline and highlighter tests to the new harness.
+        https://bugs.webkit.org/show_bug.cgi?id=54390
+
+        * inspector/cookie-resource-match.html:
+        * inspector/elements-panel-search.html:
+        * inspector/evaluate-in-frontend-expected.txt: Removed.
+        * inspector/evaluate-in-frontend.html: Removed.
+        * inspector/inspected-objects-not-overriden.html:
+        * inspector/resources/timeline-iframe-data.html:
+        * inspector/syntax-highlight-css.html:
+        * inspector/syntax-highlight-html.html:
+        * inspector/syntax-highlight-javascript-expected.txt:
+        * inspector/syntax-highlight-javascript.html:
+        * inspector/syntax-highlight.js:
+        (initialize_SyntaxHighlight.InspectorTest.dumpSyntaxHighlight):
+        (initialize_SyntaxHighlight):
+        * inspector/timeline-enum-stability-expected.txt:
+        * inspector/timeline-enum-stability.html:
+        * inspector/timeline-event-dispatch.html:
+        * inspector/timeline-layout-expected.txt:
+        * inspector/timeline-layout.html:
+        * inspector/timeline-mark-timeline.html:
+        * inspector/timeline-network-resource-expected.txt:
+        * inspector/timeline-network-resource.html:
+        * inspector/timeline-network-resource.js:
+        * inspector/timeline-paint.html:
+        * inspector/timeline-parse-html-expected.txt:
+        * inspector/timeline-parse-html.html:
+        * inspector/timeline-recalculate-styles-expected.txt:
+        * inspector/timeline-recalculate-styles.html:
+        * inspector/timeline-script-tag-1-expected.txt:
+        * inspector/timeline-script-tag-1.html:
+        * inspector/timeline-script-tag-2-expected.txt:
+        * inspector/timeline-script-tag-2.html:
+        * inspector/timeline-script-tag-2.js:
+        * inspector/timeline-test.js:
+        (initialize_Timeline.InspectorTest.performActionsAndPrint.step1):
+        (initialize_Timeline.InspectorTest.performActionsAndPrint.step2):
+        (initialize_Timeline.InspectorTest.performActionsAndPrint.step3):
+        (initialize_Timeline.InspectorTest.performActionsAndPrint):
+        (initialize_Timeline.InspectorTest.printTimelineRecords):
+        (initialize_Timeline.InspectorTest._timelineResults):
+        (initialize_Timeline.InspectorTest.dumpTimelineRecord):
+        (initialize_Timeline.InspectorTest.dumpTimelineRecords):
+        (initialize_Timeline.InspectorTest.printTimelineRecordProperties):
+        (initialize_Timeline.InspectorTest._timelineAgentTypeToString):
+        (initialize_Timeline):
+        * inspector/timeline-trivial.html:
+
+2011-02-14  Pavel Feldman  <pfeldman@chromium.org>
+
         Not reviewed: update chromium expectation for inspector test.
 
         * inspector/console-uncaught-exception-in-eval.html:
index 70874fb..90f1261 100644 (file)
@@ -1,36 +1,26 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script>
 
-function doit() {
-    function callback(result)
-    {
-        for (var i = 0; i < result.length; ++i)
-            output("[" + result[i] + "]");
-        notifyDone();
-    }
-    evaluateInWebInspector("frontend_doitAndDump", callback);
-}
+function test() {
 
-function frontend_doitAndDump()
-{
     var cookies = [
-        frontend_createCookie("insecureOnlyWebkit", "1234567890", false, "webkit.org", "/"),
-        frontend_createCookie("insecureAllWebkit", "1234567890123456", false, ".webkit.org", "/"),
-        frontend_createCookie("insecureAllWebkitPath", "1234567890123456", false, ".webkit.org", "/path"),
-        frontend_createCookie("secureOnlyWebkitPath", "bar", true, "webkit.org", "/path"),
-        frontend_createCookie("secureAllWebkit", "foo", true, ".webkit.org", "/"),
-        frontend_createCookie("secureAllWebkitPath", "foo", true, ".webkit.org", "/path"),
-        frontend_createCookie("insecureOnlyWebkitPort", "1234567890", false, "webkit.org", "/", 80),
-        frontend_createCookie("insecureAllWebkitPort", "1234567890123456", false, ".webkit.org", "/", 80),
-        frontend_createCookie("insecureAllWebkitPathPort", "1234567890123456", false, ".webkit.org", "/path", 80),
-        frontend_createCookie("secureOnlyWebkitPathPort", "bar", true, "webkit.org", "/path", 80),
-        frontend_createCookie("secureAllWebkitPort", "foo", true, ".webkit.org", "/", 80),
-        frontend_createCookie("secureAllWebkitPathPort", "foo", true, ".webkit.org", "/path", 80),
-        frontend_createCookie("nonMatching1", "bar", false, "webkit.zoo", "/"),
-        frontend_createCookie("nonMatching2", "bar", false, "webkit.org", "/badPath"),
-        frontend_createCookie("nonMatching3", "bar", true, ".moo.com", "/")
+        createCookie("insecureOnlyWebkit", "1234567890", false, "webkit.org", "/"),
+        createCookie("insecureAllWebkit", "1234567890123456", false, ".webkit.org", "/"),
+        createCookie("insecureAllWebkitPath", "1234567890123456", false, ".webkit.org", "/path"),
+        createCookie("secureOnlyWebkitPath", "bar", true, "webkit.org", "/path"),
+        createCookie("secureAllWebkit", "foo", true, ".webkit.org", "/"),
+        createCookie("secureAllWebkitPath", "foo", true, ".webkit.org", "/path"),
+        createCookie("insecureOnlyWebkitPort", "1234567890", false, "webkit.org", "/", 80),
+        createCookie("insecureAllWebkitPort", "1234567890123456", false, ".webkit.org", "/", 80),
+        createCookie("insecureAllWebkitPathPort", "1234567890123456", false, ".webkit.org", "/path", 80),
+        createCookie("secureOnlyWebkitPathPort", "bar", true, "webkit.org", "/path", 80),
+        createCookie("secureAllWebkitPort", "foo", true, ".webkit.org", "/", 80),
+        createCookie("secureAllWebkitPathPort", "foo", true, ".webkit.org", "/path", 80),
+        createCookie("nonMatching1", "bar", false, "webkit.zoo", "/"),
+        createCookie("nonMatching2", "bar", false, "webkit.org", "/badPath"),
+        createCookie("nonMatching3", "bar", true, ".moo.com", "/")
     ];
 
     var resourceURLs = [
@@ -67,31 +57,30 @@ function frontend_doitAndDump()
             if (WebInspector.Cookies.cookieMatchesResourceURL(cookies[i], resourceURLs[j]))
                 cookieResult.push(j);
         }
-        result.push(cookieResult);
+        InspectorTest.addResult("[" + cookieResult + "]");
     }
-    return result;
-}
+    InspectorTest.completeTest();
 
-function frontend_createCookie(name, value, secure, domain, path, port)
-{
-    return {
-        name: name,
-        value: value,
-        domain: domain,
-        port: port,
-        path: path,
-        expires: "Thu Jan 01 1970 00:00:00 GMT",
-        size: name.length + value.length,
-        httpOnly: false,
-        secure: secure,
-        session: true
-    };
+    function createCookie(name, value, secure, domain, path, port)
+    {
+        return {
+            name: name,
+            value: value,
+            domain: domain,
+            port: port,
+            path: path,
+            expires: "Thu Jan 01 1970 00:00:00 GMT",
+            size: name.length + value.length,
+            httpOnly: false,
+            secure: secure,
+            session: true
+        };
+    }
 }
-
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests that cookies are matched up with resources correctly.
 </p>
index b69c745..aa9d437 100755 (executable)
@@ -1,31 +1,20 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script>
-function doit()
+function test()
 {
-    function callback(searchResults)
-    {
-        output("====================================");
-        output("Results:");
-        for (var i = 0; i < searchResults.length; ++i)
-            output(searchResults[i]);
-        notifyDone();
-    }
-    evaluateInWebInspector("frontend_performSearch", callback);
-}
-
-
-// Frontend functions.
-
-function frontend_performSearch(testController)
-{
-    testController.waitUntilDone();
-
     var searchResults = [];
     function addSearchResult(markupValue)
     {
+        if (markupValue.indexOf("ter" + "mi" + "nator") !== -1) {
+            InspectorTest.addResult("====================================");
+            InspectorTest.addResult("Results:");
+            InspectorTest.addResults(searchResults);
+            InspectorTest.completeTest();
+            return;
+         }
         searchResults.push(markupValue);
     }
 
@@ -39,6 +28,7 @@ function frontend_performSearch(testController)
                 InspectorBackend.getOuterHTML(node.id, addSearchResult);
         }
     }
+
     // Plain text.
     InspectorBackend.performSearch("Foo" + "Bar", true);
     // Partial text.
@@ -53,21 +43,20 @@ function frontend_performSearch(testController)
     InspectorBackend.performSearch("In" + "putVa" + "l", true);
     // Partial attribute val<>ue.
     InspectorBackend.performSearch("n" + "putVa" + "l", true);
-
-    testController.runAfterPendingDispatches(function() {
-        testController.notifyDone(searchResults);
-    });
+    // Terminator.
+    InspectorBackend.performSearch("ter" + "mi" + "nator", true);
 }
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests that elements panel search is returning proper results.
 </p>
 
 <div>FooBar</div>
 <input value="InputVal">
+<div id="terminator"></div>
 
 </body>
 </html>
diff --git a/LayoutTests/inspector/evaluate-in-frontend-expected.txt b/LayoutTests/inspector/evaluate-in-frontend-expected.txt
deleted file mode 100644 (file)
index a8752df..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-This tests that layout test can evaluate scripts in the web inspector context.
-
-2 + 2 = 4
-
diff --git a/LayoutTests/inspector/evaluate-in-frontend.html b/LayoutTests/inspector/evaluate-in-frontend.html
deleted file mode 100755 (executable)
index 891afae..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<html>
-<head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
-<script>
-
-function doit()
-{
-    function callback(result)
-    {
-        output("2 + 2 = " + result);
-        notifyDone();
-    }
-    evaluateInWebInspector("frontend_sum(2, 2)", callback);
-}
-
-
-// Frontend functions.
-
-function frontend_sum(a, b)
-{
-    return a + b;
-}
-
-</script>
-</head>
-
-<body onload="onload()">
-<p>
-This tests that layout test can evaluate scripts in the web inspector context.
-</p>
-
-</body>
-</html>
diff --git a/LayoutTests/inspector/evaluate-in-page-expected.txt b/LayoutTests/inspector/evaluate-in-page-expected.txt
new file mode 100644 (file)
index 0000000..b90ad43
--- /dev/null
@@ -0,0 +1,4 @@
+This tests that layout test can evaluate scripts in the inspected page.
+
+2 + 2 = 4
+
diff --git a/LayoutTests/inspector/evaluate-in-page.html b/LayoutTests/inspector/evaluate-in-page.html
new file mode 100755 (executable)
index 0000000..986769d
--- /dev/null
@@ -0,0 +1,30 @@
+<html>
+<head>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
+<script>
+
+function sum(a, b)
+{
+    return a + b;
+}
+
+function test()
+{
+    function callback(result)
+    {
+        InspectorTest.addResult("2 + 2 = " + result.description);
+        InspectorTest.completeTest();
+    }
+    InspectorTest.evaluateInPage("sum(2, 2)", callback);
+}
+
+</script>
+</head>
+
+<body onload="runTest()">
+<p>
+This tests that layout test can evaluate scripts in the inspected page.
+</p>
+
+</body>
+</html>
index 747ea9e..3a5c65d 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script>
 
 function myImpl() {
@@ -16,34 +16,42 @@ Object.className = myImpl;
 String.prototype.escapeCharacters = myImpl;
 JSON.stringify = myImpl;
 
-function doit()
+function output(text)
 {
-    function callback(result)
+    var output = document.getElementById("output");
+    output.appendChild(document.createTextNode(text));
+    output.appendChild(document.createElement("br"));
+}
+
+function dumpValues()
+{
+    // Check that the methods haven't changed.
+    output("myImpl() => " + myImpl());
+    output("Object.type === myImpl => " + (Object.type === myImpl));
+    output("Object.hasProperties === myImpl => " + (Object.hasProperties === myImpl));
+    output("Object.describe === myImpl => " + (Object.describe === myImpl));
+    output("Object.className === myImpl => " + (Object.className === myImpl));
+    output("String.prototype.escapeCharacters === myImpl => " + (String.prototype.escapeCharacters === myImpl));
+    output("JSON.stringify === myImpl => " + (JSON.stringify === myImpl));
+}
+
+function test()
+{
+    function callback()
     {
-        // Check that the methods haven't changed.
-        output("myImpl() => " + myImpl());
-        output("Object.type === myImpl => " + (Object.type === myImpl));
-        output("Object.hasProperties === myImpl => " + (Object.hasProperties === myImpl));
-        output("Object.describe === myImpl => " + (Object.describe === myImpl));
-        output("Object.className === myImpl => " + (Object.className === myImpl));
-        output("String.prototype.escapeCharacters === myImpl => " + (String.prototype.escapeCharacters === myImpl));
-        output("JSON.stringify === myImpl => " + (JSON.stringify === myImpl));
-
-        notifyDone();
+        InspectorTest.completeTest();
     }
-    evaluateInWebInspector("true", callback);
+    InspectorTest.evaluateInPage("dumpValues()", callback);
 }
-
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests that opening inspector front-end doesn't change methods defined by the inspected application.
 </p>
 
-<pre id="outputPre">
-</pre>
+<div id="output"></div>
 
 </body>
 </html>
index 74f16a6..3595680 100644 (file)
@@ -5,7 +5,7 @@ console.markTimeline("SCRIPT TAG");
 
 function iframeOnload()
 {
-    window.parent.iframeLoaded = true;
+    console.log("iframe loaded");
 }
 </script>
 </head>
index d89c081..987b9d3 100644 (file)
@@ -1,33 +1,32 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="syntax-highlight.js"></script>
 <script>
 
-// Frontend functions.
-
-function frontend_dumpSyntaxHighlightCSS(str)
+function test()
 {
-    return frontend_dumpSyntaxHighlight(str, "text/css");
-}
+    function dumpSyntaxHighlightCSS(str)
+    {
+        InspectorTest.dumpSyntaxHighlight(str, "text/css");
+    }
+
+    dumpSyntaxHighlightCSS("a[href='/']");
+    dumpSyntaxHighlightCSS("#content > a:hover");
+    dumpSyntaxHighlightCSS("@import url(style.css);");
+    dumpSyntaxHighlightCSS("@import url(\"style.css\") projection, tv;");
+    dumpSyntaxHighlightCSS("@media screen { body { color: red; } }");
+    dumpSyntaxHighlightCSS("@font-face { font-family: MyHelvetica; }");
+    dumpSyntaxHighlightCSS("p { color: color; red: red; }");
+    dumpSyntaxHighlightCSS("p { margin: -10px !important; }");
 
-function frontend_doitAndDump() {
-    var result = [];
-    result.push(frontend_dumpSyntaxHighlightCSS("a[href='/']"));
-    result.push(frontend_dumpSyntaxHighlightCSS("#content > a:hover"));
-    result.push(frontend_dumpSyntaxHighlightCSS("@import url(style.css);"));
-    result.push(frontend_dumpSyntaxHighlightCSS("@import url(\"style.css\") projection, tv;"));
-    result.push(frontend_dumpSyntaxHighlightCSS("@media screen { body { color: red; } }"));
-    result.push(frontend_dumpSyntaxHighlightCSS("@font-face { font-family: MyHelvetica; }"));
-    result.push(frontend_dumpSyntaxHighlightCSS("p { color: color; red: red; }"));
-    result.push(frontend_dumpSyntaxHighlightCSS("p { margin: -10px !important; }"));
-    return result;
+    InspectorTest.completeTest();
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests that CSSSourceSyntaxHighlighter detects the tokens.
 </p>
index 4273cfe..365bab5 100644 (file)
@@ -1,33 +1,32 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="syntax-highlight.js"></script>
 <script>
 
-// Frontend functions.
-
-function frontend_dumpSyntaxHighlightHTML(str)
+function test()
 {
-    return frontend_dumpSyntaxHighlight(str, "text/html");
-}
+    function dumpSyntaxHighlightHTML(str)
+    {
+        InspectorTest.dumpSyntaxHighlight(str, "text/html");
+    }
+
+    dumpSyntaxHighlightHTML("<html>");
+    dumpSyntaxHighlightHTML("<table cellspacing=0>");
+    dumpSyntaxHighlightHTML("<input checked value=\"foo\">");
+    dumpSyntaxHighlightHTML("<table cellspacing=\"0\" cellpadding='0'>");
+    dumpSyntaxHighlightHTML("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
+    dumpSyntaxHighlightHTML("<!--div><div foobar-->");
+    dumpSyntaxHighlightHTML("<script></" + "script><!--div-->");
+    dumpSyntaxHighlightHTML("<script type=\"text/javascript\">document.write('<script type=\"text/javascript\"></' + 'script>');</" + "script>");
 
-function frontend_doitAndDump() {
-    var result = [];
-    result.push(frontend_dumpSyntaxHighlightHTML("<html>"));
-    result.push(frontend_dumpSyntaxHighlightHTML("<table cellspacing=0>"));
-    result.push(frontend_dumpSyntaxHighlightHTML("<input checked value=\"foo\">"));
-    result.push(frontend_dumpSyntaxHighlightHTML("<table cellspacing=\"0\" cellpadding='0'>"));
-    result.push(frontend_dumpSyntaxHighlightHTML("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"));
-    result.push(frontend_dumpSyntaxHighlightHTML("<!--div><div foobar-->"));
-    result.push(frontend_dumpSyntaxHighlightHTML("<script></" + "script><!--div-->"));
-    result.push(frontend_dumpSyntaxHighlightHTML("<script type=\"text/javascript\">document.write('<script type=\"text/javascript\"></' + 'script>');</" + "script>"));
-    return result;
+    InspectorTest.completeTest();
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests that SourceHTMLTokenizer detects the tokens.
 </p>
index 833c2a1..ed4e4f7 100644 (file)
@@ -1,37 +1,35 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="syntax-highlight.js"></script>
 <script>
 
-// Frontend functions.
-
-function frontend_dumpSyntaxHighlightJS(str)
+function test()
 {
-    return frontend_dumpSyntaxHighlight(str, "text/javascript");
-}
+    function dumpSyntaxHighlightJS(str)
+    {
+        InspectorTest.dumpSyntaxHighlight(str, "text/javascript");
+    }
+
+    dumpSyntaxHighlightJS("return'foo';");
+    dumpSyntaxHighlightJS("/\\\//g");
+    dumpSyntaxHighlightJS("//ig';");
+    dumpSyntaxHighlightJS("1 / 2 + /a/.test('a');");
+    dumpSyntaxHighlightJS("\"\\\"/\".length / 2");
+    dumpSyntaxHighlightJS("var foo = 1/*/***//2");
+    dumpSyntaxHighlightJS("/*comment*//.*/.test('a')");
+    dumpSyntaxHighlightJS("'f\\\noo';");
+    dumpSyntaxHighlightJS("'\\f\\b\\t';");
+    dumpSyntaxHighlightJS("'/\\\n/';");
+    dumpSyntaxHighlightJS("foo/**\n/\n*/foo");
 
-function frontend_doitAndDump() {
-    var result = [];
-    
-    result.push(frontend_dumpSyntaxHighlightJS("return'foo';"));
-    result.push(frontend_dumpSyntaxHighlightJS("/\\\//g"));
-    result.push(frontend_dumpSyntaxHighlightJS("//ig';"));
-    result.push(frontend_dumpSyntaxHighlightJS("1 / 2 + /a/.test('a');"));
-    result.push(frontend_dumpSyntaxHighlightJS("\"\\\"/\".length / 2"));
-    result.push(frontend_dumpSyntaxHighlightJS("var foo = 1/*/***//2"));
-    result.push(frontend_dumpSyntaxHighlightJS("/*comment*//.*/.test('a')"));
-    result.push(frontend_dumpSyntaxHighlightJS("'f\\\noo';"));
-    result.push(frontend_dumpSyntaxHighlightJS("'\\f\\b\\t';"));
-    result.push(frontend_dumpSyntaxHighlightJS("'/\\\n/';"));
-    result.push(frontend_dumpSyntaxHighlightJS("foo/**\n/\n*/foo"));
-    return result;
+    InspectorTest.completeTest();
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests that JavaScriptSourceSyntaxHighlighter detects the tokens.
 </p>
index 9bdf2b3..cb3ea7a 100644 (file)
@@ -1,19 +1,6 @@
-// Inspected Page functions.
+var initialize_SyntaxHighlight = function() {
 
-function doit()
-{
-    function callback(result)
-    {
-        for (var i = 0; i < result.length; ++i)
-            output(result[i]);
-        notifyDone();
-    }
-    evaluateInWebInspector("frontend_doitAndDump", callback);
-}
-
-// Frontend functions.
-
-function frontend_dumpSyntaxHighlight(str, mimeType)
+InspectorTest.dumpSyntaxHighlight = function(str, mimeType)
 {
     var node = document.createElement("span");
     node.textContent = str;
@@ -27,5 +14,7 @@ function frontend_dumpSyntaxHighlight(str, mimeType)
             node_parts.push("*");
         }
     }
-    return str + ": " + node_parts.join(",");
-}
+    InspectorTest.addResult(str + ": " + node_parts.join(","));
+};
+
+};
index ce23106..a28fd48 100644 (file)
@@ -2,25 +2,27 @@ Check to see that TimelineAgent record types are stable.
 
 Applications outside of WebKit depend on the stability of the mapping of these types to these specific values.
 
-WebInspector.TimelineAgent.RecordType.EventDispatch : 0
-WebInspector.TimelineAgent.RecordType.Layout : 1
-WebInspector.TimelineAgent.RecordType.RecalculateStyles : 2
-WebInspector.TimelineAgent.RecordType.Paint : 3
-WebInspector.TimelineAgent.RecordType.ParseHTML : 4
-WebInspector.TimelineAgent.RecordType.TimerInstall : 5
-WebInspector.TimelineAgent.RecordType.TimerRemove : 6
-WebInspector.TimelineAgent.RecordType.TimerFire : 7
-WebInspector.TimelineAgent.RecordType.XHRReadyStateChange : 8
-WebInspector.TimelineAgent.RecordType.XHRLoad : 9
-WebInspector.TimelineAgent.RecordType.EvaluateScript : 10
-WebInspector.TimelineAgent.RecordType.MarkTimeline : 11
-WebInspector.TimelineAgent.RecordType.ResourceSendRequest : 12
-WebInspector.TimelineAgent.RecordType.ResourceReceiveResponse : 13
-WebInspector.TimelineAgent.RecordType.ResourceFinish : 14
-WebInspector.TimelineAgent.RecordType.FunctionCall : 15
-WebInspector.TimelineAgent.RecordType.ResourceReceiveData : 16
-WebInspector.TimelineAgent.RecordType.GCEvent : 17
-WebInspector.TimelineAgent.RecordType.MarkDOMContentEventType : 18
-WebInspector.TimelineAgent.RecordType.MarkLoadEventType : 19
-WebInspector.TimelineAgent.RecordType.ScheduleResourceRequest : 20
+{
+    EventDispatch : 0
+    Layout : 1
+    RecalculateStyles : 2
+    Paint : 3
+    ParseHTML : 4
+    TimerInstall : 5
+    TimerRemove : 6
+    TimerFire : 7
+    XHRReadyStateChange : 8
+    XHRLoad : 9
+    EvaluateScript : 10
+    MarkTimeline : 11
+    ResourceSendRequest : 12
+    ResourceReceiveResponse : 13
+    ResourceFinish : 14
+    FunctionCall : 15
+    ResourceReceiveData : 16
+    GCEvent : 17
+    MarkDOMContentEventType : 18
+    MarkLoadEventType : 19
+    ScheduleResourceRequest : 20
+}
 
index d582008..fe03f52 100644 (file)
@@ -1,25 +1,18 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script>
 
-function dumpTimelineAgentRecordType(types) {
-   var prefix = "WebInspector.TimelineAgent.RecordType.";
-   for (prop in types) {
-       output(prefix + prop + " : " + types[prop]);
-   }
-   notifyDone();
-}
-
-function doit()
+function test()
 {
-   evaluateInWebInspector("WebInspector.TimelineAgent.RecordType", dumpTimelineAgentRecordType);
+    InspectorTest.addObject(WebInspector.TimelineAgent.RecordType);
+    InspectorTest.completeTest();
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p> 
 Check to see that TimelineAgent record types are stable.
 </p>
index d01e93b..9723cc2 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="timeline-test.js"></script>
 <script>
 
@@ -9,11 +9,8 @@ function handleMouseDown(event)
     console.markTimeline("Handling mousedown");
 }
 
-function doit() 
+function performActions()
 {
-    if (window.layoutTestController)
-        layoutTestController.setTimelineProfilingEnabled(true);
-
     var target = document.getElementById("testTarget");
     target.addEventListener("mousedown", handleMouseDown, true);
     var rect = target.getBoundingClientRect();
@@ -23,16 +20,17 @@ function doit()
         window.eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.height / 2);
         window.eventSender.mouseDown();
     }
+}
 
-    setTimeout(function() {
-        printTimelineRecords(null, "EventDispatch");
-    }, 0);
+function test() 
+{
+    InspectorTest.performActionsAndPrint("performActions()", "EventDispatch");
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests the Timeline API instrumentation of a DOM Dispatch (mousedown)
 </p>
index 9e1be48..da7ec18 100644 (file)
@@ -1,5 +1,6 @@
 Tests the Timeline API instrumentation of a Layout event
 
+Test data
 Layout Properties:
 {
     startTime : <number>
@@ -11,4 +12,4 @@ Layout Properties:
     usedHeapSize : <number>
     totalHeapSize : <number>
 }
-Test data
+
index 2446e71..592b1b8 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="timeline-test.js"></script>
 <script>
 
@@ -11,15 +11,15 @@ function performActions()
     document.body.appendChild(element);
 }
 
-function doit() 
+function test()
 {
-    printTimelineRecords(performActions, "Layout");
+    InspectorTest.performActionsAndPrint("performActions()", "Layout");
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests the Timeline API instrumentation of a Layout event
 </p>
index 24e7a7a..fe2970f 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="timeline-test.js"></script>
 <script>
 
@@ -9,15 +9,15 @@ function performActions()
     console.markTimeline("MARK TIMELINE");
 }
 
-function doit() 
+function test()
 {
-    printTimelineRecords(performActions, "MarkTimeline");
+    InspectorTest.performActionsAndPrint("performActions()", "MarkTimeline");
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests the Timeline API mark feature
 </p>
index 9269775..c470acf 100644 (file)
@@ -1,5 +1,7 @@
+CONSOLE MESSAGE: line 7: Script evaluated
 Tests the Timeline API instrumentation of a network resource load
 
+Script resource loaded
 
 ResourceSendRequest Properties:
 {
@@ -21,7 +23,7 @@ ResourceReceiveResponse Properties:
         identifier : <number>
         statusCode : 0
         mimeType : <string>
-        expectedContentLength : 208
+        expectedContentLength : 213
         url : <string>
     }
     children : <object>
@@ -43,4 +45,4 @@ ResourceFinish Properties:
     usedHeapSize : <number>
     totalHeapSize : <number>
 }
-Script resource loaded
+
index 6fc508f..bf94fd2 100644 (file)
@@ -1,74 +1,90 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="timeline-test.js"></script>
 <script>
 
 var scriptUrl = "timeline-network-resource.js";
 
-function runAfterScriptIsEvaluated()
+function performActions() 
 {
-    printTimelineRecords(null, null, function(record) {
-        if (record.type === timelineAgentRecordType["ResourceSendRequest"])
-            printSend(record);
-        else if (record.type === timelineAgentRecordType["ResourceReceiveResponse"])
-            printReceive(record);
-        else if (record.type === timelineAgentRecordType["ResourceFinish"])
-            printFinish(record);
-    });
-    evaluateInWebInspector("0", function(result) {
-        // Temporary noop to remove flake.
-    });
+    var script = document.createElement("script");
+    script.src = scriptUrl;
+    document.body.appendChild(script);
 }
 
-function printRecord(record)
+function test()
 {
-    output("");
-    printTimelineRecordProperties(record);
-}
+    var resourceId;
+    var scriptUrl = "timeline-network-resource.js";
 
-function printSend(record)
-{
-    printRecord(record);
-    window.resourceId = record.data.identifier;
-    if (record.data.url === undefined) 
-        output("* No 'url' property in record");
-    else if (record.data.url.indexOf(scriptUrl) === -1)
-        output("* Didn't find URL: " + scriptUrl);
-}
+    InspectorBackend.startTimelineProfiler(step1);
 
-function printReceive(record)
-{
-    printRecord(record);
-    if (window.resourceId !== record.data.identifier)
-        output("Didn't find matching resourceId: " + window.resourceId);
-    if (record.data.statusCode !== 0)
-        output("Response received status: " + record.data.statusCode);
-}
+    function step1()
+    {
+        InspectorTest.evaluateInPage("performActions()");
+        InspectorTest._addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    }
 
-function printFinish(record)
-{
-    printRecord(record);
-    if (window.resourceId !== record.data.identifier)
-        output("Didn't find matching resourceId: " + window.resourceId);
-    if (record.data.didFail)
-        output("Request failed.");
-}
+    function step2()
+    {
+        InspectorBackend.stopTimelineProfiler(step3);
+    }
 
-function doit() 
-{
-    if (window.layoutTestController)
-        layoutTestController.setTimelineProfilingEnabled(true);
+    function step3()
+    {
+        function format(record)
+        {
+            if (record.type === WebInspector.TimelineAgent.RecordType.ResourceSendRequest)
+                printSend(record);
+            else if (record.type === WebInspector.TimelineAgent.RecordType.ResourceReceiveResponse)
+                printReceive(record);
+            else if (record.type === WebInspector.TimelineAgent.RecordType.ResourceFinish)
+                printFinish(record);
+        }
+        InspectorTest.printTimelineRecords(null, format);
+        InspectorTest.completeTest();
+    }
 
-    var script = document.createElement("script");
-    script.src = scriptUrl;
-    document.body.appendChild(script);
+    function printRecord(record)
+    {
+        InspectorTest.addResult("");
+        InspectorTest.printTimelineRecordProperties(record);
+    }
+
+    function printSend(record)
+    {
+        printRecord(record);
+        resourceId = record.data.identifier;
+        if (record.data.url === undefined) 
+            InspectorTest.addResult("* No 'url' property in record");
+        else if (record.data.url.indexOf(scriptUrl) === -1)
+            InspectorTest.addResult("* Didn't find URL: " + scriptUrl);
+    }
+
+    function printReceive(record)
+    {
+        printRecord(record);
+        if (resourceId !== record.data.identifier)
+            InspectorTest.addResult("Didn't find matching resourceId: " + resourceId);
+        if (record.data.statusCode !== 0)
+            InspectorTest.addResult("Response received status: " + record.data.statusCode);
+    }
+
+    function printFinish(record)
+    {
+        printRecord(record);
+        if (resourceId !== record.data.identifier)
+            InspectorTest.addResult("Didn't find matching resourceId: " + resourceId);
+        if (record.data.didFail)
+            InspectorTest.addResult("Request failed.");
+    }
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests the Timeline API instrumentation of a network resource load
 </p>
index de7c720..548976e 100644 (file)
@@ -3,4 +3,5 @@
 var element = document.createElement("div");
 element.innerHTML = "Script resource loaded";
 document.body.appendChild(element);
-runAfterScriptIsEvaluated();
+
+console.log("Script evaluated");
index de8a913..7691af1 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="timeline-test.js"></script>
 <script>
 
@@ -10,15 +10,15 @@ function performActions()
         layoutTestController.display();
 }
 
-function doit() 
+function test()
 {
-    printTimelineRecords(performActions, "Paint");
+    InspectorTest.performActionsAndPrint("performActions()", "Paint");
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests the Timeline API instrumentation of a paint event
 </p>
index b81cd2d..d3e9352 100644 (file)
@@ -1,5 +1,6 @@
 Tests the Timeline API instrumentation of ParseHTML
 
+Test data
 ParseHTML Properties:
 {
     startTime : <number>
@@ -28,4 +29,4 @@ ParseHTML Properties:
     usedHeapSize : <number>
     totalHeapSize : <number>
 }
-Test data
+
index 176451f..ceb56e6 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="timeline-test.js"></script>
 <script>
 
@@ -11,15 +11,15 @@ function performActions()
     document.body.appendChild(element);
 }
 
-function doit() 
+function test()
 {
-    printTimelineRecords(performActions, "ParseHTML");
+    InspectorTest.performActionsAndPrint("performActions()", "ParseHTML");
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests the Timeline API instrumentation of ParseHTML 
 </p>
index 510436d..690f6ed 100644 (file)
@@ -1,5 +1,6 @@
 Tests the Timeline API instrumentation of a style recalculation event
 
+Test data
 RecalculateStyles Properties:
 {
     startTime : <number>
@@ -11,4 +12,4 @@ RecalculateStyles Properties:
     usedHeapSize : <number>
     totalHeapSize : <number>
 }
-Test data
+
index 10213b9..f8a7aee 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="timeline-test.js"></script>
 
 <style>
@@ -19,15 +19,15 @@ function performActions()
     document.body.appendChild(element);
 }
 
-function doit() 
+function test()
 {
-    printTimelineRecords(performActions, "RecalculateStyles");
+    InspectorTest.performActionsAndPrint("performActions()", "RecalculateStyles");
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests the Timeline API instrumentation of a style recalculation event
 </p>
index 35631d8..9f50745 100644 (file)
@@ -1,5 +1,7 @@
+CONSOLE MESSAGE: line 8: iframe loaded
 Tests the Timeline API instrumentation of an HTML script tag.
 
+
 ParseHTML
 ParseHTML
 ----> EvaluateScript
index 131d34e..5863bbd 100644 (file)
@@ -1,44 +1,47 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="timeline-test.js"></script>
 <script>
 
-function runAfterIframeIsLoaded(continuation)
+function performActions()
 {
-    function step()
-    {
-        if (!window.iframeLoaded)
-            setTimeout(step, 100);
-        else
-            continuation();
-    }
-    setTimeout(step, 100);
+    var iframe = document.createElement("iframe");
+    iframe.src = "resources/timeline-iframe-data.html";
+    document.body.appendChild(iframe);
 }
 
-function doit() 
+function test() 
 {
-    if (window.layoutTestController)
-        layoutTestController.setTimelineProfilingEnabled(true);
+    InspectorBackend.startTimelineProfiler(step1);
+    function step1()
+    {
+        InspectorTest.evaluateInPage("performActions()");
+        InspectorTest._addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    }
 
-    var iframe = document.createElement("iframe");
-    iframe.src = "resources/timeline-iframe-data.html";
-    document.body.appendChild(iframe);
+    function step2()
+    {
+        InspectorBackend.stopTimelineProfiler(step3);
+    }
 
-    runAfterIframeIsLoaded(function() {
-        printTimelineRecords(null, null, function(record) {
-            if (record.type === timelineAgentRecordType.EvaluateScript)
-                printTimelineRecordProperties(record);
-            else if (record.type === timelineAgentRecordType.ParseHTML)
-                dumpTimelineRecord(record);
-        });
-    });
+    function step3()
+    {
+        function format(record) {
+            if (record.type === WebInspector.TimelineAgent.RecordType.EvaluateScript)
+                InspectorTest.printTimelineRecordProperties(record);
+            else if (record.type === WebInspector.TimelineAgent.RecordType.ParseHTML)
+                InspectorTest.dumpTimelineRecord(record);
+        }
+        InspectorTest.printTimelineRecords(null, format);
+        InspectorTest.completeTest();
+    }
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests the Timeline API instrumentation of an HTML script tag.
 </p>
index bed173c..a1160c4 100644 (file)
@@ -1,3 +1,4 @@
+CONSOLE MESSAGE: line 1: SCRIPT TAG
 Tests the Timeline API instrumentation of a script tag with an external script.
 
 EvaluateScript Properties:
index 53e3d48..5f8dec2 100644 (file)
@@ -1,39 +1,41 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script src="timeline-test.js"></script>
 <script>
 
-function runAfterScriptIsEvaluated(continuation)
+function performActions()
 {
-    function step()
-    {
-        if (!window.scriptEvaluated)
-            setTimeout(step, 100);
-        else
-            continuation();
-    }
-    setTimeout(step, 100);
+    var script = document.createElement("script");
+    script.src = "timeline-script-tag-2.js";
+    document.body.appendChild(script);
 }
 
-function doit() 
+function test() 
 {
-    if (window.layoutTestController)
-        layoutTestController.setTimelineProfilingEnabled(true);
+    InspectorBackend.startTimelineProfiler(step1);
+    function step1()
+    {
+        InspectorTest._addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+        InspectorTest.evaluateInPage("performActions()");
+    }
 
-    var script = document.createElement("script");
-    script.src = "timeline-script-tag-2.js";
-    document.body.appendChild(script);
+    function step2()
+    {
+        InspectorBackend.stopTimelineProfiler(step3);
+    }
 
-    runAfterScriptIsEvaluated(function() {
-        printTimelineRecords(null, "EvaluateScript");
-    });
+    function step3()
+    {
+        InspectorTest.printTimelineRecords("EvaluateScript");
+        InspectorTest.completeTest();
+    }
 }
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p>
 Tests the Timeline API instrumentation of a script tag with an external script.
 </p>
index 64024f1..9057a37 100644 (file)
@@ -1,2 +1 @@
-console.markTimeline("SCRIPT TAG");
-window.scriptEvaluated = true;
+console.log("SCRIPT TAG");
index a4d72ff..54d63c1 100644 (file)
@@ -1,7 +1,7 @@
-var timelineAgentRecordType = {};
+var initialize_Timeline = function() {
 
 // Scrub values when printing out these properties in the record or data field.
-var timelineNonDeterministicProps = { 
+InspectorTest.timelineNonDeterministicProps = { 
     children : 1,
     endTime : 1, 
     height : 1,
@@ -15,43 +15,55 @@ var timelineNonDeterministicProps = {
     mimeType : 1
 };
 
-function printTimelineRecords(performActions, typeName, formatter)
+InspectorTest.performActionsAndPrint = function(actions, typeName)
 {
-    if (performActions) {
-        if (window.layoutTestController)
-            layoutTestController.setTimelineProfilingEnabled(true);
-        performActions();
+    InspectorBackend.startTimelineProfiler(step1);
+    function step1()
+    {
+        InspectorTest.evaluateInPage(actions, step2);
     }
 
-    evaluateInWebInspector("WebInspector.TimelineAgent.RecordType", function(result) {
-        timelineAgentRecordType = result;
-    });
+    function step2()
+    {
+        InspectorBackend.stopTimelineProfiler(step3);
+    }
 
-    evaluateInWebInspector("frontend_getTimelineResults", function(timelineRecords) {
-        try {
-            if (typeof(timelineRecords) === "string")
-                output("Error fetching Timeline results: " + timelineRecords);
-            else {
-                for (var i = 0; i < timelineRecords.length; ++i) {
-                    var record = timelineRecords[i];
-                    if (typeName && record.type === timelineAgentRecordType[typeName])
-                        printTimelineRecordProperties(record);
-                    if (formatter)
-                        formatter(record);
-                }
-            }
-            if (window.layoutTestController)
-                layoutTestController.setTimelineProfilingEnabled(false);
-            notifyDone();
-        } catch (e) {
-            console.log("An exception was caught: " + e.toString());
-            notifyDone(e.toString());
-        }
-    });
+    function step3()
+    {
+        InspectorTest.printTimelineRecords(typeName);
+        InspectorTest.completeTest();
+    }
 }
 
+InspectorTest.printTimelineRecords = function(typeName, formatter)
+{
+    var timelineRecords = InspectorTest._timelineResults();
+    for (var i = 0; i < timelineRecords.length; ++i) {
+        var record = timelineRecords[i];
+        if (typeName && record.type === WebInspector.TimelineAgent.RecordType[typeName])
+            InspectorTest.printTimelineRecordProperties(record);
+        if (formatter)
+            formatter(record);
+    }
+};
+
+InspectorTest._timelineResults = function() {
+    var result = [];
+    function addRecords(records)
+    {
+        if (!records)
+            return;
+        for (var i = 0; i < records.length; ++i) {
+            result.push(records[i].originalRecordForTests);
+            addRecords(records[i].children);
+        }
+    }
+    addRecords(WebInspector.panels.timeline._rootRecord.children);
+    return result;
+};
+
 // Dump just the record name, indenting output on separate lines for subrecords
-function dumpTimelineRecord(record, level) 
+InspectorTest.dumpTimelineRecord = function(record, level) 
 {
     if (typeof level !== "number")
         level = 0;
@@ -61,49 +73,36 @@ function dumpTimelineRecord(record, level)
         prefix = "----" + prefix;
     if (level > 0)
         prefix = prefix + "> ";
-    if (record.type === timelineAgentRecordType.MarkTimeline) {
+    if (record.type === WebInspector.TimelineAgent.RecordType.MarkTimeline) {
         suffix = " : " + record.data.message;
     }
-    output(prefix + timelineAgentTypeToString(record.type) + suffix);
+    InspectorTest.addResult(prefix + InspectorTest._timelineAgentTypeToString(record.type) + suffix);
 
     var numChildren = record.children ? record.children.length : 0;
     for (var i = 0; i < numChildren; ++i)
-        dumpTimelineRecord(record.children[i], level + 1);
-}
+        InspectorTest.dumpTimelineRecord(record.children[i], level + 1);
+};
 
-function dumpTimelineRecords(timelineRecords) {
+InspectorTest.dumpTimelineRecords = function(timelineRecords)
+{
     for (var i = 0; i < timelineRecords.length; ++i)
-        dumpTimelineRecord(timelineRecords[i], 0);
-}
+        InspectorTest.dumpTimelineRecord(timelineRecords[i], 0);
+};
 
-function printTimelineRecordProperties(record)
+InspectorTest.printTimelineRecordProperties = function(record)
 {
-    output(timelineAgentTypeToString(record.type) + " Properties:");
+    InspectorTest.addResult(InspectorTest._timelineAgentTypeToString(record.type) + " Properties:");
     // Use this recursive routine to print the properties
-    dumpObject(record, timelineNonDeterministicProps);
-}
+    InspectorTest.addObject(record, InspectorTest.timelineNonDeterministicProps);
+};
 
-function timelineAgentTypeToString(numericType)
+InspectorTest._timelineAgentTypeToString = function(numericType)
 {
-    for (var prop in timelineAgentRecordType) {
-        if (timelineAgentRecordType[prop] === numericType)
+    for (var prop in WebInspector.TimelineAgent.RecordType) {
+        if (WebInspector.TimelineAgent.RecordType[prop] === numericType)
             return prop;
     }
     return undefined;
-}
+};
 
-// Injected into Inspector window
-function frontend_getTimelineResults() {
-    var result = [];
-    function addRecords(records)
-    {
-        if (!records)
-            return;
-        for (var i = 0; i < records.length; ++i) {
-            result.push(records[i].originalRecordForTests);
-            addRecords(records[i].children);
-        }
-    }
-    addRecords(WebInspector.panels.timeline._rootRecord.children);
-    return result;
-}
+};
index 6feed9b..eddb228 100644 (file)
@@ -1,33 +1,25 @@
 <html>
 <head>
-<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="../http/tests/inspector/inspector-test2.js"></script>
 <script>
 
-function doit()
-{
-    function callback(result) {
-        output("Timeline started");
-        notifyDone();
-    }
-    evaluateInWebInspector("startTimeline()", callback);
-}
-
-
-// Frontend functions.
-
-function frontend_startTimeline() {
+function test() {
     /* This test seems silly, but originally it tickled bug 31080 */
-    InspectorController.startTimelineProfiler();
-    return true;
+    function callback()
+    {
+        InspectorTest.addResult("Timeline started");
+        InspectorTest.completeTest();
+    }
+    InspectorBackend.startTimelineProfiler(callback);
 }
 
 
 </script>
 </head>
 
-<body onload="onload()">
+<body onload="runTest()">
 <p> 
-Trivial use of inspector frontend tests 
+Trivial use of inspector frontend tests
 </p>
 
 </body>