OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import sys | 5 import sys |
6 import time | 6 import time |
7 | 7 |
8 from telemetry.core.util import TimeoutException | 8 from telemetry.core import exceptions |
9 from telemetry.page import page_test | 9 from telemetry.page import page_test |
10 from telemetry.value import scalar | 10 from telemetry.value import scalar |
11 | 11 |
12 | 12 |
13 class RasterizeAndRecordMicro(page_test.PageTest): | 13 class RasterizeAndRecordMicro(page_test.PageTest): |
14 def __init__(self, start_wait_time=2, rasterize_repeat=100, record_repeat=100, | 14 def __init__(self, start_wait_time=2, rasterize_repeat=100, record_repeat=100, |
15 timeout=120, report_detailed_results=False): | 15 timeout=120, report_detailed_results=False): |
16 super(RasterizeAndRecordMicro, self).__init__('') | 16 super(RasterizeAndRecordMicro, self).__init__('') |
17 self._chrome_branch_number = None | 17 self._chrome_branch_number = None |
18 self._start_wait_time = start_wait_time | 18 self._start_wait_time = start_wait_time |
19 self._rasterize_repeat = rasterize_repeat | 19 self._rasterize_repeat = rasterize_repeat |
20 self._record_repeat = record_repeat | 20 self._record_repeat = record_repeat |
21 self._timeout = timeout | 21 self._timeout = timeout |
22 self._report_detailed_results = report_detailed_results | 22 self._report_detailed_results = report_detailed_results |
23 | 23 |
24 def CustomizeBrowserOptions(self, options): | 24 def CustomizeBrowserOptions(self, options): |
25 options.AppendExtraBrowserArgs([ | 25 options.AppendExtraBrowserArgs([ |
26 '--enable-impl-side-painting', | 26 '--enable-impl-side-painting', |
27 '--enable-threaded-compositing', | 27 '--enable-threaded-compositing', |
28 '--enable-gpu-benchmarking' | 28 '--enable-gpu-benchmarking' |
29 ]) | 29 ]) |
30 | 30 |
31 def ValidateAndMeasurePage(self, page, tab, results): | 31 def ValidateAndMeasurePage(self, page, tab, results): |
32 try: | 32 try: |
33 tab.WaitForDocumentReadyStateToBeComplete() | 33 tab.WaitForDocumentReadyStateToBeComplete() |
34 except TimeoutException: | 34 except exceptions.TimeoutException: |
35 pass | 35 pass |
36 time.sleep(self._start_wait_time) | 36 time.sleep(self._start_wait_time) |
37 | 37 |
38 # Enqueue benchmark | 38 # Enqueue benchmark |
39 tab.ExecuteJavaScript(""" | 39 tab.ExecuteJavaScript(""" |
40 window.benchmark_results = {}; | 40 window.benchmark_results = {}; |
41 window.benchmark_results.done = false; | 41 window.benchmark_results.done = false; |
42 window.benchmark_results.id = | 42 window.benchmark_results.id = |
43 chrome.gpuBenchmarking.runMicroBenchmark( | 43 chrome.gpuBenchmarking.runMicroBenchmark( |
44 "rasterize_and_record_benchmark", | 44 "rasterize_and_record_benchmark", |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 results.current_page, 'total_layers', 'count', total_layers)) | 133 results.current_page, 'total_layers', 'count', total_layers)) |
134 results.AddValue(scalar.ScalarValue( | 134 results.AddValue(scalar.ScalarValue( |
135 results.current_page, 'total_picture_layers', 'count', | 135 results.current_page, 'total_picture_layers', 'count', |
136 total_picture_layers)) | 136 total_picture_layers)) |
137 results.AddValue(scalar.ScalarValue( | 137 results.AddValue(scalar.ScalarValue( |
138 results.current_page, 'total_picture_layers_with_no_content', 'count', | 138 results.current_page, 'total_picture_layers_with_no_content', 'count', |
139 total_picture_layers_with_no_content)) | 139 total_picture_layers_with_no_content)) |
140 results.AddValue(scalar.ScalarValue( | 140 results.AddValue(scalar.ScalarValue( |
141 results.current_page, 'total_picture_layers_off_screen', 'count', | 141 results.current_page, 'total_picture_layers_off_screen', 'count', |
142 total_picture_layers_off_screen)) | 142 total_picture_layers_off_screen)) |
OLD | NEW |