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
3 # found in the LICENSE file.
5 import("//build/module_args/v8.gni")
8 assert(defined(invoker.test_type) &&
9 (invoker.test_type == "webui" || invoker.test_type == "unit" ||
10 invoker.test_type == "extension"))
11 action_name = target_name + "_action"
12 source_set_name = target_name
14 action_foreach(action_name) {
16 visibility = [ ":$source_set_name" ]
17 script = "//tools/gypv8sh.py"
19 sources = invoker.sources
21 d8_path = get_label_info("//v8:d8($host_toolchain)", "root_out_dir") + "/d8"
27 "//chrome/third_party/mock4js/mock4js.js",
28 "//chrome/test/data/webui/test_api.js",
29 "//chrome/test/base/js2gtest.js",
31 inputs = [ d8_path ] + input_js
32 if (defined(invoker.deps_js)) {
33 inputs += [ invoker.deps_js ]
37 "$target_gen_dir/{{source_name_part}}-gen.cc",
38 "$root_out_dir/test_data/{{source_root_relative_dir}}/{{source_file_part}}",
42 if (defined(invoker.deps_js)) {
45 rebase_path(invoker.deps_js, root_build_dir),
49 # Need "./" for script to find binary (cur dir is not on path).
50 "./" + rebase_path(d8_path, root_build_dir),
52 args += rebase_path(input_js, root_build_dir) + [ invoker.test_type ]
53 if (v8_use_external_startup_data) {
54 args += [ "--external=y" ]
56 args += [ "--external=n" ]
60 "{{source_root_relative_dir}}/{{source_file_part}}",
62 args += rebase_path(outputs, root_build_dir)
65 "//v8:d8($host_toolchain)",
67 if (defined(invoker.deps)) {
72 if (defined(invoker.extra_js_files)) {
73 copy_target_name = target_name + "_copy"
74 copy(copy_target_name) {
75 visibility = [ ":$source_set_name" ]
76 sources = invoker.extra_js_files
78 "$root_out_dir/test_data/{{source_root_relative_dir}}/{{source_file_part}}",
83 source_set(source_set_name) {
85 if (defined(invoker.visibility)) {
86 visibility = invoker.visibility
88 sources = get_target_outputs(":$action_name")
89 if (defined(invoker.defines)) {
90 defines = invoker.defines
95 # The generator implicitly makes includes from these targets.
96 "//chrome/test:test_support",
101 if (defined(invoker.deps)) {
104 if (defined(invoker.extra_js_files)) {
105 data_deps = [ ":$copy_target_name" ]