| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import feature_compiler | 6 import feature_compiler |
| 7 import unittest | 7 import unittest |
| 8 | 8 |
| 9 class FeatureCompilerTest(unittest.TestCase): | 9 class FeatureCompilerTest(unittest.TestCase): |
| 10 """Test the FeatureCompiler. Note that we test that the expected features are | 10 """Test the FeatureCompiler. Note that we test that the expected features are |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 'location': 'component', | 43 'location': 'component', |
| 44 'internal': True, | 44 'internal': True, |
| 45 'matches': ['*://*/*'], | 45 'matches': ['*://*/*'], |
| 46 'max_manifest_version': 1, | 46 'max_manifest_version': 1, |
| 47 'noparent': True, | 47 'noparent': True, |
| 48 'platforms': ['mac', 'win'], | 48 'platforms': ['mac', 'win'], |
| 49 'whitelist': ['zzz', 'yyy'] | 49 'whitelist': ['zzz', 'yyy'] |
| 50 }) | 50 }) |
| 51 self.assertFalse(f.errors) | 51 self.assertFalse(f.errors) |
| 52 | 52 |
| 53 def testInvalidAll(self): |
| 54 f = self._parseFeature({ |
| 55 'channel': 'stable', |
| 56 'dependencies': 'all', |
| 57 }) |
| 58 self._hasError(f, 'Illegal value: "all"') |
| 59 |
| 53 def testUnknownKeyError(self): | 60 def testUnknownKeyError(self): |
| 54 f = self._parseFeature({ | 61 f = self._parseFeature({ |
| 55 'contexts': ['blessed_extension'], | 62 'contexts': ['blessed_extension'], |
| 56 'channel': 'stable', | 63 'channel': 'stable', |
| 57 'unknownkey': 'unknownvalue' | 64 'unknownkey': 'unknownvalue' |
| 58 }) | 65 }) |
| 59 self._hasError(f, 'Unrecognized key') | 66 self._hasError(f, 'Unrecognized key') |
| 60 | 67 |
| 61 def testUnknownEnumValue(self): | 68 def testUnknownEnumValue(self): |
| 62 f = self._parseFeature({ | 69 f = self._parseFeature({ |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 self.assertFalse(channel_feature.errors) | 138 self.assertFalse(channel_feature.errors) |
| 132 dependency_feature = self._parseFeature( | 139 dependency_feature = self._parseFeature( |
| 133 {'contexts': ['blessed_extension'], | 140 {'contexts': ['blessed_extension'], |
| 134 'dependencies': ['alpha']}) | 141 'dependencies': ['alpha']}) |
| 135 dependency_feature.Validate('APIFeature') | 142 dependency_feature.Validate('APIFeature') |
| 136 self.assertFalse(dependency_feature.errors) | 143 self.assertFalse(dependency_feature.errors) |
| 137 | 144 |
| 138 | 145 |
| 139 if __name__ == '__main__': | 146 if __name__ == '__main__': |
| 140 unittest.main() | 147 unittest.main() |
| OLD | NEW |