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

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

Issue 305973004: BookmarkClient can add extra nodes to BookmarkModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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
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 6b07ac6ce251d7c18c4e76b3da6e3b4ef6c530a1..d777b22be919bb3eb633580a92d6ad7e73261913 100644
--- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
@@ -609,7 +609,9 @@ class ProfileSyncServiceBookmarkTest : public testing::Test {
EXPECT_EQ(gnode.GetPredecessorId(), gprev.GetId());
EXPECT_EQ(gnode.GetParentId(), gprev.GetParentId());
}
- if (browser_index == bnode->parent()->child_count() - 1) {
+ // 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()) {
EXPECT_EQ(gnode.GetSuccessorId(), 0);
} else {
const BookmarkNode* bnext =
@@ -634,6 +636,7 @@ class ProfileSyncServiceBookmarkTest : public testing::Test {
const BookmarkNode* bnode =
model_associator_->GetChromeNodeFromSyncId(sync_id);
ASSERT_TRUE(bnode);
+ ASSERT_FALSE(model_->IsManaged(bnode));
int64 id = model_associator_->GetSyncIdFromChromeId(bnode->id());
EXPECT_EQ(id, sync_id);
ExpectSyncerNodeMatching(trans, bnode);
@@ -1314,6 +1317,11 @@ class ProfileSyncServiceBookmarkTestWithData
void ExpectBookmarkModelMatchesTestData();
void WriteTestDataToBookmarkModel();
+ // Output transaction versions of |node| and nodes under it to
+ // |node_versions|.
+ void GetTransactionVersions(const BookmarkNode* root,
+ BookmarkNodeVersionMap* node_versions);
+
// Verify transaction versions of bookmark nodes and sync nodes are equal
// recursively. If node is in |version_expected|, versions should match
// there, too.
@@ -2002,8 +2010,7 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateMetaInfoFromModel) {
ExpectModelMatch();
}
-// Output transaction versions of |node| and nodes under it to |node_versions|.
-void GetTransactionVersions(
+void ProfileSyncServiceBookmarkTestWithData::GetTransactionVersions(
const BookmarkNode* root,
BookmarkNodeVersionMap* node_versions) {
node_versions->clear();
@@ -2017,8 +2024,11 @@ void GetTransactionVersions(
EXPECT_NE(BookmarkNode::kInvalidSyncTransactionVersion, version);
(*node_versions)[n->id()] = version;
- for (int i = 0; i < n->child_count(); ++i)
+ for (int i = 0; i < n->child_count(); ++i) {
+ if (model_->IsManaged(n->GetChild(i)))
+ continue;
nodes.push(n->GetChild(i));
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698