| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 EXPECT_TRUE( | 263 EXPECT_TRUE( |
| 264 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK)); | 264 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK)); |
| 265 EXPECT_TRUE( | 265 EXPECT_TRUE( |
| 266 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_NEW_FOLDER)); | 266 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_NEW_FOLDER)); |
| 267 } | 267 } |
| 268 | 268 |
| 269 // Tests the enabled state of open incognito. | 269 // Tests the enabled state of open incognito. |
| 270 TEST_F(BookmarkContextMenuTest, DisableIncognito) { | 270 TEST_F(BookmarkContextMenuTest, DisableIncognito) { |
| 271 std::vector<const BookmarkNode*> nodes; | 271 std::vector<const BookmarkNode*> nodes; |
| 272 nodes.push_back(model_->bookmark_bar_node()->GetChild(0)); | 272 nodes.push_back(model_->bookmark_bar_node()->GetChild(0)); |
| 273 TestingProfile::Builder builder; | 273 Profile* incognito = profile_->GetOffTheRecordProfile(); |
| 274 builder.SetIncognito(); | |
| 275 scoped_ptr<TestingProfile> incognito_ = builder.Build().Pass(); | |
| 276 incognito_->SetOriginalProfile(profile_.get()); | |
| 277 BookmarkContextMenu controller( | 274 BookmarkContextMenu controller( |
| 278 NULL, NULL, incognito_.get(), NULL, nodes[0]->parent(), nodes, false); | 275 NULL, NULL, incognito, NULL, nodes[0]->parent(), nodes, false); |
| 279 EXPECT_FALSE(controller.IsCommandEnabled(IDC_BOOKMARK_BAR_OPEN_INCOGNITO)); | 276 EXPECT_FALSE(controller.IsCommandEnabled(IDC_BOOKMARK_BAR_OPEN_INCOGNITO)); |
| 280 EXPECT_FALSE( | 277 EXPECT_FALSE( |
| 281 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO)); | 278 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO)); |
| 282 } | 279 } |
| 283 | 280 |
| 284 // Tests that you can't remove/edit when showing the other node. | 281 // Tests that you can't remove/edit when showing the other node. |
| 285 TEST_F(BookmarkContextMenuTest, DisabledItemsWithOtherNode) { | 282 TEST_F(BookmarkContextMenuTest, DisabledItemsWithOtherNode) { |
| 286 std::vector<const BookmarkNode*> nodes; | 283 std::vector<const BookmarkNode*> nodes; |
| 287 nodes.push_back(model_->other_node()); | 284 nodes.push_back(model_->other_node()); |
| 288 BookmarkContextMenu controller( | 285 BookmarkContextMenu controller( |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 controller.reset(new BookmarkContextMenu( | 376 controller.reset(new BookmarkContextMenu( |
| 380 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); | 377 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); |
| 381 EXPECT_TRUE(controller->IsCommandVisible(IDC_BOOKMARK_BAR_NEW_FOLDER)); | 378 EXPECT_TRUE(controller->IsCommandVisible(IDC_BOOKMARK_BAR_NEW_FOLDER)); |
| 382 EXPECT_TRUE( | 379 EXPECT_TRUE( |
| 383 controller->IsCommandVisible(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS)); | 380 controller->IsCommandVisible(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS)); |
| 384 menu = controller->menu(); | 381 menu = controller->menu(); |
| 385 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_NEW_FOLDER)->visible()); | 382 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_NEW_FOLDER)->visible()); |
| 386 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS) | 383 EXPECT_TRUE(menu->GetMenuItemByID(IDC_BOOKMARK_BAR_SHOW_MANAGED_BOOKMARKS) |
| 387 ->visible()); | 384 ->visible()); |
| 388 } | 385 } |
| OLD | NEW |