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.
5 from telemetry
.page
import page
as page_module
6 from telemetry
.results
import page_test_results
7 from telemetry
.value
import scalar
10 class TestPageTestResults(
11 page_test_results
.PageTestResults
):
12 def __init__(self
, test
):
13 super(TestPageTestResults
, self
).__init
__()
15 page
= page_module
.Page("http://www.google.com", {})
16 self
.WillRunPage(page
)
18 def GetPageSpecificValueNamed(self
, name
):
19 values
= [value
for value
in self
.all_page_specific_values
20 if value
.name
== name
]
21 assert len(values
) == 1, 'Could not find value named %s' % name
24 def AssertHasPageSpecificScalarValue(self
, name
, units
, expected_value
):
25 value
= self
.GetPageSpecificValueNamed(name
)
26 self
.test
.assertEquals(units
, value
.units
)
27 self
.test
.assertTrue(isinstance(value
, scalar
.ScalarValue
))
28 self
.test
.assertEquals(expected_value
, value
.value
)
31 return '\n'.join([repr(x
) for x
in self
.all_page_specific_values
])