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

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

Issue 820433003: Enable smoothness.tough_pinch_zoom_cases on Chrome OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@powermonitor
Patch Set: Add test Created 6 years 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/decorators.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/decorators_unittest.py
diff --git a/tools/telemetry/telemetry/decorators_unittest.py b/tools/telemetry/telemetry/decorators_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..a39d9bb5d6f9b0dce9b144d178e9f9783241a04d
--- /dev/null
+++ b/tools/telemetry/telemetry/decorators_unittest.py
@@ -0,0 +1,84 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
tonyg 2014/12/19 17:24:03 Thanks for adding these. FYI, there are also some
nednguyen 2014/12/20 01:18:22 A bunch of test cases in run_tests_unittest do not
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import unittest
+
+from telemetry import decorators
+
+
+class FakePlatform(object):
+ def GetOSName(self):
+ return 'os_name'
+
+ def GetOSVersionName(self):
+ return 'os_version_name'
+
+
+class FakePossibleBrowser(object):
+ def __init__(self):
+ self.browser_type = 'browser_type'
+ self.platform = FakePlatform()
+ self.supports_tab_control = False
+
+
+class FakeTest(object):
+ def SetEnabledStrings(self, enabled_strings):
+ # pylint: disable=W0201
+ self._enabled_strings = enabled_strings
+
+ def SetDisabledStrings(self, disabled_strings):
+ # pylint: disable=W0201
+ self._disabled_strings = disabled_strings
+
+
+class TestShouldSkip(unittest.TestCase):
+ def testEnabledStrings(self):
+ test = FakeTest()
+ possible_browser = FakePossibleBrowser()
+
+ # When no enabled_strings is given, everything should be enabled.
+ self.assertFalse(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetEnabledStrings(['os_name'])
+ self.assertFalse(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetEnabledStrings(['another_os_name'])
+ self.assertTrue(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetEnabledStrings(['os_version_name'])
+ self.assertFalse(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetEnabledStrings(['os_name', 'another_os_name'])
+ self.assertFalse(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetEnabledStrings(['another_os_name', 'os_name'])
+ self.assertFalse(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetEnabledStrings(['another_os_name', 'another_os_version_name'])
+ self.assertTrue(decorators.ShouldSkip(test, possible_browser)[0])
+
+ def testDisabledStrings(self):
+ test = FakeTest()
+ possible_browser = FakePossibleBrowser()
+
+ # When no disabled_strings is given, nothing should be disabled.
+ self.assertFalse(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetDisabledStrings(['os_name'])
+ self.assertTrue(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetDisabledStrings(['another_os_name'])
+ self.assertFalse(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetDisabledStrings(['os_version_name'])
+ self.assertTrue(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetDisabledStrings(['os_name', 'another_os_name'])
+ self.assertTrue(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetDisabledStrings(['another_os_name', 'os_name'])
+ self.assertTrue(decorators.ShouldSkip(test, possible_browser)[0])
+
+ test.SetDisabledStrings(['another_os_name', 'another_os_version_name'])
+ self.assertFalse(decorators.ShouldSkip(test, possible_browser)[0])
« no previous file with comments | « tools/telemetry/telemetry/decorators.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698