| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 from measurements import repaint | 5 from measurements import repaint |
| 6 from telemetry.core import wpr_modes | 6 from telemetry.core import wpr_modes |
| 7 from telemetry.page import page_measurement_unittest_base | |
| 8 from telemetry.page import page as page_module | 7 from telemetry.page import page as page_module |
| 8 from telemetry.testing import page_test_test_case |
| 9 from telemetry.unittest import options_for_unittests | 9 from telemetry.unittest import options_for_unittests |
| 10 from telemetry.unittest import test | 10 from telemetry.unittest import test |
| 11 | 11 |
| 12 | 12 |
| 13 class TestRepaintPage(page_module.Page): | 13 class TestRepaintPage(page_module.Page): |
| 14 def __init__(self, page_set, base_dir): | 14 def __init__(self, page_set, base_dir): |
| 15 super(TestRepaintPage, self).__init__('file://blank.html', | 15 super(TestRepaintPage, self).__init__('file://blank.html', |
| 16 page_set, base_dir) | 16 page_set, base_dir) |
| 17 | 17 |
| 18 def RunRepaint(self, action_runner): | 18 def RunRepaint(self, action_runner): |
| 19 action_runner.RepaintContinuously(seconds=2) | 19 action_runner.RepaintContinuously(seconds=2) |
| 20 | 20 |
| 21 | 21 |
| 22 class RepaintUnitTest( | 22 class RepaintUnitTest(page_test_test_case.PageTestTestCase): |
| 23 page_measurement_unittest_base.PageMeasurementUnitTestBase): | |
| 24 """Smoke test for repaint measurement | 23 """Smoke test for repaint measurement |
| 25 | 24 |
| 26 Runs repaint measurement on a simple page and verifies | 25 Runs repaint measurement on a simple page and verifies |
| 27 that all metrics were added to the results. The test is purely functional, | 26 that all metrics were added to the results. The test is purely functional, |
| 28 i.e. it only checks if the metrics are present and non-zero. | 27 i.e. it only checks if the metrics are present and non-zero. |
| 29 """ | 28 """ |
| 30 | 29 |
| 31 def setUp(self): | 30 def setUp(self): |
| 32 self._options = options_for_unittests.GetCopy() | 31 self._options = options_for_unittests.GetCopy() |
| 33 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF | 32 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF |
| (...skipping 17 matching lines...) Expand all Loading... |
| 51 self.assertEquals(len(jank), 1) | 50 self.assertEquals(len(jank), 1) |
| 52 self.assertGreater(jank[0].GetRepresentativeNumber(), 0) | 51 self.assertGreater(jank[0].GetRepresentativeNumber(), 0) |
| 53 | 52 |
| 54 mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') | 53 mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') |
| 55 self.assertEquals(len(mostly_smooth), 1) | 54 self.assertEquals(len(mostly_smooth), 1) |
| 56 self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) | 55 self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) |
| 57 | 56 |
| 58 @test.Disabled('android') | 57 @test.Disabled('android') |
| 59 def testCleanUpTrace(self): | 58 def testCleanUpTrace(self): |
| 60 self.TestTracingCleanedUp(repaint.Repaint, self._options) | 59 self.TestTracingCleanedUp(repaint.Repaint, self._options) |
| OLD | NEW |