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

Unified Diff: third_party/WebKit/PerformanceTests/Canvas/resources/canvas_runner.js

Issue 1644353002: Enable blink_perf.canvas on Android Perf bots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add --reduce-security-for-testing Created 4 years, 10 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
Index: third_party/WebKit/PerformanceTests/Canvas/resources/canvas_runner.js
diff --git a/third_party/WebKit/PerformanceTests/Canvas/resources/canvas_runner.js b/third_party/WebKit/PerformanceTests/Canvas/resources/canvas_runner.js
index 8f1028049420fd62c468fa5df2aa87eb0f2d062d..21c3fe11d5bf7597517a68c9d009a5bb17787b3d 100644
--- a/third_party/WebKit/PerformanceTests/Canvas/resources/canvas_runner.js
+++ b/third_party/WebKit/PerformanceTests/Canvas/resources/canvas_runner.js
@@ -12,7 +12,7 @@
PerfTestRunner.prepareToMeasureValuesAsync({unit: 'runs/s',
description: test.description, done: testDone});
if (!test.doRun) {
- CanvasRunner.logFatalError("\ndoRun must be set.\n");
+ CanvasRunner.logFatalError("doRun must be set.");
return;
}
currentTest = test;
@@ -40,7 +40,7 @@
PerfTestRunner.measureValueAsync(MEASURE_DRAW_TIMES * count * 1000 / elapsedTime);
} catch(err) {
- CanvasRunner.logFatalError("\ntest fails due to GPU issue. " + err + "\n");
+ CanvasRunner.logFatalError("test fails due to GPU issue. " + err);
return;
}
@@ -56,5 +56,39 @@
PerfTestRunner.logFatalError(text);
}
+ CanvasRunner.startPlayingAndWaitForVideo = function (video, callback) {
+ var gotPlaying = false;
+ var gotTimeUpdate = false;
+
+ var maybeCallCallback = function() {
+ if (gotPlaying && gotTimeUpdate && callback) {
+ callback(video);
+ callback = undefined;
+ video.removeEventListener('playing', playingListener, true);
+ video.removeEventListener('timeupdate', timeupdateListener, true);
+ }
+ };
+
+ var playingListener = function() {
+ gotPlaying = true;
+ maybeCallCallback();
+ };
+
+ var timeupdateListener = function() {
+ // Checking to make sure the current time has advanced beyond
+ // the start time seems to be a reliable heuristic that the
+ // video element has data that can be consumed.
+ if (video.currentTime > 0.0) {
+ gotTimeUpdate = true;
+ maybeCallCallback();
+ }
+ };
+
+ video.addEventListener('playing', playingListener, true);
+ video.addEventListener('timeupdate', timeupdateListener, true);
+ video.loop = true;
+ video.play();
+ }
+
window.CanvasRunner = CanvasRunner;
})();

Powered by Google App Engine
This is Rietveld 408576698