Web Inspector: UI performance test for Inspector start-up time is required.
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2011 09:30:27 +0000 (09:30 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Sep 2011 09:30:27 +0000 (09:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=68986

Reviewed by Yury Semikhatsky.

* inspector/performance/resources/inspector-startup-time.html: Added.
* inspector/performance/resources/performance-test.js:
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._dump):
(initialize_TimeTracker.InspectorTest.runPerformanceTest):

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

LayoutTests/ChangeLog
LayoutTests/inspector/performance/resources/inspector-startup-time.html [new file with mode: 0644]
LayoutTests/inspector/performance/resources/performance-test.js

index 64bbeb7215b1a61b0f9ed76684ebf958178c390f..d74eed072b18398bec1a59cca0e0bfca5cf3d183 100644 (file)
@@ -1,3 +1,15 @@
+2011-09-28  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Web Inspector: UI performance test for Inspector start-up time is required.
+        https://bugs.webkit.org/show_bug.cgi?id=68986
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/performance/resources/inspector-startup-time.html: Added.
+        * inspector/performance/resources/performance-test.js:
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._dump):
+        (initialize_TimeTracker.InspectorTest.runPerformanceTest):
+
 2011-09-28  Kentaro Hara  <haraken@chromium.org>
 
         Implement an ErrorEvent constructor for V8
diff --git a/LayoutTests/inspector/performance/resources/inspector-startup-time.html b/LayoutTests/inspector/performance/resources/inspector-startup-time.html
new file mode 100644 (file)
index 0000000..01d9544
--- /dev/null
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../../http/tests/inspector/inspector-test.js"></script>
+<script src="performance-test.js"></script>
+<script>
+
+function onload()
+{
+    layoutTestController.waitUntilDone();
+    times = [];
+    startTime = Date.now();
+    testStartTime = startTime;
+    runTest();
+}
+
+function inspectorIsReady()
+{
+    times.push(Date() - startTime);
+    if (Date.now() - testStartTime > 20000) {
+        layoutTestController.evaluateInWebInspector(2, "InspectorTest.dumpTestStats('inspector-startup-time', " + JSON.stringify(times) + ")")
+        layoutTestController.evaluateInWebInspector(3, "(InspectorTest.completeTest())")
+        return;
+    }
+    layoutTestController.closeWebInspector();
+    startTime = Date.now();
+    layoutTestController.showWebInspector();
+    runTest();
+}
+
+function test()
+{
+    WebInspector.domAgent._setDocument(null);
+
+    InspectorTest.addBackendResponseSniffer(DOMAgent, "requestChildNodes", function() {
+        WebInspector.settings.lastActivePanel.set("audits");
+        InspectorTest.evaluateInPage("inspectorIsReady()");
+    });
+    WebInspector.showPanel("elements");
+}
+
+</script>
+
+</head>
+<body onload="onload()">
+<p>Tests Web Inspector startup time.</p>
+
+<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
+<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
+<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
+<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
+<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
+<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
+<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
+<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
+<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
+<div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div>
+
+</body>
+</html>
index 3290ebebe01fb2ee26306f9f2e9f077094000ce2..95d8a5ece09e558c42c61ea6f8b2cc290c00e61e 100644 (file)
@@ -67,31 +67,32 @@ InspectorTest.runPerformanceTest = function(perfTest, executeTime, callback)
         _dump: function()
         {
             for (var testName in this._times)
-                this._dumpTestStats(testName, this._times[testName]);
+                InspectorTest.dumpTestStats(testName, this._times[testName]);
 
             var url = WebInspector.mainResource._documentURL;
             var regExp = /([^\/]+)\.html/;
             var matches = regExp.exec(url);
-            this._dumpTestStats("heap-delta-kb-" + matches[1], this._heapSizeDeltas, 1024);
+            InspectorTest.dumpTestStats("heap-delta-kb-" + matches[1], this._heapSizeDeltas, 1024);
         },
 
-        _dumpTestStats: function(testName, samples, divider)
-        {
-            divider = divider || 1;
-            var stripNResults = Math.floor(samples.length / 10);
-            samples.sort(function(a, b) { return a - b; });
-            var sum = 0;
-            for (var i = stripNResults; i < samples.length - stripNResults; ++i)
-                sum += samples[i];
-            InspectorTest.addResult("* " + testName + ": " + Math.floor(sum / (samples.length - stripNResults * 2) / divider));
-            InspectorTest.addResult(testName + " min/max/count: " + Math.floor(samples[0] / divider) + "/" + Math.floor(samples[samples.length-1] / divider) + "/" + samples.length);
-        }
     }
 
     var timer = new Timer(perfTest, callback);
     timer._runTest();
 }
 
+InspectorTest.dumpTestStats = function(testName, samples, divider)
+{
+    divider = divider || 1;
+    var stripNResults = Math.floor(samples.length / 10);
+    samples.sort(function(a, b) { return a - b; });
+    var sum = 0;
+    for (var i = stripNResults; i < samples.length - stripNResults; ++i)
+        sum += samples[i];
+    InspectorTest.addResult("* " + testName + ": " + Math.floor(sum / (samples.length - stripNResults * 2) / divider));
+    InspectorTest.addResult(testName + " min/max/count: " + Math.floor(samples[0] / divider) + "/" + Math.floor(samples[samples.length-1] / divider) + "/" + samples.length);
+}
+
 InspectorTest.addBackendResponseSniffer = function(object, methodName, override, opt_sticky)
 {
     var originalMethod = InspectorTest.override(object, methodName, backendCall, opt_sticky);