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

Unified Diff: tools/telemetry/telemetry/value/value_unittest_.py

Issue 27486002: Cleanup of page_measurement_results object (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: keep on trying Created 7 years, 1 month 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/value/value_backcompat.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/value/value_unittest_.py
diff --git a/tools/telemetry/telemetry/value/value_unittest_.py b/tools/telemetry/telemetry/value/value_unittest_.py
new file mode 100644
index 0000000000000000000000000000000000000000..0eba5074d293f503ee4ff43384d2486fa0136dbf
--- /dev/null
+++ b/tools/telemetry/telemetry/value/value_unittest_.py
@@ -0,0 +1,48 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+import os
+import unittest
+
+from telemetry import value
+from telemetry.page import page_set
+
+class TestBase(unittest.TestCase):
+ def setUp(self):
+ self.page_set = page_set.PageSet.FromDict({
+ "description": "hello",
+ "archive_path": "foo.wpr",
+ "pages": [
+ {"url": "http://www.bar.com/"},
+ {"url": "http://www.baz.com/"},
+ {"url": "http://www.foo.com/"}
+ ]
+ }, os.path.dirname(__file__))
+
+ @property
+ def pages(self):
+ return self.page_set.pages
+
+class ValueTest(TestBase):
+ def testCompat(self):
+ page0 = self.pages[0]
+ page1 = self.pages[0]
+
+ a = value.Value(page0, 'x', 'unit', important=False)
+ b = value.Value(page1, 'x', 'unit', important=False)
+ self.assertTrue(b.IsMergableWith(a))
+
+ def testIncompat(self):
+ page0 = self.pages[0]
+
+ a = value.Value(page0, 'x', 'unit', important=False)
+ b = value.Value(page0, 'x', 'incompatUnit', important=False)
+ self.assertFalse(b.IsMergableWith(a))
+
+ a = value.Value(page0, 'x', 'unit', important=False)
+ b = value.Value(page0, 'x', 'unit', important=True)
+ self.assertFalse(b.IsMergableWith(a))
+
+ a = value.Value(page0, 'x', 'unit', important=False)
+ b = value.ScalarValue(page0, 'x', 'unit', 3, important=True)
+ self.assertFalse(b.IsMergableWith(a))
« no previous file with comments | « tools/telemetry/telemetry/value/value_backcompat.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698