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

Unified Diff: third_party/WebKit/PerformanceTests/resources/runner.js

Issue 2858783003: Refactor prepareToMeasureValuesAsync to startMeasureValuesAsyn which run test through callback (Closed)
Patch Set: Address Xianzhu's review comments Created 3 years, 8 months 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 | « third_party/WebKit/PerformanceTests/Parser/html-parser-threaded.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/PerformanceTests/resources/runner.js
diff --git a/third_party/WebKit/PerformanceTests/resources/runner.js b/third_party/WebKit/PerformanceTests/resources/runner.js
index 246385aec10c297d876244d3f14ab21bdcda51f9..f12979d06b246c9b4ac0f6ff53f4d00495d3104c 100644
--- a/third_party/WebKit/PerformanceTests/resources/runner.js
+++ b/third_party/WebKit/PerformanceTests/resources/runner.js
@@ -145,7 +145,7 @@ if (window.testRunner) {
};
function start(test, scheduler, runner) {
- if (!test) {
+ if (!test || !runner) {
PerfTestRunner.logFatalError("Got a bad test object.");
return;
}
@@ -170,24 +170,36 @@ if (window.testRunner) {
if (test.doNotIgnoreInitialRun)
completedIterations++;
- if (runner && test.tracingCategories && window.testRunner &&
- window.testRunner.supportTracing) {
- window.testRunner.startTracing(test.tracingCategories, function() {
+ if (!test.tracingCategories) {
+ scheduleNextRun(scheduler, runner);
+ return;
+ }
+
+ if (window.testRunner && window.testRunner.supportTracing) {
+ testRunner.startTracing(test.tracingCategories, function() {
scheduleNextRun(scheduler, runner);
});
- } else if (runner) {
- if (test.tracingCategories && !(window.testRuner &&
- window.testRunner.supportTracing)) {
- PerfTestRunner.log("Tracing based metrics are specified but " +
- "tracing is not supported on this platform. To get those " +
- "metrics from this test, you can run the test using " +
- "tools/perf/run_benchmarks script.");
- }
- scheduleNextRun(scheduler, runner);
+ return;
}
+
+ PerfTestRunner.log("Tracing based metrics are specified but " +
+ "tracing is not supported on this platform. To get those " +
+ "metrics from this test, you can run the test using " +
+ "tools/perf/run_benchmarks script.");
+ scheduleNextRun(scheduler, runner);
}
function scheduleNextRun(scheduler, runner) {
+ if (!scheduler) {
+ // This is an async measurement test which has its own scheduler.
+ try {
+ runner();
+ } catch (exception) {
+ PerfTestRunner.logFatalError("Got an exception while running test.run with name=" + exception.name + ", message=" + exception.message);
+ }
+ return;
+ }
+
scheduler(function () {
// This will be used by tools/perf/benchmarks/blink_perf.py to find
// traces during the measured runs.
@@ -264,9 +276,9 @@ if (window.testRunner) {
}
}
- PerfTestRunner.prepareToMeasureValuesAsync = function (test) {
+ PerfTestRunner.startMeasureValuesAsync = function (test) {
PerfTestRunner.unit = test.unit;
- start(test);
+ start(test, undefined, function() { test.run() });
}
PerfTestRunner.measureValueAsync = function (measuredValue) {
« no previous file with comments | « third_party/WebKit/PerformanceTests/Parser/html-parser-threaded.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698