2 # Copyright 2017 The Chromium Authors
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
12 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
13 from PRESUBMIT_test_mocks import MockFile, MockInputApi
15 class DisallowedBuildFlagsTest(unittest.TestCase):
16 def testChromeDoesNotUseISAPPLE(self):
17 lines = ['#if BUILDFLAG(IS_APPLE)',
18 '#error IS_APPLE not allowed',
20 errors = PRESUBMIT._CheckNoIsAppleBuildFlagsInChromeFile(
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])
25 def testChromeDoesNotUseISIOS(self):
26 lines = ['#if BUILDFLAG(IS_IOS)',
27 '#error IS_IOS not allowed',
29 errors = PRESUBMIT._CheckNoIsIOSBuildFlagsInChromeFile(
30 MockInputApi(), MockFile('chrome/path/foo_platform.cc', lines))
31 self.assertEqual(1, len(errors))
32 self.assertEqual(' chrome/path/foo_platform.cc:1', errors[0])
34 if __name__ == '__main__':