| Index: chrome/browser/bookmarks/bookmark_model_unittest.cc
|
| diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc
|
| index 5d1a0a3d4e5f3d88a54ec0e5e51c817010dfaaaf..d1e9e91b9390e1d53f57f9792ff4877b091d0e5b 100644
|
| --- a/chrome/browser/bookmarks/bookmark_model_unittest.cc
|
| +++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc
|
| @@ -178,7 +178,14 @@ TEST_F(BookmarkModelTest, InitialState) {
|
| EXPECT_EQ(0, other_node->child_count());
|
| EXPECT_EQ(BookmarkNode::OTHER_NODE, other_node->type());
|
|
|
| + const BookmarkNode* synced_node = model.synced_node();
|
| + ASSERT_TRUE(synced_node != NULL);
|
| + EXPECT_EQ(0, synced_node->child_count());
|
| + EXPECT_EQ(BookmarkNode::SYNCED, synced_node->type());
|
| +
|
| EXPECT_TRUE(bb_node->id() != other_node->id());
|
| + EXPECT_TRUE(bb_node->id() != synced_node->id());
|
| + EXPECT_TRUE(other_node->id() != synced_node->id());
|
| }
|
|
|
| TEST_F(BookmarkModelTest, AddURL) {
|
| @@ -197,7 +204,28 @@ TEST_F(BookmarkModelTest, AddURL) {
|
| ASSERT_TRUE(new_node == model.GetMostRecentlyAddedNodeForURL(url));
|
|
|
| EXPECT_TRUE(new_node->id() != root->id() &&
|
| - new_node->id() != model.other_node()->id());
|
| + new_node->id() != model.other_node()->id() &&
|
| + new_node->id() != model.synced_node()->id());
|
| +}
|
| +
|
| +TEST_F(BookmarkModelTest, AddURLToSyncedBookmarks) {
|
| + const BookmarkNode* root = model.synced_node();
|
| + const string16 title(ASCIIToUTF16("foo"));
|
| + const GURL url("http://foo.com");
|
| +
|
| + const BookmarkNode* new_node = model.AddURL(root, 0, title, url);
|
| + AssertObserverCount(1, 0, 0, 0, 0);
|
| + observer_details.AssertEquals(root, NULL, 0, -1);
|
| +
|
| + ASSERT_EQ(1, root->child_count());
|
| + ASSERT_EQ(title, new_node->GetTitle());
|
| + ASSERT_TRUE(url == new_node->GetURL());
|
| + ASSERT_EQ(BookmarkNode::URL, new_node->type());
|
| + ASSERT_TRUE(new_node == model.GetMostRecentlyAddedNodeForURL(url));
|
| +
|
| + EXPECT_TRUE(new_node->id() != root->id() &&
|
| + new_node->id() != model.other_node()->id() &&
|
| + new_node->id() != model.synced_node()->id());
|
| }
|
|
|
| TEST_F(BookmarkModelTest, AddFolder) {
|
| @@ -213,7 +241,8 @@ TEST_F(BookmarkModelTest, AddFolder) {
|
| ASSERT_EQ(BookmarkNode::FOLDER, new_node->type());
|
|
|
| EXPECT_TRUE(new_node->id() != root->id() &&
|
| - new_node->id() != model.other_node()->id());
|
| + new_node->id() != model.other_node()->id() &&
|
| + new_node->id() != model.synced_node()->id());
|
|
|
| // Add another folder, just to make sure folder_ids are incremented correctly.
|
| ClearCounts();
|
| @@ -381,6 +410,9 @@ TEST_F(BookmarkModelTest, ParentForNewNodes) {
|
|
|
| model.AddURL(model.other_node(), 0, title, url);
|
| ASSERT_EQ(model.other_node(), model.GetParentForNewNodes());
|
| +
|
| + model.AddURL(model.synced_node(), 0, title, url);
|
| + ASSERT_EQ(model.synced_node(), model.GetParentForNewNodes());
|
| }
|
|
|
| // Make sure recently modified stays in sync when adding a URL.
|
| @@ -760,6 +792,8 @@ TEST_F(BookmarkModelTestWithProfile, CreateAndRestore) {
|
| const std::string bbn_contents;
|
| // Structure of the children of the other node.
|
| const std::string other_contents;
|
| + // Structure of the children of the synced node.
|
| + const std::string synced_contents;
|
| } data[] = {
|
| // See PopulateNodeFromString for a description of these strings.
|
| { "", "" },
|
| @@ -787,11 +821,16 @@ TEST_F(BookmarkModelTestWithProfile, CreateAndRestore) {
|
| PopulateNodeFromString(data[i].other_contents, &other);
|
| PopulateBookmarkNode(&other, bb_model_, bb_model_->other_node());
|
|
|
| + TestNode synced;
|
| + PopulateNodeFromString(data[i].synced_contents, &synced);
|
| + PopulateBookmarkNode(&synced, bb_model_, bb_model_->synced_node());
|
| +
|
| profile_->CreateBookmarkModel(false);
|
| BlockTillBookmarkModelLoaded();
|
|
|
| VerifyModelMatchesNode(&bbn, bb_model_->GetBookmarkBarNode());
|
| VerifyModelMatchesNode(&other, bb_model_->other_node());
|
| + VerifyModelMatchesNode(&synced, bb_model_->synced_node());
|
| VerifyNoDuplicateIDs(bb_model_);
|
| }
|
| }
|
| @@ -861,6 +900,9 @@ class BookmarkModelTestWithProfile2 : public BookmarkModelTestWithProfile {
|
| ASSERT_TRUE(child->GetURL() ==
|
| GURL("http://www.google.com/intl/en/about.html"));
|
|
|
| + parent = bb_model_->synced_node();
|
| + ASSERT_EQ(0, parent->child_count());
|
| +
|
| ASSERT_TRUE(bb_model_->IsBookmarked(GURL("http://www.google.com")));
|
| }
|
|
|
|
|