| 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 task_execution_time | 5 from measurements import task_execution_time |
| 6 from telemetry.core import wpr_modes | 6 from telemetry.core import wpr_modes |
| 7 from telemetry.page import page as page_module | 7 from telemetry.page import page as page_module |
| 8 from telemetry.unittest import options_for_unittests | 8 from telemetry.unittest import options_for_unittests |
| 9 from telemetry.unittest import page_test_test_case | 9 from telemetry.unittest import page_test_test_case |
| 10 | 10 |
| 11 | 11 |
| 12 class TestTaskExecutionTimePage(page_module.Page): | 12 class TestTaskExecutionTimePage(page_module.Page): |
| 13 def __init__(self, page_set, base_dir): | 13 def __init__(self, page_set, base_dir): |
| 14 super(TestTaskExecutionTimePage, self).__init__( | 14 super(TestTaskExecutionTimePage, self).__init__( |
| 15 'file://blank.html', page_set, base_dir) | 15 'file://blank.html', page_set, base_dir) |
| 16 | 16 |
| 17 def RunTaskExecutionTime(self, action_runner): | 17 def RunSmoothness(self, action_runner): |
| 18 interaction = action_runner.BeginGestureInteraction( | 18 interaction = action_runner.BeginGestureInteraction( |
| 19 'ScrollAction', is_smooth=True) | 19 'ScrollAction', is_smooth=True) |
| 20 action_runner.ScrollPage() | 20 action_runner.ScrollPage() |
| 21 interaction.End() | 21 interaction.End() |
| 22 | 22 |
| 23 | 23 |
| 24 class TaskExecutionTimeUnitTest(page_test_test_case.PageTestTestCase): | 24 class TaskExecutionTimeUnitTest(page_test_test_case.PageTestTestCase): |
| 25 def setUp(self): | 25 def setUp(self): |
| 26 self._options = options_for_unittests.GetCopy() | 26 self._options = options_for_unittests.GetCopy() |
| 27 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF | 27 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF |
| (...skipping 12 matching lines...) Expand all Loading... |
| 40 def testResultsAreDecreasing(self): | 40 def testResultsAreDecreasing(self): |
| 41 ps = self.CreateEmptyPageSet() | 41 ps = self.CreateEmptyPageSet() |
| 42 ps.AddPage(TestTaskExecutionTimePage(ps, ps.base_dir)) | 42 ps.AddPage(TestTaskExecutionTimePage(ps, ps.base_dir)) |
| 43 measurement = task_execution_time.TaskExecutionTime() | 43 measurement = task_execution_time.TaskExecutionTime() |
| 44 | 44 |
| 45 results = self.RunMeasurement(measurement, ps, options=self._options) | 45 results = self.RunMeasurement(measurement, ps, options=self._options) |
| 46 | 46 |
| 47 for first, second in zip( | 47 for first, second in zip( |
| 48 results.all_page_specific_values, results.all_page_specific_values[1:]): | 48 results.all_page_specific_values, results.all_page_specific_values[1:]): |
| 49 self.assertGreaterEqual(first.value, second.value) | 49 self.assertGreaterEqual(first.value, second.value) |
| OLD | NEW |