diff options
-rw-r--r-- | chrome/common/extensions/PRESUBMIT.py | 6 | ||||
-rwxr-xr-x | chrome/common/extensions/PRESUBMIT_test.py | 13 |
2 files changed, 14 insertions, 5 deletions
diff --git a/chrome/common/extensions/PRESUBMIT.py b/chrome/common/extensions/PRESUBMIT.py index 1ab0964..46865d1 100644 --- a/chrome/common/extensions/PRESUBMIT.py +++ b/chrome/common/extensions/PRESUBMIT.py @@ -147,9 +147,9 @@ def StaticDocBuilt(static_file, input_api): """ for subdir in [APPS_DIR, EXTENSIONS_DIR]: generated_file = _FindFileInAlternateDir(static_file, subdir, input_api) - if not _ChangesMatch(generated_file, static_file): - return False - return True + if _ChangesMatch(generated_file, static_file): + return True + return False def _FindFileInAlternateDir(affected_file, alt_dir, input_api): """Return an AffectFile for the file in |alt_dir| that corresponds to diff --git a/chrome/common/extensions/PRESUBMIT_test.py b/chrome/common/extensions/PRESUBMIT_test.py index ac7a182d..d20ab930 100755 --- a/chrome/common/extensions/PRESUBMIT_test.py +++ b/chrome/common/extensions/PRESUBMIT_test.py @@ -259,18 +259,27 @@ class TestPresubmit(unittest.TestCase): FakeAffectedFile(local_path='chrome/common/extensions/docs/two.html')]) self.assertFalse(PRESUBMIT.NonGeneratedFilesEdited(input_api)) - def testStaticDocBuilt_ChangesMatch(self): + def testStaticDocBuilt_ChangesMatchApps(self): static_file = FakeAffectedFile( local_path='chrome/common/extensions/docs/static/index.html', changed_contents=[(3, 'foo!'), (4, 'bar!')]) generated_apps_file = FakeAffectedFile( local_path='chrome/common/extensions/docs/apps/index.html', changed_contents=[(13, 'foo!'), (14, 'bar!')]) + input_api = FakeInputApi(affected_files=[ + generated_apps_file, + static_file]) + + self.assertTrue(PRESUBMIT.StaticDocBuilt(static_file, input_api)) + + def testStaticDocBuilt_ChangesMatchExtensions(self): + static_file = FakeAffectedFile( + local_path='chrome/common/extensions/docs/static/index.html', + changed_contents=[(3, 'foo!'), (4, 'bar!')]) generated_extensions_file = FakeAffectedFile( local_path='chrome/common/extensions/docs/extensions/index.html', changed_contents=[(13, 'foo!'), (14, 'bar!')]) input_api = FakeInputApi(affected_files=[ - generated_apps_file, generated_extensions_file, static_file]) |