Index: tools/perf/contrib/cluster_telemetry/pixel_diff_ct.py |
diff --git a/tools/perf/contrib/cluster_telemetry/pixel_diff_ct.py b/tools/perf/contrib/cluster_telemetry/pixel_diff_ct.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d2602ca4f7735a6f84af31c7d860f0f66cb815c4 |
--- /dev/null |
+++ b/tools/perf/contrib/cluster_telemetry/pixel_diff_ct.py |
@@ -0,0 +1,44 @@ |
+# 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 pixel_diff |
+ |
+class PixelDiffCT(perf_benchmark.PerfBenchmark): |
nednguyen
2017/06/07 20:32:12
This should inherit s.t like a base CTBenchmark cl
wkorman
2017/06/08 17:57:52
Looks reasonable to me, but propose doing as separ
|
+ """Captures PNG screenshots of web pages for Cluster Telemetry.""" |
wkorman
2017/06/07 20:15:11
Consider adding note that we write to a local file
|
+ |
+ @classmethod |
+ def Name(cls): |
+ return 'pixel_diff_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') |
+ parser.add_option('--disable-javascript', action='store_true', |
wkorman
2017/06/07 20:15:11
Either remove for now or clarify that this is plan
|
+ 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 pixel_diff.PixelDiff(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) |