Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(197)

Side by Side Diff: ash/shelf/shelf_view_unittest.cc

Issue 2618143002: cros: Remove some OS platform ifdefs from ash (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/shelf/shelf_layout_manager_unittest.cc ('k') | ash/shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after
2210 // ink drop state. 2210 // ink drop state.
2211 generator.MoveMouseBy(app_list_button_->width(), 0); 2211 generator.MoveMouseBy(app_list_button_->width(), 0);
2212 generator.MoveMouseBy(-app_list_button_->width(), 0); 2212 generator.MoveMouseBy(-app_list_button_->width(), 0);
2213 generator.ReleaseLeftButton(); 2213 generator.ReleaseLeftButton();
2214 EXPECT_EQ(views::InkDropState::HIDDEN, 2214 EXPECT_EQ(views::InkDropState::HIDDEN,
2215 app_list_button_ink_drop_->GetTargetInkDropState()); 2215 app_list_button_ink_drop_->GetTargetInkDropState());
2216 EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), 2216 EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(),
2217 IsEmpty()); 2217 IsEmpty());
2218 } 2218 }
2219 2219
2220 // There is no ink drop effect for gesture events on Windows.
2221 #if !defined(OS_WIN)
2222 // Tests that when the app list is hidden, tapping on the app list button 2220 // Tests that when the app list is hidden, tapping on the app list button
2223 // transitions ink drop states correctly. 2221 // transitions ink drop states correctly.
2224 TEST_F(ShelfViewInkDropTest, AppListButtonGestureTapWhenHidden) { 2222 TEST_F(ShelfViewInkDropTest, AppListButtonGestureTapWhenHidden) {
2225 InitAppListButtonInkDrop(); 2223 InitAppListButtonInkDrop();
2226 2224
2227 ui::test::EventGenerator& generator = GetEventGenerator(); 2225 ui::test::EventGenerator& generator = GetEventGenerator();
2228 generator.MoveMouseTo(app_list_button_->GetBoundsInScreen().CenterPoint()); 2226 generator.MoveMouseTo(app_list_button_->GetBoundsInScreen().CenterPoint());
2229 2227
2230 // Touch press on the button should end up in the pending state. 2228 // Touch press on the button should end up in the pending state.
2231 generator.PressTouch(); 2229 generator.PressTouch();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 // state. 2340 // state.
2343 touch_location.Offset(app_list_button_->width(), 0); 2341 touch_location.Offset(app_list_button_->width(), 0);
2344 generator.MoveTouch(touch_location); 2342 generator.MoveTouch(touch_location);
2345 generator.ReleaseTouch(); 2343 generator.ReleaseTouch();
2346 FinishAppListVisibilityChange(); 2344 FinishAppListVisibilityChange();
2347 EXPECT_EQ(views::InkDropState::HIDDEN, 2345 EXPECT_EQ(views::InkDropState::HIDDEN,
2348 app_list_button_ink_drop_->GetTargetInkDropState()); 2346 app_list_button_ink_drop_->GetTargetInkDropState());
2349 EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(), 2347 EXPECT_THAT(app_list_button_ink_drop_->GetAndResetRequestedStates(),
2350 ElementsAre(views::InkDropState::HIDDEN)); 2348 ElementsAre(views::InkDropState::HIDDEN));
2351 } 2349 }
2352 #endif // !defined(OS_WIN)
2353 2350
2354 // Tests that clicking on a shelf item that does not show a menu transitions ink 2351 // Tests that clicking on a shelf item that does not show a menu transitions ink
2355 // drop states correctly. 2352 // drop states correctly.
2356 TEST_F(ShelfViewInkDropTest, ShelfButtonWithoutMenuPressRelease) { 2353 TEST_F(ShelfViewInkDropTest, ShelfButtonWithoutMenuPressRelease) {
2357 InitBrowserButtonInkDrop(); 2354 InitBrowserButtonInkDrop();
2358 2355
2359 views::CustomButton* button = browser_button_; 2356 views::CustomButton* button = browser_button_;
2360 gfx::Point mouse_location = button->GetLocalBounds().CenterPoint(); 2357 gfx::Point mouse_location = button->GetLocalBounds().CenterPoint();
2361 2358
2362 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, mouse_location, 2359 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, mouse_location,
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
2707 2704
2708 generator.ReleaseRightButton(); 2705 generator.ReleaseRightButton();
2709 EXPECT_EQ(views::InkDropState::HIDDEN, 2706 EXPECT_EQ(views::InkDropState::HIDDEN,
2710 overflow_button_ink_drop_->GetTargetInkDropState()); 2707 overflow_button_ink_drop_->GetTargetInkDropState());
2711 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), 2708 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(),
2712 IsEmpty()); 2709 IsEmpty());
2713 2710
2714 EXPECT_FALSE(test_api_->IsShowingOverflowBubble()); 2711 EXPECT_FALSE(test_api_->IsShowingOverflowBubble());
2715 } 2712 }
2716 2713
2717 // There is no ink drop effect for gesture events on Windows.
2718 #if !defined(OS_WIN)
2719 // Tests ink drop state transitions for the overflow button when the user taps 2714 // Tests ink drop state transitions for the overflow button when the user taps
2720 // on it. 2715 // on it.
2721 TEST_F(OverflowButtonInkDropTest, TouchActivate) { 2716 TEST_F(OverflowButtonInkDropTest, TouchActivate) {
2722 ui::test::EventGenerator& generator = GetEventGenerator(); 2717 ui::test::EventGenerator& generator = GetEventGenerator();
2723 generator.set_current_location(GetScreenPointInsideOverflowButton()); 2718 generator.set_current_location(GetScreenPointInsideOverflowButton());
2724 2719
2725 generator.PressTouch(); 2720 generator.PressTouch();
2726 EXPECT_EQ(views::InkDropState::ACTION_PENDING, 2721 EXPECT_EQ(views::InkDropState::ACTION_PENDING,
2727 overflow_button_ink_drop_->GetTargetInkDropState()); 2722 overflow_button_ink_drop_->GetTargetInkDropState());
2728 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), 2723 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(),
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2819 2814
2820 generator.ReleaseTouch(); 2815 generator.ReleaseTouch();
2821 EXPECT_EQ(views::InkDropState::HIDDEN, 2816 EXPECT_EQ(views::InkDropState::HIDDEN,
2822 overflow_button_ink_drop_->GetTargetInkDropState()); 2817 overflow_button_ink_drop_->GetTargetInkDropState());
2823 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), 2818 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(),
2824 IsEmpty()); 2819 IsEmpty());
2825 2820
2826 EXPECT_FALSE(test_api_->IsShowingOverflowBubble()); 2821 EXPECT_FALSE(test_api_->IsShowingOverflowBubble());
2827 } 2822 }
2828 2823
2829 #endif // !defined(OS_WIN)
2830
2831 // Test fixture for testing material design ink drop on overflow button when it 2824 // Test fixture for testing material design ink drop on overflow button when it
2832 // is active. 2825 // is active.
2833 class OverflowButtonActiveInkDropTest : public OverflowButtonInkDropTest { 2826 class OverflowButtonActiveInkDropTest : public OverflowButtonInkDropTest {
2834 public: 2827 public:
2835 OverflowButtonActiveInkDropTest() {} 2828 OverflowButtonActiveInkDropTest() {}
2836 ~OverflowButtonActiveInkDropTest() override {} 2829 ~OverflowButtonActiveInkDropTest() override {}
2837 2830
2838 void SetUp() override { 2831 void SetUp() override {
2839 OverflowButtonInkDropTest::SetUp(); 2832 OverflowButtonInkDropTest::SetUp();
2840 2833
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 2940
2948 generator.ReleaseRightButton(); 2941 generator.ReleaseRightButton();
2949 EXPECT_EQ(views::InkDropState::ACTIVATED, 2942 EXPECT_EQ(views::InkDropState::ACTIVATED,
2950 overflow_button_ink_drop_->GetTargetInkDropState()); 2943 overflow_button_ink_drop_->GetTargetInkDropState());
2951 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), 2944 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(),
2952 IsEmpty()); 2945 IsEmpty());
2953 2946
2954 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); 2947 ASSERT_TRUE(test_api_->IsShowingOverflowBubble());
2955 } 2948 }
2956 2949
2957 // There is no ink drop effect for gesture events on Windows.
2958 #if !defined(OS_WIN)
2959 // Tests ink drop state transitions for the overflow button when it is active 2950 // Tests ink drop state transitions for the overflow button when it is active
2960 // and the user taps on it. 2951 // and the user taps on it.
2961 TEST_F(OverflowButtonActiveInkDropTest, TouchDeactivate) { 2952 TEST_F(OverflowButtonActiveInkDropTest, TouchDeactivate) {
2962 ui::test::EventGenerator& generator = GetEventGenerator(); 2953 ui::test::EventGenerator& generator = GetEventGenerator();
2963 generator.set_current_location(GetScreenPointInsideOverflowButton()); 2954 generator.set_current_location(GetScreenPointInsideOverflowButton());
2964 2955
2965 generator.PressTouch(); 2956 generator.PressTouch();
2966 EXPECT_EQ(views::InkDropState::ACTIVATED, 2957 EXPECT_EQ(views::InkDropState::ACTIVATED,
2967 overflow_button_ink_drop_->GetTargetInkDropState()); 2958 overflow_button_ink_drop_->GetTargetInkDropState());
2968 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), 2959 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(),
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
3059 3050
3060 generator.ReleaseTouch(); 3051 generator.ReleaseTouch();
3061 EXPECT_EQ(views::InkDropState::ACTIVATED, 3052 EXPECT_EQ(views::InkDropState::ACTIVATED,
3062 overflow_button_ink_drop_->GetTargetInkDropState()); 3053 overflow_button_ink_drop_->GetTargetInkDropState());
3063 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), 3054 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(),
3064 IsEmpty()); 3055 IsEmpty());
3065 3056
3066 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); 3057 ASSERT_TRUE(test_api_->IsShowingOverflowBubble());
3067 } 3058 }
3068 3059
3069 #endif // !defined(OS_WIN)
3070
3071 } // namespace test 3060 } // namespace test
3072 } // namespace ash 3061 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager_unittest.cc ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698