Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: tools/perf/measurements/task_execution_time_unittest.py

Issue 636203002: Task Execution Duration metrics added as a new benchmark (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: White space fix + removal of debug code Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
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 import options_for_unittests
9 from telemetry.unittest import page_test_test_case
10
11
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)
16
17 def RunTaskExecutionTime(self, action_runner):
18 interaction = action_runner.BeginGestureInteraction(
19 'ScrollAction', is_smooth=True)
20 action_runner.ScrollPage()
21 interaction.End()
22
23
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
28
29 def testCorrectNumberOfResultsReturned(self):
30 ps = self.CreateEmptyPageSet()
31 ps.AddPage(TestTaskExecutionTimePage(ps, ps.base_dir))
32 measurement = task_execution_time.TaskExecutionTime()
33
34 results = self.RunMeasurement(measurement, ps, options=self._options)
35
36 self.assertEquals(
37 task_execution_time.TaskExecutionTime.GetExpectedResultCount(),
38 len(results.all_page_specific_values))
39
40 def testResultsAreDecreasing(self):
41 ps = self.CreateEmptyPageSet()
42 ps.AddPage(TestTaskExecutionTimePage(ps, ps.base_dir))
43 measurement = task_execution_time.TaskExecutionTime()
44
45 results = self.RunMeasurement(measurement, ps, options=self._options)
46
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)
OLDNEW
« no previous file with comments | « tools/perf/measurements/task_execution_time.py ('k') | tools/perf/page_sets/key_mobile_sites.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698