Commit 03a1f6f2 authored by Robbie Gibson's avatar Robbie Gibson Committed by Commit Bot

[iOS][EG2] Use utility for prefs instead of test-specific AppInterface

A utility function for setting BOOL preference values was added
recently, so this test no longer needs the test-specific AppInterface
code setting these.

Bug: 987646
Change-Id: Ic5b96b2b20667e218407663cf2d7e042371653ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1972308
Commit-Queue: Robbie Gibson <rkgibson@google.com>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726394}
parent e4120e77
...@@ -216,6 +216,7 @@ source_set("eg_tests") { ...@@ -216,6 +216,7 @@ source_set("eg_tests") {
":test_support", ":test_support",
"//base", "//base",
"//base/test:test_support", "//base/test:test_support",
"//components/password_manager/core/common",
"//ios/chrome/test/app:test_support", "//ios/chrome/test/app:test_support",
"//ios/chrome/test/earl_grey:test_support", "//ios/chrome/test/earl_grey:test_support",
"//ios/testing/earl_grey:earl_grey_support", "//ios/testing/earl_grey:earl_grey_support",
...@@ -243,6 +244,7 @@ source_set("eg2_tests") { ...@@ -243,6 +244,7 @@ source_set("eg2_tests") {
":feature_flags", ":feature_flags",
"//base", "//base",
"//base/test:test_support", "//base/test:test_support",
"//components/password_manager/core/common",
"//ios/chrome/test/earl_grey:eg_test_support+eg2", "//ios/chrome/test/earl_grey:eg_test_support+eg2",
"//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",
...@@ -266,7 +268,6 @@ source_set("test_support") { ...@@ -266,7 +268,6 @@ source_set("test_support") {
"//components/autofill/core/common", "//components/autofill/core/common",
"//components/keyed_service/core", "//components/keyed_service/core",
"//components/password_manager/core/browser", "//components/password_manager/core/browser",
"//components/password_manager/core/common",
"//ios/chrome/test/app:test_support", "//ios/chrome/test/app:test_support",
"//ios/testing:nserror_support", "//ios/testing:nserror_support",
"//ios/web/public", "//ios/web/public",
...@@ -290,7 +291,6 @@ source_set("eg_app_support+eg2") { ...@@ -290,7 +291,6 @@ source_set("eg_app_support+eg2") {
"//components/autofill/core/common", "//components/autofill/core/common",
"//components/keyed_service/core", "//components/keyed_service/core",
"//components/password_manager/core/browser", "//components/password_manager/core/browser",
"//components/password_manager/core/common",
"//ios/chrome/test/app:test_support", "//ios/chrome/test/app:test_support",
"//ios/testing:nserror_support", "//ios/testing:nserror_support",
"//ios/web/public", "//ios/web/public",
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#import "base/test/ios/wait_util.h" #import "base/test/ios/wait_util.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#import "ios/chrome/browser/passwords/password_manager_app_interface.h" #import "ios/chrome/browser/passwords/password_manager_app_interface.h"
#include "ios/chrome/browser/passwords/password_manager_features.h" #include "ios/chrome/browser/passwords/password_manager_features.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h" #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
...@@ -115,7 +116,13 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -115,7 +116,13 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
EARL_GREY_TEST_DISABLED(@"Fails on iOS 11.0."); EARL_GREY_TEST_DISABLED(@"Fails on iOS 11.0.");
#endif #endif
[PasswordManagerAppInterface setAutosigninPreferences]; // Set Autosignin preferences
[ChromeEarlGrey setBoolValue:YES
forUserPref:password_manager::prefs::
kWasAutoSignInFirstRunExperienceShown];
[ChromeEarlGrey
setBoolValue:YES
forUserPref:password_manager::prefs::kCredentialsEnableAutosignin];
[self loadSimplePageAndStoreACredential]; [self loadSimplePageAndStoreACredential];
// Call get() from JavaScript. // Call get() from JavaScript.
...@@ -164,7 +171,13 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse( ...@@ -164,7 +171,13 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
#if defined(CHROME_EARL_GREY_1) #if defined(CHROME_EARL_GREY_1)
EARL_GREY_TEST_DISABLED(@"Fails on iOS 11.0."); EARL_GREY_TEST_DISABLED(@"Fails on iOS 11.0.");
#endif #endif
[PasswordManagerAppInterface setAutosigninPreferences]; // Set Autosignin preferences
[ChromeEarlGrey setBoolValue:YES
forUserPref:password_manager::prefs::
kWasAutoSignInFirstRunExperienceShown];
[ChromeEarlGrey
setBoolValue:YES
forUserPref:password_manager::prefs::kCredentialsEnableAutosignin];
[self loadSimplePageAndStoreACredential]; [self loadSimplePageAndStoreACredential];
// Open new tab. // Open new tab.
......
...@@ -9,9 +9,6 @@ ...@@ -9,9 +9,6 @@
@interface PasswordManagerAppInterface : NSObject @interface PasswordManagerAppInterface : NSObject
// Sets preferences required for autosign-in to true.
+ (void)setAutosigninPreferences;
// Stores a credential to the password store. // Stores a credential to the password store.
+ (NSError*)storeCredentialWithUsername:(NSString*)username + (NSError*)storeCredentialWithUsername:(NSString*)username
password:(NSString*)password; password:(NSString*)password;
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "components/autofill/core/common/password_form.h" #include "components/autofill/core/common/password_form.h"
#include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/core/service_access_type.h"
#include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/core/browser/password_store.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h"
#import "ios/chrome/test/app/chrome_test_util.h" #import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/app/tab_test_util.h" #import "ios/chrome/test/app/tab_test_util.h"
...@@ -22,15 +21,6 @@ ...@@ -22,15 +21,6 @@
@implementation PasswordManagerAppInterface @implementation PasswordManagerAppInterface
+ (void)setAutosigninPreferences {
chrome_test_util::SetBooleanUserPref(
chrome_test_util::GetOriginalBrowserState(),
password_manager::prefs::kWasAutoSignInFirstRunExperienceShown, true);
chrome_test_util::SetBooleanUserPref(
chrome_test_util::GetOriginalBrowserState(),
password_manager::prefs::kCredentialsEnableAutosignin, true);
}
+ (NSError*)storeCredentialWithUsername:(NSString*)username + (NSError*)storeCredentialWithUsername:(NSString*)username
password:(NSString*)password { password:(NSString*)password {
// Obtain a PasswordStore. // Obtain a PasswordStore.
......
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