Commit 731d6058 authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Chromium LUCI CQ

Remove unwanted code from presubmit check

Commit(1e7c2506) has added a presubmit warning to prevent further uses
of old downcast helpers. All the occurrences of old downcast helpers
are removed from the codebase and these changes are not needed now.

Bug: 891908
Change-Id: I0090438d1f8c835b153ae2d6d177389891948991
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2592539Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Cr-Commit-Position: refs/heads/master@{#837436}
parent d4dc5961
......@@ -938,44 +938,6 @@ _BANNED_CPP_FUNCTIONS = (
True,
(),
),
(
'DEFINE_TYPE_CASTS',
(
'DEFINE_TYPE_CASTS is deprecated. Instead, use downcast helpers from ',
'//third_party/blink/renderer/platform/casting.h.'
),
True,
(
r'^third_party/blink/renderer/.*\.(cc|h)$',
),
),
(
r'/\bIsHTML.+Element\(\b',
(
'Function IsHTMLXXXXElement is deprecated. Instead, use downcast ',
' helpers IsA<HTMLXXXXElement> from ',
'//third_party/blink/renderer/platform/casting.h.'
),
False,
(
r'^third_party/blink/renderer/.*\.(cc|h)$',
),
),
(
r'/\bToHTML.+Element(|OrNull)\(\b',
(
'Function ToHTMLXXXXElement and ToHTMLXXXXElementOrNull are '
'deprecated. Instead, use downcast helpers To<HTMLXXXXElement> '
'and DynamicTo<HTMLXXXXElement> from ',
'//third_party/blink/renderer/platform/casting.h.'
'auto* html_xxxx_ele = To<HTMLXXXXElement>(n)'
'auto* html_xxxx_ele_or_null = DynamicTo<HTMLXXXXElement>(n)'
),
False,
(
r'^third_party/blink/renderer/.*\.(cc|h)$',
),
),
(
r'/\bmojo::DataPipe\b',
(
......
......@@ -2332,38 +2332,6 @@ class BannedTypeCheckTest(unittest.TestCase):
self.assertTrue('some/cpp/ok/file.cc' not in results[1].message)
self.assertTrue('some/cpp/problematic/file2.cc' in results[0].message)
def testBannedBlinkDowncastHelpers(self):
input_api = MockInputApi()
input_api.files = [
MockFile('some/cpp/problematic/file1.cc',
['DEFINE_TYPE_CASTS(ToType, FromType, from_argument,'
'PointerPredicate(), ReferencePredicate());']),
MockFile('some/cpp/problematic/file2.cc',
['bool is_test_ele = IsHTMLTestElement(n);']),
MockFile('some/cpp/problematic/file3.cc',
['auto* html_test_ele = ToHTMLTestElement(n);']),
MockFile('some/cpp/problematic/file4.cc',
['auto* html_test_ele_or_null = ToHTMLTestElementOrNull(n);']),
MockFile('some/cpp/ok/file1.cc',
['bool is_test_ele = IsA<HTMLTestElement>(n);']),
MockFile('some/cpp/ok/file2.cc',
['auto* html_test_ele = To<HTMLTestElement>(n);']),
MockFile('some/cpp/ok/file3.cc',
['auto* html_test_ele_or_null = ',
'DynamicTo<HTMLTestElement>(n);']),
]
# warnings are errors[0], errors are errors[1]
errors = PRESUBMIT.CheckNoBannedFunctions(input_api, MockOutputApi())
self.assertEqual(2, len(errors))
self.assertTrue('some/cpp/problematic/file1.cc' in errors[1].message)
self.assertTrue('some/cpp/problematic/file2.cc' in errors[0].message)
self.assertTrue('some/cpp/problematic/file3.cc' in errors[0].message)
self.assertTrue('some/cpp/problematic/file4.cc' in errors[0].message)
self.assertTrue('some/cpp/ok/file1.cc' not in errors[0].message)
self.assertTrue('some/cpp/ok/file2.cc' not in errors[0].message)
self.assertTrue('some/cpp/ok/file3.cc' not in errors[0].message)
def testBannedIosObjcFunctions(self):
input_api = MockInputApi()
input_api.files = [
......
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