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 from contrib.cluster_telemetry import screenshot |
| 11 |
| 12 class ScreenshotCT(perf_benchmark.PerfBenchmark): |
| 13 """Captures PNG screenshots of web pages for Cluster Telemetry. Screenshots |
| 14 written to local file with path-safe urls of pages as filenames. Cluster |
| 15 Telemetry is then used for aggregation and analysis.""" |
| 16 |
| 17 @classmethod |
| 18 def Name(cls): |
| 19 return 'screenshot_ct' |
| 20 |
| 21 @classmethod |
| 22 def AddBenchmarkCommandLineArgs(cls, parser): |
| 23 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) |
| 24 parser.add_option('--png-outdir', type='string', |
| 25 default=None, |
| 26 help='Output directory for the PNG files') |
| 27 parser.add_option('--wait-time', type='float', default=0, |
| 28 help='Wait time before the benchmark is started') |
| 29 # Javascript flag not yet implemented |
| 30 # parser.add_option('--disable-javascript', action='store_true', |
| 31 # default=False, |
| 32 # help='Strips out script tags from page if enabled') |
| 33 |
| 34 @classmethod |
| 35 def ProcessCommandLineArgs(cls, parser, args): |
| 36 ct_benchmarks_util.ValidateCommandLineArgs(parser, args) |
| 37 if not args.png_outdir: |
| 38 parser.error('Please specify --png-outdir') |
| 39 |
| 40 def CreatePageTest(self, options): |
| 41 return screenshot.Screenshot(options.png_outdir) |
| 42 |
| 43 def CreateStorySet(self, options): |
| 44 return page_set.CTPageSet( |
| 45 options.urls_list, options.user_agent, options.archive_data_file, |
| 46 run_page_interaction_callback=repaint_helpers.WaitThenRepaint) |
OLD | NEW |