| 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.path | 6 import os.path |
| 7 import re | 7 import re |
| 8 import subprocess | 8 import subprocess |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 406 |
| 407 def testSingletonInCC(self): | 407 def testSingletonInCC(self): |
| 408 diff_cc = ['Foo* foo = base::Singleton<Foo>::get();'] | 408 diff_cc = ['Foo* foo = base::Singleton<Foo>::get();'] |
| 409 mock_input_api = MockInputApi() | 409 mock_input_api = MockInputApi() |
| 410 mock_input_api.files = [MockAffectedFile('some/path/foo.cc', diff_cc)] | 410 mock_input_api.files = [MockAffectedFile('some/path/foo.cc', diff_cc)] |
| 411 warnings = PRESUBMIT._CheckSingletonInHeaders(mock_input_api, | 411 warnings = PRESUBMIT._CheckSingletonInHeaders(mock_input_api, |
| 412 MockOutputApi()) | 412 MockOutputApi()) |
| 413 self.assertEqual(0, len(warnings)) | 413 self.assertEqual(0, len(warnings)) |
| 414 | 414 |
| 415 | 415 |
| 416 class CheckNoDeprecatedCompiledResourcesGypTest(unittest.TestCase): |
| 417 def testNoDeprecatedCompiledResourcsGyp(self): |
| 418 mock_input_api = MockInputApi() |
| 419 mock_input_api.files = [MockFile('some/js/compiled_resources.gyp', [])] |
| 420 errors = PRESUBMIT._CheckNoDeprecatedCompiledResourcesGyp(mock_input_api, |
| 421 MockOutputApi()) |
| 422 self.assertEquals(1, len(errors)) |
| 423 |
| 424 mock_input_api.files = [MockFile('some/js/compiled_resources2.gyp', [])] |
| 425 errors = PRESUBMIT._CheckNoDeprecatedCompiledResourcesGyp(mock_input_api, |
| 426 MockOutputApi()) |
| 427 self.assertEquals(0, len(errors)) |
| 428 |
| 429 |
| 416 class InvalidOSMacroNamesTest(unittest.TestCase): | 430 class InvalidOSMacroNamesTest(unittest.TestCase): |
| 417 def testInvalidOSMacroNames(self): | 431 def testInvalidOSMacroNames(self): |
| 418 lines = ['#if defined(OS_WINDOWS)', | 432 lines = ['#if defined(OS_WINDOWS)', |
| 419 ' #elif defined(OS_WINDOW)', | 433 ' #elif defined(OS_WINDOW)', |
| 420 ' # if defined(OS_MACOSX) || defined(OS_CHROME)', | 434 ' # if defined(OS_MACOSX) || defined(OS_CHROME)', |
| 421 '# else // defined(OS_MAC)', | 435 '# else // defined(OS_MAC)', |
| 422 '#endif // defined(OS_MACOS)'] | 436 '#endif // defined(OS_MACOS)'] |
| 423 errors = PRESUBMIT._CheckForInvalidOSMacrosInFile( | 437 errors = PRESUBMIT._CheckForInvalidOSMacrosInFile( |
| 424 MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) | 438 MockInputApi(), MockFile('some/path/foo_platform.cc', lines)) |
| 425 self.assertEqual(len(lines), len(errors)) | 439 self.assertEqual(len(lines), len(errors)) |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 mock_input_api.files = [ | 1333 mock_input_api.files = [ |
| 1320 MockAffectedFile('chrome/browser/resources/blah.js', 'arrow => OK here'), | 1334 MockAffectedFile('chrome/browser/resources/blah.js', 'arrow => OK here'), |
| 1321 ] | 1335 ] |
| 1322 warnings = PRESUBMIT._CheckForRiskyJsFeatures( | 1336 warnings = PRESUBMIT._CheckForRiskyJsFeatures( |
| 1323 mock_input_api, MockOutputApi()) | 1337 mock_input_api, MockOutputApi()) |
| 1324 self.assertEqual(0, len(warnings)) | 1338 self.assertEqual(0, len(warnings)) |
| 1325 | 1339 |
| 1326 | 1340 |
| 1327 if __name__ == '__main__': | 1341 if __name__ == '__main__': |
| 1328 unittest.main() | 1342 unittest.main() |
| OLD | NEW |