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

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

Issue 10140012: Ignore errors from more callsites of FixupURLAndGetVisits(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added comment per review feedback. Created 8 years, 8 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 953592b3788dd0a101a91f37eb2b94a75576363c..be794951e94499d25328a6afd7e873397d6825fa 100644
--- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
@@ -489,6 +489,41 @@ TEST_F(ProfileSyncServiceTypedUrlTest, HasNativeHasSyncMerge) {
EXPECT_TRUE(URLsEqual(merged_entry, new_sync_entries[0]));
}
+TEST_F(ProfileSyncServiceTypedUrlTest, HasNativeWithErrorHasSyncMerge) {
+ history::VisitVector native_visits;
+ history::URLRow native_entry(MakeTypedUrlEntry("http://native.com", "native",
+ 2, 15, false, &native_visits));
+ history::VisitVector sync_visits;
+ history::URLRow sync_entry(MakeTypedUrlEntry("http://native.com", "sync",
+ 1, 17, false, &sync_visits));
+
+ history::URLRows native_entries;
+ native_entries.push_back(native_entry);
+ EXPECT_CALL((*history_backend_.get()), GetAllTypedURLs(_)).
+ WillOnce(DoAll(SetArgumentPointee<0>(native_entries), Return(true)));
+ // Return an error getting the visits for the native URL.
+ EXPECT_CALL((*history_backend_.get()), GetMostRecentVisitsForURL(_, _, _)).
+ WillRepeatedly(Return(false));
+ EXPECT_CALL((*history_backend_.get()), GetURL(_, _)).
+ WillRepeatedly(DoAll(SetArgumentPointee<1>(native_entry), Return(true)));
+ EXPECT_CALL((*history_backend_.get()),
+ AddVisits(_, _, history::SOURCE_SYNCED)). WillRepeatedly(Return(true));
+
+ history::URLRows sync_entries;
+ sync_entries.push_back(sync_entry);
+
+ EXPECT_CALL((*history_backend_.get()), UpdateURL(_, _)).
+ WillRepeatedly(Return(true));
+ EXPECT_CALL((*history_backend_.get()), SetPageTitle(_, _)).
+ WillRepeatedly(Return());
+ StartSyncService(base::Bind(&AddTypedUrlEntries, this, sync_entries));
+
+ history::URLRows new_sync_entries;
+ GetTypedUrlsFromSyncDB(&new_sync_entries);
+ ASSERT_EQ(1U, new_sync_entries.size());
+ EXPECT_TRUE(URLsEqual(sync_entry, new_sync_entries[0]));
+}
+
TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeAdd) {
history::VisitVector added_visits;
history::URLRow added_entry(MakeTypedUrlEntry("http://added.com", "entry",
« 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