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

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: Nits fixed in unit test 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 class TestTaskExecutionTimePage(page_module.Page):
12 def __init__(self, page_set, base_dir):
13 super(TestTaskExecutionTimePage, self).__init__('file://blank.html',
14 page_set, base_dir)
petrcermak 2014/10/13 16:46:23 The indentation is not in line with the style guid
15
16 def RunTaskExecutionTime(self, action_runner):
17 interaction = action_runner.BeginGestureInteraction(
18 'ScrollAction', is_smooth=True)
19 action_runner.ScrollPage()
20 interaction.End()
21
22
23 def dump(obj):
24 for attr in dir(obj):
25 print "obj.%s = %s" % (attr, getattr(obj, attr))
26
27 class TaskExecutionTimeUnitTest(page_test_test_case.PageTestTestCase):
28 def setUp(self):
29 self._options = options_for_unittests.GetCopy()
30 self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF
31
32 def testCorrectNumberOfResultsReturned(self):
33 ps = self.CreateEmptyPageSet()
34 ps.AddPage(TestTaskExecutionTimePage(ps, ps.base_dir))
35 measurement = task_execution_time.TaskExecutionTime()
36
37 results = self.RunMeasurement(measurement, ps, options=self._options)
38
39 self.assertEquals(
40 task_execution_time.TaskExecutionTime.GetExpectedResultCount(),
41 len(results.all_page_specific_values))
42
43 def testResultsAreDecreasing(self):
44 ps = self.CreateEmptyPageSet()
45 ps.AddPage(TestTaskExecutionTimePage(ps, ps.base_dir))
46 measurement = task_execution_time.TaskExecutionTime()
47
48 results = self.RunMeasurement(measurement, ps, options=self._options)
49
50 for first, second in zip(results.all_page_specific_values,
51 results.all_page_specific_values[1:]):
petrcermak 2014/10/13 16:46:23 ditto.
picksi1 2014/10/16 09:44:28 Done.
52 self.assertGreaterEqual(first.value, second.value)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698