Commit f7f90b37 authored by Eugene But's avatar Eugene But Committed by Commit Bot

Compile some ios_chrome_web_egtest files with EG2.

This CL makes changes to the files, so they either compiled without (or
with fewer) errors with EG2. Updated EG1 build target with proper EG1
defined.

This CL does not add files to EG2 target, because tests are failing
because of EG2 helper absence.

Bug: 922813
Change-Id: I0fbb023d5861405a7324521c0f34f114ec29868e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1632591
Commit-Queue: Eugene But <eugenebut@chromium.org>
Auto-Submit: Eugene But <eugenebut@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663853}
parent 4e73c693
...@@ -317,6 +317,7 @@ source_set("unit_tests_internal") { ...@@ -317,6 +317,7 @@ source_set("unit_tests_internal") {
source_set("eg_tests") { source_set("eg_tests") {
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
defines = [ "CHROME_EARL_GREY_1" ]
testonly = true testonly = true
sources = [ sources = [
"browsing_egtest.mm", "browsing_egtest.mm",
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
// 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.
#import <EarlGrey/EarlGrey.h>
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h" #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h" #import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h" #import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h" #import "ios/chrome/test/earl_grey/chrome_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"
#include "ios/web/public/test/http_server/http_server_util.h" #include "ios/web/public/test/http_server/http_server_util.h"
...@@ -39,8 +38,21 @@ const char kWindow2Closed[] = "window2.closed: true"; ...@@ -39,8 +38,21 @@ const char kWindow2Closed[] = "window2.closed: true";
@implementation ChildWindowOpenByDOMTestCase @implementation ChildWindowOpenByDOMTestCase
#if defined(CHROME_EARL_GREY_2)
+ (void)setUpForTestCase {
[super setUpForTestCase];
[self setUpHelper];
}
#elif defined(CHROME_EARL_GREY_1)
+ (void)setUp { + (void)setUp {
[super setUp]; [super setUp];
[self setUpHelper];
}
#else
#error Not an EarlGrey Test
#endif
+ (void)setUpHelper {
CHROME_EG_ASSERT_NO_ERROR( CHROME_EG_ASSERT_NO_ERROR(
[ChromeEarlGrey setContentSettings:CONTENT_SETTING_ALLOW]); [ChromeEarlGrey setContentSettings:CONTENT_SETTING_ALLOW]);
web::test::SetUpFileBasedHttpServer(); web::test::SetUpFileBasedHttpServer();
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +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.
#import <EarlGrey/EarlGrey.h>
#include <functional> #include <functional>
#include <string> #include <string>
...@@ -11,6 +9,7 @@ ...@@ -11,6 +9,7 @@
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h" #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
#import "ios/chrome/test/earl_grey/chrome_error_util.h" #import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h" #import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#include "ios/testing/embedded_test_server_handlers.h" #include "ios/testing/embedded_test_server_handlers.h"
#include "net/test/embedded_test_server/default_handlers.h" #include "net/test/embedded_test_server/default_handlers.h"
#include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_request.h"
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +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.
#import <EarlGrey/EarlGrey.h>
#import <XCTest/XCTest.h> #import <XCTest/XCTest.h>
#include <memory> #include <memory>
...@@ -19,6 +18,7 @@ ...@@ -19,6 +18,7 @@
#import "ios/chrome/test/earl_grey/chrome_error_util.h" #import "ios/chrome/test/earl_grey/chrome_error_util.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h" #import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h" #import "ios/chrome/test/earl_grey/chrome_test_case.h"
#import "ios/testing/earl_grey/earl_grey_test.h"
#import "ios/testing/earl_grey/matchers.h" #import "ios/testing/earl_grey/matchers.h"
#import "ios/web/public/test/earl_grey/web_view_actions.h" #import "ios/web/public/test/earl_grey/web_view_actions.h"
#import "ios/web/public/test/earl_grey/web_view_matchers.h" #import "ios/web/public/test/earl_grey/web_view_matchers.h"
...@@ -220,7 +220,7 @@ id<GREYMatcher> ResendPostButtonMatcher() { ...@@ -220,7 +220,7 @@ id<GREYMatcher> ResendPostButtonMatcher() {
// WKBasedNavigationManager presents repost confirmation dialog before loading // WKBasedNavigationManager presents repost confirmation dialog before loading
// stops. // stops.
if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) { if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) {
[chrome_test_util::BrowserCommandDispatcherForMainBVC() reload]; [ChromeEarlGrey reload];
} else { } else {
// Legacy navigation manager presents repost confirmation dialog after // Legacy navigation manager presents repost confirmation dialog after
// loading stops. // loading stops.
...@@ -257,7 +257,7 @@ id<GREYMatcher> ResendPostButtonMatcher() { ...@@ -257,7 +257,7 @@ id<GREYMatcher> ResendPostButtonMatcher() {
// [ChromeEarlGrey reload] because WKBasedNavigationManager presents repost // [ChromeEarlGrey reload] because WKBasedNavigationManager presents repost
// confirmation dialog before loading stops. // confirmation dialog before loading stops.
if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) { if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) {
[chrome_test_util::BrowserCommandDispatcherForMainBVC() reload]; [ChromeEarlGrey reload];
} }
[self confirmResendWarning]; [self confirmResendWarning];
...@@ -289,7 +289,7 @@ id<GREYMatcher> ResendPostButtonMatcher() { ...@@ -289,7 +289,7 @@ id<GREYMatcher> ResendPostButtonMatcher() {
// [ChromeEarlGrey reload] because WKBasedNavigationManager presents repost // [ChromeEarlGrey reload] because WKBasedNavigationManager presents repost
// confirmation dialog before loading stops. // confirmation dialog before loading stops.
if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) { if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) {
[chrome_test_util::BrowserCommandDispatcherForMainBVC() reload]; [ChromeEarlGrey reload];
} }
[self confirmResendWarning]; [self confirmResendWarning];
...@@ -355,7 +355,7 @@ id<GREYMatcher> ResendPostButtonMatcher() { ...@@ -355,7 +355,7 @@ id<GREYMatcher> ResendPostButtonMatcher() {
// [ChromeEarlGrey reload] because WKBasedNavigationManager presents repost // [ChromeEarlGrey reload] because WKBasedNavigationManager presents repost
// confirmation dialog before loading stops. // confirmation dialog before loading stops.
if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) { if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) {
[chrome_test_util::BrowserCommandDispatcherForMainBVC() reload]; [ChromeEarlGrey reload];
} }
[[EarlGrey selectElementWithMatcher:ElementToDismissAlert(@"Cancel")] [[EarlGrey selectElementWithMatcher:ElementToDismissAlert(@"Cancel")]
...@@ -403,7 +403,7 @@ id<GREYMatcher> ResendPostButtonMatcher() { ...@@ -403,7 +403,7 @@ id<GREYMatcher> ResendPostButtonMatcher() {
// WKBasedNavigationManager presents repost confirmation dialog before loading // WKBasedNavigationManager presents repost confirmation dialog before loading
// stops. // stops.
if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) { if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) {
[chrome_test_util::BrowserCommandDispatcherForMainBVC() reload]; [ChromeEarlGrey reload];
} else { } else {
// Legacy navigation manager presents repost confirmation dialog after // Legacy navigation manager presents repost confirmation dialog after
// loading stops. // loading stops.
......
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