1 # Copyright 2014 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.
5 from telemetry
import benchmark
6 from telemetry
.core
import discover
7 from telemetry
.page
import page_set
9 from measurements
import skpicture_printer
12 def _MatchPageSetName(page_set_name
, page_set_base_dir
):
14 page_sets
+= discover
.DiscoverClasses(page_set_base_dir
, page_set_base_dir
,
16 index_by_class_name
=True).values()
18 if page_set_name
== p
.Name():
24 class SkpicturePrinter(benchmark
.Benchmark
):
26 def AddBenchmarkCommandLineArgs(cls
, parser
):
27 parser
.add_option('--page-set-name', action
='store', type='string')
28 parser
.add_option('--page-set-base-dir', action
='store', type='string')
29 parser
.add_option('-s', '--skp-outdir',
30 help='Output directory for the SKP files')
32 def ProcessCommandLineArgs(cls
, parser
, args
):
33 if not args
.page_set_name
:
34 parser
.error('Please specify --page-set-name')
35 if not args
.page_set_base_dir
:
36 parser
.error('Please specify --page-set-base-dir')
37 if not args
.skp_outdir
:
38 parser
.error('Please specify --skp-outdir')
42 return 'skpicture_printer'
44 def CreatePageTest(self
, options
):
45 return skpicture_printer
.SkpicturePrinter(options
.skp_outdir
)
47 def CreatePageSet(self
, options
):
48 page_set_class
= _MatchPageSetName(options
.page_set_name
,
49 options
.page_set_base_dir
)
50 return page_set_class()