Commit 5a122b34 authored by John Z Wu's avatar John Z Wu Committed by Commit Bot

Cleanup CWVAutofillControllerTest

- Use more mocks
- Remove old autoreleasepool work around

Bug: 1070657
Change-Id: Ic234ddb2e9be28048a39c365ec8c2e09eaf38d74
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2147882
Commit-Queue: John Wu <jzw@chromium.org>
Reviewed-by: default avatarHiroshi Ichikawa <ichikawa@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759111}
parent 43511d1f
......@@ -124,7 +124,8 @@ fetchNonPasswordSuggestionsForFormWithName:(NSString*)formName
autofillAgent:(AutofillAgent*)autofillAgent
JSAutofillManager:(JsAutofillManager*)JSAutofillManager
JSSuggestionManager:(JsSuggestionManager*)JSSuggestionManager
passwordController:(CWVPasswordController*)passwordController {
passwordController:(CWVPasswordController*)passwordController
applicationLocale:(const std::string&)applicationLocale {
self = [super init];
if (self) {
DCHECK(webState);
......@@ -143,8 +144,7 @@ fetchNonPasswordSuggestionsForFormWithName:(NSString*)formName
_autofillClient->set_bridge(self);
autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate(
_webState, _autofillClient.get(), self,
ios_web_view::ApplicationContext::GetInstance()->GetApplicationLocale(),
_webState, _autofillClient.get(), self, applicationLocale,
autofill::AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER);
_JSAutofillManager = JSAutofillManager;
......
......@@ -6,6 +6,7 @@
#define IOS_WEB_VIEW_INTERNAL_AUTOFILL_CWV_AUTOFILL_CONTROLLER_INTERNAL_H_
#include <memory>
#include <string>
#import "ios/web_view/public/cwv_autofill_controller.h"
......@@ -34,6 +35,7 @@ class WebState;
JSAutofillManager:(JsAutofillManager*)JSAutofillManager
JSSuggestionManager:(JsSuggestionManager*)JSSuggestionManager
passwordController:(CWVPasswordController*)passwordController
applicationLocale:(const std::string&)applicationLocale
NS_DESIGNATED_INITIALIZER;
@end
......
......@@ -38,6 +38,7 @@
#import "ios/web/public/web_state_delegate_bridge.h"
#import "ios/web/public/web_state_observer_bridge.h"
#import "ios/web/public/web_view_only/wk_web_view_configuration_util.h"
#include "ios/web_view/internal/app/application_context.h"
#import "ios/web_view/internal/autofill/cwv_autofill_controller_internal.h"
#import "ios/web_view/internal/autofill/web_view_autofill_client_ios.h"
#import "ios/web_view/internal/cwv_back_forward_list_internal.h"
......@@ -663,13 +664,15 @@ BOOL gChromeLongPressAndForceTouchHandlingEnabled = YES;
passwordManagerClient:std::move(passwordManagerClient)
passwordManagerDriver:std::move(passwordManagerDriver)];
return
[[CWVAutofillController alloc] initWithWebState:_webState.get()
autofillClient:std::move(autofillClient)
autofillAgent:autofillAgent
JSAutofillManager:JSAutofillManager
JSSuggestionManager:JSSuggestionManager
passwordController:passwordController];
return [[CWVAutofillController alloc]
initWithWebState:_webState.get()
autofillClient:std::move(autofillClient)
autofillAgent:autofillAgent
JSAutofillManager:JSAutofillManager
JSSuggestionManager:JSSuggestionManager
passwordController:passwordController
applicationLocale:ios_web_view::ApplicationContext::GetInstance()
->GetApplicationLocale()];
}
#pragma mark - Preserving and Restoring State
......
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