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

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

Issue 312883002: Enable the page_set of benchmark test file to use actual page set object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « tools/perf/benchmarks/memory.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/test.py
diff --git a/tools/telemetry/telemetry/test.py b/tools/telemetry/telemetry/test.py
index b23f43503bc43cc14287f759f0e6fb9c1a87f5d1..4b8c1abeae0c7950a34643a20cd3757168f9479b 100644
--- a/tools/telemetry/telemetry/test.py
+++ b/tools/telemetry/telemetry/test.py
@@ -37,8 +37,14 @@ class Test(command_line.Command):
name = cls.__module__.split('.')[-1]
if hasattr(cls, 'tag'):
name += '.' + cls.tag
- if hasattr(cls, 'page_set'):
- name += '.' + os.path.basename(os.path.splitext(cls.page_set)[0])
+ page_set_name = None
+ if hasattr(cls, 'page_set') and isinstance(cls.page_set, page_set.PageSet):
+ page_set_name = os.path.basename(
+ os.path.splitext(cls.page_set.file_path)[0])
+ elif hasattr(cls, 'page_set') and isinstance(cls.page_set, str):
+ page_set_name = os.path.basename(os.path.splitext(cls.page_set)[0])
+ if page_set_name:
+ name += '.' + page_set_name
return name
@classmethod
@@ -172,8 +178,15 @@ class Test(command_line.Command):
"""
if not hasattr(cls, 'page_set'):
raise NotImplementedError('This test has no "page_set" attribute.')
- return page_set.PageSet.FromFile(
- file_path=os.path.join(util.GetBaseDir(), cls.page_set))
+
+ if isinstance(cls.page_set, str):
+ return page_set.PageSet.FromFile(
+ file_path=os.path.join(util.GetBaseDir(), cls.page_set))
+ elif isinstance(cls.page_set, page_set.PageSet):
+ return cls.page_set
+ else:
+ raise TypeError('The page_set field of %s has unsupported type.' %
+ cls.Name)
@classmethod
def CreateExpectations(cls, ps): # pylint: disable=W0613
« no previous file with comments | « tools/perf/benchmarks/memory.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698