| 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 time | 5 import time |
| 6 | 6 |
| 7 from telemetry.core import exceptions | |
| 8 from telemetry.page import legacy_page_test | 7 from telemetry.page import legacy_page_test |
| 9 from telemetry.value import scalar | 8 from telemetry.value import scalar |
| 10 | 9 |
| 10 import py_utils |
| 11 | 11 |
| 12 class RasterizeAndRecordMicro(legacy_page_test.LegacyPageTest): | 12 class RasterizeAndRecordMicro(legacy_page_test.LegacyPageTest): |
| 13 | 13 |
| 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-gpu-benchmarking' | 26 '--enable-gpu-benchmarking' |
| 27 ]) | 27 ]) |
| 28 | 28 |
| 29 def ValidateAndMeasurePage(self, page, tab, results): | 29 def ValidateAndMeasurePage(self, page, tab, results): |
| 30 del page # unused | 30 del page # unused |
| 31 try: | 31 try: |
| 32 tab.WaitForDocumentReadyStateToBeComplete() | 32 tab.WaitForDocumentReadyStateToBeComplete() |
| 33 except exceptions.TimeoutException: | 33 except py_utils.TimeoutException: |
| 34 pass | 34 pass |
| 35 time.sleep(self._start_wait_time) | 35 time.sleep(self._start_wait_time) |
| 36 | 36 |
| 37 # Enqueue benchmark | 37 # Enqueue benchmark |
| 38 tab.ExecuteJavaScript(""" | 38 tab.ExecuteJavaScript(""" |
| 39 window.benchmark_results = {}; | 39 window.benchmark_results = {}; |
| 40 window.benchmark_results.done = false; | 40 window.benchmark_results.done = false; |
| 41 window.benchmark_results.id = | 41 window.benchmark_results.id = |
| 42 chrome.gpuBenchmarking.runMicroBenchmark( | 42 chrome.gpuBenchmarking.runMicroBenchmark( |
| 43 "rasterize_and_record_benchmark", | 43 "rasterize_and_record_benchmark", |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 results.current_page, 'total_layers', 'count', total_layers)) | 135 results.current_page, 'total_layers', 'count', total_layers)) |
| 136 results.AddValue(scalar.ScalarValue( | 136 results.AddValue(scalar.ScalarValue( |
| 137 results.current_page, 'total_picture_layers', 'count', | 137 results.current_page, 'total_picture_layers', 'count', |
| 138 total_picture_layers)) | 138 total_picture_layers)) |
| 139 results.AddValue(scalar.ScalarValue( | 139 results.AddValue(scalar.ScalarValue( |
| 140 results.current_page, 'total_picture_layers_with_no_content', 'count', | 140 results.current_page, 'total_picture_layers_with_no_content', 'count', |
| 141 total_picture_layers_with_no_content)) | 141 total_picture_layers_with_no_content)) |
| 142 results.AddValue(scalar.ScalarValue( | 142 results.AddValue(scalar.ScalarValue( |
| 143 results.current_page, 'total_picture_layers_off_screen', 'count', | 143 results.current_page, 'total_picture_layers_off_screen', 'count', |
| 144 total_picture_layers_off_screen)) | 144 total_picture_layers_off_screen)) |
| OLD | NEW |