Chromium Code Reviews| Index: chrome/test/data/perf/frame_rate/head_animation.js |
| =================================================================== |
| --- chrome/test/data/perf/frame_rate/head_animation.js (revision 0) |
| +++ chrome/test/data/perf/frame_rate/head_animation.js (revision 0) |
| @@ -0,0 +1,55 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview FrameRateTest harness variant for benchmarking |
| + * pages that contain content that is animated (e.g. canvas2d, webGL) |
| + * |
| + * How to instrument an animated web page for use with the frame rate test |
| + * harness: |
| + * 1. Include head.js followed by head_animation.js in the head of the test |
| + * page. |
| + * 2. If the animation loop does not already use requestAnimationFrame, convert |
| + * it. For maximum portability and functionality, use the __raf function |
| + * defined in head.js (included by this file). Using __raf instead of |
| + * requestAnimationFrame is essential for the *_noraf tests to work |
| + * properly. |
| + * 3. Add a call to __animation_hook() at the end of the animation loop |
| + */ |
| + |
| +// default gestures for animated content |
| +__gestures = { |
| + none: __gesture_library["stationary"] |
| +}; |
| + |
| +// Don't start benchmarking animated pages right away. |
| +// wait for initialization to complete. |
| +__initialized = false; |
| + |
| +// Indicate to the test harness that the test page has its own |
| +// animation loop. |
| +__animation = true; |
|
nduca
2011/10/14 21:01:46
as I mentioend before, how about just saying __ani
|
| + |
| +// Draw this many frames before starting test. |
| +// This is a delay to allow caches and other resources to spin-up to reach a |
| +// steady running state before benchmarking begins. |
| +var __warmup_frames = 10; |
| + |
| +function __animation_hook() { |
| + if (__warmup_frames > 0){ |
| + __warmup_frames--; |
| + return; |
| + } |
| + |
| + // Signal that page is ready to begin benchamarking |
| + __initialized = true; |
| + |
| + if (__running) { |
| + __advance_gesture(); |
| + __update_fps(); |
| + } |
| +} |
| + |
| + |
| + |