| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 | 145 |
| 146 class _ServiceWorkerMicroBenchmarkMeasurement(legacy_page_test.LegacyPageTest): | 146 class _ServiceWorkerMicroBenchmarkMeasurement(legacy_page_test.LegacyPageTest): |
| 147 """Record results reported by the JS microbenchmark.""" | 147 """Record results reported by the JS microbenchmark.""" |
| 148 | 148 |
| 149 def __init__(self): | 149 def __init__(self): |
| 150 super(_ServiceWorkerMicroBenchmarkMeasurement, self).__init__() | 150 super(_ServiceWorkerMicroBenchmarkMeasurement, self).__init__() |
| 151 | 151 |
| 152 def ValidateAndMeasurePage(self, page, tab, results): | 152 def ValidateAndMeasurePage(self, page, tab, results): |
| 153 del page # unused | 153 del page # unused |
| 154 tab.WaitForJavaScriptCondition2('window.done', timeout=40) | 154 tab.WaitForJavaScriptCondition('window.done', timeout=40) |
| 155 json = tab.EvaluateJavaScript2('window.results || {}') | 155 json = tab.EvaluateJavaScript('window.results || {}') |
| 156 for key, value in json.iteritems(): | 156 for key, value in json.iteritems(): |
| 157 results.AddValue(scalar.ScalarValue( | 157 results.AddValue(scalar.ScalarValue( |
| 158 results.current_page, key, value['units'], value['value'])) | 158 results.current_page, key, value['units'], value['value'])) |
| 159 | 159 |
| 160 | 160 |
| 161 class ServiceWorkerPerfTest(perf_benchmark.PerfBenchmark): | 161 class ServiceWorkerPerfTest(perf_benchmark.PerfBenchmark): |
| 162 """Performance test of pages using ServiceWorker. | 162 """Performance test of pages using ServiceWorker. |
| 163 | 163 |
| 164 The page set contains pages like Trained to Thrill and svgomg. | 164 The page set contains pages like Trained to Thrill and svgomg. |
| 165 Execution time of these pages will be shown as Speed Index, and TRACE_EVENTs | 165 Execution time of these pages will be shown as Speed Index, and TRACE_EVENTs |
| (...skipping 20 matching lines...) Expand all Loading... |
| 186 page_set = page_sets.ServiceWorkerMicroBenchmarkPageSet | 186 page_set = page_sets.ServiceWorkerMicroBenchmarkPageSet |
| 187 | 187 |
| 188 @classmethod | 188 @classmethod |
| 189 def Name(cls): | 189 def Name(cls): |
| 190 return 'service_worker.service_worker_micro_benchmark' | 190 return 'service_worker.service_worker_micro_benchmark' |
| 191 | 191 |
| 192 @classmethod | 192 @classmethod |
| 193 def ShouldDisable(cls, possible_browser): # http://crbug.com/597656 | 193 def ShouldDisable(cls, possible_browser): # http://crbug.com/597656 |
| 194 return (possible_browser.browser_type == 'reference' and | 194 return (possible_browser.browser_type == 'reference' and |
| 195 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X') | 195 possible_browser.platform.GetDeviceTypeName() == 'Nexus 5X') |
| OLD | NEW |