1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * @fileoverview FrameRateTest harness variant for benchmarking
7 * pages that contain content that is animated (e.g. canvas2d, webGL)
9 * How to instrument an animated web page for use with the frame rate test
11 * 1. Include head.js followed by head_animation.js in the head of the test
13 * 2. If the animation loop does not already use requestAnimationFrame,
15 * 3. Replace calls to requestAnimationFrame with the __requestAnimationFrame
16 * function defined below
17 * 4. If the test page needs to call requestAnimationFrame during an
18 * initialization phase that should not be measured by the test, then
19 * use __requestAnimationFrame_no_sampling
22 // default gestures for animated content
24 none: __gesture_library["stationary"]
27 // Don't start benchmarking animated pages right away.
28 // wait for initialization to complete.
29 __initialized = false;
31 // Indicate to the test harness that the test page has its own
35 // Draw this many frames before starting test.
36 // This is a delay to allow caches and other resources to spin-up to reach a
37 // steady running state before benchmarking begins.
38 var __warmup_frames = 10;
40 function __did_render_frame() {
41 if (__warmup_frames > 0){
46 // Signal that page is ready to begin benchamarking
51 __record_frame_time();
55 function __requestAnimationFrame(callback, element) {
57 __raf(callback, element);
60 function __requestAnimationFrame_no_sampling(callback, element) {
61 __raf(callback, element);