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

Unified Diff: tools/telemetry/telemetry/page/page_test_unittest.py

Issue 737403002: Revert of telemetry: Remove command line args from page test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/telemetry/telemetry/page/page_test.py ('k') | tools/telemetry/telemetry/page/record_wpr.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/page/page_test_unittest.py
diff --git a/tools/telemetry/telemetry/page/page_test_unittest.py b/tools/telemetry/telemetry/page/page_test_unittest.py
index 665754886aea7f1e1eb87b05b404079cf043359a..2589b6fc9cecb152bcb1b872b20f372aaf3fe73c 100644
--- a/tools/telemetry/telemetry/page/page_test_unittest.py
+++ b/tools/telemetry/telemetry/page/page_test_unittest.py
@@ -20,6 +20,19 @@
class PageTestThatFails(page_test.PageTest):
def ValidateAndMeasurePage(self, page, tab, results):
raise exceptions.IntentionalException
+
+
+class PageTestThatHasDefaults(page_test.PageTest):
+ def AddCommandLineArgs(self, parser):
+ parser.add_option('-x', dest='x', default=3)
+
+ def ValidateAndMeasurePage(self, page, tab, results):
+ if not hasattr(self.options, 'x'):
+ raise page_test.MeasurementFailure('Default option was not set.')
+ if self.options.x != 3:
+ raise page_test.MeasurementFailure(
+ 'Expected x == 3, got x == ' + self.options.x)
+ results.AddValue(scalar.ScalarValue(page, 'x', 'ms', 7))
class PageTestForBlank(page_test.PageTest):
@@ -88,6 +101,14 @@
all_results = self.RunMeasurement(measurement, ps, options=self._options)
self.assertEquals(1, len(all_results.failures))
+ def testDefaults(self):
+ ps = self.CreatePageSetFromFileInUnittestDataDir('blank.html')
+ measurement = PageTestThatHasDefaults()
+ all_results = self.RunMeasurement(measurement, ps, options=self._options)
+ self.assertEquals(len(all_results.all_page_specific_values), 1)
+ self.assertEquals(
+ all_results.all_page_specific_values[0].value, 7)
+
# This test is disabled because it runs against live sites, and needs to be
# fixed. crbug.com/179038
@benchmark.Disabled
« no previous file with comments | « tools/telemetry/telemetry/page/page_test.py ('k') | tools/telemetry/telemetry/page/record_wpr.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698