| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 class _ServiceWorkerMeasurement(page_test.PageTest): | 89 class _ServiceWorkerMeasurement(page_test.PageTest): |
| 90 """Measure Speed Index and TRACE_EVENTs""" | 90 """Measure Speed Index and TRACE_EVENTs""" |
| 91 | 91 |
| 92 def __init__(self): | 92 def __init__(self): |
| 93 super(_ServiceWorkerMeasurement, self).__init__() | 93 super(_ServiceWorkerMeasurement, self).__init__() |
| 94 self._timeline_controller = timeline_controller.TimelineController() | 94 self._timeline_controller = timeline_controller.TimelineController() |
| 95 self._speed_index = speedindex.SpeedIndexMetric() | 95 self._speed_index = speedindex.SpeedIndexMetric() |
| 96 self._page_open_times = collections.defaultdict(int) | 96 self._page_open_times = collections.defaultdict(int) |
| 97 | 97 |
| 98 def DidRunPage(self, platform): |
| 99 if platform.tracing_controller.is_tracing_running: |
| 100 platform.tracing_controller.StopTracing() |
| 101 |
| 98 def WillNavigateToPage(self, page, tab): | 102 def WillNavigateToPage(self, page, tab): |
| 99 self._timeline_controller.SetUp(page, tab) | 103 self._timeline_controller.SetUp(page, tab) |
| 100 self._timeline_controller.Start(tab) | 104 self._timeline_controller.Start(tab) |
| 101 self._speed_index.Start(page, tab) | 105 self._speed_index.Start(page, tab) |
| 102 | 106 |
| 103 def ValidateAndMeasurePage(self, page, tab, results): | 107 def ValidateAndMeasurePage(self, page, tab, results): |
| 104 runner = action_runner.ActionRunner(tab) | 108 runner = action_runner.ActionRunner(tab) |
| 105 # timeline_controller requires creation of at least a single interaction | 109 # timeline_controller requires creation of at least a single interaction |
| 106 # record. service_worker should be refactored to follow the | 110 # record. service_worker should be refactored to follow the |
| 107 # timeline_based_measurement or it should not re-use timeline_controller | 111 # timeline_based_measurement or it should not re-use timeline_controller |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 The page set is a benchmark page that generates many concurrent requests | 180 The page set is a benchmark page that generates many concurrent requests |
| 177 handled by a service worker that does respondWith(new Response()). The test | 181 handled by a service worker that does respondWith(new Response()). The test |
| 178 result is the response times. | 182 result is the response times. |
| 179 """ | 183 """ |
| 180 test = _ServiceWorkerMicroBenchmarkMeasurement | 184 test = _ServiceWorkerMicroBenchmarkMeasurement |
| 181 page_set = page_sets.ServiceWorkerMicroBenchmarkPageSet | 185 page_set = page_sets.ServiceWorkerMicroBenchmarkPageSet |
| 182 | 186 |
| 183 @classmethod | 187 @classmethod |
| 184 def Name(cls): | 188 def Name(cls): |
| 185 return 'service_worker.service_worker_micro_benchmark' | 189 return 'service_worker.service_worker_micro_benchmark' |
| OLD | NEW |