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 telemetry.timeline import model as model_module |
| 8 from telemetry.unittest_util import test_page_test_results |
| 9 from telemetry.web_perf import timeline_interaction_record as tir_module |
| 10 |
7 from metrics import timeline | 11 from metrics import timeline |
8 from telemetry.unittest_util import test_page_test_results | 12 |
9 from telemetry.timeline import model as model_module | |
10 from telemetry.web_perf import timeline_interaction_record as tir_module | |
11 | 13 |
12 def _GetInteractionRecord(start, end): | 14 def _GetInteractionRecord(start, end): |
13 return tir_module.TimelineInteractionRecord("test-record", start, end) | 15 return tir_module.TimelineInteractionRecord("test-record", start, end) |
14 | 16 |
15 | 17 |
16 class LoadTimesTimelineMetric(unittest.TestCase): | 18 class LoadTimesTimelineMetric(unittest.TestCase): |
17 def GetResults(self, metric, model, renderer_thread, interaction_records): | 19 def GetResults(self, metric, model, renderer_thread, interaction_records): |
18 results = test_page_test_results.TestPageTestResults(self) | 20 results = test_page_test_results.TestPageTestResults(self) |
19 metric.AddResults(model, renderer_thread, interaction_records, results) | 21 metric.AddResults(model, renderer_thread, interaction_records, results) |
20 return results | 22 return results |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 metric.details_to_report = timeline.ReportMainThreadOnly | 180 metric.details_to_report = timeline.ReportMainThreadOnly |
179 results = self.GetResults(metric, model, renderer_main.parent, | 181 results = self.GetResults(metric, model, renderer_main.parent, |
180 [_GetInteractionRecord(10, 30)]) | 182 [_GetInteractionRecord(10, 30)]) |
181 | 183 |
182 # Test a couple specific results. | 184 # Test a couple specific results. |
183 assert_results = { | 185 assert_results = { |
184 timeline.ThreadCpuTimeResultName('renderer_main') : 9.0, | 186 timeline.ThreadCpuTimeResultName('renderer_main') : 9.0, |
185 } | 187 } |
186 for name, value in assert_results.iteritems(): | 188 for name, value in assert_results.iteritems(): |
187 results.AssertHasPageSpecificScalarValue(name, 'ms', value) | 189 results.AssertHasPageSpecificScalarValue(name, 'ms', value) |
OLD | NEW |