Commit b9a383d7 authored by yoz@chromium.org's avatar yoz@chromium.org

Fix extension docs presubmit. One, not all, of the subdirs should have matching static docs.

BUG=111465

Review URL: https://chromiumcodereview.appspot.com/10834214

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150431 0039d316-1c4b-4281-b951-d872f2087c98
parent e7fc06b2
...@@ -147,9 +147,9 @@ def StaticDocBuilt(static_file, input_api): ...@@ -147,9 +147,9 @@ def StaticDocBuilt(static_file, input_api):
""" """
for subdir in [APPS_DIR, EXTENSIONS_DIR]: for subdir in [APPS_DIR, EXTENSIONS_DIR]:
generated_file = _FindFileInAlternateDir(static_file, subdir, input_api) generated_file = _FindFileInAlternateDir(static_file, subdir, input_api)
if not _ChangesMatch(generated_file, static_file): if _ChangesMatch(generated_file, static_file):
return False return True
return True return False
def _FindFileInAlternateDir(affected_file, alt_dir, input_api): def _FindFileInAlternateDir(affected_file, alt_dir, input_api):
"""Return an AffectFile for the file in |alt_dir| that corresponds to """Return an AffectFile for the file in |alt_dir| that corresponds to
......
...@@ -259,18 +259,27 @@ class TestPresubmit(unittest.TestCase): ...@@ -259,18 +259,27 @@ class TestPresubmit(unittest.TestCase):
FakeAffectedFile(local_path='chrome/common/extensions/docs/two.html')]) FakeAffectedFile(local_path='chrome/common/extensions/docs/two.html')])
self.assertFalse(PRESUBMIT.NonGeneratedFilesEdited(input_api)) self.assertFalse(PRESUBMIT.NonGeneratedFilesEdited(input_api))
def testStaticDocBuilt_ChangesMatch(self): def testStaticDocBuilt_ChangesMatchApps(self):
static_file = FakeAffectedFile( static_file = FakeAffectedFile(
local_path='chrome/common/extensions/docs/static/index.html', local_path='chrome/common/extensions/docs/static/index.html',
changed_contents=[(3, 'foo!'), (4, 'bar!')]) changed_contents=[(3, 'foo!'), (4, 'bar!')])
generated_apps_file = FakeAffectedFile( generated_apps_file = FakeAffectedFile(
local_path='chrome/common/extensions/docs/apps/index.html', local_path='chrome/common/extensions/docs/apps/index.html',
changed_contents=[(13, 'foo!'), (14, 'bar!')]) 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( generated_extensions_file = FakeAffectedFile(
local_path='chrome/common/extensions/docs/extensions/index.html', local_path='chrome/common/extensions/docs/extensions/index.html',
changed_contents=[(13, 'foo!'), (14, 'bar!')]) changed_contents=[(13, 'foo!'), (14, 'bar!')])
input_api = FakeInputApi(affected_files=[ input_api = FakeInputApi(affected_files=[
generated_apps_file,
generated_extensions_file, generated_extensions_file,
static_file]) static_file])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment