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 ...@@ -124,7 +124,8 @@ fetchNonPasswordSuggestionsForFormWithName:(NSString*)formName
autofillAgent:(AutofillAgent*)autofillAgent autofillAgent:(AutofillAgent*)autofillAgent
JSAutofillManager:(JsAutofillManager*)JSAutofillManager JSAutofillManager:(JsAutofillManager*)JSAutofillManager
JSSuggestionManager:(JsSuggestionManager*)JSSuggestionManager JSSuggestionManager:(JsSuggestionManager*)JSSuggestionManager
passwordController:(CWVPasswordController*)passwordController { passwordController:(CWVPasswordController*)passwordController
applicationLocale:(const std::string&)applicationLocale {
self = [super init]; self = [super init];
if (self) { if (self) {
DCHECK(webState); DCHECK(webState);
...@@ -143,8 +144,7 @@ fetchNonPasswordSuggestionsForFormWithName:(NSString*)formName ...@@ -143,8 +144,7 @@ fetchNonPasswordSuggestionsForFormWithName:(NSString*)formName
_autofillClient->set_bridge(self); _autofillClient->set_bridge(self);
autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate( autofill::AutofillDriverIOS::PrepareForWebStateWebFrameAndDelegate(
_webState, _autofillClient.get(), self, _webState, _autofillClient.get(), self, applicationLocale,
ios_web_view::ApplicationContext::GetInstance()->GetApplicationLocale(),
autofill::AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER); autofill::AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER);
_JSAutofillManager = JSAutofillManager; _JSAutofillManager = JSAutofillManager;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define IOS_WEB_VIEW_INTERNAL_AUTOFILL_CWV_AUTOFILL_CONTROLLER_INTERNAL_H_ #define IOS_WEB_VIEW_INTERNAL_AUTOFILL_CWV_AUTOFILL_CONTROLLER_INTERNAL_H_
#include <memory> #include <memory>
#include <string>
#import "ios/web_view/public/cwv_autofill_controller.h" #import "ios/web_view/public/cwv_autofill_controller.h"
...@@ -34,6 +35,7 @@ class WebState; ...@@ -34,6 +35,7 @@ class WebState;
JSAutofillManager:(JsAutofillManager*)JSAutofillManager JSAutofillManager:(JsAutofillManager*)JSAutofillManager
JSSuggestionManager:(JsSuggestionManager*)JSSuggestionManager JSSuggestionManager:(JsSuggestionManager*)JSSuggestionManager
passwordController:(CWVPasswordController*)passwordController passwordController:(CWVPasswordController*)passwordController
applicationLocale:(const std::string&)applicationLocale
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
@end @end
......
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#import "base/test/ios/wait_util.h" #import "base/test/ios/wait_util.h"
#include "components/autofill/core/browser/autofill_manager.h" #include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/logging/stub_log_manager.h"
#include "components/autofill/core/browser/payments/test_strike_database.h"
#include "components/autofill/core/browser/test_personal_data_manager.h"
#include "components/autofill/core/common/autofill_prefs.h"
#import "components/autofill/ios/browser/fake_autofill_agent.h" #import "components/autofill/ios/browser/fake_autofill_agent.h"
#import "components/autofill/ios/browser/fake_js_autofill_manager.h" #import "components/autofill/ios/browser/fake_js_autofill_manager.h"
#import "components/autofill/ios/browser/form_suggestion.h" #import "components/autofill/ios/browser/form_suggestion.h"
...@@ -20,14 +24,17 @@ ...@@ -20,14 +24,17 @@
#import "components/autofill/ios/form_util/form_activity_tab_helper.h" #import "components/autofill/ios/form_util/form_activity_tab_helper.h"
#import "components/autofill/ios/form_util/test_form_activity_tab_helper.h" #import "components/autofill/ios/form_util/test_form_activity_tab_helper.h"
#include "components/password_manager/core/browser/password_manager.h" #include "components/password_manager/core/browser/password_manager.h"
#include "components/password_manager/core/common/password_manager_pref_names.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/testing_pref_service.h"
#include "components/sync/driver/test_sync_service.h"
#import "ios/web/public/deprecated/crw_test_js_injection_receiver.h" #import "ios/web/public/deprecated/crw_test_js_injection_receiver.h"
#include "ios/web/public/js_messaging/web_frames_manager.h" #include "ios/web/public/js_messaging/web_frames_manager.h"
#import "ios/web/public/test/fakes/fake_web_frame.h" #import "ios/web/public/test/fakes/fake_web_frame.h"
#import "ios/web/public/test/fakes/fake_web_frames_manager.h" #import "ios/web/public/test/fakes/fake_web_frames_manager.h"
#include "ios/web/public/test/fakes/test_browser_state.h"
#import "ios/web/public/test/fakes/test_web_state.h" #import "ios/web/public/test/fakes/test_web_state.h"
#include "ios/web/public/test/scoped_testing_web_client.h"
#include "ios/web/public/test/web_task_environment.h" #include "ios/web/public/test/web_task_environment.h"
#include "ios/web/public/web_client.h"
#import "ios/web_view/internal/autofill/cwv_autofill_suggestion_internal.h" #import "ios/web_view/internal/autofill/cwv_autofill_suggestion_internal.h"
#import "ios/web_view/internal/autofill/web_view_autofill_client_ios.h" #import "ios/web_view/internal/autofill/web_view_autofill_client_ios.h"
#import "ios/web_view/internal/passwords/cwv_password_controller_fake.h" #import "ios/web_view/internal/passwords/cwv_password_controller_fake.h"
...@@ -35,7 +42,6 @@ ...@@ -35,7 +42,6 @@
#import "ios/web_view/internal/passwords/web_view_password_manager_driver.h" #import "ios/web_view/internal/passwords/web_view_password_manager_driver.h"
#include "ios/web_view/internal/web_view_browser_state.h" #include "ios/web_view/internal/web_view_browser_state.h"
#import "ios/web_view/public/cwv_autofill_controller_delegate.h" #import "ios/web_view/public/cwv_autofill_controller_delegate.h"
#include "ios/web_view/test/test_with_locale_and_resources.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#import "testing/gtest_mac.h" #import "testing/gtest_mac.h"
#include "testing/platform_test.h" #include "testing/platform_test.h"
...@@ -52,6 +58,7 @@ namespace ios_web_view { ...@@ -52,6 +58,7 @@ namespace ios_web_view {
namespace { namespace {
const char kApplicationLocale[] = "en-US";
NSString* const kTestFormName = @"FormName"; NSString* const kTestFormName = @"FormName";
NSString* const kTestFieldIdentifier = @"FieldIdentifier"; NSString* const kTestFieldIdentifier = @"FieldIdentifier";
NSString* const kTestFrameId = @"FrameID"; NSString* const kTestFrameId = @"FrameID";
...@@ -60,76 +67,85 @@ NSString* const kTestDisplayDescription = @"DisplayDescription"; ...@@ -60,76 +67,85 @@ NSString* const kTestDisplayDescription = @"DisplayDescription";
} // namespace } // namespace
class CWVAutofillControllerTest : public TestWithLocaleAndResources { class CWVAutofillControllerTest : public PlatformTest {
protected: protected:
CWVAutofillControllerTest() CWVAutofillControllerTest() {
: web_client_(std::make_unique<web::WebClient>()), pref_service_.registry()->RegisterBooleanPref(
task_environment_(web::WebTaskEnvironment::IO_MAINLOOP), password_manager::prefs::kCredentialsEnableService, true);
browser_state_(/*off_the_record=*/false) { pref_service_.registry()->RegisterBooleanPref(
test_web_state_.SetBrowserState(&browser_state_); autofill::prefs::kAutofillProfileEnabled, true);
web_state_.SetBrowserState(&browser_state_);
CRWTestJSInjectionReceiver* injectionReceiver = CRWTestJSInjectionReceiver* injectionReceiver =
[[CRWTestJSInjectionReceiver alloc] init]; [[CRWTestJSInjectionReceiver alloc] init];
test_web_state_.SetJSInjectionReceiver(injectionReceiver); web_state_.SetJSInjectionReceiver(injectionReceiver);
js_autofill_manager_ = js_autofill_manager_ =
[[FakeJSAutofillManager alloc] initWithReceiver:injectionReceiver]; [[FakeJSAutofillManager alloc] initWithReceiver:injectionReceiver];
js_suggestion_manager_ = OCMClassMock([JsSuggestionManager class]); js_suggestion_manager_ = OCMClassMock([JsSuggestionManager class]);
autofill_agent_ = autofill_agent_ =
[[FakeAutofillAgent alloc] initWithPrefService:browser_state_.GetPrefs() [[FakeAutofillAgent alloc] initWithPrefService:&pref_service_
webState:&test_web_state_]; webState:&web_state_];
auto frames_manager = std::make_unique<web::FakeWebFramesManager>(); auto frames_manager = std::make_unique<web::FakeWebFramesManager>();
fake_web_frames_manager_ = frames_manager.get(); web_frames_manager_ = frames_manager.get();
test_web_state_.SetWebFramesManager(std::move(frames_manager)); web_state_.SetWebFramesManager(std::move(frames_manager));
// TODO(crbug.com/1070468): Redo CWVPasswordController so it is easier to // TODO(crbug.com/1070468): Redo CWVPasswordController so it is easier to
// fake in unit tests. // fake in unit tests.
auto passwordManagerClient = std::make_unique<WebViewPasswordManagerClient>( auto password_manager_client =
&test_web_state_, /*sync_service=*/nullptr, browser_state_.GetPrefs(), std::make_unique<WebViewPasswordManagerClient>(
/*identity_manager=*/nullptr, /*log_manager=*/nullptr, &web_state_, /*sync_service=*/nullptr, &pref_service_,
/*profile_store=*/nullptr, /*account_store=*/nullptr); /*identity_manager=*/nullptr, /*log_manager=*/nullptr,
auto passwordManager = std::make_unique<password_manager::PasswordManager>( /*profile_store=*/nullptr, /*account_store=*/nullptr);
passwordManagerClient.get()); auto password_manager = std::make_unique<password_manager::PasswordManager>(
auto passwordManagerDriver = password_manager_client.get());
auto password_manager_driver =
std::make_unique<WebViewPasswordManagerDriver>(); std::make_unique<WebViewPasswordManagerDriver>();
password_controller_ = [[CWVPasswordControllerFake alloc] password_controller_ = [[CWVPasswordControllerFake alloc]
initWithWebState:&test_web_state_ initWithWebState:&web_state_
passwordManager:std::move(passwordManager) passwordManager:std::move(password_manager)
passwordManagerClient:std::move(passwordManagerClient) passwordManagerClient:std::move(password_manager_client)
passwordManagerDriver:std::move(passwordManagerDriver)]; passwordManagerDriver:std::move(password_manager_driver)];
// TODO(crbug.com/1070657): Fake the dependencies of the autofill client. auto autofill_client = std::make_unique<autofill::WebViewAutofillClientIOS>(
auto autofill_client = autofill::WebViewAutofillClientIOS::Create( kApplicationLocale, &pref_service_, &personal_data_manager_,
&test_web_state_, &browser_state_); /*autocomplete_history_manager=*/nullptr, &web_state_,
/*identity_manager=*/nullptr, &strike_database_, &sync_service_,
std::make_unique<autofill::StubLogManager>());
autofill_controller_ = [[CWVAutofillController alloc] autofill_controller_ = [[CWVAutofillController alloc]
initWithWebState:&test_web_state_ initWithWebState:&web_state_
autofillClient:std::move(autofill_client) autofillClient:std::move(autofill_client)
autofillAgent:autofill_agent_ autofillAgent:autofill_agent_
JSAutofillManager:js_autofill_manager_ JSAutofillManager:js_autofill_manager_
JSSuggestionManager:js_suggestion_manager_ JSSuggestionManager:js_suggestion_manager_
passwordController:password_controller_]; passwordController:password_controller_
test_form_activity_tab_helper_ = applicationLocale:kApplicationLocale];
std::make_unique<autofill::TestFormActivityTabHelper>(&test_web_state_); form_activity_tab_helper_ =
std::make_unique<autofill::TestFormActivityTabHelper>(&web_state_);
} }
void AddWebFrame(std::unique_ptr<web::WebFrame> frame) { void AddWebFrame(std::unique_ptr<web::WebFrame> frame) {
web::WebFrame* frame_ptr = frame.get(); web::WebFrame* frame_ptr = frame.get();
fake_web_frames_manager_->AddWebFrame(std::move(frame)); web_frames_manager_->AddWebFrame(std::move(frame));
test_web_state_.OnWebFrameDidBecomeAvailable(frame_ptr); web_state_.OnWebFrameDidBecomeAvailable(frame_ptr);
} }
web::ScopedTestingWebClient web_client_;
web::WebTaskEnvironment task_environment_; web::WebTaskEnvironment task_environment_;
ios_web_view::WebViewBrowserState browser_state_; TestingPrefServiceSimple pref_service_;
web::TestWebState test_web_state_; web::TestBrowserState browser_state_;
web::FakeWebFramesManager* fake_web_frames_manager_; web::TestWebState web_state_;
autofill::TestPersonalDataManager personal_data_manager_;
autofill::TestStrikeDatabase strike_database_;
syncer::TestSyncService sync_service_;
web::FakeWebFramesManager* web_frames_manager_;
CWVAutofillController* autofill_controller_; CWVAutofillController* autofill_controller_;
FakeAutofillAgent* autofill_agent_; FakeAutofillAgent* autofill_agent_;
FakeJSAutofillManager* js_autofill_manager_; FakeJSAutofillManager* js_autofill_manager_;
CWVPasswordControllerFake* password_controller_; CWVPasswordControllerFake* password_controller_;
std::unique_ptr<autofill::TestFormActivityTabHelper> std::unique_ptr<autofill::TestFormActivityTabHelper>
test_form_activity_tab_helper_; form_activity_tab_helper_;
id js_suggestion_manager_; id js_suggestion_manager_;
}; };
...@@ -297,30 +313,25 @@ TEST_F(CWVAutofillControllerTest, FocusCallback) { ...@@ -297,30 +313,25 @@ TEST_F(CWVAutofillControllerTest, FocusCallback) {
id delegate = OCMProtocolMock(@protocol(CWVAutofillControllerDelegate)); id delegate = OCMProtocolMock(@protocol(CWVAutofillControllerDelegate));
autofill_controller_.delegate = delegate; autofill_controller_.delegate = delegate;
// [delegate expect] returns an autoreleased object, but it must be [[delegate expect] autofillController:autofill_controller_
// destroyed before this test exits to avoid holding on to didFocusOnFieldWithIdentifier:kTestFieldIdentifier
// |autofill_controller_|. fieldType:@""
@autoreleasepool { formName:kTestFormName
[[delegate expect] autofillController:autofill_controller_ frameID:kTestFrameId
didFocusOnFieldWithIdentifier:kTestFieldIdentifier value:kTestFieldValue
fieldType:@"" userInitiated:YES];
formName:kTestFormName
frameID:kTestFrameId autofill::FormActivityParams params;
value:kTestFieldValue params.form_name = base::SysNSStringToUTF8(kTestFormName);
userInitiated:YES]; params.field_identifier = base::SysNSStringToUTF8(kTestFieldIdentifier);
params.value = base::SysNSStringToUTF8(kTestFieldValue);
autofill::FormActivityParams params; params.frame_id = base::SysNSStringToUTF8(kTestFrameId);
params.form_name = base::SysNSStringToUTF8(kTestFormName); params.has_user_gesture = true;
params.field_identifier = base::SysNSStringToUTF8(kTestFieldIdentifier); params.type = "focus";
params.value = base::SysNSStringToUTF8(kTestFieldValue); web::FakeWebFrame frame(base::SysNSStringToUTF8(kTestFrameId), true,
params.frame_id = base::SysNSStringToUTF8(kTestFrameId); GURL::EmptyGURL());
params.has_user_gesture = true; form_activity_tab_helper_->FormActivityRegistered(&frame, params);
params.type = "focus"; [delegate verify];
web::FakeWebFrame frame(base::SysNSStringToUTF8(kTestFrameId), true,
GURL::EmptyGURL());
test_form_activity_tab_helper_->FormActivityRegistered(&frame, params);
[delegate verify];
}
} }
// Tests CWVAutofillController delegate input callback is invoked. // Tests CWVAutofillController delegate input callback is invoked.
...@@ -328,30 +339,25 @@ TEST_F(CWVAutofillControllerTest, InputCallback) { ...@@ -328,30 +339,25 @@ TEST_F(CWVAutofillControllerTest, InputCallback) {
id delegate = OCMProtocolMock(@protocol(CWVAutofillControllerDelegate)); id delegate = OCMProtocolMock(@protocol(CWVAutofillControllerDelegate));
autofill_controller_.delegate = delegate; autofill_controller_.delegate = delegate;
// [delegate expect] returns an autoreleased object, but it must be [[delegate expect] autofillController:autofill_controller_
// destroyed before this test exits to avoid holding on to didInputInFieldWithIdentifier:kTestFieldIdentifier
// |autofill_controller_|. fieldType:@""
@autoreleasepool { formName:kTestFormName
[[delegate expect] autofillController:autofill_controller_ frameID:kTestFrameId
didInputInFieldWithIdentifier:kTestFieldIdentifier value:kTestFieldValue
fieldType:@"" userInitiated:YES];
formName:kTestFormName
frameID:kTestFrameId autofill::FormActivityParams params;
value:kTestFieldValue params.form_name = base::SysNSStringToUTF8(kTestFormName);
userInitiated:YES]; params.field_identifier = base::SysNSStringToUTF8(kTestFieldIdentifier);
params.value = base::SysNSStringToUTF8(kTestFieldValue);
autofill::FormActivityParams params; params.frame_id = base::SysNSStringToUTF8(kTestFrameId);
params.form_name = base::SysNSStringToUTF8(kTestFormName); params.type = "input";
params.field_identifier = base::SysNSStringToUTF8(kTestFieldIdentifier); params.has_user_gesture = true;
params.value = base::SysNSStringToUTF8(kTestFieldValue); web::FakeWebFrame frame(base::SysNSStringToUTF8(kTestFrameId), true,
params.frame_id = base::SysNSStringToUTF8(kTestFrameId); GURL::EmptyGURL());
params.type = "input"; form_activity_tab_helper_->FormActivityRegistered(&frame, params);
params.has_user_gesture = true; [delegate verify];
web::FakeWebFrame frame(base::SysNSStringToUTF8(kTestFrameId), true,
GURL::EmptyGURL());
test_form_activity_tab_helper_->FormActivityRegistered(&frame, params);
[delegate verify];
}
} }
// Tests CWVAutofillController delegate blur callback is invoked. // Tests CWVAutofillController delegate blur callback is invoked.
...@@ -359,9 +365,6 @@ TEST_F(CWVAutofillControllerTest, BlurCallback) { ...@@ -359,9 +365,6 @@ TEST_F(CWVAutofillControllerTest, BlurCallback) {
id delegate = OCMProtocolMock(@protocol(CWVAutofillControllerDelegate)); id delegate = OCMProtocolMock(@protocol(CWVAutofillControllerDelegate));
autofill_controller_.delegate = delegate; autofill_controller_.delegate = delegate;
// [delegate expect] returns an autoreleased object, but it must be destroyed
// before this test exits to avoid holding on to |autofill_controller_|.
@autoreleasepool {
[[delegate expect] autofillController:autofill_controller_ [[delegate expect] autofillController:autofill_controller_
didBlurOnFieldWithIdentifier:kTestFieldIdentifier didBlurOnFieldWithIdentifier:kTestFieldIdentifier
fieldType:@"" fieldType:@""
...@@ -379,10 +382,9 @@ TEST_F(CWVAutofillControllerTest, BlurCallback) { ...@@ -379,10 +382,9 @@ TEST_F(CWVAutofillControllerTest, BlurCallback) {
params.has_user_gesture = true; params.has_user_gesture = true;
web::FakeWebFrame frame(base::SysNSStringToUTF8(kTestFrameId), true, web::FakeWebFrame frame(base::SysNSStringToUTF8(kTestFrameId), true,
GURL::EmptyGURL()); GURL::EmptyGURL());
test_form_activity_tab_helper_->FormActivityRegistered(&frame, params); form_activity_tab_helper_->FormActivityRegistered(&frame, params);
[delegate verify]; [delegate verify];
}
} }
// Tests CWVAutofillController delegate submit callback is invoked. // Tests CWVAutofillController delegate submit callback is invoked.
...@@ -390,16 +392,13 @@ TEST_F(CWVAutofillControllerTest, SubmitCallback) { ...@@ -390,16 +392,13 @@ TEST_F(CWVAutofillControllerTest, SubmitCallback) {
id delegate = OCMProtocolMock(@protocol(CWVAutofillControllerDelegate)); id delegate = OCMProtocolMock(@protocol(CWVAutofillControllerDelegate));
autofill_controller_.delegate = delegate; autofill_controller_.delegate = delegate;
// [delegate expect] returns an autoreleased object, but it must be destroyed
// before this test exits to avoid holding on to |autofill_controller_|.
@autoreleasepool {
[[delegate expect] autofillController:autofill_controller_ [[delegate expect] autofillController:autofill_controller_
didSubmitFormWithName:kTestFormName didSubmitFormWithName:kTestFormName
frameID:kTestFrameId frameID:kTestFrameId
userInitiated:YES]; userInitiated:YES];
web::FakeWebFrame frame(base::SysNSStringToUTF8(kTestFrameId), true, web::FakeWebFrame frame(base::SysNSStringToUTF8(kTestFrameId), true,
GURL::EmptyGURL()); GURL::EmptyGURL());
test_form_activity_tab_helper_->DocumentSubmitted( form_activity_tab_helper_->DocumentSubmitted(
/*sender_frame*/ &frame, base::SysNSStringToUTF8(kTestFormName), /*sender_frame*/ &frame, base::SysNSStringToUTF8(kTestFormName),
/*form_data=*/"", /*form_data=*/"",
/*user_initiated=*/true, /*user_initiated=*/true,
...@@ -410,14 +409,13 @@ TEST_F(CWVAutofillControllerTest, SubmitCallback) { ...@@ -410,14 +409,13 @@ TEST_F(CWVAutofillControllerTest, SubmitCallback) {
frameID:kTestFrameId frameID:kTestFrameId
userInitiated:NO]; userInitiated:NO];
test_form_activity_tab_helper_->DocumentSubmitted( form_activity_tab_helper_->DocumentSubmitted(
/*sender_frame*/ &frame, base::SysNSStringToUTF8(kTestFormName), /*sender_frame*/ &frame, base::SysNSStringToUTF8(kTestFormName),
/*form_data=*/"", /*form_data=*/"",
/*user_initiated=*/false, /*user_initiated=*/false,
/*is_main_frame=*/true); /*is_main_frame=*/true);
[delegate verify]; [delegate verify];
}
} }
} // namespace ios_web_view } // namespace ios_web_view
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#import "ios/web/public/web_state_delegate_bridge.h" #import "ios/web/public/web_state_delegate_bridge.h"
#import "ios/web/public/web_state_observer_bridge.h" #import "ios/web/public/web_state_observer_bridge.h"
#import "ios/web/public/web_view_only/wk_web_view_configuration_util.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/cwv_autofill_controller_internal.h"
#import "ios/web_view/internal/autofill/web_view_autofill_client_ios.h" #import "ios/web_view/internal/autofill/web_view_autofill_client_ios.h"
#import "ios/web_view/internal/cwv_back_forward_list_internal.h" #import "ios/web_view/internal/cwv_back_forward_list_internal.h"
...@@ -663,13 +664,15 @@ BOOL gChromeLongPressAndForceTouchHandlingEnabled = YES; ...@@ -663,13 +664,15 @@ BOOL gChromeLongPressAndForceTouchHandlingEnabled = YES;
passwordManagerClient:std::move(passwordManagerClient) passwordManagerClient:std::move(passwordManagerClient)
passwordManagerDriver:std::move(passwordManagerDriver)]; passwordManagerDriver:std::move(passwordManagerDriver)];
return return [[CWVAutofillController alloc]
[[CWVAutofillController alloc] initWithWebState:_webState.get() initWithWebState:_webState.get()
autofillClient:std::move(autofillClient) autofillClient:std::move(autofillClient)
autofillAgent:autofillAgent autofillAgent:autofillAgent
JSAutofillManager:JSAutofillManager JSAutofillManager:JSAutofillManager
JSSuggestionManager:JSSuggestionManager JSSuggestionManager:JSSuggestionManager
passwordController:passwordController]; passwordController:passwordController
applicationLocale:ios_web_view::ApplicationContext::GetInstance()
->GetApplicationLocale()];
} }
#pragma mark - Preserving and Restoring State #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