Index: components/password_manager/core/browser/password_syncable_service_unittest.cc |
diff --git a/components/password_manager/core/browser/password_syncable_service_unittest.cc b/components/password_manager/core/browser/password_syncable_service_unittest.cc |
index 8d467c5703d523dc8ce9392851dabc6b733ba7ef..ba9f95ea268d1f4c1a0bcac26d236b1578d44f2f 100644 |
--- a/components/password_manager/core/browser/password_syncable_service_unittest.cc |
+++ b/components/password_manager/core/browser/password_syncable_service_unittest.cc |
@@ -16,7 +16,7 @@ |
#include "components/password_manager/core/browser/mock_password_store.h" |
#include "sync/api/sync_change_processor.h" |
#include "sync/api/sync_error.h" |
-#include "sync/api/sync_error_factory.h" |
+#include "sync/api/sync_error_factory_mock.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -480,6 +480,31 @@ TEST_F(PasswordSyncableServiceTest, StartSyncFlare) { |
service()->ActOnPasswordStoreChanges(list); |
} |
+// Start syncing with an error. Subsequent password store updates shouldn't be |
+// propagated to Sync. |
+TEST_F(PasswordSyncableServiceTest, FailedReadFromPasswordStore) { |
+ scoped_ptr<syncer::SyncErrorFactoryMock> error_factory( |
+ new syncer::SyncErrorFactoryMock); |
+ EXPECT_CALL(*password_store(), FillAutofillableLogins(_)) |
+ .WillOnce(Return(false)); |
+ EXPECT_CALL(*error_factory, CreateAndUploadError(_, _)) |
+ .WillOnce(Return(SyncError())); |
+ // ActOnPasswordStoreChanges() below shouldn't generate any changes for Sync. |
+ // |processor_| will be destroyed in MergeDataAndStartSyncing(). |
+ EXPECT_CALL(*processor_, ProcessSyncChanges(_, _)).Times(0); |
+ service()->MergeDataAndStartSyncing( |
+ syncer::PASSWORDS, |
+ syncer::SyncDataList(), |
+ processor_.PassAs<syncer::SyncChangeProcessor>(), |
+ error_factory.PassAs<syncer::SyncErrorFactory>()); |
+ |
+ autofill::PasswordForm form; |
+ form.signon_realm = "abc"; |
+ PasswordStoreChangeList list; |
+ list.push_back(PasswordStoreChange(PasswordStoreChange::ADD, form)); |
+ service()->ActOnPasswordStoreChanges(list); |
+} |
+ |
} // namespace |
} // namespace password_manager |