| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 | 409 |
| 410 def testSingletonInCC(self): | 410 def testSingletonInCC(self): |
| 411 diff_cc = ['Foo* foo = base::Singleton<Foo>::get();'] | 411 diff_cc = ['Foo* foo = base::Singleton<Foo>::get();'] |
| 412 mock_input_api = MockInputApi() | 412 mock_input_api = MockInputApi() |
| 413 mock_input_api.files = [MockAffectedFile('some/path/foo.cc', diff_cc)] | 413 mock_input_api.files = [MockAffectedFile('some/path/foo.cc', diff_cc)] |
| 414 warnings = PRESUBMIT._CheckSingletonInHeaders(mock_input_api, | 414 warnings = PRESUBMIT._CheckSingletonInHeaders(mock_input_api, |
| 415 MockOutputApi()) | 415 MockOutputApi()) |
| 416 self.assertEqual(0, len(warnings)) | 416 self.assertEqual(0, len(warnings)) |
| 417 | 417 |
| 418 | 418 |
| 419 class CheckNoDeprecatedCompiledResourcesGYPTest(unittest.TestCase): |
| 420 def testNoDeprecatedCompiledResourcsGYP(self): |
| 421 mock_input_api = MockInputApi() |
| 422 mock_input_api.files = [MockFile('some/js/compiled_resources.gyp', [])] |
| 423 errors = PRESUBMIT._CheckNoDeprecatedCompiledResourcesGYP(mock_input_api, |
| 424 MockOutputApi()) |
| 425 self.assertEquals(1, len(errors)) |
| 426 |
| 427 mock_input_api.files = [MockFile('some/js/compiled_resources2.gyp', [])] |
| 428 errors = PRESUBMIT._CheckNoDeprecatedCompiledResourcesGYP(mock_input_api, |
| 429 MockOutputApi()) |
| 430 self.assertEquals(0, len(errors)) |
| 431 |
| 432 |
| 419 class InvalidOSMacroNamesTest(unittest.TestCase): | 433 class InvalidOSMacroNamesTest(unittest.TestCase): |
| 420 def testInvalidOSMacroNames(self): | 434 def testInvalidOSMacroNames(self): |
| 421 lines = ['#if defined(OS_WINDOWS)', | 435 lines = ['#if defined(OS_WINDOWS)', |
| 422 ' #elif defined(OS_WINDOW)', | 436 ' #elif defined(OS_WINDOW)', |
| 423 ' # if defined(OS_MACOSX) || defined(OS_CHROME)', | 437 ' # if defined(OS_MACOSX) || defined(OS_CHROME)', |
| 424 '# else // defined(OS_MAC)', | 438 '# else // defined(OS_MAC)', |
| 425 '#endif // defined(OS_MACOS)'] | 439 '#endif // defined(OS_MACOS)'] |
| 426 errors = PRESUBMIT._CheckForInvalidOSMacrosInFile( | 440 errors = PRESUBMIT._CheckForInvalidOSMacrosInFile( |
| 427 MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) | 441 MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) |
| 428 self.assertEqual(len(lines), len(errors)) | 442 self.assertEqual(len(lines), len(errors)) |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 ['char* host = "https://www.aol.com"; // google.com']) | 986 ['char* host = "https://www.aol.com"; // google.com']) |
| 973 ] | 987 ] |
| 974 | 988 |
| 975 warnings = PRESUBMIT._CheckHardcodedGoogleHostsInLowerLayers( | 989 warnings = PRESUBMIT._CheckHardcodedGoogleHostsInLowerLayers( |
| 976 input_api, MockOutputApi()) | 990 input_api, MockOutputApi()) |
| 977 self.assertEqual(0, len(warnings)) | 991 self.assertEqual(0, len(warnings)) |
| 978 | 992 |
| 979 | 993 |
| 980 if __name__ == '__main__': | 994 if __name__ == '__main__': |
| 981 unittest.main() | 995 unittest.main() |
| OLD | NEW |