| 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/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 class TestingPageNavigator : public PageNavigator { | 62 class TestingPageNavigator : public PageNavigator { |
| 63 public: | 63 public: |
| 64 virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE { | 64 virtual WebContents* OpenURL(const OpenURLParams& params) OVERRIDE { |
| 65 url_ = params.url; | 65 url_ = params.url; |
| 66 return NULL; | 66 return NULL; |
| 67 } | 67 } |
| 68 | 68 |
| 69 GURL url_; | 69 GURL url_; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 // TODO(jschuh): Fix bookmark DND tests on Win64. crbug.com/244605 |
| 73 #if defined(OS_WIN) && defined(ARCH_CPU_X86_64) |
| 74 #define MAYBE(x) DISABLED_##x |
| 75 #else |
| 76 #define MAYBE(x) x |
| 77 #endif |
| 78 |
| 72 } // namespace | 79 } // namespace |
| 73 | 80 |
| 74 // Base class for event generating bookmark view tests. These test are intended | 81 // Base class for event generating bookmark view tests. These test are intended |
| 75 // to exercise View's menus, but that's easier done with BookmarkBarView rather | 82 // to exercise View's menus, but that's easier done with BookmarkBarView rather |
| 76 // than View's menu itself. | 83 // than View's menu itself. |
| 77 // | 84 // |
| 78 // SetUp creates a bookmark model with the following structure. | 85 // SetUp creates a bookmark model with the following structure. |
| 79 // All folders are in upper case, all URLs in lower case. | 86 // All folders are in upper case, all URLs in lower case. |
| 80 // F1 | 87 // F1 |
| 81 // f1a | 88 // f1a |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 | 574 |
| 568 void Step5() { | 575 void Step5() { |
| 569 GURL url = model_->bookmark_bar_node()->GetChild(0)->GetChild(1)->url(); | 576 GURL url = model_->bookmark_bar_node()->GetChild(0)->GetChild(1)->url(); |
| 570 EXPECT_EQ(url_dragging_, url); | 577 EXPECT_EQ(url_dragging_, url); |
| 571 Done(); | 578 Done(); |
| 572 } | 579 } |
| 573 | 580 |
| 574 GURL url_dragging_; | 581 GURL url_dragging_; |
| 575 }; | 582 }; |
| 576 | 583 |
| 577 VIEW_TEST(BookmarkBarViewTest5, DND) | 584 VIEW_TEST(BookmarkBarViewTest5, MAYBE(DND)) |
| 578 | 585 |
| 579 // Tests holding mouse down on overflow button, dragging such that menu pops up | 586 // Tests holding mouse down on overflow button, dragging such that menu pops up |
| 580 // then selecting an item. | 587 // then selecting an item. |
| 581 class BookmarkBarViewTest6 : public BookmarkBarViewEventTestBase { | 588 class BookmarkBarViewTest6 : public BookmarkBarViewEventTestBase { |
| 582 protected: | 589 protected: |
| 583 virtual void DoTestOnMessageLoop() OVERRIDE { | 590 virtual void DoTestOnMessageLoop() OVERRIDE { |
| 584 // Press the mouse button on the overflow button. Don't release it though. | 591 // Press the mouse button on the overflow button. Don't release it though. |
| 585 views::TextButton* button = bb_view_->overflow_button(); | 592 views::TextButton* button = bb_view_->overflow_button(); |
| 586 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, | 593 ui_test_utils::MoveMouseToCenterAndPress(button, ui_controls::LEFT, |
| 587 ui_controls::DOWN, CreateEventTask(this, &BookmarkBarViewTest6::Step2)); | 594 ui_controls::DOWN, CreateEventTask(this, &BookmarkBarViewTest6::Step2)); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 Done(); | 710 Done(); |
| 704 } | 711 } |
| 705 | 712 |
| 706 GURL url_dragging_; | 713 GURL url_dragging_; |
| 707 }; | 714 }; |
| 708 | 715 |
| 709 #if !(defined(OS_WIN) && defined(USE_AURA)) | 716 #if !(defined(OS_WIN) && defined(USE_AURA)) |
| 710 // This test passes locally (on aero and non-aero) but fails on the trybots and | 717 // This test passes locally (on aero and non-aero) but fails on the trybots and |
| 711 // buildbot. | 718 // buildbot. |
| 712 // http://crbug.com/154081 | 719 // http://crbug.com/154081 |
| 713 VIEW_TEST(BookmarkBarViewTest7, DNDToDifferentMenu) | 720 VIEW_TEST(BookmarkBarViewTest7, MAYBE(DNDToDifferentMenu)) |
| 714 #endif | 721 #endif |
| 715 | 722 |
| 716 // Drags from one menu to next so that original menu closes, then back to | 723 // Drags from one menu to next so that original menu closes, then back to |
| 717 // original menu. | 724 // original menu. |
| 718 class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase { | 725 class BookmarkBarViewTest8 : public BookmarkBarViewEventTestBase { |
| 719 protected: | 726 protected: |
| 720 virtual void DoTestOnMessageLoop() OVERRIDE { | 727 virtual void DoTestOnMessageLoop() OVERRIDE { |
| 721 url_dragging_ = | 728 url_dragging_ = |
| 722 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); | 729 model_->bookmark_bar_node()->GetChild(0)->GetChild(0)->url(); |
| 723 | 730 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 Done(); | 819 Done(); |
| 813 } | 820 } |
| 814 | 821 |
| 815 GURL url_dragging_; | 822 GURL url_dragging_; |
| 816 }; | 823 }; |
| 817 | 824 |
| 818 #if !(defined(OS_WIN) && defined(USE_AURA)) | 825 #if !(defined(OS_WIN) && defined(USE_AURA)) |
| 819 // This test passes locally (on aero and non-aero) but fails on the trybots and | 826 // This test passes locally (on aero and non-aero) but fails on the trybots and |
| 820 // buildbot. | 827 // buildbot. |
| 821 // http://crbug.com/154081 | 828 // http://crbug.com/154081 |
| 822 VIEW_TEST(BookmarkBarViewTest8, DNDBackToOriginatingMenu) | 829 VIEW_TEST(BookmarkBarViewTest8, MAYBE(DNDBackToOriginatingMenu)) |
| 823 #endif | 830 #endif |
| 824 | 831 |
| 825 // Moves the mouse over the scroll button and makes sure we get scrolling. | 832 // Moves the mouse over the scroll button and makes sure we get scrolling. |
| 826 class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase { | 833 class BookmarkBarViewTest9 : public BookmarkBarViewEventTestBase { |
| 827 protected: | 834 protected: |
| 828 virtual bool CreateBigMenu() OVERRIDE { return true; } | 835 virtual bool CreateBigMenu() OVERRIDE { return true; } |
| 829 | 836 |
| 830 virtual void DoTestOnMessageLoop() OVERRIDE { | 837 virtual void DoTestOnMessageLoop() OVERRIDE { |
| 831 // Move the mouse to the first folder on the bookmark bar and press the | 838 // Move the mouse to the first folder on the bookmark bar and press the |
| 832 // mouse. | 839 // mouse. |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL); | 1777 EXPECT_TRUE(bb_view_->GetContextMenu() == NULL); |
| 1771 EXPECT_TRUE(bb_view_->GetMenu() == NULL); | 1778 EXPECT_TRUE(bb_view_->GetMenu() == NULL); |
| 1772 | 1779 |
| 1773 Done(); | 1780 Done(); |
| 1774 } | 1781 } |
| 1775 | 1782 |
| 1776 ContextMenuNotificationObserver observer_; | 1783 ContextMenuNotificationObserver observer_; |
| 1777 }; | 1784 }; |
| 1778 | 1785 |
| 1779 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder) | 1786 VIEW_TEST(BookmarkBarViewTest21, ContextMenusForEmptyFolder) |
| OLD | NEW |