OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW)); | 281 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW)); |
282 EXPECT_FALSE( | 282 EXPECT_FALSE( |
283 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO)); | 283 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO)); |
284 EXPECT_FALSE(controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_REMOVE)); | 284 EXPECT_FALSE(controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_REMOVE)); |
285 EXPECT_FALSE( | 285 EXPECT_FALSE( |
286 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK)); | 286 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK)); |
287 EXPECT_FALSE( | 287 EXPECT_FALSE( |
288 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_NEW_FOLDER)); | 288 controller.IsCommandIdEnabled(IDC_BOOKMARK_BAR_NEW_FOLDER)); |
289 } | 289 } |
290 | 290 |
291 TEST_F(BookmarkContextMenuControllerTest, CutCopyPasteNode) { | 291 // Fails on Linux Aura, probably because clipboard isn't built yet. |
| 292 // See http://crbug.com/100347 |
| 293 #if defined(USE_AURA) && !defined(OS_WIN) |
| 294 #define MAYBE_CutCopyPasteNode FAILS_CutCopyPasteNode |
| 295 #else |
| 296 #define MAYBE_CutCopyPasteNode CutCopyPasteNode |
| 297 #endif |
| 298 TEST_F(BookmarkContextMenuControllerTest, MAYBE_CutCopyPasteNode) { |
292 const BookmarkNode* bb_node = model_->bookmark_bar_node(); | 299 const BookmarkNode* bb_node = model_->bookmark_bar_node(); |
293 std::vector<const BookmarkNode*> nodes; | 300 std::vector<const BookmarkNode*> nodes; |
294 nodes.push_back(bb_node->GetChild(0)); | 301 nodes.push_back(bb_node->GetChild(0)); |
295 scoped_ptr<BookmarkContextMenuController> controller( | 302 scoped_ptr<BookmarkContextMenuController> controller( |
296 new BookmarkContextMenuController( | 303 new BookmarkContextMenuController( |
297 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); | 304 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); |
298 EXPECT_TRUE(controller->IsCommandIdEnabled(IDC_COPY)); | 305 EXPECT_TRUE(controller->IsCommandIdEnabled(IDC_COPY)); |
299 EXPECT_TRUE(controller->IsCommandIdEnabled(IDC_CUT)); | 306 EXPECT_TRUE(controller->IsCommandIdEnabled(IDC_CUT)); |
300 | 307 |
301 // Copy the URL. | 308 // Copy the URL. |
302 controller->ExecuteCommand(IDC_COPY); | 309 controller->ExecuteCommand(IDC_COPY); |
303 | 310 |
304 controller.reset(new BookmarkContextMenuController( | 311 controller.reset(new BookmarkContextMenuController( |
305 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); | 312 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); |
306 int old_count = bb_node->child_count(); | 313 int old_count = bb_node->child_count(); |
307 controller->ExecuteCommand(IDC_PASTE); | 314 controller->ExecuteCommand(IDC_PASTE); |
308 | 315 |
309 ASSERT_TRUE(bb_node->GetChild(1)->is_url()); | 316 ASSERT_TRUE(bb_node->GetChild(1)->is_url()); |
310 ASSERT_EQ(old_count + 1, bb_node->child_count()); | 317 ASSERT_EQ(old_count + 1, bb_node->child_count()); |
311 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); | 318 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); |
312 | 319 |
313 controller.reset(new BookmarkContextMenuController( | 320 controller.reset(new BookmarkContextMenuController( |
314 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); | 321 NULL, NULL, profile_.get(), NULL, nodes[0]->parent(), nodes)); |
315 // Cut the URL. | 322 // Cut the URL. |
316 controller->ExecuteCommand(IDC_CUT); | 323 controller->ExecuteCommand(IDC_CUT); |
317 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); | 324 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); |
318 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); | 325 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); |
319 ASSERT_EQ(old_count, bb_node->child_count()); | 326 ASSERT_EQ(old_count, bb_node->child_count()); |
320 } | 327 } |
OLD | NEW |