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 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW)); | 284 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_NEW_WINDOW)); |
285 EXPECT_FALSE( | 285 EXPECT_FALSE( |
286 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO)); | 286 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_OPEN_ALL_INCOGNITO)); |
287 EXPECT_FALSE(controller.IsCommandEnabled(IDC_BOOKMARK_BAR_REMOVE)); | 287 EXPECT_FALSE(controller.IsCommandEnabled(IDC_BOOKMARK_BAR_REMOVE)); |
288 EXPECT_FALSE( | 288 EXPECT_FALSE( |
289 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK)); | 289 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_ADD_NEW_BOOKMARK)); |
290 EXPECT_FALSE( | 290 EXPECT_FALSE( |
291 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_NEW_FOLDER)); | 291 controller.IsCommandEnabled(IDC_BOOKMARK_BAR_NEW_FOLDER)); |
292 } | 292 } |
293 | 293 |
294 TEST_F(BookmarkContextMenuTest, CutCopyPasteNode) { | 294 // Fails on Linux Aura, clipboard not yet implemented, http://crbug.com/100350 |
| 295 #if defined(USE_AURA) && !defined(OS_WIN) |
| 296 #define MAYBE_CutCopyPasteNode FAILS_CutCopyPasteNode |
| 297 #else |
| 298 #define MAYBE_CutCopyPasteNode CutCopyPasteNode |
| 299 #endif |
| 300 TEST_F(BookmarkContextMenuTest, MAYBE_CutCopyPasteNode) { |
295 const BookmarkNode* bb_node = model_->bookmark_bar_node(); | 301 const BookmarkNode* bb_node = model_->bookmark_bar_node(); |
296 std::vector<const BookmarkNode*> nodes; | 302 std::vector<const BookmarkNode*> nodes; |
297 nodes.push_back(bb_node->GetChild(0)); | 303 nodes.push_back(bb_node->GetChild(0)); |
298 scoped_ptr<BookmarkContextMenu> controller(new BookmarkContextMenu( | 304 scoped_ptr<BookmarkContextMenu> controller(new BookmarkContextMenu( |
299 NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); | 305 NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); |
300 EXPECT_TRUE(controller->IsCommandEnabled(IDC_COPY)); | 306 EXPECT_TRUE(controller->IsCommandEnabled(IDC_COPY)); |
301 EXPECT_TRUE(controller->IsCommandEnabled(IDC_CUT)); | 307 EXPECT_TRUE(controller->IsCommandEnabled(IDC_CUT)); |
302 | 308 |
303 // Copy the URL. | 309 // Copy the URL. |
304 controller->ExecuteCommand(IDC_COPY); | 310 controller->ExecuteCommand(IDC_COPY); |
305 | 311 |
306 controller.reset(new BookmarkContextMenu( | 312 controller.reset(new BookmarkContextMenu( |
307 NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); | 313 NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); |
308 int old_count = bb_node->child_count(); | 314 int old_count = bb_node->child_count(); |
309 controller->ExecuteCommand(IDC_PASTE); | 315 controller->ExecuteCommand(IDC_PASTE); |
310 | 316 |
311 ASSERT_TRUE(bb_node->GetChild(1)->is_url()); | 317 ASSERT_TRUE(bb_node->GetChild(1)->is_url()); |
312 ASSERT_EQ(old_count + 1, bb_node->child_count()); | 318 ASSERT_EQ(old_count + 1, bb_node->child_count()); |
313 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); | 319 ASSERT_EQ(bb_node->GetChild(0)->url(), bb_node->GetChild(1)->url()); |
314 | 320 |
315 controller.reset(new BookmarkContextMenu( | 321 controller.reset(new BookmarkContextMenu( |
316 NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); | 322 NULL, profile_.get(), NULL, nodes[0]->parent(), nodes, false)); |
317 // Cut the URL. | 323 // Cut the URL. |
318 controller->ExecuteCommand(IDC_CUT); | 324 controller->ExecuteCommand(IDC_CUT); |
319 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); | 325 ASSERT_TRUE(bb_node->GetChild(0)->is_url()); |
320 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); | 326 ASSERT_TRUE(bb_node->GetChild(1)->is_folder()); |
321 ASSERT_EQ(old_count, bb_node->child_count()); | 327 ASSERT_EQ(old_count, bb_node->child_count()); |
322 } | 328 } |
OLD | NEW |