OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/views/bookmarks/bookmark_context_menu.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_context_menu.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 ASSERT_TRUE(controller.IsCommandEnabled(IDC_BOOKMARK_BAR_REMOVE)); | 126 ASSERT_TRUE(controller.IsCommandEnabled(IDC_BOOKMARK_BAR_REMOVE)); |
127 // Delete the URL. | 127 // Delete the URL. |
128 controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE, 0); | 128 controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE, 0); |
129 // Model shouldn't have URL anymore. | 129 // Model shouldn't have URL anymore. |
130 ASSERT_FALSE(model_->IsBookmarked(url)); | 130 ASSERT_FALSE(model_->IsBookmarked(url)); |
131 } | 131 } |
132 | 132 |
133 // Tests open all on a folder with a couple of bookmarks. | 133 // Tests open all on a folder with a couple of bookmarks. |
134 TEST_F(BookmarkContextMenuTest, OpenAll) { | 134 TEST_F(BookmarkContextMenuTest, OpenAll) { |
135 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); | 135 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); |
136 chrome::OpenAll(NULL, &navigator_, folder, NEW_FOREGROUND_TAB, NULL); | 136 chrome::OpenAll(NULL, &navigator_, folder, |
| 137 WindowOpenDisposition::NEW_FOREGROUND_TAB, NULL); |
137 | 138 |
138 // Should have navigated to F1's child but not F11's child. | 139 // Should have navigated to F1's child but not F11's child. |
139 ASSERT_EQ(static_cast<size_t>(2), navigator_.urls_.size()); | 140 ASSERT_EQ(static_cast<size_t>(2), navigator_.urls_.size()); |
140 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); | 141 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); |
141 } | 142 } |
142 | 143 |
143 // Tests open all on a folder with a couple of bookmarks in incognito window. | 144 // Tests open all on a folder with a couple of bookmarks in incognito window. |
144 TEST_F(BookmarkContextMenuTest, OpenAllIngonito) { | 145 TEST_F(BookmarkContextMenuTest, OpenAllIngonito) { |
145 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); | 146 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); |
146 chrome::OpenAll(NULL, &navigator_, folder, OFF_THE_RECORD, NULL); | 147 chrome::OpenAll(NULL, &navigator_, folder, |
| 148 WindowOpenDisposition::OFF_THE_RECORD, NULL); |
147 | 149 |
148 // Should have navigated to only f1a but not f2a. | 150 // Should have navigated to only f1a but not f2a. |
149 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size()); | 151 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size()); |
150 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); | 152 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); |
151 } | 153 } |
152 | 154 |
153 // Tests the enabled state of the menus when supplied an empty vector. | 155 // Tests the enabled state of the menus when supplied an empty vector. |
154 TEST_F(BookmarkContextMenuTest, EmptyNodes) { | 156 TEST_F(BookmarkContextMenuTest, EmptyNodes) { |
155 BookmarkContextMenu controller( | 157 BookmarkContextMenu controller( |
156 NULL, NULL, profile_.get(), NULL, model_->other_node(), | 158 NULL, NULL, profile_.get(), NULL, model_->other_node(), |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 controller.reset(new BookmarkContextMenu( | 374 controller.reset(new BookmarkContextMenu( |
373 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); | 375 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); |
374 EXPECT_TRUE(controller->IsCommandVisible(IDC_BOOKMARK_BAR_NEW_FOLDER)); | 376 EXPECT_TRUE(controller->IsCommandVisible(IDC_BOOKMARK_BAR_NEW_FOLDER)); |
375 EXPECT_TRUE( | 377 EXPECT_TRUE( |
376 controller->IsCommandVisible(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS)); | 378 controller->IsCommandVisible(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS)); |
377 menu = controller->menu(); | 379 menu = controller->menu(); |
378 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_NEW_FOLDER)->visible()); | 380 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_NEW_FOLDER)->visible()); |
379 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS) | 381 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS) |
380 ->visible()); | 382 ->visible()); |
381 } | 383 } |
OLD | NEW |