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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 self.assertTrue('(did you mean OS_WIN?)' in errors[0]) | 387 self.assertTrue('(did you mean OS_WIN?)' in errors[0]) |
388 | 388 |
389 def testValidOSMacroNames(self): | 389 def testValidOSMacroNames(self): |
390 lines = ['#if defined(%s)' % m for m in PRESUBMIT._VALID_OS_MACROS] | 390 lines = ['#if defined(%s)' % m for m in PRESUBMIT._VALID_OS_MACROS] |
391 errors = PRESUBMIT._CheckForInvalidOSMacrosInFile( | 391 errors = PRESUBMIT._CheckForInvalidOSMacrosInFile( |
392 MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) | 392 MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) |
393 self.assertEqual(0, len(errors)) | 393 self.assertEqual(0, len(errors)) |
394 | 394 |
395 | 395 |
396 class CheckAddedDepsHaveTetsApprovalsTest(unittest.TestCase): | 396 class CheckAddedDepsHaveTetsApprovalsTest(unittest.TestCase): |
397 def testDepsFilesToCheck(self): | 397 def testFilesToCheckForIncomingDeps(self): |
398 changed_lines = [ | 398 changed_lines = [ |
399 '"+breakpad",', | 399 '"+breakpad",', |
400 '"+chrome/installer",', | 400 '"+chrome/installer",', |
401 '"+chrome/plugin/chrome_content_plugin_client.h",', | 401 '"+chrome/plugin/chrome_content_plugin_client.h",', |
402 '"+chrome/utility/chrome_content_utility_client.h",', | 402 '"+chrome/utility/chrome_content_utility_client.h",', |
403 '"+chromeos/chromeos_paths.h",', | 403 '"+chromeos/chromeos_paths.h",', |
404 '"+components/breakpad",', | 404 '"+components/breakpad",', |
405 '"+components/nacl/common",', | 405 '"+components/nacl/common",', |
406 '"+content/public/browser/render_process_host.h",', | 406 '"+content/public/browser/render_process_host.h",', |
| 407 '"+jni/fooblat.h",', |
407 '"+grit", # For generated headers', | 408 '"+grit", # For generated headers', |
408 '"+grit/generated_resources.h",', | 409 '"+grit/generated_resources.h",', |
409 '"+grit/",', | 410 '"+grit/",', |
410 '"+policy", # For generated headers and source', | 411 '"+policy", # For generated headers and source', |
411 '"+sandbox",', | 412 '"+sandbox",', |
412 '"+tools/memory_watcher",', | 413 '"+tools/memory_watcher",', |
413 '"+third_party/lss/linux_syscall_support.h",', | 414 '"+third_party/lss/linux_syscall_support.h",', |
414 ] | 415 ] |
415 files_to_check = PRESUBMIT._DepsFilesToCheck(re, changed_lines) | 416 files_to_check = PRESUBMIT._FilesToCheckForIncomingDeps(re, changed_lines) |
416 expected = set([ | 417 expected = set([ |
417 'breakpad/DEPS', | 418 'breakpad/DEPS', |
418 'chrome/installer/DEPS', | 419 'chrome/installer/DEPS', |
419 'chrome/plugin/DEPS', | 420 'chrome/plugin/chrome_content_plugin_client.h', |
420 'chrome/utility/DEPS', | 421 'chrome/utility/chrome_content_utility_client.h', |
421 'chromeos/DEPS', | 422 'chromeos/chromeos_paths.h', |
422 'components/breakpad/DEPS', | 423 'components/breakpad/DEPS', |
423 'components/nacl/common/DEPS', | 424 'components/nacl/common/DEPS', |
424 'content/public/browser/DEPS', | 425 'content/public/browser/render_process_host.h', |
425 'policy/DEPS', | 426 'policy/DEPS', |
426 'sandbox/DEPS', | 427 'sandbox/DEPS', |
427 'tools/memory_watcher/DEPS', | 428 'tools/memory_watcher/DEPS', |
428 'third_party/lss/DEPS', | 429 'third_party/lss/linux_syscall_support.h', |
429 ]) | 430 ]) |
430 self.assertEqual(expected, files_to_check); | 431 self.assertEqual(expected, files_to_check); |
431 | 432 |
432 | 433 |
433 if __name__ == '__main__': | 434 if __name__ == '__main__': |
434 unittest.main() | 435 unittest.main() |
OLD | NEW |