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

Unified Diff: chrome/browser/sync/profile_sync_service_typed_url_unittest.cc

Issue 7753008: [Sync] Verify writing to history backend in typed urls. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test Created 9 years, 4 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 | « chrome/browser/sync/glue/typed_url_model_associator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
index 432aeb474c2a45b6b64b15826f1e9ec6e2fe9092..4bcd09a7a9c92cec7326dbfafa6a3938e9f293c1 100644
--- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
@@ -682,3 +682,30 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeRemoveAll) {
GetTypedUrlsFromSyncDB(&new_sync_entries);
ASSERT_EQ(0U, new_sync_entries.size());
}
+
+TEST_F(ProfileSyncServiceTypedUrlTest, FailWriteToHistoryBackend) {
+ history::VisitVector native_visits;
+ history::VisitVector sync_visits;
+ history::URLRow native_entry(MakeTypedUrlEntry("http://native.com", "entry",
+ 2, 15, false, &native_visits));
+ history::URLRow sync_entry(MakeTypedUrlEntry("http://sync.com", "entry",
+ 3, 16, false, &sync_visits));
+
+ std::vector<history::URLRow> native_entries;
+ native_entries.push_back(native_entry);
+ EXPECT_CALL((*history_backend_.get()), GetAllTypedURLs(_)).
+ WillOnce(DoAll(SetArgumentPointee<0>(native_entries), Return(true)));
+ EXPECT_CALL((*history_backend_.get()), GetVisitsForURL(_, _)).
+ WillRepeatedly(DoAll(SetArgumentPointee<1>(native_visits), Return(true)));
+ EXPECT_CALL((*history_backend_.get()),
+ AddVisits(_, _, history::SOURCE_SYNCED)).WillRepeatedly(Return(false));
+
+ std::vector<history::URLRow> sync_entries;
+ sync_entries.push_back(sync_entry);
+ AddTypedUrlEntriesTask task(this, sync_entries);
+
+ EXPECT_CALL((*history_backend_.get()), UpdateURL(_, _)).
+ WillRepeatedly(Return(false));
+ StartSyncService(&task);
+ ASSERT_TRUE(service_->unrecoverable_error_detected());
+}
« no previous file with comments | « chrome/browser/sync/glue/typed_url_model_associator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698