OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/module_args/v8.gni") | 5 import("//build/module_args/v8.gni") |
6 | 6 |
| 7 # Variables: |
| 8 # test_type: One of 'webui', 'unit' or 'extension' indicating what |
| 9 # environment the test runs under. |
| 10 # sources: List of javascript test source files. |
| 11 # deps_js: Javascript file with closure library dependencies. Only needed |
| 12 # if the test fixtures use closureModuleDeps. |
| 13 # gen_include_files: List of javascript files used in GEN_INCLUDE calls |
| 14 # in the tests and therefore considered input to the C++ generation step. |
| 15 # extra_js_files: List of javascript files needed by the test at runtime, |
| 16 # typically listed in the extraLibraries member of the test fixture. |
| 17 # defines |
| 18 # deps |
| 19 # visibility |
7 template("js2gtest") { | 20 template("js2gtest") { |
8 assert(defined(invoker.test_type) && | 21 assert(defined(invoker.test_type) && |
9 (invoker.test_type == "webui" || invoker.test_type == "unit" || | 22 (invoker.test_type == "webui" || invoker.test_type == "unit" || |
10 invoker.test_type == "extension")) | 23 invoker.test_type == "extension")) |
11 action_name = target_name + "_action" | 24 action_name = target_name + "_action" |
12 source_set_name = target_name | 25 source_set_name = target_name |
13 | 26 |
14 # The mapping from sources to the copied version. | 27 # The mapping from sources to the copied version. |
15 copied_source_pattern = "$root_out_dir/test_data/{{source_root_relative_dir}}/
{{source_file_part}}" | 28 copied_source_pattern = "$root_out_dir/test_data/{{source_root_relative_dir}}/
{{source_file_part}}" |
16 | 29 |
(...skipping 11 matching lines...) Expand all Loading... |
28 | 41 |
29 input_js = [ | 42 input_js = [ |
30 "//chrome/third_party/mock4js/mock4js.js", | 43 "//chrome/third_party/mock4js/mock4js.js", |
31 "//chrome/test/data/webui/test_api.js", | 44 "//chrome/test/data/webui/test_api.js", |
32 "//chrome/test/base/js2gtest.js", | 45 "//chrome/test/base/js2gtest.js", |
33 ] | 46 ] |
34 inputs = [ d8_path ] + input_js | 47 inputs = [ d8_path ] + input_js |
35 if (defined(invoker.deps_js)) { | 48 if (defined(invoker.deps_js)) { |
36 inputs += [ invoker.deps_js ] | 49 inputs += [ invoker.deps_js ] |
37 } | 50 } |
| 51 if (defined(invoker.gen_include_files)) { |
| 52 inputs += invoker.gen_include_files |
| 53 } |
38 | 54 |
39 # Outputs. The script will copy the source files to the output directory, | 55 # Outputs. The script will copy the source files to the output directory, |
40 # which then must be treated as runtime data. The generated .cc file isn't | 56 # which then must be treated as runtime data. The generated .cc file isn't |
41 # data, it will be compiled in a step below. | 57 # data, it will be compiled in a step below. |
42 outputs = [ | 58 outputs = [ |
43 "$target_gen_dir/{{source_name_part}}-gen.cc", | 59 "$target_gen_dir/{{source_name_part}}-gen.cc", |
44 copied_source_pattern, | 60 copied_source_pattern, |
45 ] | 61 ] |
46 data = process_file_template(sources, [ copied_source_pattern ]) | 62 data = process_file_template(sources, [ copied_source_pattern ]) |
47 | 63 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 "//url", | 121 "//url", |
106 ] | 122 ] |
107 if (defined(invoker.deps)) { | 123 if (defined(invoker.deps)) { |
108 deps += invoker.deps | 124 deps += invoker.deps |
109 } | 125 } |
110 if (defined(invoker.extra_js_files)) { | 126 if (defined(invoker.extra_js_files)) { |
111 data_deps = [ ":$copy_target_name" ] | 127 data_deps = [ ":$copy_target_name" ] |
112 } | 128 } |
113 } | 129 } |
114 } | 130 } |
OLD | NEW |