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 import os | 6 import os |
7 import tempfile | 7 import tempfile |
8 import unittest | 8 import unittest |
9 | 9 |
10 from compile import Checker | 10 from compile import Checker |
11 from processor import FileCache, Processor | 11 from processor import FileCache, Processor |
12 | 12 |
13 | 13 |
14 _SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 14 _SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
15 _SRC_DIR = os.path.join(_SCRIPT_DIR, os.pardir, os.pardir) | 15 _SRC_DIR = os.path.join(_SCRIPT_DIR, os.pardir, os.pardir) |
16 _RESOURCES_DIR = os.path.join(_SRC_DIR, "ui", "webui", "resources", "js") | 16 _RESOURCES_DIR = os.path.join(_SRC_DIR, "ui", "webui", "resources", "js") |
17 _ASSERT_JS = os.path.join(_RESOURCES_DIR, "assert.js") | 17 _ASSERT_JS = os.path.join(_RESOURCES_DIR, "assert.js") |
18 _CR_JS = os.path.join(_RESOURCES_DIR, "cr.js") | 18 _CR_JS = os.path.join(_RESOURCES_DIR, "cr.js") |
19 _CR_UI_JS = os.path.join(_RESOURCES_DIR, "cr", "ui.js") | 19 _CR_UI_JS = os.path.join(_RESOURCES_DIR, "cr", "ui.js") |
20 _POLYMER_EXTERNS = os.path.join(_SRC_DIR, "third_party", "polymer", "v0_8", | 20 _POLYMER_EXTERNS = os.path.join(_SRC_DIR, "third_party", "polymer", "v1_0", |
21 "components-chromium", "polymer-externs", | 21 "components-chromium", "polymer-externs", |
22 "polymer.externs.js") | 22 "polymer.externs.js") |
23 | 23 |
24 | 24 |
25 class CompilerTest(unittest.TestCase): | 25 class CompilerTest(unittest.TestCase): |
26 _ASSERT_DEFINITION = Processor(_ASSERT_JS).contents | 26 _ASSERT_DEFINITION = Processor(_ASSERT_JS).contents |
27 _CR_DEFINE_DEFINITION = Processor(_CR_JS).contents | 27 _CR_DEFINE_DEFINITION = Processor(_CR_JS).contents |
28 _CR_UI_DECORATE_DEFINITION = Processor(_CR_UI_JS).contents | 28 _CR_UI_DECORATE_DEFINITION = Processor(_CR_UI_JS).contents |
29 | 29 |
30 def setUp(self): | 30 def setUp(self): |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 316 |
317 expected_output = "'use strict';var testScript=function(){};testScript();\n" | 317 expected_output = "'use strict';var testScript=function(){};testScript();\n" |
318 self.assertTrue(os.path.exists(out_map)) | 318 self.assertTrue(os.path.exists(out_map)) |
319 self.assertTrue(os.path.exists(out_file)) | 319 self.assertTrue(os.path.exists(out_file)) |
320 with open(out_file, "r") as file: | 320 with open(out_file, "r") as file: |
321 self.assertEquals(file.read(), expected_output) | 321 self.assertEquals(file.read(), expected_output) |
322 | 322 |
323 | 323 |
324 if __name__ == "__main__": | 324 if __name__ == "__main__": |
325 unittest.main() | 325 unittest.main() |
OLD | NEW |