| # 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/bindings.dart", | 
 |     "//mojo/public/dart/core.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/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", | 
 |   ] | 
 |   output = "$target_gen_dir/test_snapshot_gen.bin" | 
 |   outputs = [ | 
 |     output, | 
 |   ] | 
 |  | 
 |   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") | 
 |   bindings_path = rebase_path("//mojo/public/dart/bindings.dart") | 
 |   core_path = rebase_path("//mojo/public/dart/core.dart") | 
 |   args = [ | 
 |     "--executable", rebase_path("$gen_snapshot_dir/gen_snapshot"), | 
 |     "--package_root", rebase_path("$root_gen_dir"), | 
 |     "--script", rebase_path("test_snapshot.dart"), | 
 |     "--output_bin", rebase_path(output, root_build_dir), | 
 |     "--target_os", os, | 
 |     "--url_mapping=dart:mojo_bindings,$bindings_path", | 
 |     "--url_mapping=dart:mojo_builtin,$builtin_path", | 
 |     "--url_mapping=dart:mojo_core,$core_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_snapshot_gen.bin", | 
 |   ] | 
 |   output = "$target_gen_dir/test_snapshot.cc" | 
 |   outputs = [ | 
 |     output, | 
 |   ] | 
 |  | 
 |   script = "//dart/runtime/tools/create_snapshot_file.py" | 
 |   args = [ | 
 |     "--input_bin", rebase_path("$target_gen_dir/test_snapshot_gen.bin"), | 
 |     "--input_cc", rebase_path("//mojo/dart/embedder/snapshot.cc.tmpl"), | 
 |     "--output", rebase_path(output), | 
 |   ] | 
 | } | 
 |  | 
 | 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 = [ | 
 |     ":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}}", | 
 |   ] | 
 | } | 
 |  | 
 | 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", | 
 |   ] | 
 | } |