Commit 570141f5 authored by Mike Dougherty's avatar Mike Dougherty Committed by Commit Bot

Revert "[iOS][eg2] Convert signin settings EG tests to EG2"

This reverts commit 4b14f5d8.

Reason for revert: The following tests are failing, please investigate and run on ios-simulator-noncq bot to test eg2 tests.

SigninSettingsTestCase/testSignInPromoWithWarmStateUsingSecondaryButton
SigninSettingsTestCase/testSignInPromoWithWarmStateUsingPrimaryButton

Failure can be seen here:
https://ci.chromium.org/p/chrome/builders/ci/iphone-simulator/6352 since build #6346

Original change's description:
> [iOS][eg2] Convert signin settings EG tests to EG2
> 
> This CL adds all signin settings tests to EG2 target
> and updates headers and adds eg2_test source_set in
> build file. New app interface for signin settings
> tests is being introduced.
> 
> Bug: 987646
> 
> Change-Id: I6d888342c059b8b1767e910697b3f4d1a9b483e4
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1903192
> Commit-Queue: Nazerke Kalidolda <nazerke@google.com>
> Reviewed-by: Stepan Khapugin <stkhapugin@chromium.org>
> Reviewed-by: Eugene But <eugenebut@chromium.org>
> Auto-Submit: Nazerke Kalidolda <nazerke@google.com>
> Cr-Commit-Position: refs/heads/master@{#720941}

TBR=eugenebut@chromium.org,stkhapugin@chromium.org,nazerke@google.com

Change-Id: I8753c7aefeb7fed69c092ad3519ed412b7e10856
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 987646
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1948086Reviewed-by: default avatarMike Dougherty <michaeldo@chromium.org>
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721160}
parent a1ac2a1a
...@@ -222,7 +222,6 @@ source_set("constants") { ...@@ -222,7 +222,6 @@ source_set("constants") {
} }
source_set("test_support") { source_set("test_support") {
defines = [ "CHROME_EARL_GREY_1" ]
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
testonly = true testonly = true
sources = [ sources = [
...@@ -230,8 +229,6 @@ source_set("test_support") { ...@@ -230,8 +229,6 @@ source_set("test_support") {
"passphrase_table_view_controller_test.mm", "passphrase_table_view_controller_test.mm",
"personal_data_manager_finished_profile_tasks_waiter.cc", "personal_data_manager_finished_profile_tasks_waiter.cc",
"personal_data_manager_finished_profile_tasks_waiter.h", "personal_data_manager_finished_profile_tasks_waiter.h",
"signin_settings_app_interface.h",
"signin_settings_app_interface.mm",
] ]
deps = [ deps = [
":settings", ":settings",
...@@ -240,13 +237,11 @@ source_set("test_support") { ...@@ -240,13 +237,11 @@ source_set("test_support") {
"//components/autofill/core/browser", "//components/autofill/core/browser",
"//components/keyed_service/core", "//components/keyed_service/core",
"//components/pref_registry", "//components/pref_registry",
"//components/prefs",
"//components/sync", "//components/sync",
"//components/sync:test_support", "//components/sync:test_support",
"//components/sync_preferences", "//components/sync_preferences",
"//components/sync_preferences:test_support", "//components/sync_preferences:test_support",
"//google_apis", "//google_apis",
"//ios/chrome/browser",
"//ios/chrome/browser/browser_state", "//ios/chrome/browser/browser_state",
"//ios/chrome/browser/browser_state:test_support", "//ios/chrome/browser/browser_state:test_support",
"//ios/chrome/browser/main:test_support", "//ios/chrome/browser/main:test_support",
...@@ -257,7 +252,6 @@ source_set("test_support") { ...@@ -257,7 +252,6 @@ source_set("test_support") {
"//ios/chrome/browser/sync:test_support", "//ios/chrome/browser/sync:test_support",
"//ios/chrome/browser/ui/settings/password", "//ios/chrome/browser/ui/settings/password",
"//ios/chrome/browser/ui/table_view:test_support", "//ios/chrome/browser/ui/table_view:test_support",
"//ios/chrome/test/app:test_support",
"//ios/public/provider/chrome/browser/signin:test_support", "//ios/public/provider/chrome/browser/signin:test_support",
"//ios/web/public/test", "//ios/web/public/test",
"//testing/gtest", "//testing/gtest",
...@@ -438,14 +432,10 @@ source_set("eg_app_support+eg2") { ...@@ -438,14 +432,10 @@ source_set("eg_app_support+eg2") {
sources = [ sources = [
"block_popups_app_interface.h", "block_popups_app_interface.h",
"block_popups_app_interface.mm", "block_popups_app_interface.mm",
"signin_settings_app_interface.h",
"signin_settings_app_interface.mm",
] ]
deps = [ deps = [
"//base", "//base",
"//components/content_settings/core/browser", "//components/content_settings/core/browser",
"//components/prefs",
"//ios/chrome/browser",
"//ios/chrome/browser/browser_state", "//ios/chrome/browser/browser_state",
"//ios/chrome/browser/content_settings", "//ios/chrome/browser/content_settings",
"//ios/chrome/test/app:test_support", "//ios/chrome/test/app:test_support",
...@@ -461,7 +451,6 @@ source_set("eg_test_support+eg2") { ...@@ -461,7 +451,6 @@ source_set("eg_test_support+eg2") {
testonly = true testonly = true
sources = [ sources = [
"block_popups_app_interface.h", "block_popups_app_interface.h",
"signin_settings_app_interface.h",
] ]
public_deps = [ public_deps = [
"//components/content_settings/core/common", "//components/content_settings/core/common",
...@@ -477,17 +466,12 @@ source_set("eg2_tests") { ...@@ -477,17 +466,12 @@ source_set("eg2_tests") {
testonly = true testonly = true
sources = [ sources = [
"block_popups_egtest.mm", "block_popups_egtest.mm",
"signin_settings_egtest.mm",
] ]
deps = [ deps = [
":eg_test_support+eg2", ":eg_test_support+eg2",
"//base", "//base",
"//ios/chrome/app/strings", "//ios/chrome/app/strings",
"//ios/chrome/browser/ui/authentication:eg_test_support+eg2",
"//ios/chrome/browser/ui/authentication/cells:constants",
"//ios/chrome/browser/ui/settings:constants",
"//ios/chrome/test/earl_grey:eg_test_support+eg2", "//ios/chrome/test/earl_grey:eg_test_support+eg2",
"//ios/public/provider/chrome/browser/signin:test_support",
"//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",
"//ios/web/public/test/http_server", "//ios/web/public/test/http_server",
......
// 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_CHROME_BROWSER_UI_SETTINGS_SIGNIN_SETTINGS_APP_INTERFACE_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_SIGNIN_SETTINGS_APP_INTERFACE_H_
#import <UIKit/UIKit.h>
// The app interface for sign-in settings tests.
@interface SigninSettingsAppInterface : NSObject
// Sets the kIosSettingsSigninPromoDisplayedCount value, related to the
// number of time the sign-in promo has been displayed.
+ (void)setSettingsSigninPromoDisplayedCount:(int)displayedCount;
// Returns the kIosSettingsSigninPromoDisplayedCount value, related to
// the number of time the sign-in promo has been displayed.
+ (int)settingsSigninPromoDisplayedCount;
@end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_SIGNIN_SETTINGS_APP_INTERFACE_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.
#import "ios/chrome/browser/ui/settings/signin_settings_app_interface.h"
#include "components/prefs/pref_service.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/pref_names.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation SigninSettingsAppInterface
+ (void)setSettingsSigninPromoDisplayedCount:(int)displayedCount {
ios::ChromeBrowserState* browserState =
chrome_test_util::GetOriginalBrowserState();
PrefService* prefService = browserState->GetPrefs();
prefService->SetInteger(prefs::kIosSettingsSigninPromoDisplayedCount,
displayedCount);
}
+ (int)settingsSigninPromoDisplayedCount {
ios::ChromeBrowserState* browserState =
chrome_test_util::GetOriginalBrowserState();
PrefService* prefService = browserState->GetPrefs();
return prefService->GetInteger(prefs::kIosSettingsSigninPromoDisplayedCount);
}
@end
...@@ -2,31 +2,29 @@ ...@@ -2,31 +2,29 @@
// 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 "components/prefs/pref_service.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/pref_names.h"
#import "ios/chrome/browser/ui/authentication/cells/signin_promo_view_constants.h" #import "ios/chrome/browser/ui/authentication/cells/signin_promo_view_constants.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h" #import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h"
#import "ios/chrome/browser/ui/authentication/signin_earlgrey_utils.h" #import "ios/chrome/browser/ui/authentication/signin_earlgrey_utils.h"
#import "ios/chrome/browser/ui/settings/settings_table_view_controller_constants.h" #import "ios/chrome/browser/ui/settings/settings_table_view_controller_constants.h"
#import "ios/chrome/browser/ui/settings/signin_settings_app_interface.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_ui.h" #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.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/public/provider/chrome/browser/signin/fake_chrome_identity.h" #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity.h"
#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h" #import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.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)
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
#if defined(CHROME_EARL_GREY_2)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wc++98-compat-extra-semi"
GREY_STUB_CLASS_IN_APP_MAIN_QUEUE(SigninSettingsAppInterface);
#pragma clang diagnostic pop
#endif // defined(CHROME_EARL_GREY_2)
using chrome_test_util::PrimarySignInButton; using chrome_test_util::PrimarySignInButton;
using chrome_test_util::SecondarySignInButton; using chrome_test_util::SecondarySignInButton;
using chrome_test_util::SettingsAccountButton; using chrome_test_util::SettingsAccountButton;
...@@ -96,17 +94,20 @@ using chrome_test_util::ButtonWithAccessibilityLabelId; ...@@ -96,17 +94,20 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
// Tests that the sign-in promo should not be shown after been shown 5 times. // Tests that the sign-in promo should not be shown after been shown 5 times.
- (void)testAutomaticSigninPromoDismiss { - (void)testAutomaticSigninPromoDismiss {
const int displayedCount = 19; const int displayedCount = 19;
[SigninSettingsAppInterface ios::ChromeBrowserState* browser_state =
setSettingsSigninPromoDisplayedCount:displayedCount]; chrome_test_util::GetOriginalBrowserState();
PrefService* prefs = browser_state->GetPrefs();
prefs->SetInteger(prefs::kIosSettingsSigninPromoDisplayedCount,
displayedCount);
[ChromeEarlGreyUI openSettingsMenu]; [ChromeEarlGreyUI openSettingsMenu];
// Check the sign-in promo view is visible. // Check the sign-in promo view is visible.
[SigninEarlGreyUI [SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState]; checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState];
// Check the sign-in promo will not be shown anymore. // Check the sign-in promo will not be shown anymore.
int newDisplayedCount = GREYAssertEqual(
[SigninSettingsAppInterface settingsSigninPromoDisplayedCount]; displayedCount + 1,
GREYAssertEqual(displayedCount + 1, newDisplayedCount, prefs->GetInteger(prefs::kIosSettingsSigninPromoDisplayedCount),
@"Should have incremented the display count"); @"Should have incremented the display count");
// Close the settings menu and open it again. // Close the settings menu and open it again.
[[EarlGrey selectElementWithMatcher:SettingsDoneButton()] [[EarlGrey selectElementWithMatcher:SettingsDoneButton()]
performAction:grey_tap()]; performAction:grey_tap()];
......
...@@ -73,6 +73,7 @@ source_set("test_support") { ...@@ -73,6 +73,7 @@ source_set("test_support") {
"//ios/chrome/browser/ui/main", "//ios/chrome/browser/ui/main",
"//ios/chrome/browser/ui/settings", "//ios/chrome/browser/ui/settings",
"//ios/chrome/browser/ui/settings:settings_root", "//ios/chrome/browser/ui/settings:settings_root",
"//ios/chrome/browser/ui/settings:test_support",
"//ios/chrome/browser/ui/settings/password", "//ios/chrome/browser/ui/settings/password",
"//ios/chrome/browser/ui/settings/password:test_support", "//ios/chrome/browser/ui/settings/password:test_support",
"//ios/chrome/browser/ui/static_content", "//ios/chrome/browser/ui/static_content",
......
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