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

Side by Side Diff: ash/frame/caption_buttons/frame_size_button_unittest.cc

Issue 1608053002: Remove now-unnecessary wrappers around gfx::Screen::GetScreen() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-5
Patch Set: cros Created 4 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/first_run/first_run_helper_impl.cc ('k') | ash/magnifier/magnification_controller.cc » ('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 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/ash_layout_constants.h" 7 #include "ash/ash_layout_constants.h"
8 #include "ash/frame/caption_buttons/frame_caption_button.h" 8 #include "ash/frame/caption_buttons/frame_caption_button.h"
9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" 9 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // because the code path is different. 330 // because the code path is different.
331 generator.MoveMouseTo(CenterPointInScreen(size_button())); 331 generator.MoveMouseTo(CenterPointInScreen(size_button()));
332 generator.PressLeftButton(); 332 generator.PressLeftButton();
333 EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); 333 EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state());
334 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); 334 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state());
335 EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); 335 EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state());
336 EXPECT_EQ(CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon()); 336 EXPECT_EQ(CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon());
337 EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon()); 337 EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon());
338 338
339 const gfx::Rect& kWorkAreaBoundsInScreen = 339 const gfx::Rect& kWorkAreaBoundsInScreen =
340 ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); 340 gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area();
341 generator.MoveMouseTo(kWorkAreaBoundsInScreen.bottom_left()); 341 generator.MoveMouseTo(kWorkAreaBoundsInScreen.bottom_left());
342 342
343 // None of the buttons should be pressed because we are really far away from 343 // None of the buttons should be pressed because we are really far away from
344 // any of the caption buttons. The minimize and close button icons should 344 // any of the caption buttons. The minimize and close button icons should
345 // be changed because the mouse is pressed. 345 // be changed because the mouse is pressed.
346 EXPECT_TRUE(AllButtonsInNormalState()); 346 EXPECT_TRUE(AllButtonsInNormalState());
347 EXPECT_EQ(CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon()); 347 EXPECT_EQ(CAPTION_BUTTON_ICON_LEFT_SNAPPED, minimize_button()->icon());
348 EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon()); 348 EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon());
349 349
350 // Release the mouse. The window should stay snapped left. 350 // Release the mouse. The window should stay snapped left.
(...skipping 30 matching lines...) Expand all
381 // the minimize button and keep the size button pressed. 381 // the minimize button and keep the size button pressed.
382 generator.MoveMouseTo(CenterPointInScreen(minimize_button())); 382 generator.MoveMouseTo(CenterPointInScreen(minimize_button()));
383 EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->state()); 383 EXPECT_EQ(views::Button::STATE_HOVERED, minimize_button()->state());
384 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); 384 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state());
385 EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state()); 385 EXPECT_EQ(views::Button::STATE_NORMAL, close_button()->state());
386 386
387 // Moving the mouse far away from the caption buttons and then moving it over 387 // Moving the mouse far away from the caption buttons and then moving it over
388 // the close button (snap right button) should hover the close button and 388 // the close button (snap right button) should hover the close button and
389 // keep the size button pressed. 389 // keep the size button pressed.
390 const gfx::Rect& kWorkAreaBoundsInScreen = 390 const gfx::Rect& kWorkAreaBoundsInScreen =
391 ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); 391 gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area();
392 generator.MoveMouseTo(kWorkAreaBoundsInScreen.bottom_left()); 392 generator.MoveMouseTo(kWorkAreaBoundsInScreen.bottom_left());
393 EXPECT_TRUE(AllButtonsInNormalState()); 393 EXPECT_TRUE(AllButtonsInNormalState());
394 generator.MoveMouseTo(CenterPointInScreen(close_button())); 394 generator.MoveMouseTo(CenterPointInScreen(close_button()));
395 EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state()); 395 EXPECT_EQ(views::Button::STATE_NORMAL, minimize_button()->state());
396 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state()); 396 EXPECT_EQ(views::Button::STATE_PRESSED, size_button()->state());
397 EXPECT_EQ(views::Button::STATE_HOVERED, close_button()->state()); 397 EXPECT_EQ(views::Button::STATE_HOVERED, close_button()->state());
398 } 398 }
399 399
400 class FrameSizeButtonTestRTL : public FrameSizeButtonTest { 400 class FrameSizeButtonTestRTL : public FrameSizeButtonTest {
401 public: 401 public:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 460
461 // None of the buttons should stay pressed and the buttons should have their 461 // None of the buttons should stay pressed and the buttons should have their
462 // regular icons. 462 // regular icons.
463 EXPECT_TRUE(AllButtonsInNormalState()); 463 EXPECT_TRUE(AllButtonsInNormalState());
464 EXPECT_EQ(CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon()); 464 EXPECT_EQ(CAPTION_BUTTON_ICON_MINIMIZE, minimize_button()->icon());
465 EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon()); 465 EXPECT_EQ(CAPTION_BUTTON_ICON_CLOSE, close_button()->icon());
466 } 466 }
467 467
468 } // namespace test 468 } // namespace test
469 } // namespace ash 469 } // namespace ash
OLDNEW
« no previous file with comments | « ash/first_run/first_run_helper_impl.cc ('k') | ash/magnifier/magnification_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698