1 # Copyright (c) 2012 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.
6 from telemetry.page import page_measurement
9 _JS = 'chrome.gpuBenchmarking.printToSkPicture("{0}");'
12 class SkpicturePrinter(page_measurement.PageMeasurement):
13 def AddCommandLineOptions(self, parser):
14 parser.add_option('-s', '--skp-outdir',
15 help='Output directory for the SKP files')
17 def CustomizeBrowserOptions(self, options):
18 options.AppendExtraBrowserArgs(['--enable-gpu-benchmarking',
20 '--enable-deferred-image-decoding',
21 '--force-compositing-mode'])
23 def MeasurePage(self, page, tab, results):
24 skp_outdir = self.options.skp_outdir
26 raise Exception('Please specify --skp-outdir')
27 outpath = os.path.abspath(
28 os.path.join(skp_outdir,
30 # Replace win32 path separator char '\' with '\\'.
31 js = _JS.format(outpath.replace('\\', '\\\\'))
32 tab.EvaluateJavaScript(js)
33 results.Add('output_path', 'path', outpath)