Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Unified Diff: components/password_manager/core/browser/password_syncable_service_unittest.cc

Issue 552713002: PasswordSyncableService shouldn't push any sync changes if MergeDataAndStartSyncing() failed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/password_manager/core/browser/password_syncable_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « components/password_manager/core/browser/password_syncable_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698