Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_context_menu_unittest.cc

Issue 2452773002: [Extensions] Limit Extension WebUI (Closed)
Patch Set: sky's Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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, OpenAllIngonito) { 145 TEST_F(BookmarkContextMenuTest, OpenAllIncognito) {
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, NULL); 148 WindowOpenDisposition::OFF_THE_RECORD, profile_.get());
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_web_ui.cc ('k') | chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698