Lei Zhang | 29278b4 | 2017-11-10 22:34:17 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # Copyright 2017 The Chromium Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | import os |
| 7 | import sys |
| 8 | import unittest |
| 9 | |
| 10 | import PRESUBMIT |
| 11 | |
| 12 | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
| 13 | from PRESUBMIT_test_mocks import MockFile, MockInputApi |
| 14 | |
| 15 | class InvalidOSMacroNamesTest(unittest.TestCase): |
| 16 | def testChromeDoesNotUseOSIOS(self): |
| 17 | lines = ['#if defined(OS_IOS)', |
| 18 | '#error OS_IOS not allowed', |
| 19 | '#endif'] |
| 20 | errors = PRESUBMIT._CheckNoOSIOSMacrosInChromeFile( |
| 21 | MockInputApi(), MockFile('chrome/path/foo_platform.cc', lines)) |
| 22 | self.assertEqual(1, len(errors)) |
| 23 | self.assertEqual(' chrome/path/foo_platform.cc:1', errors[0]) |
| 24 | |
| 25 | |
| 26 | if __name__ == '__main__': |
| 27 | unittest.main() |