Commit 7078c82e authored by John Z Wu's avatar John Z Wu Committed by Commit Bot

Add passwordLeakCheckEnabled to control leak checking behavior

This will allow users to opt out of leak check if desired.
Also added a missing test for passwordAutofillEnabled.

Bug: 1096281
Change-Id: Ibff3bf6fdb7b6bac6170f6b9aaa44938076f49fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2401943Reviewed-by: default avatarHiroshi Ichikawa <ichikawa@chromium.org>
Commit-Queue: John Wu <jzw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805820}
parent e597da50
......@@ -72,4 +72,14 @@
password_manager::prefs::kCredentialsEnableService);
}
- (void)setPasswordLeakCheckEnabled:(BOOL)enabled {
_prefService->SetBoolean(
password_manager::prefs::kPasswordLeakDetectionEnabled, enabled);
}
- (BOOL)isPasswordLeakCheckEnabled {
return _prefService->GetBoolean(
password_manager::prefs::kPasswordLeakDetectionEnabled);
}
@end
......@@ -37,6 +37,8 @@ class CWVPreferencesTest : public PlatformTest {
pref_registry->RegisterBooleanPref(
password_manager::prefs::kCredentialsEnableService, true);
pref_registry->RegisterBooleanPref(prefs::kOfferTranslateEnabled, true);
pref_registry->RegisterBooleanPref(
password_manager::prefs::kPasswordLeakDetectionEnabled, true);
scoped_refptr<PersistentPrefStore> pref_store = new InMemoryPrefStore();
PrefServiceFactory factory;
......@@ -72,4 +74,18 @@ TEST_F(CWVPreferencesTest, TranslationEnabled) {
EXPECT_FALSE(preferences_.translationEnabled);
}
// Tests CWVPreferences |passwordAutofillEnabled|.
TEST_F(CWVPreferencesTest, PasswordAutofillEnabled) {
EXPECT_TRUE(preferences_.passwordAutofillEnabled);
preferences_.passwordAutofillEnabled = NO;
EXPECT_FALSE(preferences_.passwordAutofillEnabled);
}
// Tests CWVPreferences |passwordLeakCheckEnabled|.
TEST_F(CWVPreferencesTest, PasswordLeakCheckEnabled) {
EXPECT_TRUE(preferences_.passwordLeakCheckEnabled);
preferences_.passwordLeakCheckEnabled = NO;
EXPECT_FALSE(preferences_.passwordLeakCheckEnabled);
}
} // namespace ios_web_view
......@@ -43,6 +43,11 @@ CWV_EXPORT
@property(nonatomic, assign, getter=isPasswordAutofillEnabled)
BOOL passwordAutofillEnabled;
// Whether or not password leak checks will be performed after successful form
// submission. Defaults to |YES|.
@property(nonatomic, assign, getter=isPasswordLeakCheckEnabled)
BOOL passwordLeakCheckEnabled;
- (instancetype)init NS_UNAVAILABLE;
// Resets all translation settings back to default. In particular, this will
......
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