Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5590)

Unified Diff: chrome/test/data/webui/polymer_browser_test_base.js

Issue 1470133002: Log some very basic timers in WebUI tests using PolymerTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/polymer_browser_test_base.js
diff --git a/chrome/test/data/webui/polymer_browser_test_base.js b/chrome/test/data/webui/polymer_browser_test_base.js
index d79ce512b84c0e907061f7caa1b5aa90dfb2815e..5c127b66cf7c23d78f98aa80ff5f2ba1b50ebe66 100644
--- a/chrome/test/data/webui/polymer_browser_test_base.js
+++ b/chrome/test/data/webui/polymer_browser_test_base.js
@@ -42,8 +42,24 @@ PolymerTest.prototype = {
'chrome/test/data/webui/mocha_adapter.js',
],
+ /** Time when preLoad starts, i.e. before the browsePreload page is loaded. */
+ preloadTime: 0,
+
+ /** Time when test setup starts. */
+ setupTime: 0,
+
+ /** Time when test run starts. */
+ runTime: 0,
+
+ /** @override */
+ preLoad: function() {
+ this.preloadTime = window.performance.now();
+ testing.Test.prototype.preLoad.call(this);
+ },
+
/** @override */
setUp: function() {
+ this.setupTime = window.performance.now();
testing.Test.prototype.setUp.call(this);
// List of imported URLs for debugging purposes.
@@ -90,6 +106,24 @@ PolymerTest.prototype = {
return Promise.all(promises);
});
},
+
+ /** @override */
+ runTest: function(testBody) {
+ this.runTime = window.performance.now();
+ testing.Test.prototype.runTest.call(this, testBody);
+ },
+
+ /** @override */
+ tearDown: function() {
+ var endTime = window.performance.now();
+ var delta = this.setupTime - this.preloadTime;
+ console.log('Page load time: ' + delta + " ms");
michaelpg 2015/11/24 23:26:19 Turns out floats are really annoying to read... C
+ delta = endTime - this.runTime;
+ console.log('Test run time: ' + delta + " ms");
+ delta = endTime - this.preloadTime;
+ console.log('Total time: ' + delta + " ms");
+ testing.Test.prototype.tearDown.call(this);
Dan Beam 2015/11/23 23:10:51 nit: can we use console.time() + console.timeEnd()
stevenjb 2015/11/23 23:24:41 I was thinking that later we might want to do some
+ }
};
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698