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 | 7 from telemetry.page import page_measurement_unittest_base |
8 from telemetry.page import page as page_module | 8 from telemetry.page import page as page_module |
9 # pylint: disable=W0401,W0614 | 9 # pylint: disable=W0401,W0614 |
10 from telemetry.page.actions.all_page_actions import * | 10 from telemetry.page.actions.all_page_actions import * |
11 from telemetry.unittest import options_for_unittests | 11 from telemetry.unittest import options_for_unittests |
12 from telemetry.unittest import test | 12 from telemetry.unittest import test |
13 | 13 |
14 | 14 |
15 class TestRepaintPage(page_module.Page): | 15 class TestRepaintPage(page_module.Page): |
16 def __init__(self, page_set, base_dir): | 16 def __init__(self, page_set, base_dir): |
17 super(TestRepaintPage, self).__init__('file://blank.html', | 17 super(TestRepaintPage, self).__init__('file://blank.html', |
18 page_set, base_dir) | 18 page_set, base_dir) |
19 | 19 |
20 def RunRepaint(self, action_runner): | 20 def RunRepaint(self, action_runner): |
21 action_runner.RunAction(RepaintContinuouslyAction({'seconds': 2})) | 21 action_runner.RepaintContinuously(seconds=2) |
22 | 22 |
23 | 23 |
24 class RepaintUnitTest( | 24 class RepaintUnitTest( |
25 page_measurement_unittest_base.PageMeasurementUnitTestBase): | 25 page_measurement_unittest_base.PageMeasurementUnitTestBase): |
26 """Smoke test for repaint measurement | 26 """Smoke test for repaint measurement |
27 | 27 |
28 Runs repaint measurement on a simple page and verifies | 28 Runs repaint measurement on a simple page and verifies |
29 that all metrics were added to the results. The test is purely functional, | 29 that all metrics were added to the results. The test is purely functional, |
30 i.e. it only checks if the metrics are present and non-zero. | 30 i.e. it only checks if the metrics are present and non-zero. |
31 """ | 31 """ |
(...skipping 21 matching lines...) Expand all Loading... |
53 self.assertEquals(len(jank), 1) | 53 self.assertEquals(len(jank), 1) |
54 self.assertGreater(jank[0].GetRepresentativeNumber(), 0) | 54 self.assertGreater(jank[0].GetRepresentativeNumber(), 0) |
55 | 55 |
56 mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') | 56 mostly_smooth = results.FindAllPageSpecificValuesNamed('mostly_smooth') |
57 self.assertEquals(len(mostly_smooth), 1) | 57 self.assertEquals(len(mostly_smooth), 1) |
58 self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) | 58 self.assertGreaterEqual(mostly_smooth[0].GetRepresentativeNumber(), 0) |
59 | 59 |
60 @test.Disabled('android') | 60 @test.Disabled('android') |
61 def testCleanUpTrace(self): | 61 def testCleanUpTrace(self): |
62 self.TestTracingCleanedUp(repaint.Repaint, self._options) | 62 self.TestTracingCleanedUp(repaint.Repaint, self._options) |
OLD | NEW |