blob: 47888e20f7dd7ef8696bde57410717a9733de0b4 [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//mojo/public/tools/bindings/mojom.gni")
import("//testing/test.gni")
action("generate_test_snapshot_bin") {
deps = [
"//dart/runtime/bin:gen_snapshot($host_toolchain)",
]
inputs = [
"test_snapshot.dart",
"//dart/runtime/tools/create_snapshot_bin.py",
"//mojo/dart/embedder/builtin.dart",
"//mojo/public/dart/internal.dart",
"//mojo/public/dart/src/handle_watcher.dart",
"//mojo/public/dart/src/natives.dart",
"//mojo/public/dart/src/timer_queue.dart",
]
test_vm_isolate_snapshot = "$target_gen_dir/test_vm_isolate_snapshot.bin"
test_isolate_snapshot = "$target_gen_dir/test_isolate_snapshot.bin"
outputs = [
test_vm_isolate_snapshot,
test_isolate_snapshot,
]
gen_snapshot_dir =
get_label_info("//dart/runtime/bin:gen_snapshot($host_toolchain)",
"root_out_dir")
script = "//dart/runtime/tools/create_snapshot_bin.py"
builtin_path = rebase_path("//mojo/dart/embedder/builtin.dart")
internal_path = rebase_path("//mojo/public/dart/internal.dart")
args = [
"--executable",
rebase_path("$gen_snapshot_dir/gen_snapshot"),
"--package_root",
rebase_path("$root_gen_dir"),
"--script",
rebase_path("test_snapshot.dart"),
"--vm_output_bin",
rebase_path(test_vm_isolate_snapshot, root_build_dir),
"--output_bin",
rebase_path(test_isolate_snapshot, root_build_dir),
"--target_os",
os,
"--url_mapping=dart:mojo.builtin,$builtin_path",
"--url_mapping=dart:mojo.internal,$internal_path",
]
}
action("generate_test_snapshot_file") {
deps = [
":generate_test_snapshot_bin",
]
inputs = [
"//dart/runtime/tools/create_snapshot_file.py",
"//mojo/dart/embedder/snapshot.cc.tmpl",
"$target_gen_dir/test_vm_isolate_snapshot.bin",
"$target_gen_dir/test_isolate_snapshot.bin",
]
output = "$target_gen_dir/test_snapshot.cc"
outputs = [
output,
]
script = "//dart/runtime/tools/create_snapshot_file.py"
args = [
"--vm_input_bin",
rebase_path("$target_gen_dir/test_vm_isolate_snapshot.bin"),
"--input_bin",
rebase_path("$target_gen_dir/test_isolate_snapshot.bin"),
"--input_cc",
rebase_path("//mojo/dart/embedder/snapshot.cc.tmpl"),
"--output",
rebase_path(output),
]
}
# These go into the generated source directory for embedder tests.
copy("copy_dart_mojo_sdk") {
sources = [
"//mojo/public/dart/application.dart",
"//mojo/public/dart/bindings.dart",
"//mojo/public/dart/core.dart",
"//mojo/public/dart/internal.dart",
"//mojo/public/dart/src/application.dart",
"//mojo/public/dart/src/application_connection.dart",
"//mojo/public/dart/src/buffer.dart",
"//mojo/public/dart/src/codec.dart",
"//mojo/public/dart/src/data_pipe.dart",
"//mojo/public/dart/src/drain_data.dart",
"//mojo/public/dart/src/event_stream.dart",
"//mojo/public/dart/src/handle.dart",
"//mojo/public/dart/src/handle_watcher.dart",
"//mojo/public/dart/src/message.dart",
"//mojo/public/dart/src/message_pipe.dart",
"//mojo/public/dart/src/natives.dart",
"//mojo/public/dart/src/proxy.dart",
"//mojo/public/dart/src/struct.dart",
"//mojo/public/dart/src/stub.dart",
"//mojo/public/dart/src/timer_queue.dart",
"//mojo/public/dart/src/types.dart",
]
outputs = [
"{{source_gen_dir}}/{{source_file_part}}",
]
}
source_set("dart_controller_for_test") {
testonly = true
sources = [
"$target_gen_dir/test_snapshot.cc",
]
deps = [
":generate_test_snapshot_file",
"//mojo/dart/embedder:dart_controller_no_snapshot",
]
}
test("dart_unittests") {
sources = [
"run_dart_tests.cc",
"validation_unittest.cc",
]
deps = [
":async_helper",
":copy_dart_mojo_sdk",
":dart_controller_for_test",
":dart_to_cpp_unittests",
":expect",
":validation_test_input_parser",
"//base",
"//crypto:crypto",
"//mojo/dart/embedder:dart_controller_no_snapshot",
"//mojo/edk/test:run_all_unittests",
"//mojo/edk/test:test_support",
"//mojo/public/cpp/environment",
"//mojo/public/cpp/system",
"//mojo/public/cpp/utility",
"//mojo/environment:chromium",
"//testing/gtest",
]
}
copy("expect") {
sources = [
"//mojo/dart/testing/expect.dart",
]
outputs = [
"{{source_gen_dir}}/{{source_file_part}}",
]
}
copy("validation_test_input_parser") {
sources = [
"//mojo/dart/testing/validation_test_input_parser.dart",
]
outputs = [
"{{source_gen_dir}}/{{source_file_part}}",
]
}
copy("async_helper") {
sources = [
"//mojo/dart/testing/async_helper.dart",
]
outputs = [
"{{source_gen_dir}}/{{source_file_part}}",
]
}
source_set("dart_to_cpp_unittests") {
testonly = true
sources = [
"dart_to_cpp_tests.cc",
]
deps = [
":dart_controller_for_test",
":dart_to_cpp_bindings",
"//base",
"//crypto",
"//mojo/dart/embedder:dart_controller_no_snapshot",
"//mojo/edk/test:test_support",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/system",
"//mojo/public/interfaces/bindings/tests:test_interfaces",
"//testing/gtest",
]
}
mojom("dart_to_cpp_bindings") {
sources = [
"dart_to_cpp.mojom",
]
}