OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 from ast import literal_eval | 6 from ast import literal_eval |
7 import os | 7 import os |
8 import tempfile | 8 import tempfile |
9 import unittest | 9 import unittest |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 _CHROME_SEND_EXTERNS = os.path.join(_SRC_DIR, "third_party", "closure_compiler", | 25 _CHROME_SEND_EXTERNS = os.path.join(_SRC_DIR, "third_party", "closure_compiler", |
26 "externs", "chrome_send.js") | 26 "externs", "chrome_send.js") |
27 _CLOSURE_ARGS_GYPI = os.path.join(_SCRIPT_DIR, "closure_args.gypi") | 27 _CLOSURE_ARGS_GYPI = os.path.join(_SCRIPT_DIR, "closure_args.gypi") |
28 _GYPI_DICT = literal_eval(open(_CLOSURE_ARGS_GYPI).read()) | 28 _GYPI_DICT = literal_eval(open(_CLOSURE_ARGS_GYPI).read()) |
29 _COMMON_CLOSURE_ARGS = _GYPI_DICT["closure_args"] + \ | 29 _COMMON_CLOSURE_ARGS = _GYPI_DICT["closure_args"] + \ |
30 _GYPI_DICT["default_disabled_closure_args"] | 30 _GYPI_DICT["default_disabled_closure_args"] |
31 | 31 |
32 | 32 |
33 class CompilerTest(unittest.TestCase): | 33 class CompilerTest(unittest.TestCase): |
34 _ASSERT_DEFINITION = Processor(_ASSERT_JS).contents | 34 _ASSERT_DEFINITION = Processor(_ASSERT_JS).contents |
35 _CR_DEFINE_DEFINITION = (Processor(_PROMISE_RESOLVER_JS).contents + | 35 _PROMISE_RESOLVER_DEFINITION = (_ASSERT_DEFINITION + |
| 36 Processor(_PROMISE_RESOLVER_JS).contents) |
| 37 _CR_DEFINE_DEFINITION = (_PROMISE_RESOLVER_DEFINITION + |
36 Processor(_CR_JS).contents) | 38 Processor(_CR_JS).contents) |
37 _CR_UI_DECORATE_DEFINITION = Processor(_CR_UI_JS).contents | 39 _CR_UI_DECORATE_DEFINITION = Processor(_CR_UI_JS).contents |
38 | 40 |
39 def setUp(self): | 41 def setUp(self): |
40 self._checker = Checker() | 42 self._checker = Checker() |
41 self._tmp_files = [] | 43 self._tmp_files = [] |
42 | 44 |
43 def tearDown(self): | 45 def tearDown(self): |
44 for file in self._tmp_files: | 46 for file in self._tmp_files: |
45 if os.path.exists(file): | 47 if os.path.exists(file): |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 """ | 368 """ |
367 args = ['warning_level=VERBOSE'] | 369 args = ['warning_level=VERBOSE'] |
368 self._runCheckerTestExpectError(template % '', 'Missing return', | 370 self._runCheckerTestExpectError(template % '', 'Missing return', |
369 closure_args=args) | 371 closure_args=args) |
370 self._runCheckerTestExpectSuccess(template % 'assertNotReached();', | 372 self._runCheckerTestExpectSuccess(template % 'assertNotReached();', |
371 closure_args=args) | 373 closure_args=args) |
372 | 374 |
373 | 375 |
374 if __name__ == "__main__": | 376 if __name__ == "__main__": |
375 unittest.main() | 377 unittest.main() |
OLD | NEW |