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

Side by Side Diff: chrome/browser/bookmarks/bookmark_context_menu_controller_unittest.cc

Issue 10692164: Remove browser::FindTabbedBrowser call in bookmark_utils.cc. All callers, with the exception of met… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 months 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 | Annotate | Revision Log
OLDNEW
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 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/bookmarks/bookmark_context_menu_controller.h" 10 #include "chrome/browser/bookmarks/bookmark_context_menu_controller.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 ASSERT_TRUE(controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_REMOVE)); 108 ASSERT_TRUE(controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_REMOVE));
109 // Delete the URL. 109 // Delete the URL.
110 controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE); 110 controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE);
111 // Model shouldn't have URL anymore. 111 // Model shouldn't have URL anymore.
112 ASSERT_FALSE(model_->IsBookmarked(url)); 112 ASSERT_FALSE(model_->IsBookmarked(url));
113 } 113 }
114 114
115 // Tests open all on a folder with a couple of bookmarks. 115 // Tests open all on a folder with a couple of bookmarks.
116 TEST_F(BookmarkContextMenuControllerTest, OpenAll) { 116 TEST_F(BookmarkContextMenuControllerTest, OpenAll) {
117 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); 117 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1);
118 bookmark_utils::OpenAll( 118 bookmark_utils::OpenAll(NULL, &navigator_, folder, NEW_FOREGROUND_TAB);
119 NULL, profile_.get(), &navigator_, folder, NEW_FOREGROUND_TAB);
120 119
121 // Should have navigated to F1's child, but not F11's child. 120 // Should have navigated to F1's child, but not F11's child.
122 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size()); 121 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size());
123 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); 122 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]);
124 } 123 }
125 124
126 // Tests the enabled state of the menus when supplied an empty vector. 125 // Tests the enabled state of the menus when supplied an empty vector.
127 TEST_F(BookmarkContextMenuControllerTest, EmptyNodes) { 126 TEST_F(BookmarkContextMenuControllerTest, EmptyNodes) {
128 BookmarkContextMenuController controller( 127 BookmarkContextMenuController controller(
129 NULL, NULL, NULL, profile_.get(), NULL, model_->other_node(), 128 NULL, NULL, NULL, profile_.get(), NULL, model_->other_node(),
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); 300 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url());
302 301
303 controller.reset(new BookmarkContextMenuController( 302 controller.reset(new BookmarkContextMenuController(
304 NULL, NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); 303 NULL, NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes));
305 // Cut the URL. 304 // Cut the URL.
306 controller->ExecuteCommand(IDC_CUT); 305 controller->ExecuteCommand(IDC_CUT);
307 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); 306 ASSERT_TRUE(bb_node->GetChild(0)->is_url());
308 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); 307 ASSERT_TRUE(bb_node->GetChild(1)->is_folder());
309 ASSERT_EQ(old_count, bb_node->child_count()); 308 ASSERT_EQ(old_count, bb_node->child_count());
310 } 309 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_context_menu_controller.cc ('k') | chrome/browser/bookmarks/bookmark_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698