Commit e1702667 authored by gayane's avatar gayane Committed by Commit bot

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}
parent 80295948
......@@ -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
......
......@@ -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 []
......
......@@ -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(),
......
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