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

Unified Diff: tools/telemetry/telemetry/test.py

Issue 17438002: [telemetry] test_runner and run_benchmarks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
Index: tools/telemetry/telemetry/test.py
diff --git a/tools/telemetry/telemetry/test.py b/tools/telemetry/telemetry/test.py
new file mode 100644
index 0000000000000000000000000000000000000000..b39cc7bf2242d66dc3c541dc473cb42d11b8258c
--- /dev/null
+++ b/tools/telemetry/telemetry/test.py
@@ -0,0 +1,34 @@
+# Copyright (c) 2013 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 telemetry.page import page_runner
+from telemetry.page import page_set
+from telemetry.page import page_test
+
+
+class Test(object):
+ def Run(self, options):
+ raise NotImplementedError()
+
+
+class TelemetryTest(Test):
+ options = {}
+ enabled = True
+
+ def Run(self, options):
+ assert hasattr(self, 'test'), 'This test has no "test" attribute.'
+ assert issubclass(self.test, page_test.PageTest), (
+ '"%s" is not a PageTest.' % self.test.__name__)
+
+ for key, value in self.options.iteritems():
+ setattr(options, key, value)
+
+ test = self.test()
+ ps = self.CreatePageSet(options)
+ results = page_runner.Run(test, ps, options)
+ results.PrintSummary()
+ return len(results.failures) + len(results.errors)
+
+ def CreatePageSet(self, options): # pylint: disable=W0613
+ assert hasattr(self, 'page_set'), 'This test has no "page_set" attribute.'
+ return page_set.PageSet.FromFile(self.page_set)

Powered by Google App Engine
This is Rietveld 408576698