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

Unified Diff: tools/telemetry/telemetry/value/histogram_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
Index: tools/telemetry/telemetry/value/histogram_unittest.py
diff --git a/tools/telemetry/telemetry/value/histogram_unittest.py b/tools/telemetry/telemetry/value/histogram_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..a399c665a60949a001f2cb435bfcf1a1016d8da3
--- /dev/null
+++ b/tools/telemetry/telemetry/value/histogram_unittest.py
@@ -0,0 +1,49 @@
+# 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
+from telemetry.value.histogram import HistogramValue
+
+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 testHistogramBasic(self):
+ page0 = self.pages[0]
+ histogram = HistogramValue(
+ page0, 'x', 'counts',
+ raw_value_json='{"buckets": [{"low": 1, "high": 2, "count": 1}]}',
+ important=False)
+ self.assertEquals(
+ ['{"buckets": [{"low": 1, "high": 2, "count": 1}]}'],
+ histogram.GetBuildbotValue())
+ self.assertEquals(1.5,
+ histogram.GetRepresentativeNumber())
+ self.assertEquals(
+ ['{"buckets": [{"low": 1, "high": 2, "count": 1}]}'],
+ histogram.GetBuildbotValue())
+
+ self.assertEquals(
+ 'unimportant-histogram',
+ histogram.GetBuildbotDataType(value.SUMMARY_RESULT_OUTPUT_CONTEXT))
+ histogram.important = True
+ self.assertEquals(
+ 'histogram',
+ histogram.GetBuildbotDataType(value.SUMMARY_RESULT_OUTPUT_CONTEXT))
« no previous file with comments | « tools/telemetry/telemetry/value/histogram.py ('k') | tools/telemetry/telemetry/value/list_of_scalar_values.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698