| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 three children: bookmark bar, other bookmarks and |
| 136 // the other for the 'other bookmarks' folder. | 136 // synced bookmarks. |
| 137 ASSERT_EQ(2, editor_root->child_count()); | 137 ASSERT_EQ(3, editor_root->child_count()); |
| 138 | 138 |
| 139 BookmarkEditorView::EditorNode* bb_node = editor_root->GetChild(0); | 139 BookmarkEditorView::EditorNode* bb_node = editor_root->GetChild(0); |
| 140 // The root should have 2 nodes: folder F1 and F2. | 140 // The root should have 2 nodes: folder F1 and F2. |
| 141 ASSERT_EQ(2, bb_node->child_count()); | 141 ASSERT_EQ(2, bb_node->child_count()); |
| 142 ASSERT_EQ(ASCIIToUTF16("F1"), bb_node->GetChild(0)->GetTitle()); | 142 ASSERT_EQ(ASCIIToUTF16("F1"), bb_node->GetChild(0)->GetTitle()); |
| 143 ASSERT_EQ(ASCIIToUTF16("F2"), bb_node->GetChild(1)->GetTitle()); | 143 ASSERT_EQ(ASCIIToUTF16("F2"), bb_node->GetChild(1)->GetTitle()); |
| 144 | 144 |
| 145 // F1 should have one child, F11 | 145 // F1 should have one child, F11 |
| 146 ASSERT_EQ(1, bb_node->GetChild(0)->child_count()); | 146 ASSERT_EQ(1, bb_node->GetChild(0)->child_count()); |
| 147 ASSERT_EQ(ASCIIToUTF16("F11"), bb_node->GetChild(0)->GetChild(0)->GetTitle()); | 147 ASSERT_EQ(ASCIIToUTF16("F11"), bb_node->GetChild(0)->GetChild(0)->GetTitle()); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 EXPECT_EQ(BookmarkNode::FOLDER, new_node->type()); | 357 EXPECT_EQ(BookmarkNode::FOLDER, new_node->type()); |
| 358 EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle()); | 358 EXPECT_EQ(ASCIIToUTF16("new_F"), new_node->GetTitle()); |
| 359 // The node should have one child. | 359 // The node should have one child. |
| 360 ASSERT_EQ(1, new_node->child_count()); | 360 ASSERT_EQ(1, new_node->child_count()); |
| 361 const BookmarkNode* new_child = new_node->GetChild(0); | 361 const BookmarkNode* new_child = new_node->GetChild(0); |
| 362 // Make sure the child url/title match. | 362 // Make sure the child url/title match. |
| 363 EXPECT_EQ(BookmarkNode::URL, new_child->type()); | 363 EXPECT_EQ(BookmarkNode::URL, new_child->type()); |
| 364 EXPECT_EQ(WideToUTF16Hack(details.urls[0].second), new_child->GetTitle()); | 364 EXPECT_EQ(WideToUTF16Hack(details.urls[0].second), new_child->GetTitle()); |
| 365 EXPECT_EQ(details.urls[0].first, new_child->GetURL()); | 365 EXPECT_EQ(details.urls[0].first, new_child->GetURL()); |
| 366 } | 366 } |
| OLD | NEW |