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

Side by Side Diff: tools/perf/page_sets/ct_page_set.py

Issue 1856603003: Fail CT run_benchmark if archive_data_file is not found (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix import Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 4
5 5
6 import os
7
6 from page_sets import repaint_helpers 8 from page_sets import repaint_helpers
7 9
8 from telemetry.page import page as page_module 10 from telemetry.page import page as page_module
9 from telemetry.page import shared_page_state 11 from telemetry.page import shared_page_state
10 from telemetry import story 12 from telemetry import story
11 13
12 14
13 class CTPage(page_module.Page): 15 class CTPage(page_module.Page):
14 16
15 def __init__(self, url, page_set, shared_page_state_class, archive_data_file): 17 def __init__(self, url, page_set, shared_page_state_class, archive_data_file):
16 super(CTPage, self).__init__( 18 super(CTPage, self).__init__(
17 url=url, 19 url=url,
18 page_set=page_set, 20 page_set=page_set,
19 shared_page_state_class=shared_page_state_class) 21 shared_page_state_class=shared_page_state_class)
20 self.archive_data_file = archive_data_file 22 self.archive_data_file = archive_data_file
21 23
22 def RunNavigateSteps(self, action_runner): 24 def RunNavigateSteps(self, action_runner):
23 action_runner.Navigate(self.url) 25 action_runner.Navigate(self.url)
24 action_runner.Wait(2) 26 action_runner.Wait(2)
25 27
26 def RunPageInteractions(self, action_runner): 28 def RunPageInteractions(self, action_runner):
27 repaint_helpers.Repaint(action_runner) 29 repaint_helpers.Repaint(action_runner)
28 30
29 31
30 class CTPageSet(story.StorySet): 32 class CTPageSet(story.StorySet):
31 """Page set used by CT Benchmarks.""" 33 """Page set used by CT Benchmarks."""
32 34
33 def __init__(self, urls_list, user_agent, archive_data_file): 35 def __init__(self, urls_list, user_agent, archive_data_file):
36 if archive_data_file and not os.path.exists(archive_data_file):
37 raise IOError('%s is not found' % archive_data_file)
38
34 if user_agent == 'mobile': 39 if user_agent == 'mobile':
35 shared_page_state_class = shared_page_state.SharedMobilePageState 40 shared_page_state_class = shared_page_state.SharedMobilePageState
36 elif user_agent == 'desktop': 41 elif user_agent == 'desktop':
37 shared_page_state_class = shared_page_state.SharedDesktopPageState 42 shared_page_state_class = shared_page_state.SharedDesktopPageState
38 else: 43 else:
39 raise ValueError('user_agent %s is unrecognized' % user_agent) 44 raise ValueError('user_agent %s is unrecognized' % user_agent)
40 45
41 super(CTPageSet, self).__init__(archive_data_file=archive_data_file) 46 super(CTPageSet, self).__init__(archive_data_file=archive_data_file)
42 47
43 for url in urls_list.split(','): 48 for url in urls_list.split(','):
44 self.AddStory( 49 self.AddStory(
45 CTPage(url, self, shared_page_state_class, archive_data_file)) 50 CTPage(url, self, shared_page_state_class, archive_data_file))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698