Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2027)

Unified Diff: chrome/common/extensions/api/PRESUBMIT_test.py

Issue 23512007: Prase IDL files in common/extensions/api PRESUBMIT check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/api/PRESUBMIT_test.py
diff --git a/chrome/common/extensions/api/PRESUBMIT_test.py b/chrome/common/extensions/api/PRESUBMIT_test.py
index f14ea7ed5d245ef860c833e8e9beb74b945d6e6b..f6630316502ae9a663fd6a1a3efc768d5de2abd2 100755
--- a/chrome/common/extensions/api/PRESUBMIT_test.py
+++ b/chrome/common/extensions/api/PRESUBMIT_test.py
@@ -3,6 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import glob
import json
import os
import subprocess
@@ -58,5 +59,32 @@ class JSONParsingTest(unittest.TestCase):
str(PRESUBMIT._GetJSONParseError(input_api, input_json)))
+class IDLParsingTest(unittest.TestCase):
+ def testSuccess(self):
+ input_api = MockInputApi()
+ filename = 'test_presubmit/valid_idl_basics.idl'
+ self.assertEqual(None,
+ PRESUBMIT._GetIDLParseError(input_api, filename))
+
+ def testFailure(self):
+ input_api = MockInputApi()
+ expected_errors = [
+ '''Unexpected "{" after keyword "dictionary".''',
+ '''Unexpected symbol DOMString after symbol a.''',
+ '''Unexpected symbol name2 after symbol name1.''',
+ '''Trailing comma in block.''',
+ '''Unexpected ";" after "(".''',
+ '''Unexpected ")" after symbol long.''',
+ '''Unexpected symbol Events after symbol interace.''',
+ '''Did not process Interface Interface(NotEvent)''',
+ '''Interface missing name.'''
+ ]
+
+ for i in range(0, len(glob.glob('test_presubmit/invalid_*.idl'))):
+ filename = 'test_presubmit/invalid_idl_' + str(i+1) + '.idl'
Yoyo Zhou 2013/09/09 17:19:27 Why not simply for filename in glob.glob(...)
Haojian Wu 2013/09/10 02:51:04 Done.
+ error = PRESUBMIT._GetIDLParseError(input_api, filename)
+ self.assertTrue(expected_errors[i] in error)
+
+
if __name__ == "__main__":
unittest.main()

Powered by Google App Engine
This is Rietveld 408576698