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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 ASSERT_TRUE(controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_REMOVE)); | 105 ASSERT_TRUE(controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_REMOVE)); |
106 // Delete the URL. | 106 // Delete the URL. |
107 controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE, 0); | 107 controller.ExecuteCommand(IDC_BOOKMARK_BAR_REMOVE, 0); |
108 // Model shouldn't have URL anymore. | 108 // Model shouldn't have URL anymore. |
109 ASSERT_FALSE(model_->IsBookmarked(url)); | 109 ASSERT_FALSE(model_->IsBookmarked(url)); |
110 } | 110 } |
111 | 111 |
112 // Tests open all on a folder with a couple of bookmarks. | 112 // Tests open all on a folder with a couple of bookmarks. |
113 TEST_F(BookmarkContextMenuControllerTest, OpenAll) { | 113 TEST_F(BookmarkContextMenuControllerTest, OpenAll) { |
114 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); | 114 const BookmarkNode* folder = model_->bookmark_bar_node()->GetChild(1); |
115 chrome::OpenAll(NULL, &navigator_, folder, NEW_FOREGROUND_TAB, NULL); | 115 chrome::OpenAll(NULL, &navigator_, folder, |
| 116 WindowOpenDisposition::NEW_FOREGROUND_TAB, NULL); |
116 | 117 |
117 // Should have navigated to F1's child, but not F11's child. | 118 // Should have navigated to F1's child, but not F11's child. |
118 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size()); | 119 ASSERT_EQ(static_cast<size_t>(1), navigator_.urls_.size()); |
119 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); | 120 ASSERT_TRUE(folder->GetChild(0)->url() == navigator_.urls_[0]); |
120 } | 121 } |
121 | 122 |
122 // Tests the enabled state of the menus when supplied an empty vector. | 123 // Tests the enabled state of the menus when supplied an empty vector. |
123 TEST_F(BookmarkContextMenuControllerTest, EmptyNodes) { | 124 TEST_F(BookmarkContextMenuControllerTest, EmptyNodes) { |
124 BookmarkContextMenuController controller( | 125 BookmarkContextMenuController controller( |
125 NULL, NULL, NULL, profile_.get(), NULL, model_->other_node(), | 126 NULL, NULL, NULL, profile_.get(), NULL, model_->other_node(), |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 new base::FundamentalValue(false)); | 351 new base::FundamentalValue(false)); |
351 EXPECT_FALSE( | 352 EXPECT_FALSE( |
352 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); | 353 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); |
353 | 354 |
354 // And enabling the shortcut by policy disables the command too. | 355 // And enabling the shortcut by policy disables the command too. |
355 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, | 356 prefs->SetManagedPref(bookmarks::prefs::kShowAppsShortcutInBookmarkBar, |
356 new base::FundamentalValue(true)); | 357 new base::FundamentalValue(true)); |
357 EXPECT_FALSE( | 358 EXPECT_FALSE( |
358 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); | 359 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_SHOW_APPS_SHORTCUT)); |
359 } | 360 } |
OLD | NEW |