OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 from core import perf_benchmark | |
6 | |
7 from contrib.cluster_telemetry import ct_benchmarks_util | |
8 from contrib.cluster_telemetry import page_set | |
9 from contrib.cluster_telemetry import repaint_helpers | |
10 | |
11 from measurements import screenshot | |
12 | |
13 class ScreenshotCT(perf_benchmark.PerfBenchmark): | |
14 """Captures PNG screenshots of web pages for Cluster Telemetry.""" | |
15 # Screenshots written to local file with path-safe urls of pages as filenames. | |
wkorman
2017/06/08 17:57:52
Move the comment text into the doc comment itself.
| |
16 # Cluster Telemetry is then used for aggregation and analysis. | |
17 | |
18 @classmethod | |
19 def Name(cls): | |
20 return 'screenshot_ct' | |
21 | |
22 @classmethod | |
23 def AddBenchmarkCommandLineArgs(cls, parser): | |
24 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) | |
25 parser.add_option('--png-outdir', type='string', | |
26 default=None, | |
27 help='Output directory for the PNG files') | |
28 parser.add_option('--wait-time', type='float', default=0, | |
29 help='Wait time before the benchmark is started') | |
30 # Javascript flag not yet implemented | |
31 parser.add_option('--disable-javascript', action='store_true', | |
wkorman
2017/06/08 17:57:52
Comment out this line and next two as well since o
| |
32 default=False, | |
33 help='Strips out script tags from page if enabled') | |
34 | |
35 @classmethod | |
36 def ProcessCommandLineArgs(cls, parser, args): | |
37 ct_benchmarks_util.ValidateCommandLineArgs(parser, args) | |
38 if not args.png_outdir: | |
39 parser.error('Please specify --png-outdir') | |
40 | |
41 def CreatePageTest(self, options): | |
42 return screenshot.Screenshot(options.png_outdir) | |
43 | |
44 def CreateStorySet(self, options): | |
45 return page_set.CTPageSet( | |
46 options.urls_list, options.user_agent, options.archive_data_file, | |
47 run_page_interaction_callback=repaint_helpers.WaitThenRepaint) | |
OLD | NEW |