Chromium Code Reviews| Index: tools/perf/contrib/cluster_telemetry/screenshot_ct.py |
| diff --git a/tools/perf/contrib/cluster_telemetry/screenshot_ct.py b/tools/perf/contrib/cluster_telemetry/screenshot_ct.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..616348e9cc64a6ba844482c0344a9ce2eb16fca1 |
| --- /dev/null |
| +++ b/tools/perf/contrib/cluster_telemetry/screenshot_ct.py |
| @@ -0,0 +1,47 @@ |
| +# Copyright 2017 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from core import perf_benchmark |
| + |
| +from contrib.cluster_telemetry import ct_benchmarks_util |
| +from contrib.cluster_telemetry import page_set |
| +from contrib.cluster_telemetry import repaint_helpers |
| + |
| +from measurements import screenshot |
| + |
| +class ScreenshotCT(perf_benchmark.PerfBenchmark): |
| + """Captures PNG screenshots of web pages for Cluster Telemetry.""" |
| + # 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.
|
| + # Cluster Telemetry is then used for aggregation and analysis. |
| + |
| + @classmethod |
| + def Name(cls): |
| + return 'screenshot_ct' |
| + |
| + @classmethod |
| + def AddBenchmarkCommandLineArgs(cls, parser): |
| + ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) |
| + parser.add_option('--png-outdir', type='string', |
| + default=None, |
| + help='Output directory for the PNG files') |
| + parser.add_option('--wait-time', type='float', default=0, |
| + help='Wait time before the benchmark is started') |
| + # Javascript flag not yet implemented |
| + 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
|
| + default=False, |
| + help='Strips out script tags from page if enabled') |
| + |
| + @classmethod |
| + def ProcessCommandLineArgs(cls, parser, args): |
| + ct_benchmarks_util.ValidateCommandLineArgs(parser, args) |
| + if not args.png_outdir: |
| + parser.error('Please specify --png-outdir') |
| + |
| + def CreatePageTest(self, options): |
| + return screenshot.Screenshot(options.png_outdir) |
| + |
| + def CreateStorySet(self, options): |
| + return page_set.CTPageSet( |
| + options.urls_list, options.user_agent, options.archive_data_file, |
| + run_page_interaction_callback=repaint_helpers.WaitThenRepaint) |