| OLD | NEW |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import unittest | 5 import unittest |
| 6 | 6 |
| 7 from telemetry.story import expectations | 7 from telemetry.story import expectations |
| 8 from telemetry.testing import fakes | 8 from telemetry.testing import fakes |
| 9 | 9 |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 self.assertTrue(expectations.ALL_MOBILE.ShouldDisable(self._platform)) | 87 self.assertTrue(expectations.ALL_MOBILE.ShouldDisable(self._platform)) |
| 88 | 88 |
| 89 | 89 |
| 90 class StoryExpectationsTest(unittest.TestCase): | 90 class StoryExpectationsTest(unittest.TestCase): |
| 91 def setUp(self): | 91 def setUp(self): |
| 92 self.platform = fakes.FakePlatform() | 92 self.platform = fakes.FakePlatform() |
| 93 | 93 |
| 94 def testCantDisableAfterInit(self): | 94 def testCantDisableAfterInit(self): |
| 95 e = expectations.StoryExpectations() | 95 e = expectations.StoryExpectations() |
| 96 with self.assertRaises(AssertionError): | 96 with self.assertRaises(AssertionError): |
| 97 e.DisableBenchmark(['test'], 'test') | 97 e.PermanentlyDisableBenchmark(['test'], 'test') |
| 98 with self.assertRaises(AssertionError): | 98 with self.assertRaises(AssertionError): |
| 99 e.DisableStory('story', ['platform'], 'reason') | 99 e.DisableStory('story', ['platform'], 'reason') |
| 100 | 100 |
| 101 def testDisableBenchmark(self): | 101 def testPermanentlyDisableBenchmark(self): |
| 102 class FooExpectations(expectations.StoryExpectations): | 102 class FooExpectations(expectations.StoryExpectations): |
| 103 def SetExpectations(self): | 103 def SetExpectations(self): |
| 104 self.DisableBenchmark([expectations.ALL_WIN], 'crbug.com/123') | 104 self.PermanentlyDisableBenchmark( |
| 105 [expectations.ALL_WIN], 'crbug.com/123') |
| 105 | 106 |
| 106 e = FooExpectations() | 107 e = FooExpectations() |
| 107 self.platform.SetOSName('win') | 108 self.platform.SetOSName('win') |
| 108 | 109 |
| 109 reason = e.IsBenchmarkDisabled(self.platform) | 110 reason = e.IsBenchmarkDisabled(self.platform) |
| 110 self.assertEqual(reason, 'crbug.com/123') | 111 self.assertEqual(reason, 'crbug.com/123') |
| 111 | 112 |
| 112 self.platform.SetOSName('android') | 113 self.platform.SetOSName('android') |
| 113 reason = e.IsBenchmarkDisabled(self.platform) | 114 reason = e.IsBenchmarkDisabled(self.platform) |
| 114 self.assertIsNone(reason) | 115 self.assertIsNone(reason) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 149 |
| 149 def testDisableStoryWithLongName(self): | 150 def testDisableStoryWithLongName(self): |
| 150 class FooExpectations(expectations.StoryExpectations): | 151 class FooExpectations(expectations.StoryExpectations): |
| 151 def SetExpectations(self): | 152 def SetExpectations(self): |
| 152 self.DisableStory( | 153 self.DisableStory( |
| 153 '123456789012345678901234567890123456789012345678901', | 154 '123456789012345678901234567890123456789012345678901', |
| 154 [expectations.ALL], 'Too Long') | 155 [expectations.ALL], 'Too Long') |
| 155 | 156 |
| 156 with self.assertRaises(AssertionError): | 157 with self.assertRaises(AssertionError): |
| 157 FooExpectations() | 158 FooExpectations() |
| OLD | NEW |