| 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 # pylint: disable=W0401,W0614 | 10 # pylint: disable=W0401,W0614 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 self.category_filter = category_filter | 27 self.category_filter = category_filter |
| 28 | 28 |
| 29 | 29 |
| 30 class AnimatedPage(page.Page): | 30 class AnimatedPage(page.Page): |
| 31 def __init__(self, page_set): | 31 def __init__(self, page_set): |
| 32 super(AnimatedPage, self).__init__( | 32 super(AnimatedPage, self).__init__( |
| 33 url='file://animated_page.html', | 33 url='file://animated_page.html', |
| 34 page_set=page_set, base_dir=page_set.base_dir) | 34 page_set=page_set, base_dir=page_set.base_dir) |
| 35 | 35 |
| 36 def RunSmoothness(self, action_runner): | 36 def RunSmoothness(self, action_runner): |
| 37 action_runner.RunAction(WaitAction({'seconds': 1})) | 37 action_runner.Wait(1) |
| 38 | 38 |
| 39 | 39 |
| 40 class FakeTab(object): | 40 class FakeTab(object): |
| 41 def __init__(self): | 41 def __init__(self): |
| 42 self.browser = FakeBrowser() | 42 self.browser = FakeBrowser() |
| 43 | 43 |
| 44 def ExecuteJavaScript(self, js): | 44 def ExecuteJavaScript(self, js): |
| 45 pass | 45 pass |
| 46 | 46 |
| 47 class SmoothnessUnitTest( | 47 class SmoothnessUnitTest( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 measurement = smoothness.Smoothness() | 120 measurement = smoothness.Smoothness() |
| 121 results = self.RunMeasurement(measurement, ps, options=self._options) | 121 results = self.RunMeasurement(measurement, ps, options=self._options) |
| 122 self.assertEquals(0, len(results.failures)) | 122 self.assertEquals(0, len(results.failures)) |
| 123 | 123 |
| 124 mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') | 124 mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') |
| 125 self.assertEquals(len(mostly_smooth), 1) | 125 self.assertEquals(len(mostly_smooth), 1) |
| 126 self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) | 126 self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) |
| 127 | 127 |
| 128 def testCleanUpTrace(self): | 128 def testCleanUpTrace(self): |
| 129 self.TestTracingCleanedUp(smoothness.Smoothness, self._options) | 129 self.TestTracingCleanedUp(smoothness.Smoothness, self._options) |
| OLD | NEW |