Title: [95296] trunk/LayoutTests
- Revision
- 95296
- Author
- loi...@chromium.org
- Date
- 2011-09-16 09:26:20 -0700 (Fri, 16 Sep 2011)
Log Message
Web Inspector: UI performance tests are required.
https://bugs.webkit.org/show_bug.cgi?id=68234
The idea is to create a set of tests which cover frequently used UI actions
and print the average time of these actions.
There are two pilot tests. The common part was extracted into performance-test helper.
Reviewed by Pavel Feldman.
* inspector/performance/resources/network-append-30-requests.html: Added.
* inspector/performance/resources/performance-test.js: Added.
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.start):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.finish):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.done):
(initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._runTest):
* inspector/performance/resources/show-panel-network.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (95295 => 95296)
--- trunk/LayoutTests/ChangeLog 2011-09-16 16:25:13 UTC (rev 95295)
+++ trunk/LayoutTests/ChangeLog 2011-09-16 16:26:20 UTC (rev 95296)
@@ -1,3 +1,23 @@
+2011-09-16 Ilya Tikhonovsky <loi...@chromium.org>
+
+ Web Inspector: UI performance tests are required.
+ https://bugs.webkit.org/show_bug.cgi?id=68234
+
+ The idea is to create a set of tests which cover frequently used UI actions
+ and print the average time of these actions.
+ There are two pilot tests. The common part was extracted into performance-test helper.
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/performance/resources/network-append-30-requests.html: Added.
+ * inspector/performance/resources/performance-test.js: Added.
+ (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer):
+ (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.start):
+ (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.finish):
+ (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype.done):
+ (initialize_TimeTracker.InspectorTest.runPerformanceTest.Timer.prototype._runTest):
+ * inspector/performance/resources/show-panel-network.html: Added.
+
2011-09-16 Csaba Osztrogonác <o...@webkit.org>
[Qt] Unreviewed gardening. Skip a flakey test.
Added: trunk/LayoutTests/inspector/performance/resources/network-append-30-requests.html (0 => 95296)
--- trunk/LayoutTests/inspector/performance/resources/network-append-30-requests.html (rev 0)
+++ trunk/LayoutTests/inspector/performance/resources/network-append-30-requests.html 2011-09-16 16:26:20 UTC (rev 95296)
@@ -0,0 +1,46 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function makeXHRRequests(count)
+{
+ for (var i = 0; i < count; ++i) {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", document.url, true);
+ xhr.send();
+ }
+}
+
+function test()
+{
+ WebInspector.showPanel("network");
+
+ function test(timer)
+ {
+ WebInspector.panels.network._networkLogView._reset();
+ var cookie = timer.start("network-append-30-requests");
+ InspectorTest.evaluateInPage("makeXHRRequests(30)");
+ function finish()
+ {
+ timer.finish(cookie);
+ timer.done();
+ }
+ InspectorTest.addSniffer(WebInspector.panels.network._networkLogView, "refresh", finish);
+ }
+ InspectorTest.runPerformanceTest(test, 15000);
+}
+
+if (!window.layoutTestController) {
+ setTimeout(function() {
+ makeXHRRequests(30);
+ }, 3000);
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/performance/resources/network-append-30-requests.html
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/inspector/performance/resources/performance-test.js (0 => 95296)
--- trunk/LayoutTests/inspector/performance/resources/performance-test.js (rev 0)
+++ trunk/LayoutTests/inspector/performance/resources/performance-test.js 2011-09-16 16:26:20 UTC (rev 95296)
@@ -0,0 +1,73 @@
+var initialize_TimeTracker = function() {
+
+InspectorTest.runPerformanceTest = function(perfTest, executeTime, callback)
+{
+ var Timer = function(test, callback)
+ {
+ this._callback = callback;
+ this._test = test;
+ this._times = {};
+ this._testStartTime = new Date();
+ }
+
+ Timer.prototype = {
+ start: function(name)
+ {
+ return {name: name, startTime: new Date()};
+ },
+
+ finish: function(cookie)
+ {
+ var endTime = new Date();
+ if (!this._times[cookie.name])
+ this._times[cookie.name] = [];
+ this._times[cookie.name].push(endTime - cookie.startTime);
+ },
+
+ done: function()
+ {
+ var time = new Date();
+ if (time - this._testStartTime < executeTime)
+ this._runTest();
+ else {
+ this._dump();
+ if (this._callback)
+ this._callback();
+ else
+ InspectorTest.completeTest();
+ }
+ },
+
+ _runTest: function()
+ {
+ if (this._guard) {
+ setTimeout(this._runTest.bind(this), 0);
+ return;
+ }
+
+ this._guard = true;
+ var safeTest = InspectorTest.safeWrap(this._test);
+ safeTest(this);
+ this._guard = false;
+ },
+
+ _dump: function()
+ {
+ for (var testName in this._times) {
+ var samples = this._times[testName];
+ 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)));
+ InspectorTest.addResult(testName + " min/max/count: " + samples[0] + "/" + samples[samples.length-1] + "/" + samples.length);
+ }
+ }
+ }
+
+ var timer = new Timer(perfTest, callback);
+ timer._runTest();
+}
+
+}
Property changes on: trunk/LayoutTests/inspector/performance/resources/performance-test.js
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/inspector/performance/resources/show-panel-network.html (0 => 95296)
--- trunk/LayoutTests/inspector/performance/resources/show-panel-network.html (rev 0)
+++ trunk/LayoutTests/inspector/performance/resources/show-panel-network.html 2011-09-16 16:26:20 UTC (rev 95296)
@@ -0,0 +1,48 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script>
+
+function makeXHRRequests(count)
+{
+ for (var i = 0; i < count; ++i) {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", document.url, true);
+ xhr.send();
+ }
+}
+
+
+function test()
+{
+ WebInspector.showPanel("network");
+ InspectorTest.evaluateInPage("makeXHRRequests(30)", step1);
+
+ function step1()
+ {
+ function perfTest1(timer)
+ {
+ WebInspector.showPanel("audits");
+ var timerCookie = timer.start("show-network-panel");
+ WebInspector.showPanel("network");
+ timer.finish(timerCookie);
+ timer.done();
+ }
+
+ InspectorTest.runPerformanceTest(perfTest1, 5000);
+ }
+}
+
+if (!window.layoutTestController) {
+ setTimeout(function() {
+ makeXHRRequests(700);
+ }, 3000);
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/performance/resources/show-panel-network.html
___________________________________________________________________
Added: svn:eol-style
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes