Commit 8e989e0d authored by John Z Wu's avatar John Z Wu Committed by Commit Bot

Remove -[CWVAutofillController removeSuggestion:] public API

This API was only able to delete local-only data and because ios/web_view
will no longer save local-only data, this API is now obsolete.

Change-Id: I9e919d84ac9651d72a82eb656bb9678d3d60e05b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2148459Reviewed-by: default avatarHiroshi Ichikawa <ichikawa@chromium.org>
Commit-Queue: John Wu <jzw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759095}
parent d273c844
......@@ -314,20 +314,6 @@ fetchNonPasswordSuggestionsForFormWithName:(NSString*)formName
}
}
- (BOOL)removeSuggestion:(CWVAutofillSuggestion*)suggestion {
// Identifier is greater than 0 for Autofill suggestions.
DCHECK_LT(0, suggestion.formSuggestion.identifier);
web::WebFrame* frame = web::GetWebFrameWithId(
_webState, base::SysNSStringToUTF8(suggestion.frameID));
autofill::AutofillManager* manager = [self autofillManagerForFrame:frame];
if (!manager) {
return NO;
}
return manager->RemoveAutofillProfileOrCreditCard(
suggestion.formSuggestion.identifier);
}
- (void)focusPreviousField {
[_JSSuggestionManager
selectPreviousElementInFrameWithID:_lastFocusFormActivityWebFrameID];
......@@ -346,16 +332,6 @@ fetchNonPasswordSuggestionsForFormWithName:(NSString*)formName
completionHandler:completionHandler];
}
#pragma mark - Utility Methods
- (autofill::AutofillManager*)autofillManagerForFrame:(web::WebFrame*)frame {
if (!_webState || !frame) {
return nil;
}
return autofill::AutofillDriverIOS::FromWebStateAndWebFrame(_webState, frame)
->autofill_manager();
}
#pragma mark - CWVAutofillClientIOSBridge
- (void)showAutofillPopup:(const std::vector<autofill::Suggestion>&)suggestions
......
......@@ -65,11 +65,6 @@ CWV_EXPORT
- (void)acceptSuggestion:(CWVAutofillSuggestion*)suggestion
completionHandler:(nullable void (^)(void))completionHandler;
// Deletes a suggestion from the data store.
// Returns YES if suggestion exists and can be deleted.
// Note that it may take a short while before |suggestion| is no longer fetched.
- (BOOL)removeSuggestion:(CWVAutofillSuggestion*)suggestion;
// Changes focus to the previous sibling of the currently focused field.
// No-op if no field is currently focused or if previous field is not available.
- (void)focusPreviousField;
......
......@@ -322,30 +322,4 @@ TEST_F(WebViewAutofillTest, TestSuggestionFetchFillClear) {
ASSERT_NSEQ(nil, cleared_error);
}
// Tests that CWVAutofillController can remove a suggestion.
TEST_F(WebViewAutofillTest, TestSuggestionFetchRemoveFetch) {
ASSERT_TRUE(test_server_->Start());
ASSERT_TRUE(LoadTestPage());
ASSERT_TRUE(SetFormFieldValue(kTestNameFieldID, kTestNameFieldValue));
ASSERT_TRUE(SetFormFieldValue(kTestAddressFieldID, kTestAddressFieldValue));
ASSERT_TRUE(SetFormFieldValue(kTestStateFieldID, kTestStateFieldValue));
ASSERT_TRUE(SetFormFieldValue(kTestCityFieldID, kTestCityFieldValue));
ASSERT_TRUE(SetFormFieldValue(kTestZipFieldID, kTestZipFieldValue));
ASSERT_TRUE(SubmitForm());
// Wait for about:blank to be loaded after <form> submitted.
ASSERT_TRUE(WaitUntilPageLoaded());
ASSERT_TRUE(LoadTestPage());
NSArray* fetched_suggestions_after_creating = FetchSuggestions();
ASSERT_EQ(1U, fetched_suggestions_after_creating.count);
CWVAutofillSuggestion* suggestion_to_remove =
fetched_suggestions_after_creating.firstObject;
EXPECT_TRUE([autofill_controller_ removeSuggestion:suggestion_to_remove]);
EXPECT_TRUE(WaitUntilConditionOrTimeout(kWaitForActionTimeout, ^bool {
return FetchSuggestions().count == 0;
}));
}
} // namespace ios_web_view
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