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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc

Issue 7012005: Revert "Revert 84829 - Initial implementation of "Synced Bookmarks" folder." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Trying to set .json eol-style Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/bookmarks/bookmark_model.h" 10 #include "chrome/browser/bookmarks/bookmark_model.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 125 }
126 126
127 scoped_ptr<BookmarkEditorView> editor_; 127 scoped_ptr<BookmarkEditorView> editor_;
128 }; 128 };
129 129
130 // Makes sure the tree model matches that of the bookmark bar model. 130 // Makes sure the tree model matches that of the bookmark bar model.
131 TEST_F(BookmarkEditorViewTest, ModelsMatch) { 131 TEST_F(BookmarkEditorViewTest, ModelsMatch) {
132 CreateEditor(profile_.get(), NULL, BookmarkEditor::EditDetails(), 132 CreateEditor(profile_.get(), NULL, BookmarkEditor::EditDetails(),
133 BookmarkEditorView::SHOW_TREE); 133 BookmarkEditorView::SHOW_TREE);
134 BookmarkEditorView::EditorNode* editor_root = editor_tree_model()->GetRoot(); 134 BookmarkEditorView::EditorNode* editor_root = editor_tree_model()->GetRoot();
135 // The root should have two children, one for the bookmark bar node, 135 // The root should have two or three children: bookmark bar, other bookmarks
136 // the other for the 'other bookmarks' folder. 136 // and conditionally synced bookmarks.
137 ASSERT_EQ(2, editor_root->child_count()); 137 if (model_->synced_node()->IsVisible()) {
138 ASSERT_EQ(3, editor_root->child_count());
139 } else {
140 ASSERT_EQ(2, editor_root->child_count());
141 }
138 142
139 BookmarkEditorView::EditorNode* bb_node = editor_root->GetChild(0); 143 BookmarkEditorView::EditorNode* bb_node = editor_root->GetChild(0);
140 // The root should have 2 nodes: folder F1 and F2. 144 // The root should have 2 nodes: folder F1 and F2.
141 ASSERT_EQ(2, bb_node->child_count()); 145 ASSERT_EQ(2, bb_node->child_count());
142 ASSERT_EQ(ASCIIToUTF16("F1"), bb_node->GetChild(0)->GetTitle()); 146 ASSERT_EQ(ASCIIToUTF16("F1"), bb_node->GetChild(0)->GetTitle());
143 ASSERT_EQ(ASCIIToUTF16("F2"), bb_node->GetChild(1)->GetTitle()); 147 ASSERT_EQ(ASCIIToUTF16("F2"), bb_node->GetChild(1)->GetTitle());
144 148
145 // F1 should have one child, F11 149 // F1 should have one child, F11
146 ASSERT_EQ(1, bb_node->GetChild(0)->child_count()); 150 ASSERT_EQ(1, bb_node->GetChild(0)->child_count());
147 ASSERT_EQ(ASCIIToUTF16("F11"), bb_node->GetChild(0)->GetChild(0)->GetTitle()); 151 ASSERT_EQ(ASCIIToUTF16("F11"), bb_node->GetChild(0)->GetChild(0)->GetTitle());
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 EXPECT_EQ(BookmarkNode::FOLDER, new_node->type()); 361 EXPECT_EQ(BookmarkNode::FOLDER, new_node->type());
358 EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle()); 362 EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle());
359 // The node should have one child. 363 // The node should have one child.
360 ASSERT_EQ(1, new_node->child_count()); 364 ASSERT_EQ(1, new_node->child_count());
361 const BookmarkNode* new_child = new_node->GetChild(0); 365 const BookmarkNode* new_child = new_node->GetChild(0);
362 // Make sure the child url/title match. 366 // Make sure the child url/title match.
363 EXPECT_EQ(BookmarkNode::URL, new_child->type()); 367 EXPECT_EQ(BookmarkNode::URL, new_child->type());
364 EXPECT_EQ(WideToUTF16Hack(details.urls[0].second), new_child->GetTitle()); 368 EXPECT_EQ(WideToUTF16Hack(details.urls[0].second), new_child->GetTitle());
365 EXPECT_EQ(details.urls[0].first, new_child->GetURL()); 369 EXPECT_EQ(details.urls[0].first, new_child->GetURL());
366 } 370 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698