Commit 73d88ee1 authored by Rohit Rao's avatar Rohit Rao Committed by Commit Bot

[ios] Creates forwarding headers for EarlGrey.

Adds two new headers intended for use by files that are compiled under
both EG1 and EG2.  These new headers handle importing the appropriate EG
headers, consolidating this boilerplate code into a single location.

Also consolidates setting eDO include dirs in a single location.

BUG=930859

Change-Id: I02141ea18efc38ef534ed043d61e984da1096d64
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1508578Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638767}
parent 43950569
...@@ -51,11 +51,6 @@ source_set("eg_app_support+eg2") { ...@@ -51,11 +51,6 @@ source_set("eg_app_support+eg2") {
public_deps = [ public_deps = [
":shared_helper_headers", ":shared_helper_headers",
] ]
include_dirs = [
"//ios/third_party/earl_grey2/src",
"//ios/third_party/edo/src",
]
} }
group("eg_test_support+eg2") { group("eg_test_support+eg2") {
...@@ -76,8 +71,6 @@ source_set("eg2_tests") { ...@@ -76,8 +71,6 @@ source_set("eg2_tests") {
"smoke_egtest.mm", "smoke_egtest.mm",
] ]
include_dirs = [ "//ios/third_party/edo/src" ]
deps = [ deps = [
":eg_test_support+eg2", ":eg_test_support+eg2",
"//ios/third_party/earl_grey2:test_lib", "//ios/third_party/earl_grey2:test_lib",
......
include_rules = [ include_rules = [
"+ios/third_party/earl_grey2/src",
"+net", "+net",
"+third_party/google_toolbox_for_mac", "+third_party/google_toolbox_for_mac",
"+third_party/ocmock", "+third_party/ocmock",
......
...@@ -2,11 +2,6 @@ ...@@ -2,11 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
config("earl_grey_support_config") {
include_dirs = [ "." ]
visibility = [ ":earl_grey_support" ]
}
source_set("earl_grey_support") { source_set("earl_grey_support") {
defines = [ "CHROME_EARL_GREY_1" ] defines = [ "CHROME_EARL_GREY_1" ]
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
...@@ -19,12 +14,11 @@ source_set("earl_grey_support") { ...@@ -19,12 +14,11 @@ source_set("earl_grey_support") {
sources = [ sources = [
"disabled_test_macros.h", "disabled_test_macros.h",
"earl_grey_app.h",
"earl_grey_test.h",
"matchers.h", "matchers.h",
"matchers.mm", "matchers.mm",
] ]
public_configs = [ ":earl_grey_support_config" ]
configs += [ ":earl_grey_support_config" ]
} }
source_set("eg_app_support+eg2") { source_set("eg_app_support+eg2") {
...@@ -38,12 +32,10 @@ source_set("eg_app_support+eg2") { ...@@ -38,12 +32,10 @@ source_set("eg_app_support+eg2") {
] ]
sources = [ sources = [
"earl_grey_app.h",
"matchers.h", "matchers.h",
"matchers.mm", "matchers.mm",
] ]
public_configs = [ ":earl_grey_support_config" ]
configs += [ ":earl_grey_support_config" ]
} }
source_set("eg_test_support+eg2") { source_set("eg_test_support+eg2") {
...@@ -52,5 +44,10 @@ source_set("eg_test_support+eg2") { ...@@ -52,5 +44,10 @@ source_set("eg_test_support+eg2") {
sources = [ sources = [
"disabled_test_macros.h", "disabled_test_macros.h",
"earl_grey_test.h",
]
deps = [
"//ios/third_party/earl_grey2:test_lib",
] ]
} }
// Copyright 2019 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.
#ifndef IOS_TESTING_EARL_GREY_EARL_GREY_APP_H_
#define IOS_TESTING_EARL_GREY_EARL_GREY_APP_H_
// Contains includes and typedefs to allow code to compile under both EarlGrey1
// and EarlGrey2 (App Process).
#if defined(CHROME_EARL_GREY_1)
#import <EarlGrey/EarlGrey.h>
typedef DescribeToBlock GREYDescribeToBlock;
typedef MatchesBlock GREYMatchesBlock;
#elif defined(CHROME_EARL_GREY_2)
#import <AppFramework/Action/GREYActionsShorthand.h>
#import <AppFramework/EarlGreyApp.h>
#import <AppFramework/Matcher/GREYMatchersShorthand.h>
#else
#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2.
#endif
#endif // IOS_TESTING_EARL_GREY_EARL_GREY_APP_H_
// Copyright 2019 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.
#ifndef IOS_TESTING_EARL_GREY_EARL_GREY_TEST_H_
#define IOS_TESTING_EARL_GREY_EARL_GREY_TEST_H_
// Contains includes and typedefs to allow code to compile under both EarlGrey1
// and EarlGrey2 (Test Process).
#if defined(CHROME_EARL_GREY_1)
#import <EarlGrey/EarlGrey.h>
typedef DescribeToBlock GREYDescribeToBlock;
typedef MatchesBlock GREYMatchesBlock;
#elif defined(CHROME_EARL_GREY_2)
#import "ios/third_party/earl_grey2/src/TestLib/EarlGreyImpl/EarlGrey.h" // nogncheck
#else
#error Must define either CHROME_EARL_GREY_1 or CHROME_EARL_GREY_2.
#endif
#endif // IOS_TESTING_EARL_GREY_EARL_GREY_TEST_H_
...@@ -3,20 +3,12 @@ ...@@ -3,20 +3,12 @@
// found in the LICENSE file. // found in the LICENSE file.
#import "ios/testing/earl_grey/matchers.h" #import "ios/testing/earl_grey/matchers.h"
#include "ios/testing/earl_grey/earl_grey_app.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
#if defined(CHROME_EARL_GREY_1)
#import <EarlGrey/EarlGrey.h>
#endif
#if defined(CHROME_EARL_GREY_2)
#import <AppFramework/EarlGreyApp.h>
#import <AppFramework/Matcher/GREYMatchersShorthand.h>
#endif
namespace testing { namespace testing {
id<GREYMatcher> ButtonWithAccessibilityLabel(NSString* label) { id<GREYMatcher> ButtonWithAccessibilityLabel(NSString* label) {
......
...@@ -6,7 +6,10 @@ import("//build/config/ios/ios_sdk.gni") ...@@ -6,7 +6,10 @@ import("//build/config/ios/ios_sdk.gni")
import("//build/config/ios/rules.gni") import("//build/config/ios/rules.gni")
config("config") { config("config") {
include_dirs = [ "//ios/third_party/earl_grey2/src" ] include_dirs = [
"//ios/third_party/earl_grey2/src",
"//ios/third_party/edo/src",
]
} }
group("earl_grey2") { group("earl_grey2") {
......
...@@ -124,8 +124,6 @@ source_set("eg_test_support+eg2") { ...@@ -124,8 +124,6 @@ source_set("eg_test_support+eg2") {
"earl_grey/web_shell_test_case.mm", "earl_grey/web_shell_test_case.mm",
] ]
include_dirs = [ "//ios/third_party/edo/src" ]
deps = [ deps = [
"//ios/testing/earl_grey:eg_test_support+eg2", "//ios/testing/earl_grey:eg_test_support+eg2",
"//ios/third_party/earl_grey2:test_lib", "//ios/third_party/earl_grey2:test_lib",
...@@ -144,8 +142,6 @@ source_set("eg_tests+eg2") { ...@@ -144,8 +142,6 @@ source_set("eg_tests+eg2") {
"web_shell_sample_egtest.mm", "web_shell_sample_egtest.mm",
] ]
include_dirs = [ "//ios/third_party/edo/src" ]
deps = [ deps = [
":eg_test_support+eg2", ":eg_test_support+eg2",
"//ios/third_party/earl_grey2:test_lib", "//ios/third_party/earl_grey2:test_lib",
......
...@@ -4,17 +4,13 @@ ...@@ -4,17 +4,13 @@
#import "ios/web/shell/test/earl_grey/web_shell_test_case.h" #import "ios/web/shell/test/earl_grey/web_shell_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#import "ios/web/public/test/http_server/http_server.h" #import "ios/web/public/test/http_server/http_server.h"
#if defined(CHROME_EARL_GREY_1) #if defined(CHROME_EARL_GREY_1)
#import <EarlGrey/EarlGrey.h> // nogncheck
#include "testing/coverage_util_ios.h" // nogncheck #include "testing/coverage_util_ios.h" // nogncheck
#endif #endif
#if defined(CHROME_EARL_GREY_2)
#import "ios/third_party/earl_grey2/src/TestLib/EarlGreyImpl/EarlGrey.h" // nogncheck
#endif
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment