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

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

Issue 319543003: Create the managed_node at the ChromeBookmarkClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 041856779ac4e30986cd66b002e53cd188487142..b1001142a83393160baf6014323f81360f73b046 100644
--- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc
@@ -23,6 +23,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
+#include "chrome/browser/bookmarks/chrome_bookmark_client.h"
#include "chrome/browser/sync/glue/bookmark_change_processor.h"
#include "chrome/browser/sync/glue/bookmark_model_associator.h"
#include "chrome/common/chrome_switches.h"
@@ -607,7 +608,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 =
@@ -632,6 +635,12 @@ class ProfileSyncServiceBookmarkTest : public testing::Test {
const BookmarkNode* bnode =
model_associator_->GetChromeNodeFromSyncId(sync_id);
ASSERT_TRUE(bnode);
+
+ ChromeBookmarkClient* client =
+ BookmarkModelFactory::GetChromeBookmarkClientForProfile(&profile_);
+ ASSERT_TRUE(client);
+ ASSERT_FALSE(client->IsDescendantOfManagedNode(bnode));
+
int64 id = model_associator_->GetSyncIdFromChromeId(bnode->id());
EXPECT_EQ(id, sync_id);
ExpectSyncerNodeMatching(trans, bnode);
@@ -1312,6 +1321,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.
@@ -2000,10 +2014,13 @@ 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) {
+ ChromeBookmarkClient* client =
+ BookmarkModelFactory::GetChromeBookmarkClientForProfile(&profile_);
+ ASSERT_TRUE(client);
+
node_versions->clear();
std::queue<const BookmarkNode*> nodes;
nodes.push(root);
@@ -2015,8 +2032,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 (client->IsDescendantOfManagedNode(n->GetChild(i)))
+ continue;
nodes.push(n->GetChild(i));
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698