Skip to content

Commit 5762107

Browse files
Rohit RaoCommit Bot
Rohit Rao
authored and
Commit Bot
committed
[ios] Compiles ios/testing/earl_grey under both EG1 and EG2.
Adds new GN targets for compiling these test support files under EG2. Rearranges ios/chrome/test/earl_grey2/BUILD.gn to clearly separate out support libraries for the app and test processes. Modifies the EG2 templates to automatically have EG2 app hosts and tests depend on the appropriate support libraries. BUG=922813 Change-Id: Iefcb72386389f2ed7339fcf9ce8edd13b28f08a2 Reviewed-on: https://chromium-review.googlesource.com/c/1418432 Commit-Queue: Rohit Rao <[email protected]> Reviewed-by: Justin Cohen <[email protected]> Cr-Commit-Position: refs/heads/master@{#624089}
1 parent 5fbf45d commit 5762107

File tree

5 files changed

+62
-15
lines changed

5 files changed

+62
-15
lines changed

ios/chrome/test/earl_grey2/BUILD.gn

+23-14
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ group("all_tests") {
1515
}
1616

1717
chrome_ios_eg2_test_app_host("ios_chrome_eg2_test_app_host") {
18-
deps = [
19-
":earl_grey2_host_distant_object_sources",
20-
]
2118
}
2219

2320
chrome_ios_eg2_test("ios_chrome_smoke_eg2tests") {
@@ -28,32 +25,44 @@ chrome_ios_eg2_test("ios_chrome_smoke_eg2tests") {
2825
]
2926
}
3027

31-
source_set("earl_grey2_host_distant_object_headers") {
28+
source_set("shared_helper_headers") {
3229
testonly = true
3330
sources = [
3431
"//ios/chrome/test/earl_grey2/chrome_earl_grey_edo.h",
3532
]
3633
}
3734

38-
source_set("earl_grey2_host_distant_object_sources") {
39-
configs += [ "//build/config/compiler:enable_arc" ]
35+
source_set("eg_app_support+eg2") {
4036
testonly = true
41-
sources = [
42-
"//ios/chrome/test/earl_grey2/chrome_earl_grey_edo.mm",
43-
]
37+
configs += [ "//build/config/compiler:enable_arc" ]
4438

45-
include_dirs = [
46-
"//ios/third_party/earl_grey2/src",
47-
"//ios/third_party/edo/src",
39+
sources = [
40+
"chrome_earl_grey_edo.mm",
4841
]
4942

5043
deps = [
51-
":earl_grey2_host_distant_object_headers",
5244
"//base",
5345
"//base/test:test_support",
5446
"//ios/chrome/test/app:test_support",
47+
"//ios/testing/earl_grey:eg_app_support+eg2",
5548
"//ios/third_party/earl_grey2:app_framework+link",
5649
]
50+
51+
public_deps = [
52+
":shared_helper_headers",
53+
]
54+
55+
include_dirs = [
56+
"//ios/third_party/earl_grey2/src",
57+
"//ios/third_party/edo/src",
58+
]
59+
}
60+
61+
group("eg_test_support+eg2") {
62+
testonly = true
63+
public_deps = [
64+
":shared_helper_headers",
65+
]
5766
}
5867

5968
source_set("eg2_tests") {
@@ -70,7 +79,7 @@ source_set("eg2_tests") {
7079
include_dirs = [ "//ios/third_party/edo/src" ]
7180

7281
deps = [
73-
"//ios/chrome/test/earl_grey2:earl_grey2_host_distant_object_headers",
82+
":eg_test_support+eg2",
7483
"//ios/third_party/earl_grey2:test_lib",
7584
]
7685

ios/chrome/test/earl_grey2/chrome_ios_eg2_test.gni

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ template("chrome_ios_eg2_test_app_host") {
9090
":$_deps_group_name",
9191
"//ios/chrome/app:main",
9292
"//ios/chrome/test/earl_grey:hooks",
93+
"//ios/chrome/test/earl_grey2:eg_app_support+eg2",
9394
"//ios/testing:http_server_bundle_data",
9495
"//ios/third_party/earl_grey2:app_framework+link",
9596
]
@@ -145,6 +146,11 @@ template("chrome_ios_eg2_test") {
145146
"xcode_test_application_name",
146147
"deps",
147148
])
149+
150+
if (!defined(deps)) {
151+
deps = []
152+
}
153+
deps += [ "//ios/chrome/test/earl_grey2:eg_test_support+eg2" ]
148154
}
149155
}
150156

ios/testing/earl_grey/BUILD.gn

+23
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,29 @@ source_set("earl_grey_support") {
2222
"matchers.mm",
2323
]
2424

25+
defines = [ "CHROME_EARL_GREY_1" ]
26+
27+
public_configs = [ ":earl_grey_support_config" ]
28+
configs += [ ":earl_grey_support_config" ]
29+
}
30+
31+
source_set("eg_app_support+eg2") {
32+
configs += [ "//build/config/compiler:enable_arc" ]
33+
testonly = true
34+
35+
deps = [
36+
"//base/test:test_support",
37+
"//ios/third_party/earl_grey2:app_framework+link",
38+
]
39+
40+
sources = [
41+
"disabled_test_macros.h",
42+
"matchers.h",
43+
"matchers.mm",
44+
]
45+
46+
defines = [ "CHROME_EARL_GREY_2" ]
47+
2548
public_configs = [ ":earl_grey_support_config" ]
2649
configs += [ ":earl_grey_support_config" ]
2750
}

ios/testing/earl_grey/matchers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#import <Foundation/Foundation.h>
99

10-
#import <EarlGrey/EarlGrey.h>
10+
@protocol GREYMatcher;
1111

1212
namespace testing {
1313

ios/testing/earl_grey/matchers.mm

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
#error "This file requires ARC support."
99
#endif
1010

11+
#if defined(CHROME_EARL_GREY_1)
12+
#import <EarlGrey/EarlGrey.h>
13+
#endif
14+
15+
#if defined(CHROME_EARL_GREY_2)
16+
#import <AppFramework/EarlGreyApp.h>
17+
#import <AppFramework/Matcher/GREYMatchersShorthand.h>
18+
#endif
19+
1120
namespace testing {
1221

1322
id<GREYMatcher> ButtonWithAccessibilityLabel(NSString* label) {

0 commit comments

Comments
 (0)