[Telemetry] Rename RunSmoothness to RunPageInteractions
[chromium-blink-merge.git] / tools / perf / measurements / task_execution_time_unittest.py
blob265da15a9ef954df4e806a98f6e4c6663216f7f9
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
3 # found in the LICENSE file.
5 from measurements import task_execution_time
6 from telemetry.core import wpr_modes
7 from telemetry.page import page as page_module
8 from telemetry.unittest_util import options_for_unittests
9 from telemetry.unittest_util import page_test_test_case
12 class TestTaskExecutionTimePage(page_module.Page):
13 def __init__(self, page_set, base_dir):
14 super(TestTaskExecutionTimePage, self).__init__(
15 'file://blank.html', page_set, base_dir)
17 def RunPageInteractions(self, action_runner):
18 interaction = action_runner.BeginGestureInteraction(
19 'ScrollAction', is_smooth=True)
20 action_runner.ScrollPage()
21 interaction.End()
24 class TaskExecutionTimeUnitTest(page_test_test_case.PageTestTestCase):
25 def setUp(self):
26 self._options = options_for_unittests.GetCopy()
27 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF
29 def testCorrectNumberOfResultsReturned(self):
30 ps = self.CreateEmptyPageSet()
31 ps.AddUserStory(TestTaskExecutionTimePage(ps, ps.base_dir))
32 measurement = task_execution_time.TaskExecutionTime()
34 results = self.RunMeasurement(measurement, ps, options=self._options)
36 self.assertEquals(
37 task_execution_time.TaskExecutionTime.GetExpectedResultCount(),
38 len(results.all_page_specific_values))
40 def testResultsAreDecreasing(self):
41 ps = self.CreateEmptyPageSet()
42 ps.AddUserStory(TestTaskExecutionTimePage(ps, ps.base_dir))
43 measurement = task_execution_time.TaskExecutionTime()
45 results = self.RunMeasurement(measurement, ps, options=self._options)
47 for first, second in zip(
48 results.all_page_specific_values, results.all_page_specific_values[1:]):
49 self.assertGreaterEqual(first.value, second.value)