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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // Nothing should have been selected. | 455 // Nothing should have been selected. |
456 EXPECT_EQ(GURL(), navigator_.url_); | 456 EXPECT_EQ(GURL(), navigator_.url_); |
457 | 457 |
458 // Hide menu. | 458 // Hide menu. |
459 menu->GetMenuController()->CancelAll(); | 459 menu->GetMenuController()->CancelAll(); |
460 | 460 |
461 Done(); | 461 Done(); |
462 } | 462 } |
463 }; | 463 }; |
464 | 464 |
465 VIEW_TEST(BookmarkBarViewTest3, Submenus) | 465 #if defined(OS_WIN) |
| 466 #define MAYBE_Submenus DISABLED_Submenus |
| 467 #else |
| 468 #define MAYBE_Submenus Submenus |
| 469 #endif |
| 470 VIEW_TEST(BookmarkBarViewTest3, MAYBE_Submenus) |
466 | 471 |
467 // Observer that posts task upon the context menu creation. | 472 // Observer that posts task upon the context menu creation. |
468 // This is necessary for Linux as the context menu has to check | 473 // This is necessary for Linux as the context menu has to check |
469 // the clipboard, which invokes the event loop. | 474 // the clipboard, which invokes the event loop. |
470 class ContextMenuNotificationObserver : public content::NotificationObserver { | 475 class ContextMenuNotificationObserver : public content::NotificationObserver { |
471 public: | 476 public: |
472 explicit ContextMenuNotificationObserver(const base::Closure& task) | 477 explicit ContextMenuNotificationObserver(const base::Closure& task) |
473 : task_(task) { | 478 : task_(task) { |
474 registrar_.Add(this, | 479 registrar_.Add(this, |
475 chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, | 480 chrome::NOTIFICATION_BOOKMARK_CONTEXT_MENU_SHOWN, |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 } | 549 } |
545 | 550 |
546 void Step4() { | 551 void Step4() { |
547 EXPECT_EQ(navigator_.url_, model_->other_node()->GetChild(0)->url()); | 552 EXPECT_EQ(navigator_.url_, model_->other_node()->GetChild(0)->url()); |
548 Done(); | 553 Done(); |
549 } | 554 } |
550 | 555 |
551 ContextMenuNotificationObserver observer_; | 556 ContextMenuNotificationObserver observer_; |
552 }; | 557 }; |
553 | 558 |
554 VIEW_TEST(BookmarkBarViewTest4, ContextMenus) | 559 #if defined(OS_WIN) |
| 560 #define MAYBE_ContextMenus DISABLED_ContextMenus |
| 561 #else |
| 562 #define MAYBE_ContextMenus ContextMenus |
| 563 #endif |
| 564 VIEW_TEST(BookmarkBarViewTest4, MAYBE_ContextMenus) |
555 | 565 |
556 // Tests drag and drop within the same menu. | 566 // Tests drag and drop within the same menu. |
557 class BookmarkBarViewTest5 : public BookmarkBarViewEventTestBase { | 567 class BookmarkBarViewTest5 : public BookmarkBarViewEventTestBase { |
558 protected: | 568 protected: |
559 virtual void DoTestOnMessageLoop() { | 569 virtual void DoTestOnMessageLoop() { |
560 url_dragging_ = | 570 url_dragging_ = |
561 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); | 571 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); |
562 | 572 |
563 // Move the mouse to the first folder on the bookmark bar and press the | 573 // Move the mouse to the first folder on the bookmark bar and press the |
564 // mouse. | 574 // mouse. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 624 |
615 void Step5() { | 625 void Step5() { |
616 GURL url = model_->bookmark_bar_node()->GetChild(0)->GetChild(1)->url(); | 626 GURL url = model_->bookmark_bar_node()->GetChild(0)->GetChild(1)->url(); |
617 EXPECT_EQ(url_dragging_, url); | 627 EXPECT_EQ(url_dragging_, url); |
618 Done(); | 628 Done(); |
619 } | 629 } |
620 | 630 |
621 GURL url_dragging_; | 631 GURL url_dragging_; |
622 }; | 632 }; |
623 | 633 |
624 VIEW_TEST(BookmarkBarViewTest5, DND) | 634 #if defined(OS_WIN) |
| 635 #define MAYBE_DND DISABLED_DND |
| 636 #else |
| 637 #define MAYBE_DND DND |
| 638 #endif |
| 639 VIEW_TEST(BookmarkBarViewTest5, MAYBE_DND) |
625 | 640 |
626 // Tests holding mouse down on overflow button, dragging such that menu pops up | 641 // Tests holding mouse down on overflow button, dragging such that menu pops up |
627 // then selecting an item. | 642 // then selecting an item. |
628 class BookmarkBarViewTest6 : public BookmarkBarViewEventTestBase { | 643 class BookmarkBarViewTest6 : public BookmarkBarViewEventTestBase { |
629 protected: | 644 protected: |
630 virtual void DoTestOnMessageLoop() { | 645 virtual void DoTestOnMessageLoop() { |
631 // Press the mouse button on the overflow button. Don't release it though. | 646 // Press the mouse button on the overflow button. Don't release it though. |
632 views::TextButton* button = bb_view_->overflow_button(); | 647 views::TextButton* button = bb_view_->overflow_button(); |
633 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 648 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
634 ui_controls::DOWN, CreateEventTask(this, &BookmarkBarViewTest6::Step2)); | 649 ui_controls::DOWN, CreateEventTask(this, &BookmarkBarViewTest6::Step2)); |
(...skipping 17 matching lines...) Expand all Loading... |
652 | 667 |
653 void Step3() { | 668 void Step3() { |
654 ASSERT_TRUE(navigator_.url_ == | 669 ASSERT_TRUE(navigator_.url_ == |
655 model_->bookmark_bar_node()->GetChild(4)->url()); | 670 model_->bookmark_bar_node()->GetChild(4)->url()); |
656 Done(); | 671 Done(); |
657 } | 672 } |
658 | 673 |
659 GURL url_dragging_; | 674 GURL url_dragging_; |
660 }; | 675 }; |
661 | 676 |
662 VIEW_TEST(BookmarkBarViewTest6, OpenMenuOnClickAndHold) | 677 #if defined(OS_WIN) |
| 678 #define MAYBE_OpenMenuOnClickAndHold DISABLED_OpenMenuOnClickAndHold |
| 679 #else |
| 680 #define MAYBE_OpenMenuOnClickAndHold OpenMenuOnClickAndHold |
| 681 #endif |
| 682 VIEW_TEST(BookmarkBarViewTest6, MAYBE_OpenMenuOnClickAndHold) |
663 | 683 |
664 // Tests drag and drop to different menu. | 684 // Tests drag and drop to different menu. |
665 class BookmarkBarViewTest7 : public BookmarkBarViewEventTestBase { | 685 class BookmarkBarViewTest7 : public BookmarkBarViewEventTestBase { |
666 protected: | 686 protected: |
667 virtual void DoTestOnMessageLoop() { | 687 virtual void DoTestOnMessageLoop() { |
668 url_dragging_ = | 688 url_dragging_ = |
669 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); | 689 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); |
670 | 690 |
671 // Move the mouse to the first folder on the bookmark bar and press the | 691 // Move the mouse to the first folder on the bookmark bar and press the |
672 // mouse. | 692 // mouse. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 } | 762 } |
743 | 763 |
744 void Step5() { | 764 void Step5() { |
745 ASSERT_TRUE(model_->other_node()->GetChild(0)->url() == url_dragging_); | 765 ASSERT_TRUE(model_->other_node()->GetChild(0)->url() == url_dragging_); |
746 Done(); | 766 Done(); |
747 } | 767 } |
748 | 768 |
749 GURL url_dragging_; | 769 GURL url_dragging_; |
750 }; | 770 }; |
751 | 771 |
752 VIEW_TEST(BookmarkBarViewTest7, DNDToDifferentMenu) | 772 #if defined(OS_WIN) |
| 773 #define MAYBE_DNDToDifferentMenu DISABLED_DNDToDifferentMenu |
| 774 #else |
| 775 #define MAYBE_DNDToDifferentMenu DNDToDifferentMenu |
| 776 #endif |
| 777 VIEW_TEST(BookmarkBarViewTest7, MAYBE_DNDToDifferentMenu) |
753 | 778 |
754 // Drags from one menu to next so that original menu closes, then back to | 779 // Drags from one menu to next so that original menu closes, then back to |
755 // original menu. | 780 // original menu. |
756 class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase { | 781 class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase { |
757 protected: | 782 protected: |
758 virtual void DoTestOnMessageLoop() { | 783 virtual void DoTestOnMessageLoop() { |
759 url_dragging_ = | 784 url_dragging_ = |
760 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); | 785 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); |
761 | 786 |
762 // Move the mouse to the first folder on the bookmark bar and press the | 787 // Move the mouse to the first folder on the bookmark bar and press the |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
846 // Make sure drop was processed. | 871 // Make sure drop was processed. |
847 GURL final_url = model_->bookmark_bar_node()->GetChild(0)->GetChild(0)-> | 872 GURL final_url = model_->bookmark_bar_node()->GetChild(0)->GetChild(0)-> |
848 GetChild(1)->url(); | 873 GetChild(1)->url(); |
849 ASSERT_TRUE(final_url == url_dragging_); | 874 ASSERT_TRUE(final_url == url_dragging_); |
850 Done(); | 875 Done(); |
851 } | 876 } |
852 | 877 |
853 GURL url_dragging_; | 878 GURL url_dragging_; |
854 }; | 879 }; |
855 | 880 |
856 VIEW_TEST(BookmarkBarViewTest8, DNDBackToOriginatingMenu) | 881 #if defined(OS_WIN) |
| 882 #define MAYBE_DNDBackToOriginatingMenu DISABLED_DNDBackToOriginatingMenu |
| 883 #else |
| 884 #define MAYBE_DNDBackToOriginatingMenu DNDBackToOriginatingMenu |
| 885 #endif |
| 886 VIEW_TEST(BookmarkBarViewTest8, MAYBE_DNDBackToOriginatingMenu) |
857 | 887 |
858 // Moves the mouse over the scroll button and makes sure we get scrolling. | 888 // Moves the mouse over the scroll button and makes sure we get scrolling. |
859 class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase { | 889 class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase { |
860 protected: | 890 protected: |
861 virtual bool CreateBigMenu() { return true; } | 891 virtual bool CreateBigMenu() { return true; } |
862 | 892 |
863 virtual void DoTestOnMessageLoop() { | 893 virtual void DoTestOnMessageLoop() { |
864 // Move the mouse to the first folder on the bookmark bar and press the | 894 // Move the mouse to the first folder on the bookmark bar and press the |
865 // mouse. | 895 // mouse. |
866 views::TextButton* button = GetBookmarkButton(0); | 896 views::TextButton* button = GetBookmarkButton(0); |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 ASSERT_TRUE(menu != NULL); | 1652 ASSERT_TRUE(menu != NULL); |
1623 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); | 1653 ASSERT_TRUE(menu->GetSubmenu()->IsShowing()); |
1624 | 1654 |
1625 menu->GetMenuController()->CancelAll(); | 1655 menu->GetMenuController()->CancelAll(); |
1626 | 1656 |
1627 Done(); | 1657 Done(); |
1628 } | 1658 } |
1629 }; | 1659 }; |
1630 | 1660 |
1631 VIEW_TEST(BookmarkBarViewTest19, SiblingMenu) | 1661 VIEW_TEST(BookmarkBarViewTest19, SiblingMenu) |
OLD | NEW |