Chromium Code Reviews| Index: chrome/test/data/perf/frame_rate/head.js |
| =================================================================== |
| --- chrome/test/data/perf/frame_rate/head.js (revision 102775) |
| +++ chrome/test/data/perf/frame_rate/head.js (working copy) |
| @@ -52,6 +52,7 @@ |
| var __recording = []; |
| var __advance_gesture; |
| +var __animation = function() {return false;} |
| var __gestures = { |
| none: [ |
| {"time_ms":1, "y":0}, |
| @@ -161,6 +162,13 @@ |
| ], |
| }; |
| +var __builtin_gestures = { |
| + init: [ |
| + {"time_ms":1, "y":0}, |
| + {"time_ms":5, "y":10} |
|
Justin Novosad
2011/09/27 19:56:13
factored this out of __gestures so that we don't h
|
| + ], |
| +}; |
| + |
| function __init_stats() { |
| __t_last = undefined; |
| __t_est = undefined; |
| @@ -337,9 +345,10 @@ |
| __raf(function() { |
| __raf_is_live = true; |
| if (__running) { |
| - // Only update the FPS if a gesture movement occurs. Otherwise, the frame |
| - // rate average becomes inaccurate after any pause. |
| - if (__advance_gesture()) |
| + // Only update the FPS if a gesture movement or animation occurs. |
| + // Otherwise, the frame rate average becomes inaccurate after any pause. |
| + var animated = __animation(); |
| + if (__advance_gesture() || animated) |
| __update_fps(); |
| else |
| __t_last = new Date().getTime(); |
| @@ -361,8 +370,13 @@ |
| return; |
| // Attempt to create a gesture function from a string name. |
| if (typeof gesture_function == "string") { |
| - if (!__gestures[gesture_function]) |
| - throw new Error("Unrecognized gesture name"); |
| + if (!__gestures[gesture_function]) { |
| + if (!__builtin_gestures[gesture_function]) |
| + throw new Error("Unrecognized gesture name"); |
| + else |
| + gesture_function = __create_repeating_gesture_function( |
| + __builtin_gestures[gesture_function]); |
| + } |
| else |
| gesture_function = __create_repeating_gesture_function( |
| __gestures[gesture_function]); |
| @@ -392,8 +406,8 @@ |
| __queued_gesture_functions.push(gesture); |
| } |
| __running_all = true; |
| - // Run steady gesture once to cache the webpage layout for subsequent tests. |
| - __start("steady"); |
| + // Run init gesture once to cache the webpage layout for subsequent tests. |
| + __start("init"); |
| } |
| function __stop() { |