| 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 "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" | 5 #include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 ASSERT_TRUE(controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_REMOVE)); | 114 ASSERT_TRUE(controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_REMOVE)); |
| 115 // Delete the URL. | 115 // Delete the URL. |
| 116 controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE); | 116 controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE); |
| 117 // Model shouldn't have URL anymore. | 117 // Model shouldn't have URL anymore. |
| 118 ASSERT_FALSE(model_->IsBookmarked(url)); | 118 ASSERT_FALSE(model_->IsBookmarked(url)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Tests open all on a folder with a couple of bookmarks. | 121 // Tests open all on a folder with a couple of bookmarks. |
| 122 TEST_F(BookmarkContextMenuControllerTest, OpenAll) { | 122 TEST_F(BookmarkContextMenuControllerTest, OpenAll) { |
| 123 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); | 123 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); |
| 124 chrome::OpenAll(NULL, &navigator_, folder, NEW_FOREGROUND_TAB); | 124 chrome::OpenAll(NULL, &navigator_, folder, NEW_FOREGROUND_TAB, NULL); |
| 125 | 125 |
| 126 // Should have navigated to F1's child, but not F11's child. | 126 // Should have navigated to F1's child, but not F11's child. |
| 127 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size()); | 127 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size()); |
| 128 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); | 128 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); |
| 129 } | 129 } |
| 130 | 130 |
| 131 // Tests the enabled state of the menus when supplied an empty vector. | 131 // Tests the enabled state of the menus when supplied an empty vector. |
| 132 TEST_F(BookmarkContextMenuControllerTest, EmptyNodes) { | 132 TEST_F(BookmarkContextMenuControllerTest, EmptyNodes) { |
| 133 BookmarkContextMenuController controller( | 133 BookmarkContextMenuController controller( |
| 134 NULL, NULL, NULL, profile_.get(), NULL, model_->other_node(), | 134 NULL, NULL, NULL, profile_.get(), NULL, model_->other_node(), |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); | 325 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); |
| 326 | 326 |
| 327 controller.reset(new BookmarkContextMenuController( | 327 controller.reset(new BookmarkContextMenuController( |
| 328 NULL, NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); | 328 NULL, NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); |
| 329 // Cut the URL. | 329 // Cut the URL. |
| 330 controller->ExecuteCommand(IDC_CUT); | 330 controller->ExecuteCommand(IDC_CUT); |
| 331 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); | 331 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); |
| 332 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); | 332 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); |
| 333 ASSERT_EQ(old_count, bb_node->child_count()); | 333 ASSERT_EQ(old_count, bb_node->child_count()); |
| 334 } | 334 } |
| OLD | NEW |