OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 ASSERT_TRUE(controller.IsCommandEnabled(IDC_BOOKMARK_BAR_REMOVE)); | 118 ASSERT_TRUE(controller.IsCommandEnabled(IDC_BOOKMARK_BAR_REMOVE)); |
119 // Delete the URL. | 119 // Delete the URL. |
120 controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE); | 120 controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE); |
121 // Model shouldn't have URL anymore. | 121 // Model shouldn't have URL anymore. |
122 ASSERT_FALSE(model_->IsBookmarked(url)); | 122 ASSERT_FALSE(model_->IsBookmarked(url)); |
123 } | 123 } |
124 | 124 |
125 // Tests open all on a folder with a couple of bookmarks. | 125 // Tests open all on a folder with a couple of bookmarks. |
126 TEST_F(BookmarkContextMenuTest, OpenAll) { | 126 TEST_F(BookmarkContextMenuTest, OpenAll) { |
127 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); | 127 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); |
128 bookmark_utils::OpenAll( | 128 bookmark_utils::OpenAll(NULL, &navigator_, folder, NEW_FOREGROUND_TAB); |
129 NULL, profile_.get(), &navigator_, folder, NEW_FOREGROUND_TAB); | |
130 | 129 |
131 // Should have navigated to F1's child but not F11's child. | 130 // Should have navigated to F1's child but not F11's child. |
132 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size()); | 131 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size()); |
133 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); | 132 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); |
134 } | 133 } |
135 | 134 |
136 // Tests the enabled state of the menus when supplied an empty vector. | 135 // Tests the enabled state of the menus when supplied an empty vector. |
137 TEST_F(BookmarkContextMenuTest, EmptyNodes) { | 136 TEST_F(BookmarkContextMenuTest, EmptyNodes) { |
138 BookmarkContextMenu controller( | 137 BookmarkContextMenu controller( |
139 NULL, NULL, profile_.get(), NULL, model_->other_node(), | 138 NULL, NULL, profile_.get(), NULL, model_->other_node(), |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); | 306 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); |
308 | 307 |
309 controller.reset(new BookmarkContextMenu( | 308 controller.reset(new BookmarkContextMenu( |
310 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); | 309 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); |
311 // Cut the URL. | 310 // Cut the URL. |
312 controller->ExecuteCommand(IDC_CUT); | 311 controller->ExecuteCommand(IDC_CUT); |
313 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); | 312 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); |
314 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); | 313 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); |
315 ASSERT_EQ(old_count, bb_node->child_count()); | 314 ASSERT_EQ(old_count, bb_node->child_count()); |
316 } | 315 } |
OLD | NEW |