Remove API-specific checks for deprecated apps code commits
https://crrev.com/2b456f2d8f2e6c0bfd3b12dff34f2df974816825 added a check for any JS files that used a series of app and extension APIs and signaled a warning if these APIs were used. However, many (or even the majority) of these APIs are exposed to contexts beyond Chrome Apps, including extensions, web contexts, and WebUI. This results in developers in these areas receiving noisy presubmit errors (and encourages ignoring them altogether). Remove all of these and add a TODO to add back in the list of APIs that is exposed exclusively to Chrome Apps. This does not affect the checks added for nacl, pnacl, or others. Bug: b:160753993 Change-Id: I651117f4bfccb5f2e02eee8d497f0b865d9d5f1c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2877683 Auto-Submit: Devlin <rdevlin.cronin@chromium.org> Commit-Queue: Devlin <rdevlin.cronin@chromium.org> Reviewed-by: Dirk Pranke <dpranke@google.com> Cr-Commit-Position: refs/heads/master@{#880080}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
e6fb29be2f
commit
0cefab3944
59
PRESUBMIT.py
59
PRESUBMIT.py
@ -4692,65 +4692,6 @@ def CheckForUseOfChromeAppsDeprecations(input_api, output_api):
|
||||
r'.+%s' % _IMPLEMENTATION_EXTENSIONS ),
|
||||
files_to_skip = [r"^ppapi[\\/]"] )
|
||||
|
||||
# Chrome Apps: any JS/TS file that references an API in the list below.
|
||||
# This should include the list of Chrome Apps APIs that are not Chrome
|
||||
# Extensions APIs as documented in:
|
||||
# https://developer.chrome.com/docs/apps/migration/
|
||||
detection_list_chrome_apps = [
|
||||
'chrome.accessibilityFeatures',
|
||||
'chrome.alarms',
|
||||
'chrome.app.runtime',
|
||||
'chrome.app.window',
|
||||
'chrome.audio',
|
||||
'chrome.bluetooth',
|
||||
'chrome.bluetoothLowEnergy',
|
||||
'chrome.bluetoothSocket',
|
||||
'chrome.browser',
|
||||
'chrome.commands',
|
||||
'chrome.contextMenus',
|
||||
'chrome.documentScan',
|
||||
'chrome.events',
|
||||
'chrome.extensionTypes',
|
||||
'chrome.fileSystem',
|
||||
'chrome.fileSystemProvider',
|
||||
'chrome.gcm',
|
||||
'chrome.hid',
|
||||
'chrome.i18n',
|
||||
'chrome.identity',
|
||||
'chrome.idle',
|
||||
'chrome.instanceID',
|
||||
'chrome.mdns',
|
||||
'chrome.mediaGalleries',
|
||||
'chrome.networking.onc',
|
||||
'chrome.notifications',
|
||||
'chrome.permissions',
|
||||
'chrome.power',
|
||||
'chrome.printerProvider',
|
||||
'chrome.runtime',
|
||||
'chrome.serial',
|
||||
'chrome.sockets.tcp',
|
||||
'chrome.sockets.tcpServer',
|
||||
'chrome.sockets.udp',
|
||||
'chrome.storage',
|
||||
'chrome.syncFileSystem',
|
||||
'chrome.system.cpu',
|
||||
'chrome.system.display',
|
||||
'chrome.system.memory',
|
||||
'chrome.system.network',
|
||||
'chrome.system.storage',
|
||||
'chrome.tts',
|
||||
'chrome.types',
|
||||
'chrome.usb',
|
||||
'chrome.virtualKeyboard',
|
||||
'chrome.vpnProvider',
|
||||
'chrome.wallpaper'
|
||||
]
|
||||
_JS_FILES = r'\.(js|ts)$'
|
||||
problems += _CheckForDeprecatedTech(input_api, output_api,
|
||||
detection_list = detection_list_chrome_apps,
|
||||
files_to_check = [ r'.+%s' % _JS_FILES ],
|
||||
files_to_skip = files_to_skip)
|
||||
|
||||
if problems:
|
||||
return [output_api.PresubmitPromptWarning('You are adding/modifying code'
|
||||
'related to technologies which will soon be deprecated (Chrome Apps, NaCl,'
|
||||
|
@ -3749,50 +3749,6 @@ class CheckForUseOfChromeAppsDeprecationsTest(unittest.TestCase):
|
||||
mock_output_api)
|
||||
self.assertEqual(0, len(errors))
|
||||
|
||||
def testWarningChromeApps(self):
|
||||
mock_input_api = MockInputApi()
|
||||
mock_input_api.files = [
|
||||
MockAffectedFile(
|
||||
'foo.js',
|
||||
['A', 'chrome.app.window.init()', 'B'],
|
||||
['A', 'chrome.window.init()', 'B'],
|
||||
scm_diff='\n'.join([
|
||||
'--- foo.js.old 2020-12-02 20:40:54.430676385 +0100',
|
||||
'+++ foo.js.new 2020-12-02 20:41:02.086700197 +0100',
|
||||
'@@ -1,3 +1,3 @@',
|
||||
' A',
|
||||
'+chrome.app.window.init()',
|
||||
' B']),
|
||||
action='M')
|
||||
]
|
||||
mock_output_api = MockOutputApi()
|
||||
errors = PRESUBMIT.CheckForUseOfChromeAppsDeprecations(mock_input_api,
|
||||
mock_output_api)
|
||||
self.assertEqual(1, len(errors))
|
||||
self.assertTrue( self.ERROR_MSG_PIECE in errors[0].message)
|
||||
self.assertTrue( 'foo.js' in errors[0].message)
|
||||
|
||||
def testOKChromeAppsRemoved(self):
|
||||
mock_input_api = MockInputApi()
|
||||
mock_input_api.files = [
|
||||
MockAffectedFile(
|
||||
'foo.js',
|
||||
['A', 'B'],
|
||||
['A', 'chrome.app.window.init()', 'B'],
|
||||
scm_diff='\n'.join([
|
||||
'--- foo.js.old 2020-12-02 20:40:54.430676385 +0100',
|
||||
'+++ foo.js.new 2020-12-02 20:41:02.086700197 +0100',
|
||||
'@@ -1,3 +1,2 @@',
|
||||
' A',
|
||||
'-chrome.app.window.init()',
|
||||
' B']),
|
||||
action='D')
|
||||
]
|
||||
mock_output_api = MockOutputApi()
|
||||
errors = PRESUBMIT.CheckForUseOfChromeAppsDeprecations(mock_input_api,
|
||||
mock_output_api)
|
||||
self.assertEqual(0, len(errors))
|
||||
|
||||
class CheckDeprecationOfPreferencesTest(unittest.TestCase):
|
||||
# Test that a warning is generated if a preference registration is removed
|
||||
# from a random file.
|
||||
|
Reference in New Issue
Block a user