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 core
import perf_benchmark
7 from telemetry
import benchmark
8 from telemetry
.core
import discover
9 from telemetry
import story
11 from measurements
import skpicture_printer
14 def _MatchPageSetName(story_set_name
, story_set_base_dir
):
15 story_sets
= discover
.DiscoverClasses(story_set_base_dir
, story_set_base_dir
,
16 story
.StorySet
).values()
18 if story_set_name
== s
.Name():
24 class SkpicturePrinter(perf_benchmark
.PerfBenchmark
):
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 CreateStorySet(self
, options
):
48 story_set_class
= _MatchPageSetName(options
.page_set_name
,
49 options
.page_set_base_dir
)
50 return story_set_class()