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 os | 6 import os |
7 import re | 7 import re |
8 import unittest | 8 import unittest |
9 | 9 |
10 import PRESUBMIT | 10 import PRESUBMIT |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 self.assertTrue(':1 OS_WINDOWS' in errors[0]) | 362 self.assertTrue(':1 OS_WINDOWS' in errors[0]) |
363 self.assertTrue('(did you mean OS_WIN?)' in errors[0]) | 363 self.assertTrue('(did you mean OS_WIN?)' in errors[0]) |
364 | 364 |
365 def testValidOSMacroNames(self): | 365 def testValidOSMacroNames(self): |
366 lines = ['#if defined(%s)' % m for m in PRESUBMIT._VALID_OS_MACROS] | 366 lines = ['#if defined(%s)' % m for m in PRESUBMIT._VALID_OS_MACROS] |
367 errors = PRESUBMIT._CheckForInvalidOSMacrosInFile( | 367 errors = PRESUBMIT._CheckForInvalidOSMacrosInFile( |
368 MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) | 368 MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) |
369 self.assertEqual(0, len(errors)) | 369 self.assertEqual(0, len(errors)) |
370 | 370 |
371 | 371 |
| 372 class CheckAddedDepsHaveTetsApprovalsTest(unittest.TestCase): |
| 373 def testDepsFilesToCheck(self): |
| 374 changed_lines = [ |
| 375 '"+breakpad",', |
| 376 '"+chrome/installer",', |
| 377 '"+chrome/plugin/chrome_content_plugin_client.h",', |
| 378 '"+chrome/utility/chrome_content_utility_client.h",', |
| 379 '"+chromeos/chromeos_paths.h",', |
| 380 '"+components/breakpad",', |
| 381 '"+components/nacl/common",', |
| 382 '"+content/public/browser/render_process_host.h",', |
| 383 '"+grit", # For generated headers', |
| 384 '"+grit/generated_resources.h",', |
| 385 '"+grit/",', |
| 386 '"+policy", # For generated headers and source', |
| 387 '"+sandbox",', |
| 388 '"+tools/memory_watcher",', |
| 389 '"+third_party/lss/linux_syscall_support.h",', |
| 390 ] |
| 391 files_to_check = PRESUBMIT._DepsFilesToCheck(re, changed_lines) |
| 392 expected = set([ |
| 393 'breakpad/DEPS', |
| 394 'chrome/installer/DEPS', |
| 395 'chrome/plugin/DEPS', |
| 396 'chrome/utility/DEPS', |
| 397 'chromeos/DEPS', |
| 398 'components/breakpad/DEPS', |
| 399 'components/nacl/common/DEPS', |
| 400 'content/public/browser/DEPS', |
| 401 'policy/DEPS', |
| 402 'sandbox/DEPS', |
| 403 'tools/memory_watcher/DEPS', |
| 404 'third_party/lss/DEPS', |
| 405 ]) |
| 406 self.assertEqual(expected, files_to_check); |
| 407 |
| 408 |
372 if __name__ == '__main__': | 409 if __name__ == '__main__': |
373 unittest.main() | 410 unittest.main() |
OLD | NEW |