Commit 38e72570 authored by zea@chromium.org's avatar zea@chromium.org

[Sync] Fix mobile bookmark folder association on non-android

We were failing to associate the mobile bookmarks folder at sync startup time.
This could result in various seemingly-random bookmark unrecoverable errors.
We now associate the bookmark folder if it's there, and condition triggering
an association error on whether we expected it to be there (which we only do
on ANDROID platforms).

BUG=121587
TEST=Sign in to sync with a clean profile, but synced mobile bookmarks existing
in the mobile bookmarks folder on the server. Bookmarks should appear on the
desktop client.


Review URL: https://chromiumcodereview.appspot.com/10828268

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151178 0039d316-1c4b-4281-b951-d872f2087c98
parent 2108f87f
......@@ -397,23 +397,19 @@ syncer::SyncError BookmarkModelAssociator::BuildAssociations() {
// and Other Bookmarks.
error = AssociateTaggedPermanentNode(bookmark_model_->other_node(),
kOtherBookmarksTag);
if (error.IsSet()) {
if (error.IsSet())
return error;
}
error = AssociateTaggedPermanentNode(bookmark_model_->bookmark_bar_node(),
kBookmarkBarTag);
if (error.IsSet()) {
if (error.IsSet())
return error;
}
if (expect_mobile_bookmarks_folder_) {
error = AssociateTaggedPermanentNode(bookmark_model_->mobile_node(),
kMobileBookmarksTag);
if (error.IsSet()) {
return error;
}
}
error = AssociateTaggedPermanentNode(bookmark_model_->mobile_node(),
kMobileBookmarksTag);
if (error.IsSet() && expect_mobile_bookmarks_folder_)
return error;
error = syncer::SyncError();
int64 bookmark_bar_sync_id = GetSyncIdFromChromeId(
bookmark_model_->bookmark_bar_node()->id());
......
......@@ -51,6 +51,12 @@ using testing::InvokeWithoutArgs;
using testing::Mock;
using testing::StrictMock;
#if defined(OS_ANDROID)
static const bool kExpectMobileBookmarks = true;
#else
static const bool kExpectMobileBookmarks = false;
#endif // defined(OS_ANDROID)
class TestBookmarkModelAssociator : public BookmarkModelAssociator {
public:
TestBookmarkModelAssociator(
......@@ -59,7 +65,7 @@ class TestBookmarkModelAssociator : public BookmarkModelAssociator {
DataTypeErrorHandler* error_handler)
: BookmarkModelAssociator(bookmark_model, user_share,
error_handler,
true /* expect_mobile_bookmarks_folder */),
kExpectMobileBookmarks),
user_share_(user_share) {}
// TODO(akalin): This logic lazily creates any tagged node that is
......
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