Commit 67407619 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Migrate ui/ntp to EG2.

Bug: 987646
Change-Id: Iaa13ee085aec001158ac46151a50d5ab3cbfa46c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1862994
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706781}
parent 5e64a04a
...@@ -191,6 +191,7 @@ source_set("unit_tests") { ...@@ -191,6 +191,7 @@ source_set("unit_tests") {
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 = [
"new_tab_page_egtest.mm", "new_tab_page_egtest.mm",
...@@ -212,6 +213,29 @@ source_set("eg_tests") { ...@@ -212,6 +213,29 @@ source_set("eg_tests") {
libs = [ "XCTest.framework" ] libs = [ "XCTest.framework" ]
} }
source_set("eg2_tests") {
defines = [ "CHROME_EARL_GREY_2" ]
configs += [
"//build/config/compiler:enable_arc",
"//build/config/ios:xctest_config",
]
testonly = true
sources = [
"new_tab_page_egtest.mm",
]
deps = [
"//base/test:test_support",
"//components/strings",
"//ios/chrome/app/strings",
"//ios/chrome/browser/ui/content_suggestions:content_suggestions_constant",
"//ios/chrome/test/earl_grey:eg_test_support+eg2",
"//ios/testing/earl_grey:eg_test_support+eg2",
"//ios/third_party/earl_grey2:test_lib",
"//ui/base",
]
libs = [ "UIKit.framework" ]
}
source_set("perf_tests") { source_set("perf_tests") {
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
testonly = true testonly = true
......
...@@ -2,22 +2,16 @@ ...@@ -2,22 +2,16 @@
// 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 "base/test/ios/wait_util.h" #import "base/test/ios/wait_util.h"
#include "base/test/scoped_command_line.h" #include "base/test/scoped_command_line.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "ios/chrome/browser/chrome_switches.h"
#import "ios/chrome/browser/ui/commands/browser_commands.h"
#import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h" #import "ios/chrome/browser/ui/content_suggestions/ntp_home_constant.h"
#include "ios/chrome/browser/ui/util/ui_util.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/chrome_test_util.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_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"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
...@@ -28,8 +22,8 @@ namespace { ...@@ -28,8 +22,8 @@ namespace {
// Pauses until the history label has disappeared. History should not show on // Pauses until the history label has disappeared. History should not show on
// incognito. // incognito.
void WaitForHistoryToDisappear() { BOOL WaitForHistoryToDisappear() {
[[GREYCondition return [[GREYCondition
conditionWithName:@"Wait for history to disappear" conditionWithName:@"Wait for history to disappear"
block:^BOOL { block:^BOOL {
NSError* error = nil; NSError* error = nil;
...@@ -60,7 +54,7 @@ void WaitForHistoryToDisappear() { ...@@ -60,7 +54,7 @@ void WaitForHistoryToDisappear() {
// Tests that all items are accessible on the incognito page. // Tests that all items are accessible on the incognito page.
- (void)testAccessibilityOnIncognitoTab { - (void)testAccessibilityOnIncognitoTab {
[ChromeEarlGrey openNewIncognitoTab]; [ChromeEarlGrey openNewIncognitoTab];
WaitForHistoryToDisappear(); GREYAssert(WaitForHistoryToDisappear(), @"History did not disappear.");
[ChromeEarlGrey verifyAccessibilityForCurrentScreen]; [ChromeEarlGrey verifyAccessibilityForCurrentScreen];
[ChromeEarlGrey closeAllIncognitoTabs]; [ChromeEarlGrey closeAllIncognitoTabs];
} }
......
...@@ -42,6 +42,7 @@ chrome_ios_eg2_test("ios_chrome_ui_eg2tests_module") { ...@@ -42,6 +42,7 @@ chrome_ios_eg2_test("ios_chrome_ui_eg2tests_module") {
"//ios/chrome/browser/ui/activity_services:eg2_tests", "//ios/chrome/browser/ui/activity_services:eg2_tests",
"//ios/chrome/browser/ui/download:eg2_tests", "//ios/chrome/browser/ui/download:eg2_tests",
"//ios/chrome/browser/ui/integration_tests:eg2_tests", "//ios/chrome/browser/ui/integration_tests:eg2_tests",
"//ios/chrome/browser/ui/ntp:eg2_tests",
"//ios/chrome/browser/ui/omnibox/popup:eg2_tests", "//ios/chrome/browser/ui/omnibox/popup:eg2_tests",
"//ios/chrome/browser/ui/omnibox/popup/shortcuts:eg2_tests", "//ios/chrome/browser/ui/omnibox/popup/shortcuts:eg2_tests",
"//ios/chrome/browser/ui/open_in:eg2_tests", "//ios/chrome/browser/ui/open_in:eg2_tests",
......
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