Chromium Code Reviews| 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 "ash/common/shelf/shelf_view.h" | 5 #include "ash/common/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ash/common/shelf/app_list_button.h" | 12 #include "ash/common/shelf/app_list_button.h" |
| 13 #include "ash/common/shelf/overflow_bubble.h" | 13 #include "ash/common/shelf/overflow_bubble.h" |
| 14 #include "ash/common/shelf/overflow_bubble_view.h" | 14 #include "ash/common/shelf/overflow_bubble_view.h" |
| 15 #include "ash/common/shelf/overflow_button.h" | |
| 15 #include "ash/common/shelf/shelf_button.h" | 16 #include "ash/common/shelf/shelf_button.h" |
| 16 #include "ash/common/shelf/shelf_constants.h" | 17 #include "ash/common/shelf/shelf_constants.h" |
| 17 #include "ash/common/shelf/shelf_menu_model.h" | 18 #include "ash/common/shelf/shelf_menu_model.h" |
| 18 #include "ash/common/shelf/shelf_model.h" | 19 #include "ash/common/shelf/shelf_model.h" |
| 19 #include "ash/common/shelf/shelf_tooltip_manager.h" | 20 #include "ash/common/shelf/shelf_tooltip_manager.h" |
| 20 #include "ash/common/shelf/shelf_widget.h" | 21 #include "ash/common/shelf/shelf_widget.h" |
| 21 #include "ash/common/shelf/wm_shelf.h" | 22 #include "ash/common/shelf/wm_shelf.h" |
| 22 #include "ash/common/shelf/wm_shelf_observer.h" | 23 #include "ash/common/shelf/wm_shelf_observer.h" |
| 23 #include "ash/common/shell_window_ids.h" | 24 #include "ash/common/shell_window_ids.h" |
| 24 #include "ash/common/system/web_notification/web_notification_tray.h" | 25 #include "ash/common/system/web_notification/web_notification_tray.h" |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 36 #include "ash/test/test_shelf_item_delegate.h" | 37 #include "ash/test/test_shelf_item_delegate.h" |
| 37 #include "ash/test/test_shell_delegate.h" | 38 #include "ash/test/test_shell_delegate.h" |
| 38 #include "ash/test/test_system_tray_delegate.h" | 39 #include "ash/test/test_system_tray_delegate.h" |
| 39 #include "base/i18n/rtl.h" | 40 #include "base/i18n/rtl.h" |
| 40 #include "base/macros.h" | 41 #include "base/macros.h" |
| 41 #include "base/memory/ptr_util.h" | 42 #include "base/memory/ptr_util.h" |
| 42 #include "base/run_loop.h" | 43 #include "base/run_loop.h" |
| 43 #include "base/strings/string_number_conversions.h" | 44 #include "base/strings/string_number_conversions.h" |
| 44 #include "base/strings/utf_string_conversions.h" | 45 #include "base/strings/utf_string_conversions.h" |
| 45 #include "base/test/histogram_tester.h" | 46 #include "base/test/histogram_tester.h" |
| 47 #include "base/test/test_mock_time_task_runner.h" | |
| 46 #include "base/test/user_action_tester.h" | 48 #include "base/test/user_action_tester.h" |
| 47 #include "base/threading/thread_task_runner_handle.h" | 49 #include "base/threading/thread_task_runner_handle.h" |
| 48 #include "base/time/time.h" | 50 #include "base/time/time.h" |
| 49 #include "testing/gmock/include/gmock/gmock.h" | 51 #include "testing/gmock/include/gmock/gmock.h" |
| 50 #include "ui/app_list/presenter/app_list_presenter.h" | 52 #include "ui/app_list/presenter/app_list_presenter.h" |
| 51 #include "ui/aura/test/aura_test_base.h" | 53 #include "ui/aura/test/aura_test_base.h" |
| 52 #include "ui/aura/window.h" | 54 #include "ui/aura/window.h" |
| 53 #include "ui/aura/window_event_dispatcher.h" | 55 #include "ui/aura/window_event_dispatcher.h" |
| 54 #include "ui/compositor/layer.h" | 56 #include "ui/compositor/layer.h" |
| 55 #include "ui/events/event.h" | 57 #include "ui/events/event.h" |
| (...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2122 } // namespace | 2124 } // namespace |
| 2123 | 2125 |
| 2124 // Test fixture that forces material design mode in order to test ink drop | 2126 // Test fixture that forces material design mode in order to test ink drop |
| 2125 // ripples on shelf. | 2127 // ripples on shelf. |
| 2126 class ShelfViewInkDropTest : public ShelfViewTest { | 2128 class ShelfViewInkDropTest : public ShelfViewTest { |
| 2127 public: | 2129 public: |
| 2128 ShelfViewInkDropTest() {} | 2130 ShelfViewInkDropTest() {} |
| 2129 ~ShelfViewInkDropTest() override {} | 2131 ~ShelfViewInkDropTest() override {} |
| 2130 | 2132 |
| 2131 void SetUp() override { | 2133 void SetUp() override { |
| 2132 shell_delegate_ = new TestAppListShellDelegate; | 2134 if (!ash_test_helper()->test_shell_delegate()) { |
|
bruthig
2016/09/01 16:12:54
When does a ShellDelegate already exist?
mohsen
2016/09/10 03:03:23
When it is set by a subclass (e.g. OverflowButtonI
| |
| 2133 ash_test_helper()->set_test_shell_delegate(shell_delegate_); | 2135 shell_delegate_ = new TestAppListShellDelegate; |
| 2136 ash_test_helper()->set_test_shell_delegate(shell_delegate_); | |
| 2137 } | |
| 2134 | 2138 |
| 2135 set_material_mode(ash::MaterialDesignController::MATERIAL_EXPERIMENTAL); | 2139 set_material_mode(ash::MaterialDesignController::MATERIAL_EXPERIMENTAL); |
| 2136 | 2140 |
| 2137 ShelfViewTest::SetUp(); | 2141 ShelfViewTest::SetUp(); |
| 2138 } | 2142 } |
| 2139 | 2143 |
| 2140 protected: | 2144 protected: |
| 2141 void InitAppListButtonInkDrop() { | 2145 void InitAppListButtonInkDrop() { |
| 2142 app_list_button_ = shelf_view_->GetAppListButton(); | 2146 app_list_button_ = shelf_view_->GetAppListButton(); |
| 2143 | 2147 |
| 2144 views::InkDropImpl* ink_drop_impl = | 2148 views::InkDropImpl* ink_drop_impl = |
| 2145 new views::InkDropImpl(app_list_button_); | 2149 new views::InkDropImpl(app_list_button_); |
| 2146 app_list_button_ink_drop_ = new InkDropSpy(base::WrapUnique(ink_drop_impl)); | 2150 app_list_button_ink_drop_ = new InkDropSpy(base::WrapUnique(ink_drop_impl)); |
| 2147 views::test::InkDropHostViewTestApi(app_list_button_) | 2151 views::test::InkDropHostViewTestApi(app_list_button_) |
| 2148 .SetInkDrop(base::WrapUnique(app_list_button_ink_drop_), false); | 2152 .SetInkDrop(base::WrapUnique(app_list_button_ink_drop_), false); |
| 2149 } | 2153 } |
| 2150 | 2154 |
| 2151 void InitBrowserButtonInkDrop() { | 2155 void InitBrowserButtonInkDrop() { |
| 2152 browser_button_ = test_api_->GetButton(browser_index_); | 2156 browser_button_ = test_api_->GetButton(browser_index_); |
| 2153 | 2157 |
| 2154 views::InkDropImpl* ink_drop_impl = new views::InkDropImpl(browser_button_); | 2158 views::InkDropImpl* ink_drop_impl = new views::InkDropImpl(browser_button_); |
| 2155 browser_button_ink_drop_ = new InkDropSpy(base::WrapUnique(ink_drop_impl)); | 2159 browser_button_ink_drop_ = new InkDropSpy(base::WrapUnique(ink_drop_impl)); |
| 2156 views::test::InkDropHostViewTestApi(browser_button_) | 2160 views::test::InkDropHostViewTestApi(browser_button_) |
| 2157 .SetInkDrop(base::WrapUnique(browser_button_ink_drop_)); | 2161 .SetInkDrop(base::WrapUnique(browser_button_ink_drop_)); |
| 2158 } | 2162 } |
| 2159 | 2163 |
| 2160 void ShowAppList() { | 2164 void ShowAppList() { |
| 2165 DCHECK(shelf_delegate_); | |
| 2161 shell_delegate_->app_list_presenter()->Show(0); | 2166 shell_delegate_->app_list_presenter()->Show(0); |
| 2162 // Similar to real AppListPresenter, notify button that the app list is | 2167 // Similar to real AppListPresenter, notify button that the app list is |
| 2163 // shown. | 2168 // shown. |
| 2164 app_list_button_->OnAppListShown(); | 2169 app_list_button_->OnAppListShown(); |
| 2165 } | 2170 } |
| 2166 | 2171 |
| 2167 void DismissAppList() { | 2172 void DismissAppList() { |
| 2173 DCHECK(shelf_delegate_); | |
| 2168 shell_delegate_->app_list_presenter()->Dismiss(); | 2174 shell_delegate_->app_list_presenter()->Dismiss(); |
| 2169 // Similar to real AppListPresenter, notify button that the app list is | 2175 // Similar to real AppListPresenter, notify button that the app list is |
| 2170 // dismissed. | 2176 // dismissed. |
| 2171 app_list_button_->OnAppListDismissed(); | 2177 app_list_button_->OnAppListDismissed(); |
| 2172 } | 2178 } |
| 2173 | 2179 |
| 2174 void FinishAppListVisibilityChange() { | 2180 void FinishAppListVisibilityChange() { |
| 2181 DCHECK(shelf_delegate_); | |
| 2175 shell_delegate_->app_list_presenter()->FinishVisibilityChange(); | 2182 shell_delegate_->app_list_presenter()->FinishVisibilityChange(); |
| 2176 } | 2183 } |
| 2177 | 2184 |
| 2178 TestAppListShellDelegate* shell_delegate_ = nullptr; // Owned by Shell. | 2185 TestAppListShellDelegate* shell_delegate_ = nullptr; // Owned by Shell. |
| 2179 | 2186 |
| 2180 AppListButton* app_list_button_ = nullptr; | 2187 AppListButton* app_list_button_ = nullptr; |
| 2181 InkDropSpy* app_list_button_ink_drop_ = nullptr; | 2188 InkDropSpy* app_list_button_ink_drop_ = nullptr; |
| 2182 ShelfButton* browser_button_ = nullptr; | 2189 ShelfButton* browser_button_ = nullptr; |
| 2183 InkDropSpy* browser_button_ink_drop_ = nullptr; | 2190 InkDropSpy* browser_button_ink_drop_ = nullptr; |
| 2184 | 2191 |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2566 ui::EF_LEFT_MOUSE_BUTTON, 0); | 2573 ui::EF_LEFT_MOUSE_BUTTON, 0); |
| 2567 button->OnMouseReleased(release_event); | 2574 button->OnMouseReleased(release_event); |
| 2568 test_api_->CloseMenu(); | 2575 test_api_->CloseMenu(); |
| 2569 EXPECT_EQ(views::InkDropState::HIDDEN, | 2576 EXPECT_EQ(views::InkDropState::HIDDEN, |
| 2570 browser_button_ink_drop_->GetTargetInkDropState()); | 2577 browser_button_ink_drop_->GetTargetInkDropState()); |
| 2571 EXPECT_THAT(browser_button_ink_drop_->GetAndResetRequestedStates(), | 2578 EXPECT_THAT(browser_button_ink_drop_->GetAndResetRequestedStates(), |
| 2572 ElementsAre(views::InkDropState::ACTIVATED, | 2579 ElementsAre(views::InkDropState::ACTIVATED, |
| 2573 views::InkDropState::DEACTIVATED)); | 2580 views::InkDropState::DEACTIVATED)); |
| 2574 } | 2581 } |
| 2575 | 2582 |
| 2583 namespace { | |
| 2584 | |
| 2585 // An empty menu model for shell context menu just to have a menu. | |
| 2586 class TestShellMenuModel : public ui::SimpleMenuModel, | |
| 2587 public ui::SimpleMenuModel::Delegate { | |
| 2588 public: | |
| 2589 TestShellMenuModel() : ui::SimpleMenuModel(this) {} | |
| 2590 ~TestShellMenuModel() override {} | |
| 2591 | |
| 2592 private: | |
| 2593 // ui::SimpleMenuModel::Delegate: | |
| 2594 bool IsCommandIdChecked(int command_id) const override { return false; } | |
| 2595 bool IsCommandIdEnabled(int command_id) const override { return true; } | |
| 2596 void ExecuteCommand(int command_id, int event_flags) override {} | |
| 2597 | |
| 2598 DISALLOW_COPY_AND_ASSIGN(TestShellMenuModel); | |
| 2599 }; | |
| 2600 | |
| 2601 // A test ShellDelegate implementation for overflow button tests that returns a | |
| 2602 // TestShelfMenuModel for the shell context menu. | |
| 2603 class TestOverflowButtonShellDelegate : public TestShellDelegate { | |
| 2604 public: | |
| 2605 TestOverflowButtonShellDelegate() {} | |
| 2606 ~TestOverflowButtonShellDelegate() override {} | |
| 2607 | |
| 2608 // TestShellDelegate: | |
| 2609 ui::MenuModel* CreateContextMenu(WmShelf* wm_shelf, | |
| 2610 const ShelfItem* item) override { | |
| 2611 // Caller takes ownership of the returned object. | |
| 2612 return new TestShellMenuModel; | |
| 2613 } | |
| 2614 | |
| 2615 private: | |
| 2616 DISALLOW_COPY_AND_ASSIGN(TestOverflowButtonShellDelegate); | |
| 2617 }; | |
| 2618 | |
| 2619 // A scoped wrapper around TestMockTimeTaskRunner that replaces message loop's | |
| 2620 // task runner with a TestMockTimeTaskRunner and resets it back at the end of | |
| 2621 // the scope. | |
| 2622 class ScopedMockTaskRunnerWrapper { | |
| 2623 public: | |
| 2624 ScopedMockTaskRunnerWrapper() { | |
| 2625 mock_task_runner_ = new base::TestMockTimeTaskRunner; | |
| 2626 previous_task_runner_ = base::MessageLoop::current()->task_runner(); | |
| 2627 base::MessageLoop::current()->SetTaskRunner(mock_task_runner_); | |
| 2628 } | |
| 2629 | |
| 2630 ~ScopedMockTaskRunnerWrapper() { | |
| 2631 DCHECK_EQ(mock_task_runner_, base::MessageLoop::current()->task_runner()); | |
| 2632 mock_task_runner_->ClearPendingTasks(); | |
| 2633 base::MessageLoop::current()->SetTaskRunner(previous_task_runner_); | |
| 2634 } | |
| 2635 | |
| 2636 void FastForwardUntilNoTasksRemain() { | |
| 2637 mock_task_runner_->FastForwardUntilNoTasksRemain(); | |
| 2638 } | |
| 2639 | |
| 2640 private: | |
| 2641 scoped_refptr<base::TestMockTimeTaskRunner> mock_task_runner_; | |
| 2642 scoped_refptr<base::SingleThreadTaskRunner> previous_task_runner_; | |
| 2643 | |
| 2644 DISALLOW_COPY_AND_ASSIGN(ScopedMockTaskRunnerWrapper); | |
| 2645 }; | |
| 2646 | |
| 2647 } // namespace | |
| 2648 | |
| 2649 // Test fixture for testing material design ink drop on overflow button. | |
| 2650 class OverflowButtonInkDropTest : public ShelfViewInkDropTest { | |
| 2651 public: | |
| 2652 OverflowButtonInkDropTest() {} | |
| 2653 ~OverflowButtonInkDropTest() override {} | |
| 2654 | |
| 2655 void SetUp() override { | |
| 2656 // Shell takes ownership of the test shell delegate. | |
| 2657 ash_test_helper()->set_test_shell_delegate( | |
| 2658 new TestOverflowButtonShellDelegate); | |
| 2659 | |
| 2660 ShelfViewInkDropTest::SetUp(); | |
| 2661 | |
| 2662 InitOverflowButtonInkDrop(); | |
| 2663 | |
| 2664 AddButtonsUntilOverflow(); | |
| 2665 EXPECT_TRUE(test_api_->IsOverflowButtonVisible()); | |
| 2666 EXPECT_FALSE(test_api_->overflow_bubble() && | |
| 2667 test_api_->overflow_bubble()->IsShowing()); | |
| 2668 } | |
| 2669 | |
| 2670 protected: | |
| 2671 void InitOverflowButtonInkDrop() { | |
|
bruthig
2016/09/01 16:12:54
Does this need to be protected?
mohsen
2016/09/10 03:03:23
Nope. Moved to private section.
| |
| 2672 overflow_button_ = test_api_->overflow_button(); | |
| 2673 | |
| 2674 views::InkDropImpl* ink_drop_impl = | |
| 2675 new views::InkDropImpl(overflow_button_); | |
| 2676 overflow_button_ink_drop_ = new InkDropSpy(base::WrapUnique(ink_drop_impl)); | |
| 2677 views::test::InkDropHostViewTestApi(overflow_button_) | |
| 2678 .SetInkDrop(base::WrapUnique(overflow_button_ink_drop_)); | |
| 2679 } | |
| 2680 | |
| 2681 gfx::Point GetScreenPointInsideOverflowButton() const { | |
| 2682 return overflow_button_->GetBoundsInScreen().CenterPoint(); | |
| 2683 } | |
| 2684 | |
| 2685 gfx::Point GetScreenPointOutsideOverflowButton() const { | |
| 2686 gfx::Point point = GetScreenPointInsideOverflowButton(); | |
| 2687 point.Offset(overflow_button_->width(), 0); | |
| 2688 return point; | |
| 2689 } | |
| 2690 | |
| 2691 OverflowButton* overflow_button_ = nullptr; | |
| 2692 InkDropSpy* overflow_button_ink_drop_ = nullptr; | |
| 2693 | |
| 2694 private: | |
| 2695 DISALLOW_COPY_AND_ASSIGN(OverflowButtonInkDropTest); | |
| 2696 }; | |
| 2697 | |
| 2698 // Tests ink drop state transitions for the overflow button when the overflow | |
| 2699 // bubble is shown or hidden. | |
| 2700 TEST_F(OverflowButtonInkDropTest, OnOverflowBubbleShowHide) { | |
| 2701 test_api_->ShowOverflowBubble(); | |
| 2702 ASSERT_TRUE(test_api_->overflow_bubble()); | |
| 2703 EXPECT_TRUE(test_api_->overflow_bubble()->IsShowing()); | |
| 2704 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 2705 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2706 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2707 ElementsAre(views::InkDropState::ACTIVATED)); | |
| 2708 | |
| 2709 test_api_->HideOverflowBubble(); | |
| 2710 EXPECT_FALSE(test_api_->overflow_bubble() && | |
| 2711 test_api_->overflow_bubble()->IsShowing()); | |
| 2712 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2713 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2714 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2715 ElementsAre(views::InkDropState::DEACTIVATED)); | |
| 2716 } | |
| 2717 | |
| 2718 // Tests ink drop state transitions for the overflow button when the user clicks | |
| 2719 // on it. | |
| 2720 TEST_F(OverflowButtonInkDropTest, MouseActivate) { | |
| 2721 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 2722 gfx::Point mouse_location = GetScreenPointInsideOverflowButton(); | |
| 2723 generator.MoveMouseTo(mouse_location); | |
| 2724 | |
| 2725 generator.PressLeftButton(); | |
| 2726 EXPECT_EQ(views::InkDropState::ACTION_PENDING, | |
| 2727 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2728 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2729 ElementsAre(views::InkDropState::ACTION_PENDING)); | |
| 2730 | |
| 2731 generator.ReleaseLeftButton(); | |
| 2732 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 2733 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2734 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2735 ElementsAre(views::InkDropState::ACTIVATED)); | |
| 2736 | |
| 2737 ASSERT_TRUE(test_api_->overflow_bubble()); | |
| 2738 EXPECT_TRUE(test_api_->overflow_bubble()->IsShowing()); | |
| 2739 } | |
| 2740 | |
| 2741 // Tests ink drop state transitions for the overflow button when the user | |
| 2742 // presses left mouse button on it and drags it out of the button bounds. | |
| 2743 TEST_F(OverflowButtonInkDropTest, MouseDragOut) { | |
| 2744 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 2745 generator.MoveMouseTo(GetScreenPointInsideOverflowButton()); | |
| 2746 | |
| 2747 generator.PressLeftButton(); | |
| 2748 EXPECT_EQ(views::InkDropState::ACTION_PENDING, | |
| 2749 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2750 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2751 ElementsAre(views::InkDropState::ACTION_PENDING)); | |
| 2752 | |
| 2753 generator.MoveMouseTo(GetScreenPointOutsideOverflowButton()); | |
| 2754 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2755 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2756 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2757 ElementsAre(views::InkDropState::HIDDEN)); | |
| 2758 | |
| 2759 generator.ReleaseLeftButton(); | |
| 2760 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2761 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2762 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2763 IsEmpty()); | |
| 2764 | |
| 2765 EXPECT_FALSE(test_api_->overflow_bubble() && | |
| 2766 test_api_->overflow_bubble()->IsShowing()); | |
| 2767 } | |
| 2768 | |
| 2769 // Tests ink drop state transitions for the overflow button when the user | |
| 2770 // presses left mouse button on it and drags it out of the button bounds and | |
| 2771 // back. | |
| 2772 TEST_F(OverflowButtonInkDropTest, MouseDragOutAndBack) { | |
| 2773 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 2774 generator.MoveMouseTo(GetScreenPointInsideOverflowButton()); | |
| 2775 | |
| 2776 generator.PressLeftButton(); | |
| 2777 EXPECT_EQ(views::InkDropState::ACTION_PENDING, | |
| 2778 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2779 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2780 ElementsAre(views::InkDropState::ACTION_PENDING)); | |
| 2781 | |
| 2782 generator.MoveMouseTo(GetScreenPointOutsideOverflowButton()); | |
| 2783 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2784 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2785 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2786 ElementsAre(views::InkDropState::HIDDEN)); | |
| 2787 | |
| 2788 generator.MoveMouseTo(GetScreenPointInsideOverflowButton()); | |
| 2789 EXPECT_EQ(views::InkDropState::ACTION_PENDING, | |
| 2790 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2791 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2792 ElementsAre(views::InkDropState::ACTION_PENDING)); | |
| 2793 | |
| 2794 generator.ReleaseLeftButton(); | |
| 2795 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 2796 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2797 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2798 ElementsAre(views::InkDropState::ACTIVATED)); | |
| 2799 | |
| 2800 ASSERT_TRUE(test_api_->overflow_bubble()); | |
| 2801 EXPECT_TRUE(test_api_->overflow_bubble()->IsShowing()); | |
| 2802 } | |
| 2803 | |
| 2804 // Tests ink drop state transitions for the overflow button when the user right | |
| 2805 // clicks on the button to show the context menu. | |
| 2806 TEST_F(OverflowButtonInkDropTest, MouseContextMenu) { | |
| 2807 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 2808 generator.MoveMouseTo(GetScreenPointInsideOverflowButton()); | |
| 2809 | |
| 2810 generator.PressRightButton(); | |
| 2811 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2812 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2813 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2814 IsEmpty()); | |
| 2815 | |
| 2816 generator.ReleaseRightButton(); | |
| 2817 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2818 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2819 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2820 IsEmpty()); | |
| 2821 | |
| 2822 EXPECT_FALSE(test_api_->overflow_bubble() && | |
| 2823 test_api_->overflow_bubble()->IsShowing()); | |
| 2824 } | |
| 2825 | |
| 2826 #if !defined(OS_WIN) | |
| 2827 // There is no ink drop effect for gesture events on Windows. | |
| 2828 | |
| 2829 // Tests ink drop state transitions for the overflow button when the user taps | |
| 2830 // on it. | |
| 2831 TEST_F(OverflowButtonInkDropTest, TouchActivate) { | |
| 2832 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 2833 generator.set_current_location(GetScreenPointInsideOverflowButton()); | |
| 2834 | |
| 2835 generator.PressTouch(); | |
| 2836 EXPECT_EQ(views::InkDropState::ACTION_PENDING, | |
| 2837 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2838 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2839 ElementsAre(views::InkDropState::ACTION_PENDING)); | |
| 2840 | |
| 2841 generator.ReleaseTouch(); | |
| 2842 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 2843 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2844 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2845 ElementsAre(views::InkDropState::ACTIVATED)); | |
| 2846 | |
| 2847 ASSERT_TRUE(test_api_->overflow_bubble()); | |
| 2848 EXPECT_TRUE(test_api_->overflow_bubble()->IsShowing()); | |
| 2849 } | |
| 2850 | |
| 2851 // Tests ink drop state transitions for the overflow button when the user taps | |
| 2852 // down on it and drags it out of the button bounds. | |
| 2853 TEST_F(OverflowButtonInkDropTest, TouchDragOut) { | |
| 2854 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 2855 generator.set_current_location(GetScreenPointInsideOverflowButton()); | |
| 2856 | |
| 2857 generator.PressTouch(); | |
| 2858 EXPECT_EQ(views::InkDropState::ACTION_PENDING, | |
| 2859 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2860 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2861 ElementsAre(views::InkDropState::ACTION_PENDING)); | |
| 2862 | |
| 2863 generator.MoveTouch(GetScreenPointOutsideOverflowButton()); | |
| 2864 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2865 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2866 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2867 ElementsAre(views::InkDropState::HIDDEN)); | |
| 2868 | |
| 2869 generator.ReleaseTouch(); | |
| 2870 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2871 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2872 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2873 IsEmpty()); | |
| 2874 | |
| 2875 EXPECT_FALSE(test_api_->overflow_bubble() && | |
| 2876 test_api_->overflow_bubble()->IsShowing()); | |
| 2877 } | |
| 2878 | |
| 2879 // Tests ink drop state transitions for the overflow button when the user taps | |
| 2880 // down on it and drags it out of the button bounds and back. | |
| 2881 TEST_F(OverflowButtonInkDropTest, TouchDragOutAndBack) { | |
| 2882 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 2883 generator.set_current_location(GetScreenPointInsideOverflowButton()); | |
| 2884 | |
| 2885 generator.PressTouch(); | |
| 2886 EXPECT_EQ(views::InkDropState::ACTION_PENDING, | |
| 2887 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2888 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2889 ElementsAre(views::InkDropState::ACTION_PENDING)); | |
| 2890 | |
| 2891 generator.MoveTouch(GetScreenPointOutsideOverflowButton()); | |
| 2892 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2893 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2894 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2895 ElementsAre(views::InkDropState::HIDDEN)); | |
| 2896 | |
| 2897 generator.MoveTouch(GetScreenPointInsideOverflowButton()); | |
| 2898 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2899 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2900 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2901 IsEmpty()); | |
| 2902 | |
| 2903 generator.ReleaseTouch(); | |
| 2904 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2905 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2906 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2907 IsEmpty()); | |
| 2908 | |
| 2909 EXPECT_FALSE(test_api_->overflow_bubble() && | |
| 2910 test_api_->overflow_bubble()->IsShowing()); | |
| 2911 } | |
| 2912 | |
| 2913 // Tests ink drop state transitions for the overflow button when the user long | |
| 2914 // presses on the button to show the context menu. | |
| 2915 TEST_F(OverflowButtonInkDropTest, TouchContextMenu) { | |
| 2916 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 2917 generator.set_current_location(GetScreenPointInsideOverflowButton()); | |
| 2918 | |
| 2919 { | |
| 2920 RunAllPendingInMessageLoop(); | |
| 2921 ScopedMockTaskRunnerWrapper mock_task_runner; | |
| 2922 | |
| 2923 generator.PressTouch(); | |
| 2924 EXPECT_EQ(views::InkDropState::ACTION_PENDING, | |
| 2925 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2926 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2927 ElementsAre(views::InkDropState::ACTION_PENDING)); | |
| 2928 | |
| 2929 mock_task_runner.FastForwardUntilNoTasksRemain(); | |
|
bruthig
2016/09/01 16:12:54
This causes a context menu to be shown?
mohsen
2016/09/10 03:03:23
Eventually. This causes long-press timer to expire
| |
| 2930 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2931 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2932 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2933 ElementsAre(views::InkDropState::ALTERNATE_ACTION_PENDING, | |
| 2934 views::InkDropState::HIDDEN)); | |
| 2935 | |
| 2936 generator.ReleaseTouch(); | |
| 2937 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2938 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2939 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2940 IsEmpty()); | |
| 2941 | |
| 2942 EXPECT_FALSE(test_api_->overflow_bubble() && | |
| 2943 test_api_->overflow_bubble()->IsShowing()); | |
| 2944 } | |
| 2945 } | |
| 2946 | |
| 2947 #endif // !defined(OS_WIN) | |
| 2948 | |
| 2949 // Test fixture for testing material design ink drop on overflow button when it | |
| 2950 // is active. | |
| 2951 class OverflowButtonActiveInkDropTest : public OverflowButtonInkDropTest { | |
| 2952 public: | |
| 2953 OverflowButtonActiveInkDropTest() {} | |
| 2954 ~OverflowButtonActiveInkDropTest() override {} | |
| 2955 | |
| 2956 void SetUp() override { | |
| 2957 OverflowButtonInkDropTest::SetUp(); | |
| 2958 | |
| 2959 test_api_->ShowOverflowBubble(); | |
| 2960 ASSERT_TRUE(test_api_->overflow_bubble()); | |
| 2961 EXPECT_TRUE(test_api_->overflow_bubble()->IsShowing()); | |
| 2962 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 2963 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2964 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2965 ElementsAre(views::InkDropState::ACTIVATED)); | |
| 2966 } | |
| 2967 | |
| 2968 private: | |
| 2969 DISALLOW_COPY_AND_ASSIGN(OverflowButtonActiveInkDropTest); | |
| 2970 }; | |
| 2971 | |
| 2972 // Tests ink drop state transitions for the overflow button when it is active | |
| 2973 // and the user clicks on it. | |
| 2974 TEST_F(OverflowButtonActiveInkDropTest, MouseDeactivate) { | |
| 2975 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 2976 generator.MoveMouseTo(GetScreenPointInsideOverflowButton()); | |
| 2977 | |
| 2978 generator.PressLeftButton(); | |
| 2979 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 2980 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2981 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2982 IsEmpty()); | |
| 2983 | |
| 2984 generator.ReleaseLeftButton(); | |
| 2985 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 2986 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 2987 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 2988 ElementsAre(views::InkDropState::DEACTIVATED)); | |
| 2989 | |
| 2990 EXPECT_FALSE(test_api_->overflow_bubble() && | |
| 2991 test_api_->overflow_bubble()->IsShowing()); | |
| 2992 } | |
| 2993 | |
| 2994 // Tests ink drop state transitions for the overflow button when it is active | |
| 2995 // and the user presses left mouse button on it and drags it out of the button | |
| 2996 // bounds. | |
| 2997 TEST_F(OverflowButtonActiveInkDropTest, MouseDragOut) { | |
| 2998 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 2999 generator.MoveMouseTo(GetScreenPointInsideOverflowButton()); | |
| 3000 | |
| 3001 generator.PressLeftButton(); | |
| 3002 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3003 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3004 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3005 IsEmpty()); | |
| 3006 | |
| 3007 generator.MoveMouseTo(GetScreenPointOutsideOverflowButton()); | |
| 3008 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3009 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3010 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3011 IsEmpty()); | |
| 3012 | |
| 3013 generator.ReleaseLeftButton(); | |
| 3014 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3015 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3016 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3017 IsEmpty()); | |
| 3018 | |
| 3019 ASSERT_TRUE(test_api_->overflow_bubble()); | |
| 3020 EXPECT_TRUE(test_api_->overflow_bubble()->IsShowing()); | |
| 3021 } | |
| 3022 | |
| 3023 // Tests ink drop state transitions for the overflow button when it is active | |
| 3024 // and the user presses left mouse button on it and drags it out of the button | |
| 3025 // bounds and back. | |
| 3026 TEST_F(OverflowButtonActiveInkDropTest, MouseDragOutAndBack) { | |
| 3027 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 3028 generator.MoveMouseTo(GetScreenPointInsideOverflowButton()); | |
| 3029 | |
| 3030 generator.PressLeftButton(); | |
| 3031 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3032 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3033 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3034 IsEmpty()); | |
| 3035 | |
| 3036 generator.MoveMouseTo(GetScreenPointOutsideOverflowButton()); | |
| 3037 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3038 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3039 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3040 IsEmpty()); | |
| 3041 | |
| 3042 generator.MoveMouseTo(GetScreenPointInsideOverflowButton()); | |
| 3043 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3044 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3045 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3046 IsEmpty()); | |
| 3047 | |
| 3048 generator.ReleaseLeftButton(); | |
| 3049 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 3050 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3051 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3052 ElementsAre(views::InkDropState::DEACTIVATED)); | |
| 3053 | |
| 3054 EXPECT_FALSE(test_api_->overflow_bubble() && | |
| 3055 test_api_->overflow_bubble()->IsShowing()); | |
| 3056 } | |
| 3057 | |
| 3058 // Tests ink drop state transitions for the overflow button when it is active | |
| 3059 // and the user right clicks on the button to show the context menu. | |
| 3060 TEST_F(OverflowButtonActiveInkDropTest, MouseContextMenu) { | |
| 3061 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 3062 generator.MoveMouseTo(GetScreenPointInsideOverflowButton()); | |
| 3063 | |
| 3064 generator.PressRightButton(); | |
| 3065 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3066 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3067 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3068 IsEmpty()); | |
| 3069 | |
| 3070 generator.ReleaseRightButton(); | |
| 3071 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3072 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3073 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3074 IsEmpty()); | |
| 3075 | |
| 3076 ASSERT_TRUE(test_api_->overflow_bubble()); | |
| 3077 EXPECT_TRUE(test_api_->overflow_bubble()->IsShowing()); | |
| 3078 } | |
| 3079 | |
| 3080 #if !defined(OS_WIN) | |
| 3081 // There is no ink drop effect for gesture events on Windows. | |
| 3082 | |
| 3083 // Tests ink drop state transitions for the overflow button when it is active | |
| 3084 // and the user taps on it. | |
| 3085 TEST_F(OverflowButtonActiveInkDropTest, TouchDeactivate) { | |
| 3086 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 3087 generator.set_current_location(GetScreenPointInsideOverflowButton()); | |
| 3088 | |
| 3089 generator.PressTouch(); | |
| 3090 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3091 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3092 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3093 IsEmpty()); | |
| 3094 | |
| 3095 generator.ReleaseTouch(); | |
| 3096 EXPECT_EQ(views::InkDropState::HIDDEN, | |
| 3097 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3098 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3099 ElementsAre(views::InkDropState::DEACTIVATED, | |
| 3100 views::InkDropState::HIDDEN)); | |
| 3101 | |
| 3102 EXPECT_FALSE(test_api_->overflow_bubble() && | |
| 3103 test_api_->overflow_bubble()->IsShowing()); | |
| 3104 } | |
| 3105 | |
| 3106 // Tests ink drop state transitions for the overflow button when it is active | |
| 3107 // and the user taps down on it and drags it out of the button bounds. | |
| 3108 TEST_F(OverflowButtonActiveInkDropTest, TouchDragOut) { | |
| 3109 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 3110 generator.set_current_location(GetScreenPointInsideOverflowButton()); | |
| 3111 | |
| 3112 generator.PressTouch(); | |
| 3113 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3114 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3115 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3116 IsEmpty()); | |
| 3117 | |
| 3118 generator.MoveTouch(GetScreenPointOutsideOverflowButton()); | |
| 3119 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3120 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3121 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3122 IsEmpty()); | |
| 3123 | |
| 3124 generator.ReleaseTouch(); | |
| 3125 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3126 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3127 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3128 IsEmpty()); | |
| 3129 | |
| 3130 ASSERT_TRUE(test_api_->overflow_bubble()); | |
| 3131 EXPECT_TRUE(test_api_->overflow_bubble()->IsShowing()); | |
| 3132 } | |
| 3133 | |
| 3134 // Tests ink drop state transitions for the overflow button when it is active | |
| 3135 // and the user taps down on it and drags it out of the button bounds and back. | |
| 3136 TEST_F(OverflowButtonActiveInkDropTest, TouchDragOutAndBack) { | |
| 3137 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 3138 generator.set_current_location(GetScreenPointInsideOverflowButton()); | |
| 3139 | |
| 3140 generator.PressTouch(); | |
| 3141 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3142 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3143 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3144 IsEmpty()); | |
| 3145 | |
| 3146 generator.MoveTouch(GetScreenPointOutsideOverflowButton()); | |
| 3147 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3148 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3149 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3150 IsEmpty()); | |
| 3151 | |
| 3152 generator.MoveTouch(GetScreenPointInsideOverflowButton()); | |
| 3153 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3154 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3155 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3156 IsEmpty()); | |
| 3157 | |
| 3158 generator.ReleaseTouch(); | |
| 3159 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3160 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3161 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3162 IsEmpty()); | |
| 3163 | |
| 3164 ASSERT_TRUE(test_api_->overflow_bubble()); | |
| 3165 EXPECT_TRUE(test_api_->overflow_bubble()->IsShowing()); | |
| 3166 } | |
| 3167 | |
| 3168 // Tests ink drop state transitions for the overflow button when it is active | |
| 3169 // and the user long presses on the button to show the context menu. | |
| 3170 TEST_F(OverflowButtonActiveInkDropTest, TouchContextMenu) { | |
| 3171 ui::test::EventGenerator& generator = GetEventGenerator(); | |
| 3172 generator.set_current_location(GetScreenPointInsideOverflowButton()); | |
| 3173 | |
| 3174 { | |
| 3175 RunAllPendingInMessageLoop(); | |
| 3176 ScopedMockTaskRunnerWrapper mock_task_runner; | |
| 3177 | |
| 3178 generator.PressTouch(); | |
| 3179 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3180 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3181 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3182 IsEmpty()); | |
| 3183 | |
| 3184 mock_task_runner.FastForwardUntilNoTasksRemain(); | |
| 3185 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3186 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3187 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3188 IsEmpty()); | |
| 3189 | |
| 3190 generator.ReleaseTouch(); | |
| 3191 EXPECT_EQ(views::InkDropState::ACTIVATED, | |
| 3192 overflow_button_ink_drop_->GetTargetInkDropState()); | |
| 3193 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | |
| 3194 IsEmpty()); | |
| 3195 | |
| 3196 ASSERT_TRUE(test_api_->overflow_bubble()); | |
| 3197 EXPECT_TRUE(test_api_->overflow_bubble()->IsShowing()); | |
| 3198 } | |
| 3199 } | |
| 3200 | |
| 3201 #endif // !defined(OS_WIN) | |
| 3202 | |
| 2576 } // namespace test | 3203 } // namespace test |
| 2577 } // namespace ash | 3204 } // namespace ash |
| OLD | NEW |