OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import unittest | 5 import unittest |
6 | 6 |
7 from metrics import test_page_test_results | |
8 from metrics import timeline | 7 from metrics import timeline |
| 8 from telemetry.unittest_util import test_page_test_results |
9 from telemetry.timeline import model as model_module | 9 from telemetry.timeline import model as model_module |
10 from telemetry.web_perf import timeline_interaction_record as tir_module | 10 from telemetry.web_perf import timeline_interaction_record as tir_module |
11 | 11 |
12 def _GetInteractionRecord(start, end): | 12 def _GetInteractionRecord(start, end): |
13 return tir_module.TimelineInteractionRecord("test-record", start, end) | 13 return tir_module.TimelineInteractionRecord("test-record", start, end) |
14 | 14 |
15 | 15 |
16 class LoadTimesTimelineMetric(unittest.TestCase): | 16 class LoadTimesTimelineMetric(unittest.TestCase): |
17 def GetResults(self, metric, model, renderer_thread, interaction_records): | 17 def GetResults(self, metric, model, renderer_thread, interaction_records): |
18 results = test_page_test_results.TestPageTestResults(self) | 18 results = test_page_test_results.TestPageTestResults(self) |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 metric.details_to_report = timeline.ReportMainThreadOnly | 178 metric.details_to_report = timeline.ReportMainThreadOnly |
179 results = self.GetResults(metric, model, renderer_main.parent, | 179 results = self.GetResults(metric, model, renderer_main.parent, |
180 [_GetInteractionRecord(10, 30)]) | 180 [_GetInteractionRecord(10, 30)]) |
181 | 181 |
182 # Test a couple specific results. | 182 # Test a couple specific results. |
183 assert_results = { | 183 assert_results = { |
184 timeline.ThreadCpuTimeResultName('renderer_main') : 9.0, | 184 timeline.ThreadCpuTimeResultName('renderer_main') : 9.0, |
185 } | 185 } |
186 for name, value in assert_results.iteritems(): | 186 for name, value in assert_results.iteritems(): |
187 results.AssertHasPageSpecificScalarValue(name, 'ms', value) | 187 results.AssertHasPageSpecificScalarValue(name, 'ms', value) |
OLD | NEW |