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

Unified Diff: tools/perf/page_sets/tough_animation_cases/web_animations_set_current_time_in_raf.html

Issue 664323002: Add Web Animations performance tests - trybot-android-nexus5 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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: tools/perf/page_sets/tough_animation_cases/web_animations_set_current_time_in_raf.html
diff --git a/tools/perf/page_sets/tough_animation_cases/web_animations_set_current_time_in_raf.html b/tools/perf/page_sets/tough_animation_cases/web_animations_set_current_time_in_raf.html
new file mode 100644
index 0000000000000000000000000000000000000000..9f56c942cde90ccb596b04703419aec8e1c68b23
--- /dev/null
+++ b/tools/perf/page_sets/tough_animation_cases/web_animations_set_current_time_in_raf.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta name="viewport" content="width=device-width, user-scalable=no">
+<link rel="stylesheet" type="text/css" href="resources/tablet.css">
+<script src="resources/perftesthelper.js"></script>
+<script src="resources/web_animations_api_check.js"></script>
+
+<container id="container"></container>
+
+<script>
+var N = PerfTestHelper.getN(1000);
+var duration = 1000;
+var players = [];
+var prevTime = null;
+
+for (var i = 0; i < N; i++) {
+ var target = document.createElement('target');
+ container.appendChild(target);
+
+ var player = target.animate([
+ {opacity: 0},
+ {opacity: 1},
+ ], {
+ duration: duration,
+ iterations: Infinity,
+ });
+ if (player.pause) {
+ player.pause();
+ }
+ players.push(player);
+}
+
+requestAnimationFrame(function setCurrentTime(time) {
+ if (prevTime == null) {
+ prevTime = time;
+ }
+ var delta = time - prevTime;
+ players.forEach(function(player) {
+ player.currentTime += delta;
+ });
+ prevTime = time;
+
+ requestAnimationFrame(setCurrentTime);
+});
+
+PerfTestHelper.signalReady();
+</script>

Powered by Google App Engine
This is Rietveld 408576698