| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 glob | 6 import glob |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import subprocess | 10 import subprocess |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 | 368 |
| 369 def testGoodFiles(self): | 369 def testGoodFiles(self): |
| 370 mock_input_api = MockInputApi() | 370 mock_input_api = MockInputApi() |
| 371 mock_input_api.files = [ | 371 mock_input_api.files = [ |
| 372 MockFile('other/path/qux.h', ''), | 372 MockFile('other/path/qux.h', ''), |
| 373 MockFile('other/path/qux.cc', ''), | 373 MockFile('other/path/qux.cc', ''), |
| 374 ] | 374 ] |
| 375 results = PRESUBMIT._CheckPatchFiles(mock_input_api, MockOutputApi()) | 375 results = PRESUBMIT._CheckPatchFiles(mock_input_api, MockOutputApi()) |
| 376 self.assertEqual(0, len(results)) | 376 self.assertEqual(0, len(results)) |
| 377 | 377 |
| 378 def testOnlyOwnersFiles(self): | |
| 379 mock_change = MockChange([ | |
| 380 'some/path/OWNERS', | |
| 381 'A\Windows\Path\OWNERS', | |
| 382 ]) | |
| 383 results = PRESUBMIT.GetPreferredTryMasters(None, mock_change) | |
| 384 self.assertEqual({}, results) | |
| 385 | |
| 386 | 378 |
| 387 class InvalidOSMacroNamesTest(unittest.TestCase): | 379 class InvalidOSMacroNamesTest(unittest.TestCase): |
| 388 def testInvalidOSMacroNames(self): | 380 def testInvalidOSMacroNames(self): |
| 389 lines = ['#if defined(OS_WINDOWS)', | 381 lines = ['#if defined(OS_WINDOWS)', |
| 390 ' #elif defined(OS_WINDOW)', | 382 ' #elif defined(OS_WINDOW)', |
| 391 ' # if defined(OS_MACOSX) || defined(OS_CHROME)', | 383 ' # if defined(OS_MACOSX) || defined(OS_CHROME)', |
| 392 '# else // defined(OS_MAC)', | 384 '# else // defined(OS_MAC)', |
| 393 '#endif // defined(OS_MACOS)'] | 385 '#endif // defined(OS_MACOS)'] |
| 394 errors = PRESUBMIT._CheckForInvalidOSMacrosInFile( | 386 errors = PRESUBMIT._CheckForInvalidOSMacrosInFile( |
| 395 MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) | 387 MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 } | 747 } |
| 756 for master, bots in bots.iteritems(): | 748 for master, bots in bots.iteritems(): |
| 757 for bot in bots: | 749 for bot in bots: |
| 758 self.assertEqual(master, PRESUBMIT.GetTryServerMasterForBot(bot), | 750 self.assertEqual(master, PRESUBMIT.GetTryServerMasterForBot(bot), |
| 759 'bot=%s: expected %s, computed %s' % ( | 751 'bot=%s: expected %s, computed %s' % ( |
| 760 bot, master, PRESUBMIT.GetTryServerMasterForBot(bot))) | 752 bot, master, PRESUBMIT.GetTryServerMasterForBot(bot))) |
| 761 | 753 |
| 762 | 754 |
| 763 if __name__ == '__main__': | 755 if __name__ == '__main__': |
| 764 unittest.main() | 756 unittest.main() |
| OLD | NEW |