| 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> |
| (...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1979 : ink_drop_(std::move(ink_drop)) {} | 1979 : ink_drop_(std::move(ink_drop)) {} |
| 1980 ~InkDropSpy() override {} | 1980 ~InkDropSpy() override {} |
| 1981 | 1981 |
| 1982 std::vector<views::InkDropState> GetAndResetRequestedStates() { | 1982 std::vector<views::InkDropState> GetAndResetRequestedStates() { |
| 1983 std::vector<views::InkDropState> requested_states; | 1983 std::vector<views::InkDropState> requested_states; |
| 1984 requested_states.swap(requested_states_); | 1984 requested_states.swap(requested_states_); |
| 1985 return requested_states; | 1985 return requested_states; |
| 1986 } | 1986 } |
| 1987 | 1987 |
| 1988 // views::InkDrop: | 1988 // views::InkDrop: |
| 1989 void HostSizeChanged(const gfx::Size& new_size) override { |
| 1990 ink_drop_->HostSizeChanged(new_size); |
| 1991 } |
| 1989 views::InkDropState GetTargetInkDropState() const override { | 1992 views::InkDropState GetTargetInkDropState() const override { |
| 1990 return ink_drop_->GetTargetInkDropState(); | 1993 return ink_drop_->GetTargetInkDropState(); |
| 1991 } | 1994 } |
| 1992 void AnimateToState(views::InkDropState ink_drop_state) override { | 1995 void AnimateToState(views::InkDropState ink_drop_state) override { |
| 1993 requested_states_.push_back(ink_drop_state); | 1996 requested_states_.push_back(ink_drop_state); |
| 1994 ink_drop_->AnimateToState(ink_drop_state); | 1997 ink_drop_->AnimateToState(ink_drop_state); |
| 1995 } | 1998 } |
| 1996 void SnapToActivated() override { ink_drop_->SnapToActivated(); } | 1999 void SnapToActivated() override { ink_drop_->SnapToActivated(); } |
| 1997 void SetHovered(bool is_hovered) override { | 2000 void SetHovered(bool is_hovered) override { |
| 1998 ink_drop_->SetHovered(is_hovered); | 2001 ink_drop_->SetHovered(is_hovered); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 // before calling base class's SetUp(). Shell will take ownership of the | 2136 // before calling base class's SetUp(). Shell will take ownership of the |
| 2134 // returned object. | 2137 // returned object. |
| 2135 virtual TestShellDelegate* CreateTestShellDelegate() { | 2138 virtual TestShellDelegate* CreateTestShellDelegate() { |
| 2136 shell_delegate_ = new TestAppListShellDelegate; | 2139 shell_delegate_ = new TestAppListShellDelegate; |
| 2137 return shell_delegate_; | 2140 return shell_delegate_; |
| 2138 } | 2141 } |
| 2139 | 2142 |
| 2140 void InitAppListButtonInkDrop() { | 2143 void InitAppListButtonInkDrop() { |
| 2141 app_list_button_ = shelf_view_->GetAppListButton(); | 2144 app_list_button_ = shelf_view_->GetAppListButton(); |
| 2142 | 2145 |
| 2143 auto app_list_button_ink_drop = base::MakeUnique<InkDropSpy>( | 2146 auto app_list_button_ink_drop = |
| 2144 base::MakeUnique<views::InkDropImpl>(app_list_button_)); | 2147 base::MakeUnique<InkDropSpy>(base::MakeUnique<views::InkDropImpl>( |
| 2148 app_list_button_, app_list_button_->size())); |
| 2145 app_list_button_ink_drop_ = app_list_button_ink_drop.get(); | 2149 app_list_button_ink_drop_ = app_list_button_ink_drop.get(); |
| 2146 views::test::InkDropHostViewTestApi(app_list_button_) | 2150 views::test::InkDropHostViewTestApi(app_list_button_) |
| 2147 .SetInkDrop(std::move(app_list_button_ink_drop), false); | 2151 .SetInkDrop(std::move(app_list_button_ink_drop), false); |
| 2148 } | 2152 } |
| 2149 | 2153 |
| 2150 void InitBrowserButtonInkDrop() { | 2154 void InitBrowserButtonInkDrop() { |
| 2151 browser_button_ = test_api_->GetButton(browser_index_); | 2155 browser_button_ = test_api_->GetButton(browser_index_); |
| 2152 | 2156 |
| 2153 auto browser_button_ink_drop = base::MakeUnique<InkDropSpy>( | 2157 auto browser_button_ink_drop = |
| 2154 base::MakeUnique<views::InkDropImpl>(browser_button_)); | 2158 base::MakeUnique<InkDropSpy>(base::MakeUnique<views::InkDropImpl>( |
| 2159 browser_button_, browser_button_->size())); |
| 2155 browser_button_ink_drop_ = browser_button_ink_drop.get(); | 2160 browser_button_ink_drop_ = browser_button_ink_drop.get(); |
| 2156 views::test::InkDropHostViewTestApi(browser_button_) | 2161 views::test::InkDropHostViewTestApi(browser_button_) |
| 2157 .SetInkDrop(std::move(browser_button_ink_drop)); | 2162 .SetInkDrop(std::move(browser_button_ink_drop)); |
| 2158 } | 2163 } |
| 2159 | 2164 |
| 2160 void ShowAppList() { | 2165 void ShowAppList() { |
| 2161 DCHECK(shelf_delegate_); | 2166 DCHECK(shelf_delegate_); |
| 2162 shell_delegate_->app_list_presenter()->Show(0); | 2167 shell_delegate_->app_list_presenter()->Show(0); |
| 2163 // Similar to real AppListPresenter, notify button that the app list is | 2168 // Similar to real AppListPresenter, notify button that the app list is |
| 2164 // shown. | 2169 // shown. |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2645 class OverflowButtonInkDropTest : public ShelfViewInkDropTest { | 2650 class OverflowButtonInkDropTest : public ShelfViewInkDropTest { |
| 2646 public: | 2651 public: |
| 2647 OverflowButtonInkDropTest() {} | 2652 OverflowButtonInkDropTest() {} |
| 2648 ~OverflowButtonInkDropTest() override {} | 2653 ~OverflowButtonInkDropTest() override {} |
| 2649 | 2654 |
| 2650 void SetUp() override { | 2655 void SetUp() override { |
| 2651 ShelfViewInkDropTest::SetUp(); | 2656 ShelfViewInkDropTest::SetUp(); |
| 2652 | 2657 |
| 2653 overflow_button_ = test_api_->overflow_button(); | 2658 overflow_button_ = test_api_->overflow_button(); |
| 2654 | 2659 |
| 2655 auto overflow_button_ink_drop = base::MakeUnique<InkDropSpy>( | 2660 auto overflow_button_ink_drop = |
| 2656 base::MakeUnique<views::InkDropImpl>(overflow_button_)); | 2661 base::MakeUnique<InkDropSpy>(base::MakeUnique<views::InkDropImpl>( |
| 2662 overflow_button_, overflow_button_->size())); |
| 2657 overflow_button_ink_drop_ = overflow_button_ink_drop.get(); | 2663 overflow_button_ink_drop_ = overflow_button_ink_drop.get(); |
| 2658 views::test::InkDropHostViewTestApi(overflow_button_) | 2664 views::test::InkDropHostViewTestApi(overflow_button_) |
| 2659 .SetInkDrop(std::move(overflow_button_ink_drop)); | 2665 .SetInkDrop(std::move(overflow_button_ink_drop)); |
| 2660 | 2666 |
| 2661 AddButtonsUntilOverflow(); | 2667 AddButtonsUntilOverflow(); |
| 2662 EXPECT_TRUE(test_api_->IsOverflowButtonVisible()); | 2668 EXPECT_TRUE(test_api_->IsOverflowButtonVisible()); |
| 2663 EXPECT_FALSE(test_api_->IsShowingOverflowBubble()); | 2669 EXPECT_FALSE(test_api_->IsShowingOverflowBubble()); |
| 2664 } | 2670 } |
| 2665 | 2671 |
| 2666 protected: | 2672 protected: |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3165 IsEmpty()); | 3171 IsEmpty()); |
| 3166 | 3172 |
| 3167 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); | 3173 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); |
| 3168 } | 3174 } |
| 3169 } | 3175 } |
| 3170 | 3176 |
| 3171 #endif // !defined(OS_WIN) | 3177 #endif // !defined(OS_WIN) |
| 3172 | 3178 |
| 3173 } // namespace test | 3179 } // namespace test |
| 3174 } // namespace ash | 3180 } // namespace ash |
| OLD | NEW |