diff options
Diffstat (limited to 'chromium/PRESUBMIT_test.py')
-rwxr-xr-x | chromium/PRESUBMIT_test.py | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/chromium/PRESUBMIT_test.py b/chromium/PRESUBMIT_test.py index c6f01c89fef..5c52d08996e 100755 --- a/chromium/PRESUBMIT_test.py +++ b/chromium/PRESUBMIT_test.py @@ -2888,6 +2888,22 @@ class StringTest(unittest.TestCase): '</message>', '</grit-part>') + NEW_GRDP_CONTENTS5 = ( + '<?xml version="1.0" encoding="utf-8"?>', + '<grit-part>', + '<message name="IDS_PART_TEST1" meaning="Meaning with typo.">', + 'Part string 1', + '</message>', + '</grit-part>') + + NEW_GRDP_CONTENTS6 = ( + '<?xml version="1.0" encoding="utf-8"?>', + '<grit-part>', + '<message name="IDS_PART_TEST1" meaning="Meaning with typo fixed.">', + 'Part string 1', + '</message>', + '</grit-part>') + # A grdp file with one ICU syntax message without syntax errors. NEW_GRDP_CONTENTS_ICU_SYNTAX_OK1 = ( '<?xml version="1.0" encoding="utf-8"?>', @@ -2993,12 +3009,12 @@ class StringTest(unittest.TestCase): def testModifiedMessageDescription(self): # CL modified a message description for a message that does not yet have a - # screenshot. Should warn. + # screenshot. Should not warn. input_api = self.makeInputApi([ MockAffectedFile('part.grdp', self.NEW_GRDP_CONTENTS3, self.NEW_GRDP_CONTENTS4, action='M')]) warnings = PRESUBMIT.CheckStrings(input_api, MockOutputApi()) - self.assertEqual(1, len(warnings)) + self.assertEqual(0, len(warnings)) # CL modified a message description for a message that already has a # screenshot. Should not warn. @@ -3010,6 +3026,25 @@ class StringTest(unittest.TestCase): warnings = PRESUBMIT.CheckStrings(input_api, MockOutputApi()) self.assertEqual(0, len(warnings)) + def testModifiedMessageMeaning(self): + # CL modified a message meaning for a message that does not yet have a + # screenshot. Should warn. + input_api = self.makeInputApi([ + MockAffectedFile('part.grdp', self.NEW_GRDP_CONTENTS5, + self.NEW_GRDP_CONTENTS6, action='M')]) + warnings = PRESUBMIT.CheckStrings(input_api, MockOutputApi()) + self.assertEqual(1, len(warnings)) + + # CL modified a message meaning for a message that already has a + # screenshot. Should not warn. + input_api = self.makeInputApi([ + MockAffectedFile('part.grdp', self.NEW_GRDP_CONTENTS5, + self.NEW_GRDP_CONTENTS6, action='M'), + MockFile(os.path.join('part_grdp', 'IDS_PART_TEST1.png.sha1'), + 'binary', action='A')]) + warnings = PRESUBMIT.CheckStrings(input_api, MockOutputApi()) + self.assertEqual(0, len(warnings)) + def testPngAddedSha1NotAdded(self): # CL added one new message in a grd file and added the png file associated # with it, but did not add the corresponding sha1 file. This should warn |