summaryrefslogtreecommitdiff
path: root/chromium/PRESUBMIT_test.py
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-13 15:05:36 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-02-14 10:33:47 +0000
commite684a3455bcc29a6e3e66a004e352dea4e1141e7 (patch)
treed55b4003bde34d7d05f558f02cfd82b2a66a7aac /chromium/PRESUBMIT_test.py
parent2b94bfe47ccb6c08047959d1c26e392919550e86 (diff)
downloadqtwebengine-chromium-e684a3455bcc29a6e3e66a004e352dea4e1141e7.tar.gz
BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0
Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/PRESUBMIT_test.py')
-rwxr-xr-xchromium/PRESUBMIT_test.py167
1 files changed, 119 insertions, 48 deletions
diff --git a/chromium/PRESUBMIT_test.py b/chromium/PRESUBMIT_test.py
index 0fbda0c302b..a04f7424c72 100755
--- a/chromium/PRESUBMIT_test.py
+++ b/chromium/PRESUBMIT_test.py
@@ -1391,54 +1391,6 @@ class ForwardDeclarationTest(unittest.TestCase):
self.assertEqual(4, len(warnings))
-class RiskyJsTest(unittest.TestCase):
- def testArrowWarnInIos9Code(self):
- mock_input_api = MockInputApi()
- mock_output_api = MockOutputApi()
-
- mock_input_api.files = [
- MockAffectedFile('components/blah.js', ["shouldn't use => here"]),
- ]
- warnings = PRESUBMIT._CheckForRiskyJsFeatures(
- mock_input_api, mock_output_api)
- self.assertEqual(1, len(warnings))
-
- mock_input_api.files = [
- MockAffectedFile('ios/blee.js', ['might => break folks']),
- ]
- warnings = PRESUBMIT._CheckForRiskyJsFeatures(
- mock_input_api, mock_output_api)
- self.assertEqual(1, len(warnings))
-
- mock_input_api.files = [
- MockAffectedFile('ui/webui/resources/blarg.js', ['on => iOS9']),
- ]
- warnings = PRESUBMIT._CheckForRiskyJsFeatures(
- mock_input_api, mock_output_api)
- self.assertEqual(1, len(warnings))
-
- def testArrowsAllowedInChromeCode(self):
- mock_input_api = MockInputApi()
- mock_input_api.files = [
- MockAffectedFile('chrome/browser/resources/blah.js', 'arrow => OK here'),
- ]
- warnings = PRESUBMIT._CheckForRiskyJsFeatures(
- mock_input_api, MockOutputApi())
- self.assertEqual(0, len(warnings))
-
- def testConstLetWarningIos9Code(self):
- mock_input_api = MockInputApi()
- mock_output_api = MockOutputApi()
-
- mock_input_api.files = [
- MockAffectedFile('components/blah.js', [" const foo = 'bar';"]),
- MockAffectedFile('ui/webui/resources/blah.js', [" let foo = 3;"]),
- ]
- warnings = PRESUBMIT._CheckForRiskyJsFeatures(
- mock_input_api, mock_output_api)
- self.assertEqual(2, len(warnings))
-
-
class RelativeIncludesTest(unittest.TestCase):
def testThirdPartyNotWebKitIgnored(self):
mock_input_api = MockInputApi()
@@ -1611,6 +1563,125 @@ class NewHeaderWithoutGnChangeTest(unittest.TestCase):
self.assertTrue('base/another.h' in warnings[0].items)
+class CorrectProductNameInMessagesTest(unittest.TestCase):
+ def testProductNameInDesc(self):
+ mock_input_api = MockInputApi()
+ mock_input_api.files = [
+ MockAffectedFile('chrome/app/google_chrome_strings.grd', [
+ '<message name="Foo" desc="Welcome to Chrome">',
+ ' Welcome to Chrome!',
+ '</message>',
+ ]),
+ MockAffectedFile('chrome/app/chromium_strings.grd', [
+ '<message name="Bar" desc="Welcome to Chrome">',
+ ' Welcome to Chromium!',
+ '</message>',
+ ]),
+ ]
+ warnings = PRESUBMIT._CheckCorrectProductNameInMessages(
+ mock_input_api, MockOutputApi())
+ self.assertEqual(0, len(warnings))
+
+ def testChromeInChromium(self):
+ mock_input_api = MockInputApi()
+ mock_input_api.files = [
+ MockAffectedFile('chrome/app/google_chrome_strings.grd', [
+ '<message name="Foo" desc="Welcome to Chrome">',
+ ' Welcome to Chrome!',
+ '</message>',
+ ]),
+ MockAffectedFile('chrome/app/chromium_strings.grd', [
+ '<message name="Bar" desc="Welcome to Chrome">',
+ ' Welcome to Chrome!',
+ '</message>',
+ ]),
+ ]
+ warnings = PRESUBMIT._CheckCorrectProductNameInMessages(
+ mock_input_api, MockOutputApi())
+ self.assertEqual(1, len(warnings))
+ self.assertTrue('chrome/app/chromium_strings.grd' in warnings[0].items[0])
+
+ def testChromiumInChrome(self):
+ mock_input_api = MockInputApi()
+ mock_input_api.files = [
+ MockAffectedFile('chrome/app/google_chrome_strings.grd', [
+ '<message name="Foo" desc="Welcome to Chrome">',
+ ' Welcome to Chromium!',
+ '</message>',
+ ]),
+ MockAffectedFile('chrome/app/chromium_strings.grd', [
+ '<message name="Bar" desc="Welcome to Chrome">',
+ ' Welcome to Chromium!',
+ '</message>',
+ ]),
+ ]
+ warnings = PRESUBMIT._CheckCorrectProductNameInMessages(
+ mock_input_api, MockOutputApi())
+ self.assertEqual(1, len(warnings))
+ self.assertTrue(
+ 'chrome/app/google_chrome_strings.grd:2' in warnings[0].items[0])
+
+ def testMultipleInstances(self):
+ mock_input_api = MockInputApi()
+ mock_input_api.files = [
+ MockAffectedFile('chrome/app/chromium_strings.grd', [
+ '<message name="Bar" desc="Welcome to Chrome">',
+ ' Welcome to Chrome!',
+ '</message>',
+ '<message name="Baz" desc="A correct message">',
+ ' Chromium is the software you are using.',
+ '</message>',
+ '<message name="Bat" desc="An incorrect message">',
+ ' Google Chrome is the software you are using.',
+ '</message>',
+ ]),
+ ]
+ warnings = PRESUBMIT._CheckCorrectProductNameInMessages(
+ mock_input_api, MockOutputApi())
+ self.assertEqual(1, len(warnings))
+ self.assertTrue(
+ 'chrome/app/chromium_strings.grd:2' in warnings[0].items[0])
+ self.assertTrue(
+ 'chrome/app/chromium_strings.grd:8' in warnings[0].items[1])
+
+ def testMultipleWarnings(self):
+ mock_input_api = MockInputApi()
+ mock_input_api.files = [
+ MockAffectedFile('chrome/app/chromium_strings.grd', [
+ '<message name="Bar" desc="Welcome to Chrome">',
+ ' Welcome to Chrome!',
+ '</message>',
+ '<message name="Baz" desc="A correct message">',
+ ' Chromium is the software you are using.',
+ '</message>',
+ '<message name="Bat" desc="An incorrect message">',
+ ' Google Chrome is the software you are using.',
+ '</message>',
+ ]),
+ MockAffectedFile('components/components_google_chrome_strings.grd', [
+ '<message name="Bar" desc="Welcome to Chrome">',
+ ' Welcome to Chrome!',
+ '</message>',
+ '<message name="Baz" desc="A correct message">',
+ ' Chromium is the software you are using.',
+ '</message>',
+ '<message name="Bat" desc="An incorrect message">',
+ ' Google Chrome is the software you are using.',
+ '</message>',
+ ]),
+ ]
+ warnings = PRESUBMIT._CheckCorrectProductNameInMessages(
+ mock_input_api, MockOutputApi())
+ self.assertEqual(2, len(warnings))
+ self.assertTrue(
+ 'components/components_google_chrome_strings.grd:5'
+ in warnings[0].items[0])
+ self.assertTrue(
+ 'chrome/app/chromium_strings.grd:2' in warnings[1].items[0])
+ self.assertTrue(
+ 'chrome/app/chromium_strings.grd:8' in warnings[1].items[1])
+
+
class MojoManifestOwnerTest(unittest.TestCase):
def testMojoManifestChangeNeedsSecurityOwner(self):
mock_input_api = MockInputApi()