1 # Copyright 2013 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.
7 from measurements
import smoothness
8 from telemetry
.page
import page_test
9 from telemetry
.value
import scalar
12 class RecordPerArea(page_test
.PageTest
):
13 def __init__(self
, start_wait_time
=2):
14 super(RecordPerArea
, self
).__init
__('', True)
15 self
._start
_wait
_time
= start_wait_time
17 def CustomizeBrowserOptions(self
, options
):
18 smoothness
.Smoothness
.CustomizeBrowserOptions(options
)
19 options
.AppendExtraBrowserArgs([
20 '--enable-impl-side-painting',
21 '--enable-threaded-compositing',
22 '--enable-gpu-benchmarking'
25 def ValidateAndMeasurePage(self
, page
, tab
, results
):
26 # Wait until the page has loaded and come to a somewhat steady state.
27 # Needs to be adjusted for every device (~2 seconds for workstation).
28 time
.sleep(self
._start
_wait
_time
)
31 tab
.ExecuteJavaScript("""
32 window.benchmark_results = {};
33 window.benchmark_results.done = false;
34 chrome.gpuBenchmarking.runMicroBenchmark(
35 "picture_record_benchmark",
37 window.benchmark_results.done = true;
38 window.benchmark_results.results = value;
39 }, [{width: 1, height: 1},
40 {width: 250, height: 250},
41 {width: 500, height: 500},
42 {width: 750, height: 750},
43 {width: 1000, height: 1000},
44 {width: 256, height: 1024},
45 {width: 1024, height: 256}]);
48 tab
.WaitForJavaScriptExpression('window.benchmark_results.done', 300)
50 all_data
= tab
.EvaluateJavaScript('window.benchmark_results.results')
53 height
= data
['height']
55 time_ms
= data
['time_ms']
57 results
.AddValue(scalar
.ScalarValue(
58 results
.current_page
, 'area_%07d_%dx%d' % (area
, width
, height
),