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

Unified Diff: tools/telemetry/telemetry/page/page_unittest.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 | « tools/telemetry/telemetry/page/page.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/page/page_unittest.py
diff --git a/tools/telemetry/telemetry/page/page_unittest.py b/tools/telemetry/telemetry/page/page_unittest.py
index a422a7ad43e0374e47d15172cd06426e73c12297..c60c59df5fb742be0d1fe8751b66d4c15951b04e 100644
--- a/tools/telemetry/telemetry/page/page_unittest.py
+++ b/tools/telemetry/telemetry/page/page_unittest.py
@@ -117,6 +117,23 @@ class TestPage(unittest.TestCase):
self.assertEquals(ps[0].display_name, 'foo')
def testPagesHaveDifferentIds(self):
- p = page.Page("http://example.com")
- p2 = page.Page("http://example.com")
- self.assertNotEqual(p.id, p2.id)
+ p0 = page.Page("http://example.com")
+ p1 = page.Page("http://example.com")
+ self.assertNotEqual(p0.id, p1.id)
+
+ def testNamelessPageAsDict(self):
+ nameless_dict = page.Page('http://example.com/').AsDict()
+ self.assertIn('id', nameless_dict)
+ del nameless_dict['id']
+ self.assertEquals({
+ 'url': 'http://example.com/',
+ }, nameless_dict)
+
+ def testNamedPageAsDict(self):
+ named_dict = page.Page('http://example.com/', name='Example').AsDict()
+ self.assertIn('id', named_dict)
+ del named_dict['id']
+ self.assertEquals({
+ 'url': 'http://example.com/',
+ 'name': 'Example'
+ }, named_dict)
« no previous file with comments | « tools/telemetry/telemetry/page/page.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698