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

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

Issue 8772064: Adds back BookmarkNode::IsVisible. Turns out we want to conditionally (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks Created 9 years 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 scoped_ptr<BookmarkEditorView> editor_; 129 scoped_ptr<BookmarkEditorView> editor_;
130 }; 130 };
131 131
132 // Makes sure the tree model matches that of the bookmark bar model. 132 // Makes sure the tree model matches that of the bookmark bar model.
133 TEST_F(BookmarkEditorViewTest, ModelsMatch) { 133 TEST_F(BookmarkEditorViewTest, ModelsMatch) {
134 CreateEditor(profile_.get(), NULL, 134 CreateEditor(profile_.get(), NULL,
135 BookmarkEditor::EditDetails::AddNodeInFolder(NULL, -1), 135 BookmarkEditor::EditDetails::AddNodeInFolder(NULL, -1),
136 BookmarkEditorView::SHOW_TREE); 136 BookmarkEditorView::SHOW_TREE);
137 BookmarkEditorView::EditorNode* editor_root = editor_tree_model()->GetRoot(); 137 BookmarkEditorView::EditorNode* editor_root = editor_tree_model()->GetRoot();
138 ASSERT_EQ(3, editor_root->child_count()); 138 // The root should have two or three children: bookmark bar, other bookmarks
139 // and conditionally mobile bookmarks.
140 if (model_->mobile_node()->IsVisible()) {
141 ASSERT_EQ(3, editor_root->child_count());
142 } else {
143 ASSERT_EQ(2, editor_root->child_count());
144 }
139 145
140 BookmarkEditorView::EditorNode* bb_node = editor_root->GetChild(0); 146 BookmarkEditorView::EditorNode* bb_node = editor_root->GetChild(0);
141 // The root should have 2 nodes: folder F1 and F2. 147 // The root should have 2 nodes: folder F1 and F2.
142 ASSERT_EQ(2, bb_node->child_count()); 148 ASSERT_EQ(2, bb_node->child_count());
143 ASSERT_EQ(ASCIIToUTF16("F1"), bb_node->GetChild(0)->GetTitle()); 149 ASSERT_EQ(ASCIIToUTF16("F1"), bb_node->GetChild(0)->GetTitle());
144 ASSERT_EQ(ASCIIToUTF16("F2"), bb_node->GetChild(1)->GetTitle()); 150 ASSERT_EQ(ASCIIToUTF16("F2"), bb_node->GetChild(1)->GetTitle());
145 151
146 // F1 should have one child, F11 152 // F1 should have one child, F11
147 ASSERT_EQ(1, bb_node->GetChild(0)->child_count()); 153 ASSERT_EQ(1, bb_node->GetChild(0)->child_count());
148 ASSERT_EQ(ASCIIToUTF16("F11"), bb_node->GetChild(0)->GetChild(0)->GetTitle()); 154 ASSERT_EQ(ASCIIToUTF16("F11"), bb_node->GetChild(0)->GetChild(0)->GetTitle());
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 EXPECT_EQ(BookmarkNode::FOLDER, new_node->type()); 371 EXPECT_EQ(BookmarkNode::FOLDER, new_node->type());
366 EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle()); 372 EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle());
367 // The node should have one child. 373 // The node should have one child.
368 ASSERT_EQ(1, new_node->child_count()); 374 ASSERT_EQ(1, new_node->child_count());
369 const BookmarkNode* new_child = new_node->GetChild(0); 375 const BookmarkNode* new_child = new_node->GetChild(0);
370 // Make sure the child url/title match. 376 // Make sure the child url/title match.
371 EXPECT_EQ(BookmarkNode::URL, new_child->type()); 377 EXPECT_EQ(BookmarkNode::URL, new_child->type());
372 EXPECT_EQ(details.urls[0].second, new_child->GetTitle()); 378 EXPECT_EQ(details.urls[0].second, new_child->GetTitle());
373 EXPECT_EQ(details.urls[0].first, new_child->url()); 379 EXPECT_EQ(details.urls[0].first, new_child->url());
374 } 380 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc ('k') | chrome/browser/ui/views/bookmarks/bookmark_menu_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698