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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 136 chrome::OpenAll(NULL, &navigator_, folder, |
137 WindowOpenDisposition::NEW_FOREGROUND_TAB, NULL); | 137 WindowOpenDisposition::NEW_FOREGROUND_TAB, NULL); |
138 | 138 |
139 // 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. |
140 ASSERT_EQ(static_cast<size_t>(2), navigator_.urls_.size()); | 140 ASSERT_EQ(static_cast<size_t>(2), navigator_.urls_.size()); |
141 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); | 141 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); |
142 } | 142 } |
143 | 143 |
144 // 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. |
145 TEST_F(BookmarkContextMenuTest, OpenAllIncognito) { | 145 TEST_F(BookmarkContextMenuTest, OpenAllIngonito) { |
146 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); | 146 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); |
147 chrome::OpenAll(NULL, &navigator_, folder, | 147 chrome::OpenAll(NULL, &navigator_, folder, |
148 WindowOpenDisposition::OFF_THE_RECORD, profile_.get()); | 148 WindowOpenDisposition::OFF_THE_RECORD, NULL); |
149 | 149 |
150 // Should have navigated to only f1a but not f2a. | 150 // Should have navigated to only f1a but not f2a. |
151 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size()); | 151 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size()); |
152 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); | 152 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); |
153 } | 153 } |
154 | 154 |
155 // 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. |
156 TEST_F(BookmarkContextMenuTest, EmptyNodes) { | 156 TEST_F(BookmarkContextMenuTest, EmptyNodes) { |
157 BookmarkContextMenu controller( | 157 BookmarkContextMenu controller( |
158 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... |
374 controller.reset(new BookmarkContextMenu( | 374 controller.reset(new BookmarkContextMenu( |
375 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); | 375 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); |
376 EXPECT_TRUE(controller->IsCommandVisible(IDC_BOOKMARK_BAR_NEW_FOLDER)); | 376 EXPECT_TRUE(controller->IsCommandVisible(IDC_BOOKMARK_BAR_NEW_FOLDER)); |
377 EXPECT_TRUE( | 377 EXPECT_TRUE( |
378 controller->IsCommandVisible(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS)); | 378 controller->IsCommandVisible(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS)); |
379 menu = controller->menu(); | 379 menu = controller->menu(); |
380 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_NEW_FOLDER)->visible()); | 380 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_NEW_FOLDER)->visible()); |
381 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS) | 381 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS) |
382 ->visible()); | 382 ->visible()); |
383 } | 383 } |
OLD | NEW |