Commit 91e56282 authored by John Z Wu's avatar John Z Wu Committed by Commit Bot

Use password store mock in CWVSyncController unit test

Change-Id: Iba9f1716404812f2cb4ebb5b302bd04f7eddf8d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2040610
Commit-Queue: John Wu <jzw@chromium.org>
Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Reviewed-by: default avatarHiroshi Ichikawa <ichikawa@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739442}
parent cab3ce7b
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "base/test/bind_test_util.h" #include "base/test/bind_test_util.h"
#include "components/autofill/core/browser/test_personal_data_manager.h" #include "components/autofill/core/browser/test_personal_data_manager.h"
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
#include "components/password_manager/core/browser/test_password_store.h" #include "components/password_manager/core/browser/mock_password_store.h"
#include "components/signin/core/browser/signin_error_controller.h" #include "components/signin/core/browser/signin_error_controller.h"
#include "components/signin/public/base/account_consistency_method.h" #include "components/signin/public/base/account_consistency_method.h"
#include "components/signin/public/base/signin_pref_names.h" #include "components/signin/public/base/signin_pref_names.h"
...@@ -92,7 +92,7 @@ class CWVSyncControllerTest : public TestWithLocaleAndResources { ...@@ -92,7 +92,7 @@ class CWVSyncControllerTest : public TestWithLocaleAndResources {
base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(),
base::ThreadTaskRunnerHandle::Get()); base::ThreadTaskRunnerHandle::Get());
password_store_ = new password_manager::TestPasswordStore(); password_store_ = new password_manager::MockPasswordStore;
password_store_->Init(base::RepeatingCallback<void(syncer::ModelType)>(), password_store_->Init(base::RepeatingCallback<void(syncer::ModelType)>(),
nullptr); nullptr);
...@@ -132,7 +132,7 @@ class CWVSyncControllerTest : public TestWithLocaleAndResources { ...@@ -132,7 +132,7 @@ class CWVSyncControllerTest : public TestWithLocaleAndResources {
web::WebTaskEnvironment task_environment_; web::WebTaskEnvironment task_environment_;
web::ScopedTestingWebClient web_client_; web::ScopedTestingWebClient web_client_;
ios_web_view::WebViewBrowserState browser_state_; ios_web_view::WebViewBrowserState browser_state_;
scoped_refptr<password_manager::TestPasswordStore> password_store_; scoped_refptr<password_manager::MockPasswordStore> password_store_;
std::unique_ptr<autofill::TestPersonalDataManager> personal_data_manager_; std::unique_ptr<autofill::TestPersonalDataManager> personal_data_manager_;
autofill::AutofillWebDataService* autofill_web_data_service_; autofill::AutofillWebDataService* autofill_web_data_service_;
CWVSyncController* sync_controller_ = nil; CWVSyncController* sync_controller_ = nil;
...@@ -225,6 +225,10 @@ TEST_F(CWVSyncControllerTest, CurrentIdentity) { ...@@ -225,6 +225,10 @@ TEST_F(CWVSyncControllerTest, CurrentIdentity) {
EXPECT_NSEQ(identity.gaiaID, currentIdentity.gaiaID); EXPECT_NSEQ(identity.gaiaID, currentIdentity.gaiaID);
EXPECT_CALL(*mock_sync_service(), StopAndClear()); EXPECT_CALL(*mock_sync_service(), StopAndClear());
EXPECT_CALL(*password_store_, RemoveLoginsCreatedBetweenImpl);
EXPECT_CALL(*password_store_, BeginTransaction);
EXPECT_CALL(*password_store_, NotifyLoginsChanged);
EXPECT_CALL(*password_store_, CommitTransaction);
[sync_controller_ stopSyncAndClearIdentity]; [sync_controller_ stopSyncAndClearIdentity];
EXPECT_FALSE(sync_controller_.currentIdentity); EXPECT_FALSE(sync_controller_.currentIdentity);
} }
......
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