OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame/caption_buttons/frame_size_button.h" | 5 #include "ash/frame/caption_buttons/frame_size_button.h" |
6 | 6 |
7 #include "ash/frame/caption_buttons/frame_caption_button.h" | 7 #include "ash/frame/caption_buttons/frame_caption_button.h" |
8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" | 8 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
11 #include "ash/wm/window_state.h" | 11 #include "ash/wm/window_state.h" |
12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
13 #include "grit/ash_resources.h" | 13 #include "grit/ash_resources.h" |
14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
15 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
16 #include "ui/events/gestures/gesture_configuration.h" | 16 #include "ui/events/gesture_detection/gesture_configuration.h" |
17 #include "ui/events/test/event_generator.h" | 17 #include "ui/events/test/event_generator.h" |
18 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
19 #include "ui/gfx/screen.h" | 19 #include "ui/gfx/screen.h" |
20 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
21 #include "ui/views/widget/widget_delegate.h" | 21 #include "ui/views/widget/widget_delegate.h" |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 namespace test { | 24 namespace test { |
25 | 25 |
26 namespace { | 26 namespace { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 generator.GestureScrollSequence( | 240 generator.GestureScrollSequence( |
241 CenterPointInScreen(size_button()), | 241 CenterPointInScreen(size_button()), |
242 CenterPointInScreen(minimize_button()), | 242 CenterPointInScreen(minimize_button()), |
243 base::TimeDelta::FromMilliseconds(100), | 243 base::TimeDelta::FromMilliseconds(100), |
244 3); | 244 3); |
245 RunAllPendingInMessageLoop(); | 245 RunAllPendingInMessageLoop(); |
246 EXPECT_TRUE(HasStateType(wm::WINDOW_STATE_TYPE_LEFT_SNAPPED)); | 246 EXPECT_TRUE(HasStateType(wm::WINDOW_STATE_TYPE_LEFT_SNAPPED)); |
247 | 247 |
248 // 3) Test with tap gestures. | 248 // 3) Test with tap gestures. |
249 const float touch_default_radius = | 249 const float touch_default_radius = |
250 ui::GestureConfiguration::default_radius(); | 250 ui::GestureConfiguration::GetInstance()->default_radius(); |
251 ui::GestureConfiguration::set_default_radius(0); | 251 ui::GestureConfiguration::GetInstance()->set_default_radius(0); |
252 // Snap right. | 252 // Snap right. |
253 generator.MoveMouseTo(CenterPointInScreen(size_button())); | 253 generator.MoveMouseTo(CenterPointInScreen(size_button())); |
254 generator.PressMoveAndReleaseTouchTo(CenterPointInScreen(close_button())); | 254 generator.PressMoveAndReleaseTouchTo(CenterPointInScreen(close_button())); |
255 RunAllPendingInMessageLoop(); | 255 RunAllPendingInMessageLoop(); |
256 EXPECT_TRUE(HasStateType(wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED)); | 256 EXPECT_TRUE(HasStateType(wm::WINDOW_STATE_TYPE_RIGHT_SNAPPED)); |
257 // Snap left. | 257 // Snap left. |
258 generator.MoveMouseTo(CenterPointInScreen(size_button())); | 258 generator.MoveMouseTo(CenterPointInScreen(size_button())); |
259 generator.PressMoveAndReleaseTouchTo(CenterPointInScreen(minimize_button())); | 259 generator.PressMoveAndReleaseTouchTo(CenterPointInScreen(minimize_button())); |
260 RunAllPendingInMessageLoop(); | 260 RunAllPendingInMessageLoop(); |
261 EXPECT_TRUE(HasStateType(wm::WINDOW_STATE_TYPE_LEFT_SNAPPED)); | 261 EXPECT_TRUE(HasStateType(wm::WINDOW_STATE_TYPE_LEFT_SNAPPED)); |
262 ui::GestureConfiguration::set_default_radius(touch_default_radius); | 262 ui::GestureConfiguration::GetInstance()->set_default_radius( |
| 263 touch_default_radius); |
263 } | 264 } |
264 | 265 |
265 // Test that clicking, dragging, and overshooting the minimize button a bit | 266 // Test that clicking, dragging, and overshooting the minimize button a bit |
266 // horizontally still snaps the window left. | 267 // horizontally still snaps the window left. |
267 TEST_F(FrameSizeButtonTest, SnapLeftOvershootMinimize) { | 268 TEST_F(FrameSizeButtonTest, SnapLeftOvershootMinimize) { |
268 EXPECT_TRUE(window_state()->IsNormalStateType()); | 269 EXPECT_TRUE(window_state()->IsNormalStateType()); |
269 | 270 |
270 ui::test::EventGenerator& generator = GetEventGenerator(); | 271 ui::test::EventGenerator& generator = GetEventGenerator(); |
271 generator.MoveMouseTo(CenterPointInScreen(size_button())); | 272 generator.MoveMouseTo(CenterPointInScreen(size_button())); |
272 | 273 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 | 467 |
467 // None of the buttons should stay pressed and the buttons should have their | 468 // None of the buttons should stay pressed and the buttons should have their |
468 // regular icons. | 469 // regular icons. |
469 EXPECT_TRUE(AllButtonsInNormalState()); | 470 EXPECT_TRUE(AllButtonsInNormalState()); |
470 EXPECT_EQ(CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon()); | 471 EXPECT_EQ(CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon()); |
471 EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon()); | 472 EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon()); |
472 } | 473 } |
473 | 474 |
474 } // namespace test | 475 } // namespace test |
475 } // namespace ash | 476 } // namespace ash |
OLD | NEW |