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.page import page as page | 5 from telemetry.page import page as page |
6 from telemetry.page import page_set as page_set | 6 from telemetry.page import page_set as page_set |
7 | 7 |
8 | 8 |
9 archive_data_file_path = 'data/service_worker.json' | 9 archive_data_file_path = 'data/service_worker.json' |
10 | 10 |
11 | 11 |
12 class ServiceWorkerBenchmarkPage(page.Page): | |
13 """Page for workload to measure some specific functions in JS""" | |
14 | |
15 def RunNavigateSteps(self, action_runner): | |
16 action_runner.NavigateToPage(self) | |
17 action_runner.WaitForJavaScriptCondition('window.done') | |
18 | |
19 | |
20 class ServiceWorkerPageSet(page_set.PageSet): | 12 class ServiceWorkerPageSet(page_set.PageSet): |
21 """Page set which is using ServiceWorker""" | 13 """Page set of applications using ServiceWorker""" |
22 | 14 |
23 def __init__(self): | 15 def __init__(self): |
24 super(ServiceWorkerPageSet, self).__init__( | 16 super(ServiceWorkerPageSet, self).__init__( |
25 archive_data_file=archive_data_file_path, | 17 archive_data_file=archive_data_file_path, |
26 make_javascript_deterministic=False, | 18 make_javascript_deterministic=False, |
27 bucket=page_set.PUBLIC_BUCKET) | 19 bucket=page_set.PARTNER_BUCKET) |
28 | 20 |
29 # pylint: disable=C0301 | |
30 # The code of localhost:8091 is placed in | |
31 # https://github.com/coonsta/Service-Worker-Performance | |
32 # but currently the following is used: | |
33 # https://github.com/amiq11/Service-Worker-Performance/tree/follow_spec_and_
many_registration | |
34 # (rev: 3238098ea0225f53dab2f69f7406db8a2712dbf9) | |
35 # This will be merged into the main repository. | |
36 # pylint: enable=C0301 | |
37 # Why: to measure performance of many concurrent fetches | |
38 self.AddPage(ServiceWorkerBenchmarkPage( | |
39 'http://localhost:8091/index.html', self)) | |
40 # Why: to measure performance of registrations | |
41 self.AddPage(ServiceWorkerBenchmarkPage( | |
42 'http://localhost:8091/many-registration.html', self)) | |
43 # Why: the first application using ServiceWorker | 21 # Why: the first application using ServiceWorker |
44 # TODO(shimazu): Separate application tests from microbenchmark above two. | |
45 # 1st time: registration | 22 # 1st time: registration |
46 self.AddPage(page.Page( | 23 self.AddPage(page.Page( |
47 'https://jakearchibald.github.io/trained-to-thrill/', self)) | 24 'https://jakearchibald.github.io/trained-to-thrill/', self)) |
48 # 2st time: 1st onfetch with caching | 25 # 2st time: 1st onfetch with caching |
49 self.AddPage(page.Page( | 26 self.AddPage(page.Page( |
50 'https://jakearchibald.github.io/trained-to-thrill/', self)) | 27 'https://jakearchibald.github.io/trained-to-thrill/', self)) |
51 # 3rd time: 2nd onfetch from cache | 28 # 3rd time: 2nd onfetch from cache |
52 self.AddPage(page.Page( | 29 self.AddPage(page.Page( |
53 'https://jakearchibald.github.io/trained-to-thrill/', self)) | 30 'https://jakearchibald.github.io/trained-to-thrill/', self)) |
OLD | NEW |