diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-05-09 14:22:11 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-05-09 15:11:45 +0000 |
commit | 2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c (patch) | |
tree | e75f511546c5fd1a173e87c1f9fb11d7ac8d1af3 /chromium/PRESUBMIT_test.py | |
parent | a4f3d46271c57e8155ba912df46a05559d14726e (diff) | |
download | qtwebengine-chromium-2ddb2d3e14eef3de7dbd0cef553d669b9ac2361c.tar.gz |
BASELINE: Update Chromium to 51.0.2704.41
Also adds in all smaller components by reversing logic for exclusion.
Change-Id: Ibf90b506e7da088ea2f65dcf23f2b0992c504422
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'chromium/PRESUBMIT_test.py')
-rwxr-xr-x | chromium/PRESUBMIT_test.py | 117 |
1 files changed, 111 insertions, 6 deletions
diff --git a/chromium/PRESUBMIT_test.py b/chromium/PRESUBMIT_test.py index 6b83350e73c..a8a3c27ab7f 100755 --- a/chromium/PRESUBMIT_test.py +++ b/chromium/PRESUBMIT_test.py @@ -3,12 +3,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import glob -import json -import os import re import subprocess -import sys import unittest import PRESUBMIT @@ -416,6 +412,20 @@ class CheckSingletonInHeadersTest(unittest.TestCase): self.assertEqual(0, len(warnings)) +class CheckNoDeprecatedCompiledResourcesGYPTest(unittest.TestCase): + def testNoDeprecatedCompiledResourcsGYP(self): + mock_input_api = MockInputApi() + mock_input_api.files = [MockFile('some/js/compiled_resources.gyp', [])] + errors = PRESUBMIT._CheckNoDeprecatedCompiledResourcesGYP(mock_input_api, + MockOutputApi()) + self.assertEquals(1, len(errors)) + + mock_input_api.files = [MockFile('some/js/compiled_resources2.gyp', [])] + errors = PRESUBMIT._CheckNoDeprecatedCompiledResourcesGYP(mock_input_api, + MockOutputApi()) + self.assertEquals(0, len(errors)) + + class InvalidOSMacroNamesTest(unittest.TestCase): def testInvalidOSMacroNames(self): lines = ['#if defined(OS_WINDOWS)', @@ -709,7 +719,6 @@ class TryServerMasterTest(unittest.TestCase): 'mac_nacl_sdk', 'mac_nacl_sdk_build', 'mac_rel_naclmore', - 'mac_valgrind', 'mac_x64_rel', 'mac_xcodebuild', ], @@ -729,7 +738,6 @@ class TryServerMasterTest(unittest.TestCase): 'android_x86_dbg', 'blink_android_compile_dbg', 'blink_android_compile_rel', - 'blink_presubmit', 'chromium_presubmit', 'linux_arm_cross_compile', 'linux_arm_tester', @@ -822,6 +830,103 @@ class UserMetricsActionTest(unittest.TestCase): output[0].message) +class PydepsNeedsUpdatingTest(unittest.TestCase): + + class MockSubprocess(object): + CalledProcessError = subprocess.CalledProcessError + + def setUp(self): + mock_all_pydeps = ['A.pydeps', 'B.pydeps'] + self.old_ALL_PYDEPS_FILES = PRESUBMIT._ALL_PYDEPS_FILES + PRESUBMIT._ALL_PYDEPS_FILES = mock_all_pydeps + self.mock_input_api = MockInputApi() + self.mock_output_api = MockOutputApi() + self.mock_input_api.subprocess = PydepsNeedsUpdatingTest.MockSubprocess() + self.checker = PRESUBMIT.PydepsChecker(self.mock_input_api, mock_all_pydeps) + self.checker._file_cache = { + 'A.pydeps': '# Generated by:\n# CMD A\nA.py\nC.py\n', + 'B.pydeps': '# Generated by:\n# CMD B\nB.py\nC.py\n', + } + + def tearDown(self): + PRESUBMIT._ALL_PYDEPS_FILES = self.old_ALL_PYDEPS_FILES + + def _RunCheck(self): + return PRESUBMIT._CheckPydepsNeedsUpdating(self.mock_input_api, + self.mock_output_api, + checker_for_tests=self.checker) + + def testAddedPydep(self): + self.mock_input_api.files = [ + MockAffectedFile('new.pydeps', [], action='A'), + ] + + results = self._RunCheck() + self.assertEqual(1, len(results)) + self.assertTrue('PYDEPS_FILES' in str(results[0])) + + def testRemovedPydep(self): + self.mock_input_api.files = [ + MockAffectedFile(PRESUBMIT._ALL_PYDEPS_FILES[0], [], action='D'), + ] + + results = self._RunCheck() + self.assertEqual(1, len(results)) + self.assertTrue('PYDEPS_FILES' in str(results[0])) + + def testRandomPyIgnored(self): + self.mock_input_api.files = [ + MockAffectedFile('random.py', []), + ] + + results = self._RunCheck() + self.assertEqual(0, len(results), 'Unexpected results: %r' % results) + + def testRelevantPyNoChange(self): + self.mock_input_api.files = [ + MockAffectedFile('A.py', []), + ] + + def mock_check_output(cmd, shell=False): + self.assertEqual('CMD A --output ""', cmd) + return self.checker._file_cache['A.pydeps'] + + self.mock_input_api.subprocess.check_output = mock_check_output + + results = self._RunCheck() + self.assertEqual(0, len(results), 'Unexpected results: %r' % results) + + def testRelevantPyOneChange(self): + self.mock_input_api.files = [ + MockAffectedFile('A.py', []), + ] + + def mock_check_output(cmd, shell=False): + self.assertEqual('CMD A --output ""', cmd) + return 'changed data' + + self.mock_input_api.subprocess.check_output = mock_check_output + + results = self._RunCheck() + self.assertEqual(1, len(results)) + self.assertTrue('File is stale' in str(results[0])) + + def testRelevantPyTwoChanges(self): + self.mock_input_api.files = [ + MockAffectedFile('C.py', []), + ] + + def mock_check_output(cmd, shell=False): + return 'changed data' + + self.mock_input_api.subprocess.check_output = mock_check_output + + results = self._RunCheck() + self.assertEqual(2, len(results)) + self.assertTrue('File is stale' in str(results[0])) + self.assertTrue('File is stale' in str(results[1])) + + class LogUsageTest(unittest.TestCase): def testCheckAndroidCrLogUsage(self): |