OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 collections | 5 import collections |
6 import page_sets | 6 import page_sets |
7 import re | 7 import re |
8 | 8 |
9 from core import perf_benchmark | 9 from core import perf_benchmark |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 self._speed_index.AddResults(tab, results, chart_prefix) | 142 self._speed_index.AddResults(tab, results, chart_prefix) |
143 | 143 |
144 | 144 |
145 class _ServiceWorkerMicroBenchmarkMeasurement(page_test.PageTest): | 145 class _ServiceWorkerMicroBenchmarkMeasurement(page_test.PageTest): |
146 """Record results reported by the JS microbenchmark.""" | 146 """Record results reported by the JS microbenchmark.""" |
147 | 147 |
148 def __init__(self): | 148 def __init__(self): |
149 super(_ServiceWorkerMicroBenchmarkMeasurement, self).__init__() | 149 super(_ServiceWorkerMicroBenchmarkMeasurement, self).__init__() |
150 | 150 |
151 def ValidateAndMeasurePage(self, page, tab, results): | 151 def ValidateAndMeasurePage(self, page, tab, results): |
| 152 del page # unused |
152 tab.WaitForJavaScriptExpression('window.done', 40) | 153 tab.WaitForJavaScriptExpression('window.done', 40) |
153 json = tab.EvaluateJavaScript('window.results || {}') | 154 json = tab.EvaluateJavaScript('window.results || {}') |
154 for key, value in json.iteritems(): | 155 for key, value in json.iteritems(): |
155 results.AddValue(scalar.ScalarValue( | 156 results.AddValue(scalar.ScalarValue( |
156 results.current_page, key, value['units'], value['value'])) | 157 results.current_page, key, value['units'], value['value'])) |
157 | 158 |
158 | 159 |
159 class ServiceWorkerPerfTest(perf_benchmark.PerfBenchmark): | 160 class ServiceWorkerPerfTest(perf_benchmark.PerfBenchmark): |
160 """Performance test of pages using ServiceWorker. | 161 """Performance test of pages using ServiceWorker. |
161 | 162 |
(...skipping 21 matching lines...) Expand all Loading... |
183 page_set = page_sets.ServiceWorkerMicroBenchmarkPageSet | 184 page_set = page_sets.ServiceWorkerMicroBenchmarkPageSet |
184 | 185 |
185 @classmethod | 186 @classmethod |
186 def Name(cls): | 187 def Name(cls): |
187 return 'service_worker.service_worker_micro_benchmark' | 188 return 'service_worker.service_worker_micro_benchmark' |
188 | 189 |
189 @classmethod | 190 @classmethod |
190 def ShouldDisable(cls, possible_browser): # http://crbug.com/597656 | 191 def ShouldDisable(cls, possible_browser): # http://crbug.com/597656 |
191 return (possible_browser.browser_type == 'reference' and | 192 return (possible_browser.browser_type == 'reference' and |
192 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X') | 193 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X') |
OLD | NEW |