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

Unified Diff: tools/telemetry/telemetry/page/page.py

Issue 23545023: [Telemetry] Add 'name' attribute for pages, which allows for more human-readable printing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forgot to update the unitttests :( Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/page/page.py
diff --git a/tools/telemetry/telemetry/page/page.py b/tools/telemetry/telemetry/page/page.py
index 145f036ae30c584f7412ad5fc96b91f8666dd365..616d6e8ec659565c7a237a220e6ced1980b70e9a 100644
--- a/tools/telemetry/telemetry/page/page.py
+++ b/tools/telemetry/telemetry/page/page.py
@@ -52,6 +52,7 @@ class Page(object):
# These attributes can be set dynamically by the page.
self.credentials = None
self.disabled = False
+ self.name = None
self.script_to_evaluate_on_commit = None
if attributes:
@@ -88,14 +89,16 @@ class Page(object):
return os.path.split(path)
- # A version of this page's URL that's safe to use as a filename.
@property
- def url_as_file_safe_name(self):
+ def file_safe_name(self):
+ """A version of display_name that's safe to use as a filename."""
# Just replace all special characters in the url with underscore.
- return re.sub('[^a-zA-Z0-9]', '_', self.display_url)
+ return re.sub('[^a-zA-Z0-9]', '_', self.display_name)
@property
- def display_url(self):
+ def display_name(self):
+ if self.name:
+ return self.name
if not self.is_local:
return self.url
url_paths = ['/'.join(p.url.strip('/').split('/')[:-1])

Powered by Google App Engine
This is Rietveld 408576698