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

Unified Diff: third_party/closure_compiler/compiler_test.py

Issue 1152583011: Refactor compile_js.gypi to support script_args and closure_args (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove --success_stamp, use gypi closure args in compile_test.py Created 5 years, 6 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
« remoting/compile_js.gypi ('K') | « third_party/closure_compiler/compile_js.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/closure_compiler/compiler_test.py
diff --git a/third_party/closure_compiler/compiler_test.py b/third_party/closure_compiler/compiler_test.py
index a39776a4193851d81b3b671186fa22f4601de292..df6c10c9b5567e9d2e0061ed83ef61372014eebc 100755
--- a/third_party/closure_compiler/compiler_test.py
+++ b/third_party/closure_compiler/compiler_test.py
@@ -20,6 +20,9 @@ _CR_UI_JS = os.path.join(_RESOURCES_DIR, "cr", "ui.js")
_POLYMER_EXTERNS = os.path.join(_SRC_DIR, "third_party", "polymer", "v1_0",
"components-chromium", "polymer-externs",
"polymer.externs.js")
+_GYPI_DICT = eval(open(os.path.join(os.path.dirname(__file__)) + '/compile_js.gypi').read())
Dan Beam 2015/06/04 20:44:30 can we use gyp.input.Load()?
Dan Beam 2015/06/04 20:44:30 os.path.join(_SCRIPT_DIR, 'compile_js.gypi')
Theresa 2015/06/04 23:06:09 Discussed on hangouts; gyp.input.Load() requires m
Theresa 2015/06/04 23:06:09 Done.
+_COMMON_CLOSURE_ARGS =_GYPI_DICT['variables']['closure_args+']
+_COMMON_CLOSURE_ARGS += _GYPI_DICT['actions'][0]['variables']['disabled_closure_args%']
class CompilerTest(unittest.TestCase):
@@ -36,15 +39,19 @@ class CompilerTest(unittest.TestCase):
if os.path.exists(file):
os.remove(file)
- def _runChecker(self, source_code, output_wrapper=None):
+ def _runChecker(self, source_code, closure_args=None):
file_path = "/script.js"
FileCache._cache[file_path] = source_code
out_file, out_map = self._createOutFiles()
+ args = []
+ args += _COMMON_CLOSURE_ARGS;
+ if closure_args:
+ args += closure_args
Dan Beam 2015/06/04 20:44:30 args = _COMMON_CLOSURE_ARGS + (closure_args or [])
Theresa 2015/06/04 23:06:09 Done.
found_errors, stderr = self._checker.check(file_path,
externs=[_POLYMER_EXTERNS],
out_file=out_file,
- output_wrapper=output_wrapper)
+ closure_args=args)
return found_errors, stderr, out_file, out_map
def _runCheckerTestExpectError(self, source_code, expected_error):
@@ -57,9 +64,9 @@ class CompilerTest(unittest.TestCase):
self.assertFalse(os.path.exists(out_map))
def _runCheckerTestExpectSuccess(self, source_code, expected_output=None,
- output_wrapper=None):
+ closure_args=None):
found_errors, stderr, out_file, out_map = self._runChecker(source_code,
- output_wrapper)
+ closure_args)
self.assertFalse(found_errors,
msg="Expected success, but got failure\n\nOutput:\n%s\n" % stderr)
@@ -282,9 +289,9 @@ var testScript = function() {
"""
expected_output = ("""(function(){'use strict';var testScript=function()"""
"""{console.log("hello world")};})();\n""")
- output_wrapper="(function(){%output%})();"
+ closure_args=["output_wrapper='(function(){%output%})();'"]
self._runCheckerTestExpectSuccess(source_code, expected_output,
- output_wrapper=output_wrapper)
+ closure_args)
def testCheckMultiple(self):
source_file1 = tempfile.NamedTemporaryFile(delete=False)
@@ -308,9 +315,9 @@ testScript();
out_file, out_map = self._createOutFiles()
sources = [source_file1.name, source_file2.name]
externs = [_POLYMER_EXTERNS]
- found_errors, stderr = self._checker.check_multiple(sources,
- externs=externs,
- out_file=out_file)
+ found_errors, stderr = self._checker.check_multiple(
+ sources, externs=externs, out_file=out_file,
+ closure_args=_COMMON_CLOSURE_ARGS)
self.assertFalse(found_errors,
msg="Expected success, but got failure\n\nOutput:\n%s\n" % stderr)
« remoting/compile_js.gypi ('K') | « third_party/closure_compiler/compile_js.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698