Chinmay Garde 37b367e4d2
Allow specifying both Dart and non-Dart fixtures in engine unit-tests. (#9113)
* Allow specifying both Dart and non-Dart fixtures in engine unittests.

This fixes numerous issues in the way in which fixtures were managed
in the engine unit-tests.

* Instead of only being able to specify Dart fixtures, unit-tests may specify
  non-Dart fixtures as well. These are simply copied over to the fixtures
  directory known to the unit-test at runtime.
* An issue where numerous Dart files could be given to the kernel snapshotter
  has been addressed. It was anticipated that such a (legal) invocation to the
  kernel snapshotter would produce a snapshot with the contents of all the Dart
  files added to the root library. This is incorrect and the behavior in this
  case is undefined.
* Dart files referenced by the main Dart file are correctly tracked via a
  depfile.
* The snapshotter arguments have been cleaned up to get rid of unused
  arguments (`—strong`) and  the use of the VM product mode argument has been
  corrected to no longer depend on the Flutter product mode.
2019-05-28 19:11:47 -07:00

108 lines
3.0 KiB
Plaintext

# Copyright 2013 The Flutter 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("$flutter_root/testing/testing.gni")
import("publish.gni")
_wrapper_includes = [
"include/flutter/basic_message_channel.h",
"include/flutter/binary_messenger.h",
"include/flutter/encodable_value.h",
"include/flutter/engine_method_result.h",
"include/flutter/json_message_codec.h",
"include/flutter/json_method_codec.h",
"include/flutter/json_type.h",
"include/flutter/message_codec.h",
"include/flutter/method_call.h",
"include/flutter/method_channel.h",
"include/flutter/method_codec.h",
"include/flutter/method_result.h",
"include/flutter/plugin_registrar.h",
"include/flutter/standard_message_codec.h",
"include/flutter/standard_method_codec.h",
]
# TODO: Once the wrapper API is more stable, consolidate to as few files as is
# reasonable (without forcing different kinds of clients to take unnecessary
# code) to simplify use.
_wrapper_sources = [
"byte_stream_wrappers.h",
"engine_method_result.cc",
"json_message_codec.cc", # TODO combine into a single json_codec.cc.
"json_method_codec.cc", # TODO combine into a single json_codec.cc.
"plugin_registrar.cc",
"standard_codec_serializer.h",
"standard_codec.cc",
]
# Client library build for internal use by the shell implementation.
source_set("client_wrapper") {
sources = _wrapper_sources
public = _wrapper_includes
deps = [
"$flutter_root/shell/platform/common/cpp:common_cpp_library_headers",
"//third_party/rapidjson",
]
defines = [ "USE_RAPID_JSON" ]
configs += [
"$flutter_root/shell/platform/common/cpp:desktop_library_implementation",
]
public_configs = [
"$flutter_root/shell/platform/common/cpp:relative_flutter_library_headers",
]
}
# Copies the client wrapper code to the output directory.
publish_client_wrapper("publish_wrapper") {
public = _wrapper_includes
sources = _wrapper_sources + [ "README" ]
}
source_set("client_wrapper_library_stubs") {
sources = [
"testing/stub_flutter_api.cc",
"testing/stub_flutter_api.h",
]
defines = [ "FLUTTER_DESKTOP_LIBRARY" ]
public_deps = [
"$flutter_root/shell/platform/common/cpp:common_cpp_library_headers",
]
}
test_fixtures("client_wrapper_fixtures") {
fixtures = []
}
executable("client_wrapper_unittests") {
testonly = true
# TODO: Add more unit tests.
sources = [
"encodable_value_unittests.cc",
"method_call_unittests.cc",
"plugin_registrar_unittests.cc",
"standard_message_codec_unittests.cc",
"standard_method_codec_unittests.cc",
"testing/encodable_value_utils.cc",
"testing/encodable_value_utils.h",
]
deps = [
":client_wrapper",
":client_wrapper_fixtures",
":client_wrapper_library_stubs",
"$flutter_root/testing",
# TODO: Consider refactoring flutter_root/testing so that there's a testing
# target that doesn't require a Dart runtime to be linked in.
"//third_party/dart/runtime:libdart_jit",
]
}