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

Unified Diff: tools/perf/metrics/metric_unittest.py

Issue 191383003: First cut of chrome-proxy (data reduction proxy) measurements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 9 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
Index: tools/perf/metrics/metric_unittest.py
diff --git a/tools/perf/metrics/metric_unittest.py b/tools/perf/metrics/metric_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..e1df8bda27f63f1efeca3b99554494cf4f1ca126
--- /dev/null
+++ b/tools/perf/metrics/metric_unittest.py
@@ -0,0 +1,30 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
tonyg 2014/03/25 16:19:39 This file isn't named correctly, the name makes it
bolian 2014/03/25 18:19:01 sounds good. Done.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from telemetry.page import page_measurement_results
+from telemetry.page import page as page_module
+from telemetry.value import scalar
+
+class TestPageMeasurementResults(
+ page_measurement_results.PageMeasurementResults):
+ def __init__(self, test):
+ super(TestPageMeasurementResults, self).__init__()
+ self.test = test
+ page = page_module.Page("http://www.google.com", {})
+ self.WillMeasurePage(page)
+
+ def GetPageSpecificValueNamed(self, name):
+ values = [value for value in self.all_page_specific_values
+ if value.name == name]
+ assert len(values) == 1, 'Could not find value named %s' % name
+ return values[0]
+
+ def AssertHasPageSpecificScalarValue(self, name, units, expected_value):
+ value = self.GetPageSpecificValueNamed(name)
+ self.test.assertEquals(units, value.units)
+ self.test.assertTrue(isinstance(value, scalar.ScalarValue))
+ self.test.assertEquals(expected_value, value.value)
+
+ def __str__(self):
+ return '\n'.join([repr(x) for x in self.all_page_specific_values])

Powered by Google App Engine
This is Rietveld 408576698