Commit a81b246d authored by atwilson@chromium.org's avatar atwilson@chromium.org

Ignore errors from more callsites of FixupURLAndGetVisits().

Now we ignore errors returned from FixupURLAndGetVisits() in all calls during ModelAssociation.

There is still a call in TypedURLChangeProcessor, but I haven't seen any errors reported from that one yet so I'm being conservative and letting that one continue to throw an unrecoverable error.

BUG=123219
TEST=Added new unit test.


Review URL: http://codereview.chromium.org/10140012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133789 0039d316-1c4b-4281-b951-d872f2087c98
parent 73edffe7
...@@ -376,10 +376,10 @@ SyncError TypedUrlModelAssociator::UpdateFromSyncDB( ...@@ -376,10 +376,10 @@ SyncError TypedUrlModelAssociator::UpdateFromSyncDB(
// merge them below. // merge them below.
if (!FixupURLAndGetVisits( if (!FixupURLAndGetVisits(
history_backend_, &new_url, &existing_visits)) { history_backend_, &new_url, &existing_visits)) {
return error_handler_->CreateAndUploadError( // Couldn't load the visits for this URL due to some kind of DB error.
FROM_HERE, // Just treat this URL as if it were not an existing URL.
"UpdateFromSyncDB failed", LOG(ERROR) << "Could not load visits for url: " << new_url.url();
model_type()); existing_url = false;
} }
} }
......
...@@ -489,6 +489,41 @@ TEST_F(ProfileSyncServiceTypedUrlTest, HasNativeHasSyncMerge) { ...@@ -489,6 +489,41 @@ TEST_F(ProfileSyncServiceTypedUrlTest, HasNativeHasSyncMerge) {
EXPECT_TRUE(URLsEqual(merged_entry, new_sync_entries[0])); 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) { TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeAdd) {
history::VisitVector added_visits; history::VisitVector added_visits;
history::URLRow added_entry(MakeTypedUrlEntry("http://added.com", "entry", history::URLRow added_entry(MakeTypedUrlEntry("http://added.com", "entry",
......
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