| 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 from telemetry import story |
| 5 from telemetry.page import page as page | 6 from telemetry.page import page as page |
| 6 from telemetry.page import page_set as page_set | |
| 7 | |
| 8 | 7 |
| 9 archive_data_file_path = 'data/service_worker_micro_benchmark.json' | 8 archive_data_file_path = 'data/service_worker_micro_benchmark.json' |
| 10 | 9 |
| 11 | 10 |
| 12 class ServiceWorkerBenchmarkPage(page.Page): | 11 class ServiceWorkerBenchmarkPage(page.Page): |
| 13 """Page for workload to measure some specific functions in JS""" | 12 """Page for workload to measure some specific functions in JS""" |
| 14 | 13 |
| 15 def RunNavigateSteps(self, action_runner): | 14 def RunNavigateSteps(self, action_runner): |
| 16 super(ServiceWorkerBenchmarkPage, self).RunNavigateSteps(action_runner) | 15 super(ServiceWorkerBenchmarkPage, self).RunNavigateSteps(action_runner) |
| 17 action_runner.WaitForJavaScriptCondition('window.done') | 16 action_runner.WaitForJavaScriptCondition('window.done') |
| 18 | 17 |
| 19 | 18 |
| 20 class ServiceWorkerMicroBenchmarkPageSet(page_set.PageSet): | 19 class ServiceWorkerMicroBenchmarkPageSet(story.StorySet): |
| 21 """Page set for micro benchmarking of each functions with ServiceWorker""" | 20 """Page set for micro benchmarking of each functions with ServiceWorker""" |
| 22 | 21 |
| 23 def __init__(self): | 22 def __init__(self): |
| 24 super(ServiceWorkerMicroBenchmarkPageSet, self).__init__( | 23 super(ServiceWorkerMicroBenchmarkPageSet, self).__init__( |
| 25 archive_data_file=archive_data_file_path, | 24 archive_data_file=archive_data_file_path, |
| 26 bucket=page_set.PUBLIC_BUCKET) | 25 cloud_storage_bucket=story.PUBLIC_BUCKET) |
| 27 | 26 |
| 28 # pylint: disable=C0301 | 27 # pylint: disable=C0301 |
| 29 # The code of localhost:8091 is placed in | 28 # The code of localhost:8091 is placed in |
| 30 # https://github.com/coonsta/Service-Worker-Performance | 29 # https://github.com/coonsta/Service-Worker-Performance |
| 31 # but currently the following is used: | 30 # but currently the following is used: |
| 32 # https://github.com/amiq11/Service-Worker-Performance/tree/follow_spec_and_
many_registration | 31 # https://github.com/amiq11/Service-Worker-Performance/tree/follow_spec_and_
many_registration |
| 33 # (rev: 3238098ea0225f53dab2f69f7406db8a2712dbf9) | 32 # (rev: 3238098ea0225f53dab2f69f7406db8a2712dbf9) |
| 34 # This will be merged into the main repository. | 33 # This will be merged into the main repository. |
| 35 # pylint: enable=C0301 | 34 # pylint: enable=C0301 |
| 36 # Why: to measure performance of many concurrent fetches | 35 # Why: to measure performance of many concurrent fetches |
| 37 self.AddUserStory(ServiceWorkerBenchmarkPage( | 36 self.AddUserStory(ServiceWorkerBenchmarkPage( |
| 38 'http://localhost:8091/index.html', self, | 37 'http://localhost:8091/index.html', self, |
| 39 make_javascript_deterministic=False)) | 38 make_javascript_deterministic=False)) |
| OLD | NEW |