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

Side by Side Diff: tools/telemetry/telemetry/page/page.py

Issue 170183004: Move smoothness to the new API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@submit
Patch Set: Reset actions list. Modify repaint measurement. Created 6 years, 9 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/metrics/timeline_interaction_record_unittest.py ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 import os 5 import os
6 import re 6 import re
7 import urlparse 7 import urlparse
8 8
9 from telemetry import decorators
10
9 11
10 class Page(object): 12 class Page(object):
11 def __init__(self, url, page_set, attributes=None, base_dir=None): 13 def __init__(self, url, page_set, attributes=None, base_dir=None):
12 self.url = url 14 self.url = url
13 self.page_set = page_set 15 self.page_set = page_set
14 self._base_dir = base_dir 16 self._base_dir = base_dir
15 17
16 # These attributes can be set dynamically by the page. 18 # These attributes can be set dynamically by the page.
17 self.credentials = None 19 self.credentials = None
18 self.disabled = False 20 self.disabled = False
(...skipping 14 matching lines...) Expand all
33 if startup_url_scheme == 'file': 35 if startup_url_scheme == 'file':
34 raise ValueError('startup_url with local file scheme is not supported') 36 raise ValueError('startup_url with local file scheme is not supported')
35 37
36 def __getattr__(self, name): 38 def __getattr__(self, name):
37 # Inherit attributes from the page set. 39 # Inherit attributes from the page set.
38 if self.page_set and hasattr(self.page_set, name): 40 if self.page_set and hasattr(self.page_set, name):
39 return getattr(self.page_set, name) 41 return getattr(self.page_set, name)
40 raise AttributeError( 42 raise AttributeError(
41 '%r object has no attribute %r' % (self.__class__, name)) 43 '%r object has no attribute %r' % (self.__class__, name))
42 44
45 @decorators.Cache
46 def GetSyntheticDelayCategories(self):
47 if not hasattr(self, 'synthetic_delays'):
48 return []
49 result = []
50 for delay, options in self.synthetic_delays.items():
51 options = '%f;%s' % (options.get('target_duration', 0),
52 options.get('mode', 'static'))
53 result.append('DELAY(%s;%s)' % (delay, options))
54 return result
55
43 def __lt__(self, other): 56 def __lt__(self, other):
44 return self.url < other.url 57 return self.url < other.url
45 58
46 def __cmp__(self, other): 59 def __cmp__(self, other):
47 x = cmp(self.name, other.name) 60 x = cmp(self.name, other.name)
48 if x != 0: 61 if x != 0:
49 return x 62 return x
50 return cmp(self.url, other.url) 63 return cmp(self.url, other.url)
51 64
52 def __str__(self): 65 def __str__(self):
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return self.name 120 return self.name
108 if not self.is_file: 121 if not self.is_file:
109 return self.url 122 return self.url
110 all_urls = [p.url.rstrip('/') for p in self.page_set if p.is_file] 123 all_urls = [p.url.rstrip('/') for p in self.page_set if p.is_file]
111 common_prefix = os.path.dirname(os.path.commonprefix(all_urls)) 124 common_prefix = os.path.dirname(os.path.commonprefix(all_urls))
112 return self.url[len(common_prefix):].strip('/') 125 return self.url[len(common_prefix):].strip('/')
113 126
114 @property 127 @property
115 def archive_path(self): 128 def archive_path(self):
116 return self.page_set.WprFilePathForPage(self) 129 return self.page_set.WprFilePathForPage(self)
OLDNEW
« no previous file with comments | « tools/perf/metrics/timeline_interaction_record_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698