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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/perf/measurements/task_execution_time_unittest.py
diff --git a/tools/perf/measurements/task_execution_time_unittest.py b/tools/perf/measurements/task_execution_time_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..560ff5dfae89b3dc710f6fe990670ec1a665c890
--- /dev/null
+++ b/tools/perf/measurements/task_execution_time_unittest.py
@@ -0,0 +1,49 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from measurements import task_execution_time
+from telemetry.core import wpr_modes
+from telemetry.page import page as page_module
+from telemetry.unittest import options_for_unittests
+from telemetry.unittest import page_test_test_case
+
+
+class TestTaskExecutionTimePage(page_module.Page):
+ def __init__(self, page_set, base_dir):
+ super(TestTaskExecutionTimePage, self).__init__(
+ 'file://blank.html', page_set, base_dir)
+
+ def RunTaskExecutionTime(self, action_runner):
+ interaction = action_runner.BeginGestureInteraction(
+ 'ScrollAction', is_smooth=True)
+ action_runner.ScrollPage()
+ interaction.End()
+
+
+class TaskExecutionTimeUnitTest(page_test_test_case.PageTestTestCase):
+ def setUp(self):
+ self._options = options_for_unittests.GetCopy()
+ self._options.browser_options.wpr_mode = wpr_modes.WPR_OFF
+
+ def testCorrectNumberOfResultsReturned(self):
+ ps = self.CreateEmptyPageSet()
+ ps.AddPage(TestTaskExecutionTimePage(ps, ps.base_dir))
+ measurement = task_execution_time.TaskExecutionTime()
+
+ results = self.RunMeasurement(measurement, ps, options=self._options)
+
+ self.assertEquals(
+ task_execution_time.TaskExecutionTime.GetExpectedResultCount(),
+ len(results.all_page_specific_values))
+
+ def testResultsAreDecreasing(self):
+ ps = self.CreateEmptyPageSet()
+ ps.AddPage(TestTaskExecutionTimePage(ps, ps.base_dir))
+ measurement = task_execution_time.TaskExecutionTime()
+
+ results = self.RunMeasurement(measurement, ps, options=self._options)
+
+ for first, second in zip(
+ results.all_page_specific_values, results.all_page_specific_values[1:]):
+ self.assertGreaterEqual(first.value, second.value)
« 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