| OLD | NEW |
| 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 Loading... |
| 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 // The root should have two or three children: bookmark bar, other bookmarks | 138 ASSERT_EQ(3, editor_root->child_count()); |
| 139 // and conditionally synced bookmarks. | |
| 140 if (model_->synced_node()->IsVisible()) { | |
| 141 ASSERT_EQ(3, editor_root->child_count()); | |
| 142 } else { | |
| 143 ASSERT_EQ(2, editor_root->child_count()); | |
| 144 } | |
| 145 | 139 |
| 146 BookmarkEditorView::EditorNode* bb_node = editor_root->GetChild(0); | 140 BookmarkEditorView::EditorNode* bb_node = editor_root->GetChild(0); |
| 147 // The root should have 2 nodes: folder F1 and F2. | 141 // The root should have 2 nodes: folder F1 and F2. |
| 148 ASSERT_EQ(2, bb_node->child_count()); | 142 ASSERT_EQ(2, bb_node->child_count()); |
| 149 ASSERT_EQ(ASCIIToUTF16("F1"), bb_node->GetChild(0)->GetTitle()); | 143 ASSERT_EQ(ASCIIToUTF16("F1"), bb_node->GetChild(0)->GetTitle()); |
| 150 ASSERT_EQ(ASCIIToUTF16("F2"), bb_node->GetChild(1)->GetTitle()); | 144 ASSERT_EQ(ASCIIToUTF16("F2"), bb_node->GetChild(1)->GetTitle()); |
| 151 | 145 |
| 152 // F1 should have one child, F11 | 146 // F1 should have one child, F11 |
| 153 ASSERT_EQ(1, bb_node->GetChild(0)->child_count()); | 147 ASSERT_EQ(1, bb_node->GetChild(0)->child_count()); |
| 154 ASSERT_EQ(ASCIIToUTF16("F11"), bb_node->GetChild(0)->GetChild(0)->GetTitle()); | 148 ASSERT_EQ(ASCIIToUTF16("F11"), bb_node->GetChild(0)->GetChild(0)->GetTitle()); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 EXPECT_EQ(BookmarkNode::FOLDER, new_node->type()); | 365 EXPECT_EQ(BookmarkNode::FOLDER, new_node->type()); |
| 372 EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle()); | 366 EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle()); |
| 373 // The node should have one child. | 367 // The node should have one child. |
| 374 ASSERT_EQ(1, new_node->child_count()); | 368 ASSERT_EQ(1, new_node->child_count()); |
| 375 const BookmarkNode* new_child = new_node->GetChild(0); | 369 const BookmarkNode* new_child = new_node->GetChild(0); |
| 376 // Make sure the child url/title match. | 370 // Make sure the child url/title match. |
| 377 EXPECT_EQ(BookmarkNode::URL, new_child->type()); | 371 EXPECT_EQ(BookmarkNode::URL, new_child->type()); |
| 378 EXPECT_EQ(details.urls[0].second, new_child->GetTitle()); | 372 EXPECT_EQ(details.urls[0].second, new_child->GetTitle()); |
| 379 EXPECT_EQ(details.urls[0].first, new_child->url()); | 373 EXPECT_EQ(details.urls[0].first, new_child->url()); |
| 380 } | 374 } |
| OLD | NEW |