| 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/common/frame/caption_buttons/frame_size_button.h" | 5 #include "ash/common/frame/caption_buttons/frame_size_button.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_layout_constants.h" | 7 #include "ash/common/ash_layout_constants.h" |
| 8 #include "ash/common/frame/caption_buttons/frame_caption_button.h" | 8 #include "ash/common/frame/caption_buttons/frame_caption_button.h" |
| 9 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" | 9 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h
" |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 // Repeat test but release button where it does not affect the window's state | 324 // Repeat test but release button where it does not affect the window's state |
| 325 // because the code path is different. | 325 // because the code path is different. |
| 326 generator.MoveMouseTo(CenterPointInScreen(size_button())); | 326 generator.MoveMouseTo(CenterPointInScreen(size_button())); |
| 327 generator.PressLeftButton(); | 327 generator.PressLeftButton(); |
| 328 EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); | 328 EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); |
| 329 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); | 329 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); |
| 330 EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); | 330 EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); |
| 331 EXPECT_EQ(CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon()); | 331 EXPECT_EQ(CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon()); |
| 332 EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon()); | 332 EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon()); |
| 333 | 333 |
| 334 const gfx::Rect& kWorkAreaBoundsInScreen = | 334 const gfx::Rect work_area_bounds_in_screen = |
| 335 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); | 335 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); |
| 336 generator.MoveMouseTo(kWorkAreaBoundsInScreen.bottom_left()); | 336 generator.MoveMouseTo(work_area_bounds_in_screen.bottom_left()); |
| 337 | 337 |
| 338 // None of the buttons should be pressed because we are really far away from | 338 // None of the buttons should be pressed because we are really far away from |
| 339 // any of the caption buttons. The minimize and close button icons should | 339 // any of the caption buttons. The minimize and close button icons should |
| 340 // be changed because the mouse is pressed. | 340 // be changed because the mouse is pressed. |
| 341 EXPECT_TRUE(AllButtonsInNormalState()); | 341 EXPECT_TRUE(AllButtonsInNormalState()); |
| 342 EXPECT_EQ(CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon()); | 342 EXPECT_EQ(CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon()); |
| 343 EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon()); | 343 EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon()); |
| 344 | 344 |
| 345 // Release the mouse. The window should stay snapped left. | 345 // Release the mouse. The window should stay snapped left. |
| 346 generator.ReleaseLeftButton(); | 346 generator.ReleaseLeftButton(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 375 // Dragging the mouse over the minimize button (snap left button) should hover | 375 // Dragging the mouse over the minimize button (snap left button) should hover |
| 376 // the minimize button and keep the size button pressed. | 376 // the minimize button and keep the size button pressed. |
| 377 generator.MoveMouseTo(CenterPointInScreen(minimize_button())); | 377 generator.MoveMouseTo(CenterPointInScreen(minimize_button())); |
| 378 EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->state()); | 378 EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->state()); |
| 379 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); | 379 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); |
| 380 EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); | 380 EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); |
| 381 | 381 |
| 382 // Moving the mouse far away from the caption buttons and then moving it over | 382 // Moving the mouse far away from the caption buttons and then moving it over |
| 383 // the close button (snap right button) should hover the close button and | 383 // the close button (snap right button) should hover the close button and |
| 384 // keep the size button pressed. | 384 // keep the size button pressed. |
| 385 const gfx::Rect& kWorkAreaBoundsInScreen = | 385 const gfx::Rect work_area_bounds_in_screen = |
| 386 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); | 386 display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); |
| 387 generator.MoveMouseTo(kWorkAreaBoundsInScreen.bottom_left()); | 387 generator.MoveMouseTo(work_area_bounds_in_screen.bottom_left()); |
| 388 EXPECT_TRUE(AllButtonsInNormalState()); | 388 EXPECT_TRUE(AllButtonsInNormalState()); |
| 389 generator.MoveMouseTo(CenterPointInScreen(close_button())); | 389 generator.MoveMouseTo(CenterPointInScreen(close_button())); |
| 390 EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); | 390 EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); |
| 391 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); | 391 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); |
| 392 EXPECT_EQ(views::Button::STATE_HOVERED, close_button()->state()); | 392 EXPECT_EQ(views::Button::STATE_HOVERED, close_button()->state()); |
| 393 } | 393 } |
| 394 | 394 |
| 395 class FrameSizeButtonTestRTL : public FrameSizeButtonTest { | 395 class FrameSizeButtonTestRTL : public FrameSizeButtonTest { |
| 396 public: | 396 public: |
| 397 FrameSizeButtonTestRTL() {} | 397 FrameSizeButtonTestRTL() {} |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 455 |
| 456 // None of the buttons should stay pressed and the buttons should have their | 456 // None of the buttons should stay pressed and the buttons should have their |
| 457 // regular icons. | 457 // regular icons. |
| 458 EXPECT_TRUE(AllButtonsInNormalState()); | 458 EXPECT_TRUE(AllButtonsInNormalState()); |
| 459 EXPECT_EQ(CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon()); | 459 EXPECT_EQ(CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon()); |
| 460 EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon()); | 460 EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon()); |
| 461 } | 461 } |
| 462 | 462 |
| 463 } // namespace test | 463 } // namespace test |
| 464 } // namespace ash | 464 } // namespace ash |
| OLD | NEW |