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

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

Issue 376993002: Fixed ProfileSyncServiceBookmarkTest on iOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « no previous file | 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_bookmark_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
index 02195bea7fd54c199fbaf09fc7377a1f24d6e3d3..b0eb70235f8f5a45a3f40387aab6cce4f9a36b6a 100644
--- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
@@ -336,6 +336,10 @@ class ProfileSyncServiceBookmarkTest : public testing::Test {
test_user_share_.TearDown();
}
+ bool CanSyncNode(const BookmarkNode* node) {
+ return model_->client()->CanSyncNode(node);
+ }
+
// Inserts a folder directly to the share.
// Do not use this after model association is complete.
//
@@ -606,13 +610,14 @@ class ProfileSyncServiceBookmarkTest : public testing::Test {
EXPECT_EQ(gnode.GetPredecessorId(), gprev.GetId());
EXPECT_EQ(gnode.GetParentId(), gprev.GetParentId());
}
- // Note: the managed node comes next to the mobile node but isn't synced.
- if (browser_index == bnode->parent()->child_count() - 1 ||
- bnode == model_->mobile_node()) {
+ // Note: the managed node is the last child of the root_node but isn't
+ // synced; if CanSyncNode() is false then there is no next node to sync.
+ const BookmarkNode* bnext = NULL;
+ if (browser_index + 1 < bnode->parent()->child_count())
+ bnext = bnode->parent()->GetChild(browser_index + 1);
+ if (!bnext || !CanSyncNode(bnext)) {
EXPECT_EQ(gnode.GetSuccessorId(), 0);
} else {
- const BookmarkNode* bnext =
- bnode->parent()->GetChild(browser_index + 1);
syncer::ReadNode gnext(trans);
ASSERT_TRUE(InitSyncNodeFromChromeNode(bnext, &gnext));
EXPECT_EQ(gnode.GetSuccessorId(), gnext.GetId());
@@ -633,11 +638,7 @@ class ProfileSyncServiceBookmarkTest : public testing::Test {
const BookmarkNode* bnode =
model_associator_->GetChromeNodeFromSyncId(sync_id);
ASSERT_TRUE(bnode);
-
- ChromeBookmarkClient* client =
- ChromeBookmarkClientFactory::GetForProfile(&profile_);
- ASSERT_TRUE(client);
- ASSERT_FALSE(client->IsDescendantOfManagedNode(bnode));
+ ASSERT_TRUE(CanSyncNode(bnode));
int64 id = model_associator_->GetSyncIdFromChromeId(bnode->id());
EXPECT_EQ(id, sync_id);
@@ -2010,10 +2011,6 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateMetaInfoFromModel) {
void ProfileSyncServiceBookmarkTestWithData::GetTransactionVersions(
const BookmarkNode* root,
BookmarkNodeVersionMap* node_versions) {
- ChromeBookmarkClient* client =
- ChromeBookmarkClientFactory::GetForProfile(&profile_);
- ASSERT_TRUE(client);
-
node_versions->clear();
std::queue<const BookmarkNode*> nodes;
nodes.push(root);
@@ -2026,7 +2023,7 @@ void ProfileSyncServiceBookmarkTestWithData::GetTransactionVersions(
(*node_versions)[n->id()] = version;
for (int i = 0; i < n->child_count(); ++i) {
- if (client->IsDescendantOfManagedNode(n->GetChild(i)))
+ if (!CanSyncNode(n->GetChild(i)))
continue;
nodes.push(n->GetChild(i));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698