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

Side by Side Diff: chrome/test/base/js2gtest.gni

Issue 1145243006: Port chromevox build to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@externs
Patch Set: Unshare some vars, add TODO for the rest. 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 import("//build/module_args/v8.gni")
6
7 template("js2gtest") {
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
13
14 action_foreach(action_name) {
15 testonly = true
16 visibility = [ ":$source_set_name" ]
17 script = "//tools/gypv8sh.py"
18
19 sources = invoker.sources
20
21 d8_path = get_label_info("//v8:d8($host_toolchain)", "root_out_dir") + "/d8"
22 if (is_win) {
23 d8_path += ".exe"
24 }
25
26 input_js = [
27 "//chrome/third_party/mock4js/mock4js.js",
28 "//chrome/test/data/webui/test_api.js",
29 "//chrome/test/base/js2gtest.js",
30 ]
31 inputs = [ d8_path ] + input_js
32 if (defined(invoker.deps_js)) {
33 inputs += [ invoker.deps_js ]
34 }
35
36 outputs = [
37 "$target_gen_dir/{{source_name_part}}-gen.cc",
38 "$root_out_dir/test_data/{{source_root_relative_dir}}/{{source_file_part}} ",
39 ]
40
41 args = []
42 if (defined(invoker.deps_js)) {
43 args += [
44 "--deps_js",
45 rebase_path(invoker.deps_js, root_build_dir),
46 ]
47 }
48 args += [
49 # Need "./" for script to find binary (cur dir is not on path).
50 "./" + rebase_path(d8_path, root_build_dir),
51 ]
52 args += rebase_path(input_js, root_build_dir) + [ invoker.test_type ]
53 if (v8_use_external_startup_data) {
54 args += [ "--external=y" ]
55 } else {
56 args += [ "--external=n" ]
57 }
58 args += [
59 "{{source}}",
60 "{{source_root_relative_dir}}/{{source_file_part}}",
61 ]
62 args += rebase_path(outputs, root_build_dir)
63
64 deps = [
65 "//v8:d8($host_toolchain)",
66 ]
67 }
68
69 if (defined(invoker.extra_js_files)) {
70 copy_target_name = target_name + "_copy"
71 copy(copy_target_name) {
72 visibility = [ ":$source_set_name" ]
73 sources = invoker.extra_js_files
74 outputs = [
75 "$root_out_dir/test_data/{{source_root_relative_dir}}/{{source_file_part }}",
76 ]
77 }
78 }
79 source_set(source_set_name) {
80 testonly = true
81 if (defined(invoker.visibility)) {
82 visibility = invoker.visibility
83 }
84 sources = get_target_outputs(":$action_name")
85 if (defined(invoker.defines)) {
86 defines = invoker.defines
87 }
88 deps = [
89 ":$action_name",
90
91 # The generator implicitly makes includes from these targets.
92 "//chrome/test:test_support",
93 "//testing/gmock",
94 "//testing/gtest",
95 "//url",
96 ]
97 if (defined(invoker.deps)) {
98 deps += invoker.deps
99 }
100 if (defined(invoker.extra_js_files)) {
101 data_deps = [ ":$copy_target_name" ]
102 }
103 }
104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698