blob: 52393a43cb1a1f3b1e749bfed6d382f353ba1125 [file] [log] [blame]
Lei Zhang29278b42017-11-10 22:34:171#!/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
6import os
7import sys
8import unittest
9
10import PRESUBMIT
11
12sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
13from PRESUBMIT_test_mocks import MockFile, MockInputApi
14
15class 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
26if __name__ == '__main__':
27 unittest.main()