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 import sys | 4 import sys |
5 | 5 |
6 from measurements import smoothness | 6 from measurements import smoothness |
7 from telemetry.core import wpr_modes | 7 from telemetry.core import wpr_modes |
8 from telemetry.page import page | 8 from telemetry.page import page |
9 from telemetry.page import page_measurement_unittest_base | 9 from telemetry.page import page_measurement_unittest_base |
10 from telemetry.unittest import options_for_unittests | 10 from telemetry.unittest import options_for_unittests |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 test_page = page.Page('http://dummy', None) | 54 test_page = page.Page('http://dummy', None) |
55 test_page.synthetic_delays = { | 55 test_page.synthetic_delays = { |
56 'cc.BeginMainFrame': { 'target_duration': 0.012 }, | 56 'cc.BeginMainFrame': { 'target_duration': 0.012 }, |
57 'cc.DrawAndSwap': { 'target_duration': 0.012, 'mode': 'alternating' }, | 57 'cc.DrawAndSwap': { 'target_duration': 0.012, 'mode': 'alternating' }, |
58 'gpu.PresentingFrame': { 'target_duration': 0.012 } | 58 'gpu.PresentingFrame': { 'target_duration': 0.012 } |
59 } | 59 } |
60 | 60 |
61 tab = FakeTab() | 61 tab = FakeTab() |
62 measurement = smoothness.Smoothness() | 62 measurement = smoothness.Smoothness() |
63 measurement.WillStartBrowser(tab.browser) | 63 measurement.WillStartBrowser(tab.browser) |
| 64 measurement.WillNavigateToPage(test_page, tab) |
64 measurement.WillRunActions(test_page, tab) | 65 measurement.WillRunActions(test_page, tab) |
65 | 66 |
66 expected_category_filter = [ | 67 expected_category_filter = [ |
67 'DELAY(cc.BeginMainFrame;0.012000;static)', | 68 'DELAY(cc.BeginMainFrame;0.012000;static)', |
68 'DELAY(cc.DrawAndSwap;0.012000;alternating)', | 69 'DELAY(cc.DrawAndSwap;0.012000;alternating)', |
69 'DELAY(gpu.PresentingFrame;0.012000;static)', | 70 'DELAY(gpu.PresentingFrame;0.012000;static)', |
70 'benchmark' | 71 'benchmark' |
71 ] | 72 ] |
72 actual_category_filter = tab.browser.category_filter.split(',') | 73 actual_category_filter = tab.browser.category_filter.split(',') |
73 actual_category_filter.sort() | 74 actual_category_filter.sort() |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 measurement = smoothness.Smoothness() | 125 measurement = smoothness.Smoothness() |
125 results = self.RunMeasurement(measurement, ps, options=self._options) | 126 results = self.RunMeasurement(measurement, ps, options=self._options) |
126 self.assertEquals(0, len(results.failures)) | 127 self.assertEquals(0, len(results.failures)) |
127 | 128 |
128 mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') | 129 mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') |
129 self.assertEquals(len(mostly_smooth), 1) | 130 self.assertEquals(len(mostly_smooth), 1) |
130 self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) | 131 self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) |
131 | 132 |
132 def testCleanUpTrace(self): | 133 def testCleanUpTrace(self): |
133 self.TestTracingCleanedUp(smoothness.Smoothness, self._options) | 134 self.TestTracingCleanedUp(smoothness.Smoothness, self._options) |
OLD | NEW |