Index: ios/third_party/earl_grey/eg_test.gni |
diff --git a/ios/third_party/earl_grey/eg_test.gni b/ios/third_party/earl_grey/eg_test.gni |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b3040e76dc825ecfc5b07e188c241d00633afdba |
--- /dev/null |
+++ b/ios/third_party/earl_grey/eg_test.gni |
@@ -0,0 +1,147 @@ |
+# Copyright 2016 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("//build/config/ios/rules.gni") |
+ |
+# For Chrome on iOS we want to run EarlGrey tests (that are XCTests) for all |
+# our build configurations (Debug, Release, ...). In addition, the symbols |
+# visibility is configured to private by default. To simplify testing with |
+# those constraints, our tests are compiled in the TEST_HOST target instead |
+# of the .xctest bundle. |
+template("ios_eg_test") { |
+ _target_name = target_name |
+ _output_name = target_name |
+ if (defined(invoker.output_name)) { |
+ _output_name = invoker.output_name |
+ } |
+ |
+ _xctest_target = _target_name |
+ _xctest_output = _output_name |
+ _xctest_bundle = _xctest_target + "_bundle" |
+ _xctest_config = _xctest_target + "_config" |
+ |
+ config(_xctest_config) { |
+ common_flags = [ |
+ "-F", |
+ "$ios_sdk_platform_path/Developer/Library/Frameworks", |
+ ] |
+ |
+ cflags = common_flags |
+ ldflags = common_flags |
+ |
+ libs = [ |
+ "Foundation.framework", |
+ "XCTest.framework", |
+ ] |
+ } |
+ |
+ _xctest_info_plist_target = _xctest_target + "_info_plist" |
+ _xctest_info_plist_bundle = _xctest_target + "_info_plist_bundle" |
+ ios_info_plist(_xctest_info_plist_target) { |
+ visibility = [ ":$_xctest_info_plist_bundle" ] |
+ info_plist = "//ios/third_party/earl_grey/Module-Info.plist" |
+ executable_name = _output_name |
+ } |
+ |
+ bundle_data(_xctest_info_plist_bundle) { |
+ visibility = [ ":$_xctest_target" ] |
+ public_deps = [ |
+ ":$_xctest_info_plist_target", |
+ ] |
+ sources = get_target_outputs(":$_xctest_info_plist_target") |
+ outputs = [ |
+ "{{bundle_root_dir}}/Info.plist", |
+ ] |
+ } |
+ |
+ _xctest_loadable_module_target = _xctest_target + "_loadable_module" |
+ _xctest_loadable_module_bundle = _xctest_target + "_loadable_module_bundle" |
+ loadable_module(_xctest_loadable_module_target) { |
+ visibility = [ ":$_xctest_loadable_module_bundle" ] |
+ sources = [ |
+ "//ios/third_party/earl_grey/xctest_shell.mm", |
+ ] |
+ configs += [ ":$_xctest_config" ] |
+ |
+ output_name = rebase_path("$target_out_dir/$_xctest_output", root_out_dir) |
+ output_prefix_override = true |
+ output_extension = "" |
+ } |
+ |
+ bundle_data(_xctest_loadable_module_bundle) { |
+ visibility = [ ":$_xctest_target" ] |
+ public_deps = [ |
+ ":$_xctest_loadable_module_target", |
+ ] |
+ sources = [ |
+ "$target_out_dir/$_xctest_output", |
+ ] |
+ outputs = [ |
+ "{{bundle_root_dir}}/$_xctest_output", |
+ ] |
+ } |
+ |
+ create_bundle(_xctest_target) { |
+ visibility = [ ":$_xctest_bundle" ] |
+ product_type = "com.apple.product-type.bundle.unit-test" |
+ deps = [ |
+ ":$_xctest_info_plist_bundle", |
+ ":$_xctest_loadable_module_bundle", |
+ ] |
+ bundle_root_dir = "$root_out_dir/$_xctest_output.xctest" |
+ } |
+ |
+ _host_target = _target_name + "_host" |
+ _host_output = _output_name + "_host" |
+ |
+ bundle_data(_xctest_bundle) { |
+ visibility = [ ":$_host_target" ] |
+ public_deps = [ |
+ ":$_xctest_target", |
+ ] |
+ sources = [ |
+ "$root_out_dir/$_xctest_output.xctest", |
+ ] |
+ outputs = [ |
+ "{{bundle_plugins_dir}}/$_xctest_output.xctest", |
+ ] |
+ } |
+ |
+ ios_app_bundle(_host_target) { |
+ forward_variables_from(invoker, "*", [ "testonly" ]) |
+ |
+ testonly = true |
+ output_name = _host_output |
+ info_plist = "//ios/third_party/earl_grey/Host-Info.plist" |
+ configs += [ ":$_xctest_config" ] |
+ |
+ if (!defined(bundle_deps)) { |
+ bundle_deps = [] |
+ } |
+ bundle_deps += [ |
+ ":$_xctest_bundle", |
+ "//ios/third_party/earl_grey:xctest_bundle", |
+ "//ios/third_party/earl_grey:earl_grey+bundle", |
+ "//ios/third_party/ochamcrest:ochamcrest+bundle", |
+ ] |
+ |
+ if (!defined(ldflags)) { |
+ ldflags = [] |
+ } |
+ ldflags += [ |
+ "-Xlinker", |
+ "-rpath", |
+ "-Xlinker", |
+ "@executable_path/Frameworks", |
+ "-Xlinker", |
+ "-rpath", |
+ "-Xlinker", |
+ "@loader_path/Frameworks", |
+ ] |
+ } |
+} |
+ |
+set_defaults("ios_eg_test") { |
+ configs = default_executable_configs |
+} |