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

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

Issue 388653002: Telemetry Pages support AsDict() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Name 'name' parameter in page_unittest Created 6 years, 5 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 | « no previous file | tools/telemetry/telemetry/page/page_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/page.py
diff --git a/tools/telemetry/telemetry/page/page.py b/tools/telemetry/telemetry/page/page.py
index 33101a70ce6e996f115d058948effce4ac5dd859..bde3dfb80a63e69daad82ff59c72940b710e9ac8 100644
--- a/tools/telemetry/telemetry/page/page.py
+++ b/tools/telemetry/telemetry/page/page.py
@@ -57,6 +57,16 @@ class Page(object):
assert browser_info
return True
+ def AsDict(self):
+ """Converts a page object to a dict suitable for JSON output."""
+ d = {
+ 'id': self._id,
+ 'url': self._url,
+ }
+ if self._name:
+ d['name'] = self._name
+ return d
+
@property
def page_set(self):
return self._page_set
« no previous file with comments | « no previous file | tools/telemetry/telemetry/page/page_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698