Chromium Code Reviews| 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..9cca63b32a4bf938950430157a2f1560c0b10b77 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,35 @@ 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 { |
|
Xianzhu
2017/05/03 22:06:26
Nit: Use indentation same as the reset of this fil
nednguyen
2017/05/04 00:10:32
Done.
|
| + runner(); |
| + } catch (exception) { |
| + PerfTestRunner.logFatalError("Got an exception while running test.run with name=" + exception.name + ", message=" + exception.message); |
| + } |
| + return; |
| + } |
|
Xianzhu
2017/05/03 22:06:26
Nit: insert a blank line after this line.
nednguyen
2017/05/04 00:10:33
Done.
|
| scheduler(function () { |
| // This will be used by tools/perf/benchmarks/blink_perf.py to find |
| // traces during the measured runs. |
| @@ -266,7 +277,7 @@ if (window.testRunner) { |
| PerfTestRunner.prepareToMeasureValuesAsync = function (test) { |
|
Xianzhu
2017/05/03 22:06:26
As test.run is called inside of this function, it
nednguyen
2017/05/04 00:10:50
Done.
|
| PerfTestRunner.unit = test.unit; |
| - start(test); |
| + start(test, undefined, function() { test.run() }); |
| } |
| PerfTestRunner.measureValueAsync = function (measuredValue) { |