| 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.util import TimeoutException |
| 9 from telemetry.page import page_measurement | |
| 10 from telemetry.page import page_test | 9 from telemetry.page import page_test |
| 11 from telemetry.value import scalar | 10 from telemetry.value import scalar |
| 12 | 11 |
| 13 | 12 |
| 14 class RasterizeAndRecordMicro(page_measurement.PageMeasurement): | 13 class RasterizeAndRecordMicro(page_test.PageTest): |
| 15 def __init__(self): | 14 def __init__(self): |
| 16 super(RasterizeAndRecordMicro, self).__init__('') | 15 super(RasterizeAndRecordMicro, self).__init__('') |
| 17 self._chrome_branch_number = None | 16 self._chrome_branch_number = None |
| 18 | 17 |
| 19 @classmethod | 18 @classmethod |
| 20 def AddCommandLineArgs(cls, parser): | 19 def AddCommandLineArgs(cls, parser): |
| 21 parser.add_option('--start-wait-time', type='float', | 20 parser.add_option('--start-wait-time', type='float', |
| 22 default=2, | 21 default=2, |
| 23 help='Wait time before the benchmark is started ' | 22 help='Wait time before the benchmark is started ' |
| 24 '(must be long enought to load all content)') | 23 '(must be long enought to load all content)') |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 window.benchmark_results.done = true; | 75 window.benchmark_results.done = true; |
| 77 window.benchmark_results.results = value; | 76 window.benchmark_results.results = value; |
| 78 }, { | 77 }, { |
| 79 "record_repeat_count": """ + str(record_repeat) + """, | 78 "record_repeat_count": """ + str(record_repeat) + """, |
| 80 "rasterize_repeat_count": """ + str(rasterize_repeat) + """ | 79 "rasterize_repeat_count": """ + str(rasterize_repeat) + """ |
| 81 }); | 80 }); |
| 82 """) | 81 """) |
| 83 | 82 |
| 84 benchmark_id = tab.EvaluateJavaScript('window.benchmark_results.id') | 83 benchmark_id = tab.EvaluateJavaScript('window.benchmark_results.id') |
| 85 if (not benchmark_id): | 84 if (not benchmark_id): |
| 86 raise page_measurement.MeasurementFailure( | 85 raise page_test.MeasurementFailure( |
| 87 'Failed to schedule rasterize_and_record_micro') | 86 'Failed to schedule rasterize_and_record_micro') |
| 88 | 87 |
| 89 tab.WaitForJavaScriptExpression( | 88 tab.WaitForJavaScriptExpression( |
| 90 'window.benchmark_results.done', self.options.timeout) | 89 'window.benchmark_results.done', self.options.timeout) |
| 91 | 90 |
| 92 data = tab.EvaluateJavaScript('window.benchmark_results.results') | 91 data = tab.EvaluateJavaScript('window.benchmark_results.results') |
| 93 | 92 |
| 94 pixels_recorded = data['pixels_recorded'] | 93 pixels_recorded = data['pixels_recorded'] |
| 95 record_time = data['record_time_ms'] | 94 record_time = data['record_time_ms'] |
| 96 pixels_rasterized = data['pixels_rasterized'] | 95 pixels_rasterized = data['pixels_rasterized'] |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 results.current_page, 'total_layers', 'count', total_layers)) | 143 results.current_page, 'total_layers', 'count', total_layers)) |
| 145 results.AddValue(scalar.ScalarValue( | 144 results.AddValue(scalar.ScalarValue( |
| 146 results.current_page, 'total_picture_layers', 'count', | 145 results.current_page, 'total_picture_layers', 'count', |
| 147 total_picture_layers)) | 146 total_picture_layers)) |
| 148 results.AddValue(scalar.ScalarValue( | 147 results.AddValue(scalar.ScalarValue( |
| 149 results.current_page, 'total_picture_layers_with_no_content', 'count', | 148 results.current_page, 'total_picture_layers_with_no_content', 'count', |
| 150 total_picture_layers_with_no_content)) | 149 total_picture_layers_with_no_content)) |
| 151 results.AddValue(scalar.ScalarValue( | 150 results.AddValue(scalar.ScalarValue( |
| 152 results.current_page, 'total_picture_layers_off_screen', 'count', | 151 results.current_page, 'total_picture_layers_off_screen', 'count', |
| 153 total_picture_layers_off_screen)) | 152 total_picture_layers_off_screen)) |
| OLD | NEW |