Commit 478dff1d authored by John Z Wu's avatar John Z Wu Committed by Commit Bot

Split out address and creditcard prefs.

Change-Id: Ia0537fad5c80cb07382234853951305b3c340a2d
Reviewed-on: https://chromium-review.googlesource.com/c/1333116Reviewed-by: default avatarHiroshi Ichikawa <ichikawa@chromium.org>
Commit-Queue: John Wu <jzw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607934}
parent 0d9d864b
......@@ -47,13 +47,22 @@
#if BUILDFLAG(IOS_WEB_VIEW_ENABLE_AUTOFILL)
#pragma mark - Autofill
- (void)setAutofillEnabled:(BOOL)enabled {
autofill::prefs::SetAutofillEnabled(_prefService, enabled);
- (void)setProfileAutofillEnabled:(BOOL)enabled {
autofill::prefs::SetProfileAutofillEnabled(_prefService, enabled);
}
- (BOOL)isAutofillEnabled {
return autofill::prefs::IsAutofillEnabled(_prefService);
- (BOOL)isProfileAutofillEnabled {
return autofill::prefs::IsProfileAutofillEnabled(_prefService);
}
- (void)setCreditCardAutofillEnabled:(BOOL)enabled {
autofill::prefs::SetCreditCardAutofillEnabled(_prefService, enabled);
}
- (BOOL)isCreditCardAutofillEnabled {
return autofill::prefs::IsCreditCardAutofillEnabled(_prefService);
}
#endif // BUILDFLAG(IOS_WEB_VIEW_ENABLE_AUTOFILL)
@end
......@@ -52,11 +52,18 @@ class CWVPreferencesTest : public PlatformTest {
CWVPreferences* preferences_;
};
// Tests CWVPreferences |autofillEnabled|.
TEST_F(CWVPreferencesTest, AutofillEnabled) {
EXPECT_TRUE(preferences_.autofillEnabled);
preferences_.autofillEnabled = NO;
EXPECT_FALSE(preferences_.autofillEnabled);
// Tests CWVPreferences |profileAutofillEnabled|.
TEST_F(CWVPreferencesTest, ProfileAutofillEnabled) {
EXPECT_TRUE(preferences_.profileAutofillEnabled);
preferences_.profileAutofillEnabled = NO;
EXPECT_FALSE(preferences_.profileAutofillEnabled);
}
// Tests CWVPreferences |creditCardAutofillEnabled|.
TEST_F(CWVPreferencesTest, CreditCardAutofillEnabled) {
EXPECT_TRUE(preferences_.creditCardAutofillEnabled);
preferences_.creditCardAutofillEnabled = NO;
EXPECT_FALSE(preferences_.creditCardAutofillEnabled);
}
// Tests CWVPreferences |translationEnabled|.
......
......@@ -11,10 +11,17 @@
@interface CWVPreferences (Autofill)
// Whether or not autofill as a feature is turned on. Defaults to |YES|.
// If enabled, contents of submitted forms may be saved and offered as a
// Whether or not profile autofill is turned on. Defaults to |YES|.
// If enabled, contents of submitted profiles may be saved and offered as a
// suggestion in either the same or similar forms.
@property(nonatomic, assign, getter=isAutofillEnabled) BOOL autofillEnabled;
@property(nonatomic, assign, getter=isProfileAutofillEnabled)
BOOL profileAutofillEnabled;
// Whether or not credit card autofill is turned on. Defaults to |YES|.
// If enabled, contents of submitted credit cards may be saved and offered as a
// suggestion in either the same or similar forms.
@property(nonatomic, assign, getter=isCreditCardAutofillEnabled)
BOOL creditCardAutofillEnabled;
@end
......
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