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

Side by Side Diff: tools/perf/metrics/test_page_measurement_results.py

Issue 211133004: Added telemetry test metric network.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@loading_metrics
Patch Set: sync to head. 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 unified diff | Download patch
« no previous file with comments | « tools/perf/metrics/network_unittest.py ('k') | tools/perf/metrics/timeline_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from telemetry.page import page_measurement_results
6 from telemetry.page import page as page_module
7 from telemetry.value import scalar
8
9 class TestPageMeasurementResults(
10 page_measurement_results.PageMeasurementResults):
11 def __init__(self, test):
12 super(TestPageMeasurementResults, self).__init__()
13 self.test = test
14 page = page_module.Page("http://www.google.com", {})
15 self.WillMeasurePage(page)
16
17 def GetPageSpecificValueNamed(self, name):
18 values = [value for value in self.all_page_specific_values
19 if value.name == name]
20 assert len(values) == 1, 'Could not find value named %s' % name
21 return values[0]
22
23 def AssertHasPageSpecificScalarValue(self, name, units, expected_value):
24 value = self.GetPageSpecificValueNamed(name)
25 self.test.assertEquals(units, value.units)
26 self.test.assertTrue(isinstance(value, scalar.ScalarValue))
27 self.test.assertEquals(expected_value, value.value)
28
29 def __str__(self):
30 return '\n'.join([repr(x) for x in self.all_page_specific_values])
OLDNEW
« no previous file with comments | « tools/perf/metrics/network_unittest.py ('k') | tools/perf/metrics/timeline_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698