Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Side by Side Diff: tools/perf/measurements/skpicture_printer.py

Issue 641823004: telemetry: Allow page tests to be configured via constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Add debug output to figure out why pixel tests fail on bots. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/perf/measurements/screenshot.py ('k') | tools/perf/measurements/startup.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2012 The Chromium Authors. All rights reserved. 1 # Copyright 2012 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 import glob 4 import glob
5 import os 5 import os
6 6
7 from telemetry.page import page_test 7 from telemetry.page import page_test
8 from telemetry.value import scalar 8 from telemetry.value import scalar
9 9
10 10
11 _JS = 'chrome.gpuBenchmarking.printToSkPicture("{0}");' 11 _JS = 'chrome.gpuBenchmarking.printToSkPicture("{0}");'
12 12
13 13
14 class SkpicturePrinter(page_test.PageTest): 14 class SkpicturePrinter(page_test.PageTest):
15 @classmethod 15 def __init__(self):
16 def AddCommandLineArgs(cls, parser): 16 super(SkpicturePrinter, self).__init__()
17 self._skp_outdir = None
18
19 def AddCommandLineArgs(self, parser):
17 parser.add_option('-s', '--skp-outdir', 20 parser.add_option('-s', '--skp-outdir',
18 help='Output directory for the SKP files') 21 help='Output directory for the SKP files')
19 22
20 @classmethod 23 def ProcessCommandLineArgs(self, parser, args):
21 def ProcessCommandLineArgs(cls, parser, args):
22 if not args.skp_outdir: 24 if not args.skp_outdir:
23 parser.error('Please specify --skp-outdir') 25 parser.error('Please specify --skp-outdir')
24 cls._skp_outdir = args.skp_outdir 26 self._skp_outdir = args.skp_outdir
25 27
26 def CustomizeBrowserOptions(self, options): 28 def CustomizeBrowserOptions(self, options):
27 options.AppendExtraBrowserArgs(['--enable-gpu-benchmarking', 29 options.AppendExtraBrowserArgs(['--enable-gpu-benchmarking',
28 '--no-sandbox', 30 '--no-sandbox',
29 '--enable-deferred-image-decoding']) 31 '--enable-deferred-image-decoding'])
30 32
31 def ValidateAndMeasurePage(self, page, tab, results): 33 def ValidateAndMeasurePage(self, page, tab, results):
32 if tab.browser.platform.GetOSName() in ['android', 'chromeos']: 34 if tab.browser.platform.GetOSName() in ['android', 'chromeos']:
33 raise page_test.MeasurementFailure( 35 raise page_test.MeasurementFailure(
34 'SkPicture printing not supported on this platform') 36 'SkPicture printing not supported on this platform')
35 37
36 # Replace win32 path separator char '\' with '\\'. 38 # Replace win32 path separator char '\' with '\\'.
37 outpath = os.path.abspath( 39 outpath = os.path.abspath(
38 os.path.join(self._skp_outdir, page.file_safe_name)) 40 os.path.join(self._skp_outdir, page.file_safe_name))
39 js = _JS.format(outpath.replace('\\', '\\\\')) 41 js = _JS.format(outpath.replace('\\', '\\\\'))
40 tab.EvaluateJavaScript(js) 42 tab.EvaluateJavaScript(js)
41 pictures = glob.glob(os.path.join(outpath, '*.skp')) 43 pictures = glob.glob(os.path.join(outpath, '*.skp'))
42 results.AddValue(scalar.ScalarValue( 44 results.AddValue(scalar.ScalarValue(
43 results.current_page, 'saved_picture_count', 'count', len(pictures))) 45 results.current_page, 'saved_picture_count', 'count', len(pictures)))
OLDNEW
« no previous file with comments | « tools/perf/measurements/screenshot.py ('k') | tools/perf/measurements/startup.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698