summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgayane <gayane@chromium.org>2014-12-12 19:48:09 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-13 03:49:29 +0000
commite17026679329c19ce4c2b988ee0c33c9cfeaa7fc (patch)
tree7eacc8c2299477d77f39d4ad1f0779ce6b069301
parent80295948bf0bc43ebb640afd81fa152e9679fd36 (diff)
downloadchromium_src-e17026679329c19ce4c2b988ee0c33c9cfeaa7fc.zip
chromium_src-e17026679329c19ce4c2b988ee0c33c9cfeaa7fc.tar.gz
chromium_src-e17026679329c19ce4c2b988ee0c33c9cfeaa7fc.tar.bz2
Looking into all changed files to find actions.xml.
In case actions.xml is included in the changelist the chrome/browser/resources/PRESUBMIT.py shouldn't run because the presubmit for actions.xml will do more complete job. Fixing the bug to look into all changed files in the CL where previously it was only looking at subdirectories of current presubmit script to find actions.xml BUG=439978 Review URL: https://codereview.chromium.org/760163004 Cr-Commit-Position: refs/heads/master@{#308244}
-rw-r--r--PRESUBMIT_test_mocks.py1
-rw-r--r--chrome/browser/resources/PRESUBMIT.py4
-rw-r--r--chrome/browser/resources/PRESUBMIT_test.py11
3 files changed, 9 insertions, 7 deletions
diff --git a/PRESUBMIT_test_mocks.py b/PRESUBMIT_test_mocks.py
index f99671d..7d286b9 100644
--- a/PRESUBMIT_test_mocks.py
+++ b/PRESUBMIT_test_mocks.py
@@ -24,6 +24,7 @@ class MockInputApi(object):
self.subprocess = subprocess
self.files = []
self.is_committing = False
+ self.change = MockChange([])
def AffectedFiles(self, file_filter=None):
return self.files
diff --git a/chrome/browser/resources/PRESUBMIT.py b/chrome/browser/resources/PRESUBMIT.py
index e22e2a0..d603cc0 100644
--- a/chrome/browser/resources/PRESUBMIT.py
+++ b/chrome/browser/resources/PRESUBMIT.py
@@ -12,8 +12,8 @@ ACTION_XML_PATH = '../../../tools/metrics/actions/actions.xml'
def CheckUserActionUpdate(input_api, output_api, action_xml_path):
"""Checks if any new user action has been added."""
- if any('actions.xml' == input_api.os_path.basename(f.LocalPath()) for f in
- input_api.AffectedFiles()):
+ if any('actions.xml' == input_api.os_path.basename(f) for f in
+ input_api.change.LocalPaths()):
# If actions.xml is already included in the changelist, the PRESUBMIT
# for actions.xml will do a more complete presubmit check.
return []
diff --git a/chrome/browser/resources/PRESUBMIT_test.py b/chrome/browser/resources/PRESUBMIT_test.py
index 028da07..d46f3b7 100644
--- a/chrome/browser/resources/PRESUBMIT_test.py
+++ b/chrome/browser/resources/PRESUBMIT_test.py
@@ -11,16 +11,17 @@ import PRESUBMIT
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(
os.path.abspath(__file__))))))
-from PRESUBMIT_test_mocks import MockFile, MockInputApi, MockOutputApi
+from PRESUBMIT_test_mocks import MockInputApi, MockOutputApi
+from PRESUBMIT_test_mocks import MockFile, MockChange
class HTMLActionAdditionTest(unittest.TestCase):
def testActionXMLChanged(self):
mock_input_api = MockInputApi()
- mock_input_api.files = [
- MockFile('path/valid.html', ''),
- MockFile('actions.xml', '') ]
-
+ lines = ['<input id="testinput" pref="testpref"',
+ 'metric="validaction" type="checkbox" dialog-pref>']
+ mock_input_api.files = [MockFile('path/valid.html', lines)]
+ mock_input_api.change = MockChange(['path/valid.html','actions.xml'])
action_xml_path = self._createActionXMLFile()
self.assertEqual([], PRESUBMIT.CheckUserActionUpdate(mock_input_api,
MockOutputApi(),