2009-11-17 Pavel Feldman <pfeldman@chromium.org>
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Nov 2009 13:11:47 +0000 (13:11 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Nov 2009 13:11:47 +0000 (13:11 +0000)
        Reviewed by Timothy Hatcher.

        Web Inspector: Make DRT show web inspector for tests in inspector/ folder.
        - Updated DRT to show/close inspector for all tests under /inspector
        - Introduced LayoutTestController::setTimelineProfilingEnabled and
          WebInspector::setTimelineProfilingEnabled beside setJavaScriptProfilingEnabled
        - Removed reload on each inspector test
        - Renamed fast/inspector to fast/inspector-support in order not to trigger
        inspector for those.
        - Reimplemented timeline tests in order to get rid of reload there.
        - Moved tests that don't require harness into the fast group.

        https://bugs.webkit.org/show_bug.cgi?id=31472

        WebCore:
        * WebCore.Inspector.exp:
        * inspector/front-end/TimelinePanel.js:
        (WebInspector.TimelinePanel.prototype._formatRecord):

        WebKitTools:
        * DumpRenderTree/LayoutTestController.cpp:
        (setTimelineProfilingEnabledCallback):
        (closeWebInspectorCallback):
        (LayoutTestController::staticFunctions):
        * DumpRenderTree/LayoutTestController.h:
        * DumpRenderTree/gtk/DumpRenderTree.cpp:
        (shouldOpenWebInspector):
        (runTest):
        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
        (LayoutTestController::setTimelineProfilingEnabled):
        * DumpRenderTree/mac/DumpRenderTree.mm:
        (shouldOpenWebInspector):
        (runTest):
        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
        (LayoutTestController::setTimelineProfilingEnabled):
        * DumpRenderTree/win/DumpRenderTree.cpp:
        (shouldOpenWebInspector):
        (runTest):
        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
        (LayoutTestController::setTimelineProfilingEnabled):

        LayoutTests:
        * fast/inspector-support/cssURLQuotes-expected.txt: Renamed from LayoutTests/fast/inspector/cssURLQuotes-expected.txt.
        * fast/inspector-support/cssURLQuotes.html: Renamed from LayoutTests/fast/inspector/cssURLQuotes.html.
        * fast/inspector-support/matchedrules.html: Renamed from LayoutTests/fast/inspector/matchedrules.html.
        * fast/inspector-support/style.html: Renamed from LayoutTests/fast/inspector/style.html.
        * fast/inspector-support/uncaught-dom1-exception-expected.txt: Renamed from LayoutTests/inspector/uncaught-dom1-exception-expected.txt.
        * fast/inspector-support/uncaught-dom1-exception.html: Renamed from LayoutTests/inspector/uncaught-dom1-exception.html.
        * fast/inspector-support/uncaught-dom3-exception-expected.txt: Renamed from LayoutTests/inspector/uncaught-dom3-exception-expected.txt.
        * fast/inspector-support/uncaught-dom3-exception.html: Renamed from LayoutTests/inspector/uncaught-dom3-exception.html.
        * fast/inspector-support/uncaught-dom8-exception-expected.txt: Renamed from LayoutTests/inspector/uncaught-dom8-exception-expected.txt.
        * fast/inspector-support/uncaught-dom8-exception.html: Renamed from LayoutTests/inspector/uncaught-dom8-exception.html.
        * inspector/inspector-test.js:
        (onload):
        (evaluateInWebInspector):
        (notifyDone):
        * inspector/resources/timeline-iframe-data.html: Added.
        * inspector/timeline-layout-expected.txt:
        * inspector/timeline-layout.html:
        * inspector/timeline-mark-timeline.html:
        * 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:
        (printTimelineRecords):
        ():
        (dumpTimelineRecords):
        (printProps):
        (frontend_getTimelineResults):

        WebKit/mac:
        * WebInspector/WebInspector.h:
        * WebInspector/WebInspector.mm:
        (-[WebInspector isTimelineProfilingEnabled]):
        (-[WebInspector setTimelineProfilingEnabled:]):

        WebKit/win:
        * Interfaces/IWebInspector.idl:
        * WebInspector.cpp:
        (WebInspector::isTimelineProfilingEnabled):
        (WebInspector::setTimelineProfilingEnabled):
        * WebInspector.h:

        WebKit/gtk:
        * webkit/webkitwebinspector.cpp:
        (webkit_web_inspector_class_init):
        (webkit_web_inspector_set_property):
        (webkit_web_inspector_get_property):

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

48 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/inspector-support/cssURLQuotes-expected.txt [moved from LayoutTests/fast/inspector/cssURLQuotes-expected.txt with 100% similarity]
LayoutTests/fast/inspector-support/cssURLQuotes.html [moved from LayoutTests/fast/inspector/cssURLQuotes.html with 100% similarity]
LayoutTests/fast/inspector-support/matchedrules.html [moved from LayoutTests/fast/inspector/matchedrules.html with 100% similarity]
LayoutTests/fast/inspector-support/style.html [moved from LayoutTests/fast/inspector/style.html with 100% similarity]
LayoutTests/fast/inspector-support/uncaught-dom1-exception-expected.txt [moved from LayoutTests/inspector/uncaught-dom1-exception-expected.txt with 100% similarity]
LayoutTests/fast/inspector-support/uncaught-dom1-exception.html [moved from LayoutTests/inspector/uncaught-dom1-exception.html with 100% similarity]
LayoutTests/fast/inspector-support/uncaught-dom3-exception-expected.txt [moved from LayoutTests/inspector/uncaught-dom3-exception-expected.txt with 100% similarity]
LayoutTests/fast/inspector-support/uncaught-dom3-exception.html [moved from LayoutTests/inspector/uncaught-dom3-exception.html with 100% similarity]
LayoutTests/fast/inspector-support/uncaught-dom8-exception-expected.txt [moved from LayoutTests/inspector/uncaught-dom8-exception-expected.txt with 100% similarity]
LayoutTests/fast/inspector-support/uncaught-dom8-exception.html [moved from LayoutTests/inspector/uncaught-dom8-exception.html with 100% similarity]
LayoutTests/inspector/inspector-test.js
LayoutTests/inspector/resources/timeline-iframe-data.html [new file with mode: 0644]
LayoutTests/inspector/timeline-layout-expected.txt
LayoutTests/inspector/timeline-layout.html
LayoutTests/inspector/timeline-mark-timeline.html
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
WebCore/ChangeLog
WebCore/WebCore.Inspector.exp
WebCore/inspector/front-end/TimelinePanel.js
WebKit/gtk/ChangeLog
WebKit/gtk/webkit/webkitwebinspector.cpp
WebKit/mac/ChangeLog
WebKit/mac/WebInspector/WebInspector.h
WebKit/mac/WebInspector/WebInspector.mm
WebKit/win/ChangeLog
WebKit/win/Interfaces/IWebInspector.idl
WebKit/win/WebInspector.cpp
WebKit/win/WebInspector.h
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/LayoutTestController.cpp
WebKitTools/DumpRenderTree/LayoutTestController.h
WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

index 7215c51..14de674 100644 (file)
@@ -1,3 +1,54 @@
+2009-11-17  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Make DRT show web inspector for tests in inspector/ folder.
+        - Updated DRT to show/close inspector for all tests under /inspector
+        - Introduced LayoutTestController::setTimelineProfilingEnabled and
+          WebInspector::setTimelineProfilingEnabled beside setJavaScriptProfilingEnabled
+        - Removed reload on each inspector test
+        - Renamed fast/inspector to fast/inspector-support in order not to trigger
+        inspector for those.
+        - Reimplemented timeline tests in order to get rid of reload there.
+        - Moved tests that don't require harness into the fast group.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31472
+
+        * fast/inspector-support/cssURLQuotes-expected.txt: Renamed from LayoutTests/fast/inspector/cssURLQuotes-expected.txt.
+        * fast/inspector-support/cssURLQuotes.html: Renamed from LayoutTests/fast/inspector/cssURLQuotes.html.
+        * fast/inspector-support/matchedrules.html: Renamed from LayoutTests/fast/inspector/matchedrules.html.
+        * fast/inspector-support/style.html: Renamed from LayoutTests/fast/inspector/style.html.
+        * fast/inspector-support/uncaught-dom1-exception-expected.txt: Renamed from LayoutTests/inspector/uncaught-dom1-exception-expected.txt.
+        * fast/inspector-support/uncaught-dom1-exception.html: Renamed from LayoutTests/inspector/uncaught-dom1-exception.html.
+        * fast/inspector-support/uncaught-dom3-exception-expected.txt: Renamed from LayoutTests/inspector/uncaught-dom3-exception-expected.txt.
+        * fast/inspector-support/uncaught-dom3-exception.html: Renamed from LayoutTests/inspector/uncaught-dom3-exception.html.
+        * fast/inspector-support/uncaught-dom8-exception-expected.txt: Renamed from LayoutTests/inspector/uncaught-dom8-exception-expected.txt.
+        * fast/inspector-support/uncaught-dom8-exception.html: Renamed from LayoutTests/inspector/uncaught-dom8-exception.html.
+        * inspector/inspector-test.js:
+        (onload):
+        (evaluateInWebInspector):
+        (notifyDone):
+        * inspector/resources/timeline-iframe-data.html: Added.
+        * inspector/timeline-layout-expected.txt:
+        * inspector/timeline-layout.html:
+        * inspector/timeline-mark-timeline.html:
+        * 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:
+        (printTimelineRecords):
+        ():
+        (dumpTimelineRecords):
+        (printProps):
+        (frontend_getTimelineResults):
+
 2009-11-17  Yuta Kitamura  <yutak@chromium.org>
 
         Reviewed by Eric Seidel.
index f87bbc0..ca0aa83 100755 (executable)
@@ -6,72 +6,34 @@ if (window.layoutTestController) {
     layoutTestController.waitUntilDone();
 }
 
-// We ignore initial load of the page, enable inspector and initiate reload. This allows inspector controller
-// to capture events that happen during the initial page load.
-var ignoreLoad = window.location.href.indexOf("?reload") === -1;
-if (ignoreLoad) {
-    // Start in a timer, as synchronous opening of web inspector may fail on Windows
-    setTimeout(function() {
-        if (window.layoutTestController)
-            layoutTestController.showWebInspector();
-    }, 0);
-}
-
 function onload()
 {
-    if (ignoreLoad) {
-        // Inject scripts into the frontend on the first pass.  Some other logic may want to
-        // use them before the reload.
-        var toInject = [];
-        for (var name in window) {
-            if (name.indexOf("frontend_") === 0 && typeof window[name] === "function")
-                toInject.push(window[name].toString());
-        }
-        // Invoke a setup method if it has been specified
-        if (window["frontend_setup"]) 
-            toInject.push("frontend_setup();");
-
-        evaluateInWebInspector(toInject.join("\n"), function(arg) {
-            window.location.href += "?reload";
-        });
-        return;
-    }
-
     var outputElement = document.createElement("div");
     outputElement.id = "output";
     document.body.appendChild(outputElement);
 
-    // Make sure web inspector has settled down before executing user code
-    evaluateInWebInspector("true", doit);
-
-    // Make sure web inspector window is closed before the test is interrupted.
-    setTimeout(function() {
-        alert("Internal timeout exceeded.")
-        if (window.layoutTestController) {
-            layoutTestController.closeWebInspector();
-            layoutTestController.notifyDone();
-        }
-    }, 10000);
+    var toInject = [];
+    for (var name in window) {
+        if (name.indexOf("frontend_") === 0 && typeof window[name] === "function")
+            toInject.push(window[name].toString());
+    }
+    evaluateInWebInspector(toInject.join("\n"), doit);
 }
 
 function evaluateInWebInspector(script, callback)
 {
     var callId = lastCallId++;
     callbacks[callId] = callback;
-    setTimeout(function() {
-        if (window.layoutTestController)
-            layoutTestController.evaluateInWebInspector(callId, script);
-    }, 0);
+    if (window.layoutTestController)
+        layoutTestController.evaluateInWebInspector(callId, script);
 }
 
 function notifyDone()
 {
-    setTimeout(function() {
-        if (window.layoutTestController) {
-            layoutTestController.closeWebInspector();
+    evaluateInWebInspector("true", function() {
+        if (window.layoutTestController)
             layoutTestController.notifyDone();
-        }
-    }, 0);
+    });
 }
 
 function output(text)
diff --git a/LayoutTests/inspector/resources/timeline-iframe-data.html b/LayoutTests/inspector/resources/timeline-iframe-data.html
new file mode 100644 (file)
index 0000000..74f16a6
--- /dev/null
@@ -0,0 +1,17 @@
+<html>
+<head>
+<script>
+console.markTimeline("SCRIPT TAG");
+
+function iframeOnload()
+{
+    window.parent.iframeLoaded = true;
+}
+</script>
+</head>
+
+<body onload="iframeOnload()">
+    <div>Foo</div>
+</body>
+
+</html>
index ad65133..51c10d7 100644 (file)
@@ -5,4 +5,4 @@ Layout Properties:
 + children : * DEFINED *
 + endTime : * DEFINED *
 + type : 1
-
+Test data
index 9458bdf..822f2d8 100644 (file)
@@ -4,25 +4,16 @@
 <script src="timeline-test.js"></script>
 <script>
 
-function analyzeTimelineData(timelineRecords) 
+function performActions()
 {
-    // Uncomment to debugging the list of data returned.
-    // dumpTimelineRecords(timelineRecords);
-
-    // Search for the first Layout record you can find
-    var numRecords = timelineRecords.length;
-    for (var i = 0 ; i < numRecords; ++i) {
-        var record = timelineRecords[i];
-        if (record.type === timelineAgentRecordType.Layout) {
-            printTimelineRecordProperties(record);
-            break;
-        }
-    }
+    var element = document.createElement("div");
+    element.innerHTML = "Test data";
+    document.body.appendChild(element);
 }
 
 function doit() 
 {
-    retrieveTimelineData(analyzeTimelineData);
+    printTimelineRecords(performActions, "Layout");
 }
 
 </script>
index 53b098b..da8c410 100644 (file)
@@ -4,42 +4,14 @@
 <script src="timeline-test.js"></script>
 <script>
 
-var timelineMark = "MARK TIMELINE";
-
-function findMarkTimeline(record) 
+function performActions()
 {
-    if (record.type === timelineAgentRecordType.MarkTimeline && record.data.message === timelineMark) {
-        printTimelineRecordProperties(record);
-        return true;
-    }
-
-    var numChildren = record.children ? record.children.length : 0;
-    for (var i = 0; i < numChildren; ++i) {
-        if (findMarkTimeline(record.children[i]))
-            return true;
-    }
-    return false;
-}
-
-function analyzeTimelineData(timelineRecords) 
-{
-    // Uncomment to debugging the list of data returned.
-    // dumpTimelineRecords(timelineRecords);
-
-    var found = false;
-    var numRecords = timelineRecords.length;
-    for (var i = 0 ; i < numRecords; ++i) {
-        var record = timelineRecords[i];
-        if (found = findMarkTimeline(record))
-            break;
-    }
-    if (!found)
-        output("Couldn't find timeline mark: " + timelineMark);
+    console.markTimeline("MARK TIMELINE");
 }
 
 function doit() 
 {
-    retrieveTimelineData(analyzeTimelineData);
+    printTimelineRecords(performActions, "MarkTimeline");
 }
 
 </script>
@@ -50,9 +22,5 @@ function doit()
 Tests the Timeline API mark feature
 </p>
 
-<script>
-    console.markTimeline(timelineMark);
-</script>
-
 </body>
 </html>
index ac84941..21d892f 100644 (file)
@@ -4,25 +4,15 @@
 <script src="timeline-test.js"></script>
 <script>
 
-function analyzeTimelineData(timelineRecords) 
+function performActions()
 {
-    // Uncomment to debugging the list of data returned.
-    // dumpTimelineRecords(timelineRecords);
-
-    // Search for the first Paint record you can find
-    var numRecords = timelineRecords.length;
-    for (var i = 0 ; i < numRecords; ++i) {
-        var record = timelineRecords[i];
-        if (record.type === timelineAgentRecordType.Paint) {
-            printTimelineRecordProperties(record);
-            break;
-        }
-    }
+    if (window.layoutTestController)
+        layoutTestController.display();
 }
 
 function doit() 
 {
-    retrieveTimelineData(analyzeTimelineData);
+    printTimelineRecords(performActions, "Paint");
 }
 
 </script>
index 98c337b..d42a8e7 100644 (file)
@@ -5,4 +5,4 @@ ParseHTML Properties:
 + children : * DEFINED *
 + endTime : * DEFINED *
 + type : 4
-
+Test data
index 715eb6c..11d8f5a 100644 (file)
@@ -4,25 +4,16 @@
 <script src="timeline-test.js"></script>
 <script>
 
-function analyzeTimelineData(timelineRecords) 
+function performActions()
 {
-    // Uncomment to debugging the list of data returned.
-    // dumpTimelineRecords(timelineRecords);
-
-    // Search for the first ParseHTML record you can find
-    var numRecords = timelineRecords.length;
-    for (var i = 0 ; i < numRecords; ++i) {
-        var record = timelineRecords[i];
-        if (record.type === timelineAgentRecordType.ParseHTML) {
-            printTimelineRecordProperties(record);
-            break;
-        }
-    }
+    var element = document.createElement("div");
+    element.innerHTML = "Test data";
+    document.body.appendChild(element);
 }
 
 function doit() 
 {
-    retrieveTimelineData(analyzeTimelineData);
+    printTimelineRecords(performActions, "ParseHTML");
 }
 
 </script>
index b38dced..e532a15 100644 (file)
@@ -5,4 +5,4 @@ RecalculateStyles Properties:
 + children : * DEFINED *
 + endTime : * DEFINED *
 + type : 2
-
+Test data
index 12fa1ef..c4e4d34 100644 (file)
@@ -2,27 +2,26 @@
 <head>
 <script src="inspector-test.js"></script>
 <script src="timeline-test.js"></script>
+
+<style>
+.test-style {
+    color: red;
+}
+</style>
+
 <script>
 
-function analyzeTimelineData(timelineRecords) 
+function performActions()
 {
-    // Uncomment to debugging the list of data returned.
-    // dumpTimelineRecords(timelineRecords);
-
-    // Search for the first RecalculateStyles record you can find
-    var numRecords = timelineRecords.length;
-    for (var i = 0 ; i < numRecords; ++i) {
-        var record = timelineRecords[i];
-        if (record.type === timelineAgentRecordType.RecalculateStyles) {
-            printTimelineRecordProperties(record);
-            break;
-        }
-    }
+    var element = document.createElement("div");
+    element.className = "test-style";
+    element.innerHTML = "Test data";
+    document.body.appendChild(element);
 }
 
 function doit() 
 {
-    retrieveTimelineData(analyzeTimelineData);
+    printTimelineRecords(performActions, "RecalculateStyles");
 }
 
 </script>
index 3011441..bdfa5b4 100644 (file)
@@ -3,12 +3,11 @@ Tests the Timeline API instrumentation of an HTML script tag.
 ParseHTML
 ----> EvaluateScript
 --------> MarkTimeline : SCRIPT TAG
-
 EvaluateScript Properties:
 + startTime : * DEFINED *
 + data : {
 +- url : * DEFINED *
-+- lineNumber : 76
++- lineNumber : 3
 + }
 + children : * DEFINED *
 + endTime : * DEFINED *
index f8ef7b7..8ea1a36 100644 (file)
@@ -3,66 +3,36 @@
 <script src="inspector-test.js"></script>
 <script src="timeline-test.js"></script>
 <script>
-var timelineMark = "SCRIPT TAG";
 
-function analyzeEvaluateScript(record) 
+function runAfterIframeIsLoaded(continuation)
 {
-    var numChildren = record.children ? record.children.length : 0;
-    for (var i = 0; i < numChildren; ++i) {
-        var child = record.children[i];
-        if (child.type === timelineAgentRecordType.MarkTimeline
-            && child.data.message === timelineMark
-            && record.data.url.indexOf("timeline-script-tag-1.html") !== -1) {
-
-            // Finish printing the record as a tree
-            dumpTimelineRecord(record, 1);
-            output("");
-
-            // Now print the important fields of the record
-            printTimelineRecordProperties(record);
-            return true;
-        }
-    }
-    return false;
-}
-
-function analyzeParseHTML(record) 
-{
-    // Now, dump the specific Script tag that includes the Marker and dump it in detail.
-    var numChildren = record.children ? record.children.length : 0;
-    for (var i = 0; i < numChildren; ++i) {
-        var child = record.children[i];
-        if (child.type === timelineAgentRecordType.EvaluateScript)
-            if (analyzeEvaluateScript(child))
-                return true;
-    }
-    return false;
-}  
-
-// Look for the ParseHtml->EvaluateScript->MarkTimeline that correlates 
-// to the <script> tag below.
-function analyzeTimelineData(timelineRecords) 
-{
-    // Uncomment to debugging the list of data returned.
-    // dumpTimelineRecords(timelineRecords);
-
-    // Search for a ParseHTML record
-    var numRecords = timelineRecords.length;
-    for (var i = 0 ; i < numRecords; ++i) {
-        var record = timelineRecords[i];
-        if (record.type === timelineAgentRecordType.ParseHTML) {
-            // Uncomment to debug the ParseHTML data record
-            // dumpTimelineRecord(record, 0);
-            output("ParseHTML");
-            if (!analyzeParseHTML(record))
-                output("Failed to find timeline mark: " + timelineMark);
-        }
+    function step()
+    {
+        if (!window.iframeLoaded)
+            setTimeout(step, 100);
+        else
+            continuation();
     }
+    setTimeout(step, 100);
 }
 
 function doit() 
 {
-    retrieveTimelineData(analyzeTimelineData);
+    if (window.layoutTestController)
+        layoutTestController.setTimelineProfilingEnabled(true);
+
+    var iframe = document.createElement("iframe");
+    iframe.src = "resources/timeline-iframe-data.html";
+    document.body.appendChild(iframe);
+
+    runAfterIframeIsLoaded(function() {
+        printTimelineRecords(null, null, function(record) {
+            if (record.type === timelineAgentRecordType.EvaluateScript)
+                printTimelineRecordProperties(record);
+            else if (record.type === timelineAgentRecordType.ParseHTML)
+                dumpTimelineRecord(record);
+        });
+    });
 }
 
 </script>
@@ -73,9 +43,5 @@ function doit()
 Tests the Timeline API instrumentation of an HTML script tag.
 </p>
 
-<script>
-     // Mark this script tag so we can find it in the timeline data.
-     console.markTimeline(timelineMark);
-</script>
 </body>
 </html>
index 1d21537..acd7f17 100644 (file)
@@ -1,9 +1,5 @@
 Tests the Timeline API instrumentation of a script tag with an external script.
 
-ParseHTML
-----> EvaluateScript
---------> MarkTimeline : SCRIPT TAG
-
 EvaluateScript Properties:
 + startTime : * DEFINED *
 + data : {
index 196b65f..03c1bfd 100644 (file)
@@ -3,65 +3,31 @@
 <script src="inspector-test.js"></script>
 <script src="timeline-test.js"></script>
 <script>
-var timelineMark = "SCRIPT TAG";
 
-function analyzeEvaluateScript(record) 
+function runAfterScriptIsEvaluated(continuation)
 {
-    var numChildren = record.children ? record.children.length : 0;
-    for (var i = 0; i < numChildren; ++i) {
-        var child = record.children[i];
-        if (child.type === timelineAgentRecordType.MarkTimeline
-            && child.data.message === timelineMark
-            && record.data.url.indexOf("timeline-script-tag-2.js") !== -1) {
-
-            // Finish printing the record as a tree
-            dumpTimelineRecord(record, 1);
-            output("");
-
-            // Now print the important fields of the record
-            printTimelineRecordProperties(record);
-            return true;
-        }
+    function step()
+    {
+        if (!window.scriptEvaluated)
+            setTimeout(step, 100);
+        else
+            continuation();
     }
-    return false;
+    setTimeout(step, 100);
 }
 
-function analyzeParseHTML(record) 
-{
-    var numChildren = record.children ? record.children.length : 0;
-    for (var i = 0; i < numChildren; ++i) {
-        var child = record.children[i];
-        if (child.type === timelineAgentRecordType.EvaluateScript)
-            if (analyzeEvaluateScript(child))
-                return true;
-    }
-    return false;
-}  
-
-// Look for the ParseHtml->EvaluateScript->MarkTimeline that correlates 
-// to the <script> tag below.
-function analyzeTimelineData(timelineRecords) 
+function doit() 
 {
-    // Uncomment to debugging the list of data returned.
-    // dumpTimelineRecords(timelineRecords);
+    if (window.layoutTestController)
+        layoutTestController.setTimelineProfilingEnabled(true);
 
-    // Search for a ParseHTML record
-    var numRecords = timelineRecords.length;
-    for (var i = 0 ; i < numRecords; ++i) {
-        var record = timelineRecords[i];
-        if (record.type === timelineAgentRecordType.ParseHTML) {
-            // Uncomment to debug the ParseHTML data record
-            // dumpTimelineRecord(record, 0);
-            output("ParseHTML");
-            if (!analyzeParseHTML(record))
-                output("Failed to find timeline mark: " + timelineMark);
-        }
-    }
-}
+    var script = document.createElement("script");
+    script.src = "timeline-script-tag-2.js";
+    document.body.appendChild(script);
 
-function doit() 
-{
-    retrieveTimelineData(analyzeTimelineData);
+    runAfterScriptIsEvaluated(function() {
+        printTimelineRecords(null, "EvaluateScript");
+    });
 }
 
 </script>
@@ -72,6 +38,5 @@ function doit()
 Tests the Timeline API instrumentation of a script tag with an external script.
 </p>
 
-<script src="timeline-script-tag-2.js"></script>
 </body>
 </html>
index 0fb273f..64024f1 100644 (file)
@@ -1 +1,2 @@
-console.markTimeline(timelineMark);
\ No newline at end of file
+console.markTimeline("SCRIPT TAG");
+window.scriptEvaluated = true;
index 19865b2..00bb770 100644 (file)
@@ -1,7 +1,3 @@
-// Used to mark timeline records as belonging to the test framework.
-var timelineOverheadMark = "***Overhead***";
-
-// TimelineAgent record type definitions from the inspector
 var timelineAgentRecordType = {};
 
 // Scrub values when printing out these properties in the record or data field.
@@ -12,27 +8,40 @@ var timelineNonDeterministicProps = {
     url : 1
 };
 
-// Call this function from the doit() function in the main test page.
-// Pass a function that will get an array of timeline data to process.
-function retrieveTimelineData(analyzeFunction)
+function printTimelineRecords(performActions, typeName, formatter)
 {
+    if (performActions) {
+        if (window.layoutTestController)
+            layoutTestController.setTimelineProfilingEnabled(true);
+        performActions();
+    }
+
     evaluateInWebInspector("WebInspector.TimelineAgent.RecordType", function(result) {
         timelineAgentRecordType = result;
     });
 
-    evaluateInWebInspector("frontend_getTimelineResults()", function(timelineRecords) {
+    evaluateInWebInspector("frontend_getTimelineResults", function(timelineRecords) {
         if (typeof(timelineRecords) === "string")
             output("Error fetching Timeline results: " + timelineRecords);
-        else 
-            analyzeFunction(timelineRecords);
+        else {
+            for (var i = 0; i < timelineRecords.length; ++i) {
+                if (typeName && timelineRecords[i].type === timelineAgentRecordType[typeName])
+                    printTimelineRecordProperties(timelineRecords[i]);
+                if (formatter)
+                    formatter(timelineRecords[i]);
+            }
+        }
+        if (window.layoutTestController)
+            layoutTestController.setTimelineProfilingEnabled(false);
         notifyDone();
     });
-    markTimelineRecordAsOverhead("onload" + (ignoreLoad ? ":ignoreLoad": ""));
 }
 
 // Dump just the record name, indenting output on separate lines for subrecords
 function dumpTimelineRecord(record, level) 
 {
+    if (typeof level !== "number")
+        level = 0;
     var prefix = "";
     var suffix = "";
     for (var i = 0; i < level ; ++i)
@@ -49,18 +58,11 @@ function dumpTimelineRecord(record, level)
         dumpTimelineRecord(record.children[i], level + 1);
 }
 
-// Dumps an entire list of records, culling out those marked as overhead
 function dumpTimelineRecords(timelineRecords) {
-    var numRecords = timelineRecords.length;
-    for (var i = 0; i < numRecords; ++i) {
-        var record = timelineRecords[i];
-        if (!isTimelineOverheadRecord(record))
-            dumpTimelineRecord(record, 0);
-    }
+    for (var i = 0; i < timelineRecords.length; ++i)
+        dumpTimelineRecord(timelineRecords[i], 0);
 }
 
-// Sort the fields, then strip out startTime and endTime, they are not deterministic.
-// Also remove children - that field isn't important for the printout.
 function printTimelineRecordProperties(record)
 {
     output(timelineAgentTypeToString(record.type) + " Properties:");
@@ -75,7 +77,7 @@ function isNonDeterministicProp(propName)
     return false;
 }
 
-function printProps (record, level)
+function printProps(record, level)
 {
     var props = new Array();
     for (var prop in record) {
@@ -102,28 +104,6 @@ function printProps (record, level)
     }
 }
 
-// Records that have been marked with console.markTimeline(timelineMark)
-// are a part of the test framework and not a part of the test being performed
-function isTimelineOverheadRecord(record) {
-    if (record.type === 11 && record.data.message.indexOf(timelineOverheadMark) !== -1)
-        return true;
-    var numChildren = record.children ?  record.children.length : 0;
-    for (var i = 0; i < numChildren; ++i) {
-        if (isTimelineOverheadRecord(record.children[i]))
-            return true;
-    }
-    return false;
-}
-
-// This mark will help the test analysis cull out records that are overhead.
-function markTimelineRecordAsOverhead(arg)
-{
-    var suffix = '';
-    if (arg)
-        suffix = ": " + arg;
-    console.markTimeline(timelineOverheadMark + suffix);
-}
-
 function timelineAgentTypeToString(numericType)
 {
     for (var prop in timelineAgentRecordType) {
@@ -134,23 +114,11 @@ function timelineAgentTypeToString(numericType)
 }
 
 // Injected into Inspector window
-function frontend_startTimelineProfiler()
-{
-    window.timelineResults = new Array();
-    window.WebInspector.addRecordToTimeline = function(arg) {
-        window.timelineResults.push(arg);
-    };
-    window.InspectorController.startTimelineProfiler();
-    return 'done';
-}
-
-// Injected into Inspector window
 function frontend_getTimelineResults() {
-    return window.timelineResults;
-}
-
-// Injected into Inspector window
-// frontend_setup always gets called before the page is reloaded.
-function frontend_setup() {
-    frontend_startTimelineProfiler();
+    var result = [];
+    var items = WebInspector.panels.timeline._items;
+    for (var i = 0; i < items.length; ++i) {
+        result.push(items[i].record);
+    }
+    return result;
 }
index 16a3fe1..565ee61 100644 (file)
@@ -1,3 +1,23 @@
+2009-11-17  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Make DRT show web inspector for tests in inspector/ folder.
+        - Updated DRT to show/close inspector for all tests under /inspector
+        - Introduced LayoutTestController::setTimelineProfilingEnabled and
+          WebInspector::setTimelineProfilingEnabled beside setJavaScriptProfilingEnabled
+        - Removed reload on each inspector test
+        - Renamed fast/inspector to fast/inspector-support in order not to trigger
+        inspector for those.
+        - Reimplemented timeline tests in order to get rid of reload there.
+        - Moved tests that don't require harness into the fast group.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31472
+
+        * WebCore.Inspector.exp:
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel.prototype._formatRecord):
+
 2009-11-17  Andrei Popescu  <andreip@google.com>
 
         Reviewed by Dimitri Glazkov.
index 576994f..000594d 100644 (file)
@@ -16,3 +16,5 @@ __ZN7WebCore19InspectorController25evaluateForTestInFrontendElRKNS_6StringE
 __ZNK7WebCore19InspectorController17drawNodeHighlightERNS_15GraphicsContextE
 __ZNK7WebCore19InspectorController7enabledEv
 __ZNK7WebCore19InspectorController7settingERKNS_6StringE
+__ZN7WebCore19InspectorController21startTimelineProfilerEv
+__ZN7WebCore19InspectorController20stopTimelineProfilerEv
index 11cadf3..3770ebc 100644 (file)
@@ -172,6 +172,7 @@ WebInspector.TimelinePanel.prototype = {
         formattedRecord.count = 1;
         formattedRecord.type = record.type;
         formattedRecord.endTime = (typeof record.endTime !== "undefined") ? record.endTime / 1000 : formattedRecord.startTime;
+        formattedRecord.record = record;
 
         // Make resource receive record last since request was sent; make finish record last since response received.
         if (record.type === WebInspector.TimelineAgent.RecordType.ResourceSendRequest) {
index 9c8dbdd..f787631 100644 (file)
@@ -1,3 +1,24 @@
+2009-11-17  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Make DRT show web inspector for tests in inspector/ folder.
+        - Updated DRT to show/close inspector for all tests under /inspector
+        - Introduced LayoutTestController::setTimelineProfilingEnabled and
+          WebInspector::setTimelineProfilingEnabled beside setJavaScriptProfilingEnabled
+        - Removed reload on each inspector test
+        - Renamed fast/inspector to fast/inspector-support in order not to trigger
+        inspector for those.
+        - Reimplemented timeline tests in order to get rid of reload there.
+        - Moved tests that don't require harness into the fast group.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31472
+
+        * webkit/webkitwebinspector.cpp:
+        (webkit_web_inspector_class_init):
+        (webkit_web_inspector_set_property):
+        (webkit_web_inspector_get_property):
+
 2009-11-13  Adam Roben  <aroben@apple.com>
 
         Update for changes to FrameLoaderClient
index ee2815c..e497541 100644 (file)
@@ -83,7 +83,8 @@ enum {
 
     PROP_WEB_VIEW,
     PROP_INSPECTED_URI,
-    PROP_JAVASCRIPT_PROFILING_ENABLED
+    PROP_JAVASCRIPT_PROFILING_ENABLED,
+    PROP_TIMELINE_PROFILING_ENABLED    
 };
 
 G_DEFINE_TYPE(WebKitWebInspector, webkit_web_inspector, G_TYPE_OBJECT)
@@ -300,6 +301,22 @@ static void webkit_web_inspector_class_init(WebKitWebInspectorClass* klass)
                                         FALSE,
                                         WEBKIT_PARAM_READWRITE));
 
+    /**
+    * WebKitWebInspector:timeline-profiling-enabled
+    *
+    * This is enabling Timeline profiling in the Inspector.
+    *
+    * Since: 1.1.17
+    */
+    g_object_class_install_property(gobject_class,
+                                    PROP_TIMELINE_PROFILING_ENABLED,
+                                    g_param_spec_boolean(
+                                        "timeline-profiling-enabled",
+                                        _("Enable Timeline profiling"),
+                                        _("Profile the WebCore instrumentation."),
+                                        FALSE,
+                                        WEBKIT_PARAM_READWRITE));
+
     g_type_class_add_private(klass, sizeof(WebKitWebInspectorPrivate));
 }
 
@@ -337,6 +354,15 @@ static void webkit_web_inspector_set_property(GObject* object, guint prop_id, co
             controller->disableProfiler();
         break;
     }
+    case PROP_TIMELINE_PROFILING_ENABLED: {
+        bool enabled = g_value_get_boolean(value);
+        WebCore::InspectorController* controller = priv->page->inspectorController();
+        if (enabled)
+            controller->startTimelineProfiler();
+        else
+            controller->stopTimelineProfiler();
+        break;
+    }
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
@@ -358,6 +384,9 @@ static void webkit_web_inspector_get_property(GObject* object, guint prop_id, GV
     case PROP_JAVASCRIPT_PROFILING_ENABLED:
         g_value_set_boolean(value, priv->page->inspectorController()->profilerEnabled());
         break;
+    case PROP_TIMELINE_PROFILING_ENABLED:
+        g_value_set_boolean(value, priv->page->inspectorController()->timelineAgent() != 0);
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
         break;
index 0345ca0..8ca3681 100644 (file)
@@ -1,3 +1,24 @@
+2009-11-17  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Make DRT show web inspector for tests in inspector/ folder.
+        - Updated DRT to show/close inspector for all tests under /inspector
+        - Introduced LayoutTestController::setTimelineProfilingEnabled and
+          WebInspector::setTimelineProfilingEnabled beside setJavaScriptProfilingEnabled
+        - Removed reload on each inspector test
+        - Renamed fast/inspector to fast/inspector-support in order not to trigger
+        inspector for those.
+        - Reimplemented timeline tests in order to get rid of reload there.
+        - Moved tests that don't require harness into the fast group.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31472
+
+        * WebInspector/WebInspector.h:
+        * WebInspector/WebInspector.mm:
+        (-[WebInspector isTimelineProfilingEnabled]):
+        (-[WebInspector setTimelineProfilingEnabled:]):
+
 2009-11-14  Chris Fleizach  <cfleizach@apple.com>
 
         Reviewed by Darin Adler.
index c16726d..fa13c8d 100644 (file)
@@ -49,6 +49,8 @@
 
 - (BOOL)isJavaScriptProfilingEnabled;
 - (void)setJavaScriptProfilingEnabled:(BOOL)enabled;
+- (BOOL)isTimelineProfilingEnabled;
+- (void)setTimelineProfilingEnabled:(BOOL)enabled;
 
 - (BOOL)isProfilingJavaScript;
 - (void)toggleProfilingJavaScript:(id)sender;
index ccb09c5..258dd01 100644 (file)
@@ -148,6 +148,25 @@ using namespace WebCore;
         page->inspectorController()->disableProfiler();
 }
 
+- (BOOL)isTimelineProfilingEnabled
+{
+    if (Page* page = core(_webView))
+        return page->inspectorController()->timelineAgent() ? YES : NO;
+    return NO;
+}
+
+- (void)setTimelineProfilingEnabled:(BOOL)enabled
+{
+    Page* page = core(_webView);
+    if (!page)
+        return;
+
+    if (enabled)
+        page->inspectorController()->startTimelineProfiler();
+    else
+        page->inspectorController()->stopTimelineProfiler();
+}
+
 - (void)close:(id)sender 
 {
     if (Page* page = core(_webView))
index d4e89c8..7bcf720 100644 (file)
@@ -1,3 +1,25 @@
+2009-11-17  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Make DRT show web inspector for tests in inspector/ folder.
+        - Updated DRT to show/close inspector for all tests under /inspector
+        - Introduced LayoutTestController::setTimelineProfilingEnabled and
+          WebInspector::setTimelineProfilingEnabled beside setJavaScriptProfilingEnabled
+        - Removed reload on each inspector test
+        - Renamed fast/inspector to fast/inspector-support in order not to trigger
+        inspector for those.
+        - Reimplemented timeline tests in order to get rid of reload there.
+        - Moved tests that don't require harness into the fast group.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31472
+
+        * Interfaces/IWebInspector.idl:
+        * WebInspector.cpp:
+        (WebInspector::isTimelineProfilingEnabled):
+        (WebInspector::setTimelineProfilingEnabled):
+        * WebInspector.h:
+
 2009-11-13  Adam Roben  <aroben@apple.com>
 
         Build fix
index e31376c..4d0d96c 100644 (file)
@@ -54,4 +54,6 @@ interface IWebInspector : IUnknown
 
     HRESULT isJavaScriptProfilingEnabled(BOOL* isProfilingEnabled);
     HRESULT setJavaScriptProfilingEnabled(BOOL enabled);
+    HRESULT isTimelineProfilingEnabled(BOOL* isEnabled);
+    HRESULT setTimelineProfilingEnabled(BOOL enabled);
 }
index 97587f9..e4ac32b 100644 (file)
@@ -272,3 +272,38 @@ HRESULT STDMETHODCALLTYPE  WebInspector::evaluateInFrontend(ULONG callId, BSTR b
     page->inspectorController()->evaluateForTestInFrontend(callId, script);
     return S_OK;
 }
+
+HRESULT STDMETHODCALLTYPE WebInspector::isTimelineProfilingEnabled(BOOL* isEnabled)
+{
+    if (!isEnabled)
+        return E_POINTER;
+
+    *isEnabled = FALSE;
+
+    if (!m_webView)
+        return S_OK;
+
+    Page* page = m_webView->page();
+    if (!page)
+        return S_OK;
+
+    *isEnabled = page->inspectorController()->timelineAgent() != 0;
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebInspector::setTimelineProfilingEnabled(BOOL enabled)
+{
+    if (!m_webView)
+        return S_OK;
+
+    Page* page = m_webView->page();
+    if (!page)
+        return S_OK;
+
+    if (enabled)
+        page->inspectorController()->startTimelineProfiler();
+    else
+        page->inspectorController()->stopTimelineProfiler();
+
+    return S_OK;
+}
index 4f9bedb..053a593 100644 (file)
@@ -59,9 +59,12 @@ public:
 
     virtual HRESULT STDMETHODCALLTYPE isJavaScriptProfilingEnabled(BOOL* isProfilingEnabled);
     virtual HRESULT STDMETHODCALLTYPE setJavaScriptProfilingEnabled(BOOL);
-    
+
     virtual HRESULT STDMETHODCALLTYPE evaluateInFrontend(ULONG callId, BSTR script);
 
+    virtual HRESULT STDMETHODCALLTYPE isTimelineProfilingEnabled(BOOL* isEnabled);
+    virtual HRESULT STDMETHODCALLTYPE setTimelineProfilingEnabled(BOOL);
+
 private:
     WebInspector(WebView*);
     ~WebInspector();
index ad76e98..aa03eb5 100644 (file)
@@ -1,3 +1,40 @@
+2009-11-17  Pavel Feldman  <pfeldman@chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: Make DRT show web inspector for tests in inspector/ folder.
+        - Updated DRT to show/close inspector for all tests under /inspector
+        - Introduced LayoutTestController::setTimelineProfilingEnabled and
+          WebInspector::setTimelineProfilingEnabled beside setJavaScriptProfilingEnabled
+        - Removed reload on each inspector test
+        - Renamed fast/inspector to fast/inspector-support in order not to trigger
+        inspector for those.
+        - Reimplemented timeline tests in order to get rid of reload there.
+        - Moved tests that don't require harness into the fast group.
+
+        https://bugs.webkit.org/show_bug.cgi?id=31472
+
+        * DumpRenderTree/LayoutTestController.cpp:
+        (setTimelineProfilingEnabledCallback):
+        (closeWebInspectorCallback):
+        (LayoutTestController::staticFunctions):
+        * DumpRenderTree/LayoutTestController.h:
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (shouldOpenWebInspector):
+        (runTest):
+        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+        (LayoutTestController::setTimelineProfilingEnabled):
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (shouldOpenWebInspector):
+        (runTest):
+        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+        (LayoutTestController::setTimelineProfilingEnabled):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (shouldOpenWebInspector):
+        (runTest):
+        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+        (LayoutTestController::setTimelineProfilingEnabled):
+
 2009-11-17  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Maciej Stachowiak.
index daf888f..4c28ca7 100644 (file)
@@ -850,6 +850,16 @@ static JSValueRef setTabKeyCyclesThroughElementsCallback(JSContextRef context, J
     return JSValueMakeUndefined(context);
 }
 
+static JSValueRef setTimelineProfilingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    if (argumentCount < 1)
+        return JSValueMakeUndefined(context);
+
+    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+    controller->setTimelineProfilingEnabled(JSValueToBoolean(context, arguments[0]));
+    return JSValueMakeUndefined(context);
+}
+
 static JSValueRef setUseDashboardCompatibilityModeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     // Has mac implementation
@@ -979,6 +989,7 @@ static JSValueRef showWebInspectorCallback(JSContextRef context, JSObjectRef fun
 static JSValueRef closeWebInspectorCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+    controller->setTimelineProfilingEnabled(false);
     controller->closeWebInspector();
     return JSValueMakeUndefined(context);
 }
@@ -1264,6 +1275,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
         { "setSmartInsertDeleteEnabled", setSmartInsertDeleteEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setStopProvisionalFrameLoads", setStopProvisionalFrameLoadsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setTabKeyCyclesThroughElements", setTabKeyCyclesThroughElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "setTimelineProfilingEnabled", setTimelineProfilingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setUseDashboardCompatibilityMode", setUseDashboardCompatibilityModeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setUserStyleSheetEnabled", setUserStyleSheetEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "setUserStyleSheetLocation", setUserStyleSheetLocationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
index 79ffb99..0641e99 100644 (file)
@@ -214,6 +214,7 @@ public:
 
     void showWebInspector();
     void closeWebInspector();
+    void setTimelineProfilingEnabled(bool enabled);
     void evaluateInWebInspector(long callId, JSStringRef script);
     void evaluateScriptInIsolatedWorld(unsigned worldId, JSObjectRef globalObject, JSStringRef script);
 
index 5408ba1..768f0e0 100644 (file)
@@ -114,6 +114,11 @@ static bool shouldLogFrameLoadDelegates(const char* pathOrURL)
     return strstr(pathOrURL, "loading/");
 }
 
+static bool shouldOpenWebInspector(const char* pathOrURL)
+{
+    return strstr(pathOrURL, "inspector/");
+}
+
 void dumpFrameScrollPosition(WebKitWebFrame* frame)
 {
 
@@ -456,6 +461,9 @@ static void runTest(const string& testPathOrURL)
     if (shouldLogFrameLoadDelegates(pathOrURL.c_str()))
         gLayoutTestController->setDumpFrameLoadCallbacks(true);
 
+    if (shouldOpenWebInspector(pathOrURL.c_str()))
+        gLayoutTestController->showWebInspector();
+
     WorkQueue::shared()->clear();
     WorkQueue::shared()->setFrozen(false);
 
@@ -487,6 +495,9 @@ static void runTest(const string& testPathOrURL)
 
     gtk_main();
 
+    if (shouldOpenWebInspector(pathOrURL.c_str()))
+        gLayoutTestController->closeWebInspector();
+
     // Also check if we still have opened webViews and free them.
     if (gLayoutTestController->closeRemainingWindowsWhenComplete() || webViewList) {
         while (webViewList) {
index 173e526..964d7ba 100644 (file)
@@ -229,6 +229,15 @@ void LayoutTestController::setTabKeyCyclesThroughElements(bool cycles)
     g_object_set(G_OBJECT(settings), "tab-key-cycles-through-elements", cycles, NULL);
 }
 
+void LayoutTestController::setTimelineProfilingEnabled(bool flag)
+{
+    WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
+    ASSERT(view);
+
+    WebKitWebInspector* inspector = webkit_web_view_get_inspector(view);
+    g_object_set(G_OBJECT(inspector), "timeline-profiling-enabled", flag, NULL);
+}
+
 void LayoutTestController::setUseDashboardCompatibilityMode(bool flag)
 {
     // FIXME: implement
index c0a0b74..661d1b0 100644 (file)
@@ -1102,6 +1102,11 @@ static bool shouldLogHistoryDelegates(const char* pathOrURL)
     return strstr(pathOrURL, "globalhistory/");
 }
 
+static bool shouldOpenWebInspector(const char* pathOrURL)
+{
+    return strstr(pathOrURL, "inspector/");
+}
+
 static void resetWebViewToConsistentStateBeforeTesting()
 {
     WebView *webView = [mainFrame webView];
@@ -1178,7 +1183,10 @@ static void runTest(const string& testPathOrURL)
         [[mainFrame webView] setHistoryDelegate:historyDelegate];
     else
         [[mainFrame webView] setHistoryDelegate:nil];
-    
+
+    if (shouldOpenWebInspector(pathOrURL.c_str()))
+        gLayoutTestController->showWebInspector();
+
     if ([WebHistory optionalSharedHistory])
         [WebHistory setOptionalSharedHistory:nil];
     lastMousePosition = NSZeroPoint;
@@ -1202,6 +1210,7 @@ static void runTest(const string& testPathOrURL)
         [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
         [pool release];
     }
+
     pool = [[NSAutoreleasePool alloc] init];
     [EventSendingController clearSavedEvents];
     [[mainFrame webView] setSelectedDOMRange:nil affinity:NSSelectionAffinityDownstream];
@@ -1226,11 +1235,14 @@ static void runTest(const string& testPathOrURL)
         }
     }
 
+    if (shouldOpenWebInspector(pathOrURL.c_str()))
+        gLayoutTestController->closeWebInspector();
+
     resetWebViewToConsistentStateBeforeTesting();
 
     [mainFrame loadHTMLString:@"<html></html>" baseURL:[NSURL URLWithString:@"about:blank"]];
     [mainFrame stopLoading];
-    
+
     [pool release];
 
     // We should only have our main window left open when we're done
index 3345388..b435f54 100644 (file)
@@ -311,6 +311,11 @@ void LayoutTestController::setTabKeyCyclesThroughElements(bool cycles)
     [[mainFrame webView] setTabKeyCyclesThroughElements:cycles];
 }
 
+void LayoutTestController::setTimelineProfilingEnabled(bool enabled)
+{
+    [[[mainFrame webView] inspector] setTimelineProfilingEnabled:enabled];
+}
+
 void LayoutTestController::setUseDashboardCompatibilityMode(bool flag)
 {
     [[mainFrame webView] _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:flag];
index d486d06..453a8a2 100644 (file)
@@ -688,6 +688,11 @@ static bool shouldLogHistoryDelegates(const char* pathOrURL)
     return strstr(pathOrURL, "/globalhistory/") || strstr(pathOrURL, "\\globalhistory\\");
 }
 
+static bool shouldOpenWebInspector(const char* pathOrURL)
+{
+    return strstr(pathOrURL, "/inspector/") || strstr(pathOrURL, "\\inspector\\");
+}
+
 static void resetDefaultsToConsistentValues(IWebPreferences* preferences)
 {
 #ifdef USE_MAC_FONTS
@@ -859,6 +864,9 @@ static void runTest(const string& testPathOrURL)
 
     resetWebViewToConsistentStateBeforeTesting();
 
+    if (shouldOpenWebInspector(pathOrURL.c_str()))
+        gLayoutTestController->showWebInspector();
+
     prevTestBFItem = 0;
     if (webView) {
         COMPtr<IWebBackForwardList> bfList;
@@ -893,6 +901,9 @@ static void runTest(const string& testPathOrURL)
         DispatchMessage(&msg);
     }
 
+    if (shouldOpenWebInspector(pathOrURL.c_str()))
+        gLayoutTestController->closeWebInspector();
+
     resetWebViewToConsistentStateBeforeTesting();
 
     frame->stopLoading();
index 0320b42..c8649bb 100644 (file)
@@ -398,6 +398,23 @@ void LayoutTestController::setTabKeyCyclesThroughElements(bool shouldCycle)
     viewPrivate->setTabKeyCyclesThroughElements(shouldCycle ? TRUE : FALSE);
 }
 
+void LayoutTestController::setTimelineProfilingEnabled(bool flag)
+{
+    COMPtr<IWebView> webView;
+    if (FAILED(frame->webView(&webView)))
+        return;
+
+    COMPtr<IWebViewPrivate> viewPrivate;
+    if (FAILED(webView->QueryInterface(&viewPrivate)))
+        return;
+
+    COMPtr<IWebInspector> inspector;
+    if (FAILED(viewPrivate->inspector(&inspector)))
+        return;
+
+    inspector->setTimelineProfilingEnabled(flag);
+}
+
 void LayoutTestController::setUseDashboardCompatibilityMode(bool flag)
 {
     // FIXME: Implement!