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

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer_ash_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
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/scoped_target_root_window.h" 5 #include "ash/scoped_target_root_window.h"
6 #include "ash/screen_util.h" 6 #include "ash/screen_util.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "ash/test/test_shell_delegate.h" 9 #include "ash/test/test_shell_delegate.h"
10 #include "ash/wm/window_positioner.h" 10 #include "ash/wm/window_positioner.h"
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 #if defined(OS_CHROMEOS) 577 #if defined(OS_CHROMEOS)
578 #define MAYBE_PlaceNewWindowsOnMultipleDisplays PlaceNewWindowsOnMultipleDisplay s 578 #define MAYBE_PlaceNewWindowsOnMultipleDisplays PlaceNewWindowsOnMultipleDisplay s
579 #else 579 #else
580 // No multiple displays on windows ash. 580 // No multiple displays on windows ash.
581 #define MAYBE_PlaceNewWindowsOnMultipleDisplays DISABLED_PlaceNewWindowsOnMultip leDisplays 581 #define MAYBE_PlaceNewWindowsOnMultipleDisplays DISABLED_PlaceNewWindowsOnMultip leDisplays
582 #endif 582 #endif
583 583
584 // Test the placement of newly created windows on multiple dislays. 584 // Test the placement of newly created windows on multiple dislays.
585 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindowsOnMultipleDisplays) { 585 TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindowsOnMultipleDisplays) {
586 UpdateDisplay("1600x1200,1600x1200"); 586 UpdateDisplay("1600x1200,1600x1200");
587 gfx::Rect primary_bounds = ash::Shell::GetInstance()->GetScreen()-> 587 gfx::Rect primary_bounds =
588 GetPrimaryDisplay().bounds(); 588 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds();
589 gfx::Rect secondary_bounds = ash::ScreenUtil::GetSecondaryDisplay().bounds(); 589 gfx::Rect secondary_bounds = ash::ScreenUtil::GetSecondaryDisplay().bounds();
590 590
591 ash::Shell::GetInstance()->set_target_root_window( 591 ash::Shell::GetInstance()->set_target_root_window(
592 ash::Shell::GetPrimaryRootWindow()); 592 ash::Shell::GetPrimaryRootWindow());
593 593
594 scoped_ptr<TestingProfile> profile(new TestingProfile()); 594 scoped_ptr<TestingProfile> profile(new TestingProfile());
595 595
596 // Create browser windows that are used as reference. 596 // Create browser windows that are used as reference.
597 Browser::CreateParams params(profile.get(), chrome::HOST_DESKTOP_TYPE_ASH); 597 Browser::CreateParams params(profile.get(), chrome::HOST_DESKTOP_TYPE_ASH);
598 scoped_ptr<Browser> browser(CreateTestBrowser( 598 scoped_ptr<Browser> browser(CreateTestBrowser(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 &window_bounds); 630 &window_bounds);
631 // TODO(oshima): Use exact bounds when the window_sizer_ash is 631 // TODO(oshima): Use exact bounds when the window_sizer_ash is
632 // moved to ash and changed to include the result from 632 // moved to ash and changed to include the result from
633 // RearrangeVisibleWindowOnShow. 633 // RearrangeVisibleWindowOnShow.
634 EXPECT_TRUE(primary_bounds.Contains(window_bounds)); 634 EXPECT_TRUE(primary_bounds.Contains(window_bounds));
635 } 635 }
636 636
637 // Move the window to the right side of the secondary display and create a new 637 // Move the window to the right side of the secondary display and create a new
638 // window. It should be opened then on the secondary display. 638 // window. It should be opened then on the secondary display.
639 { 639 {
640 gfx::Display second_display = ash::Shell::GetScreen()-> 640 gfx::Display second_display =
641 GetDisplayNearestPoint(gfx::Point(1600 + 100,10)); 641 gfx::Screen::GetScreen()->GetDisplayNearestPoint(
642 gfx::Point(1600 + 100, 10));
642 browser_window->GetNativeWindow()->SetBoundsInScreen( 643 browser_window->GetNativeWindow()->SetBoundsInScreen(
643 gfx::Rect(secondary_bounds.CenterPoint().x() - 100, 10, 200, 200), 644 gfx::Rect(secondary_bounds.CenterPoint().x() - 100, 10, 200, 200),
644 second_display); 645 second_display);
645 aura::client::GetActivationClient(native_window->GetRootWindow()) 646 aura::client::GetActivationClient(native_window->GetRootWindow())
646 ->ActivateWindow(native_window); 647 ->ActivateWindow(native_window);
647 EXPECT_NE(ash::Shell::GetPrimaryRootWindow(), 648 EXPECT_NE(ash::Shell::GetPrimaryRootWindow(),
648 ash::Shell::GetTargetRootWindow()); 649 ash::Shell::GetTargetRootWindow());
649 gfx::Rect window_bounds; 650 gfx::Rect window_bounds;
650 GetWindowBounds(p1600x1200, p1600x1200, secondary_bounds, gfx::Rect(), 651 GetWindowBounds(p1600x1200, p1600x1200, secondary_bounds, gfx::Rect(),
651 secondary_bounds, PERSISTED, new_browser.get(), gfx::Rect(), 652 secondary_bounds, PERSISTED, new_browser.get(), gfx::Rect(),
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 } 822 }
822 823
823 TEST_F(WindowSizerAshTest, DefaultStateBecomesMaximized) { 824 TEST_F(WindowSizerAshTest, DefaultStateBecomesMaximized) {
824 // Create a browser to pass into the GetWindowBounds function. 825 // Create a browser to pass into the GetWindowBounds function.
825 scoped_ptr<TestingProfile> profile(new TestingProfile()); 826 scoped_ptr<TestingProfile> profile(new TestingProfile());
826 Browser::CreateParams native_params(profile.get(), 827 Browser::CreateParams native_params(profile.get(),
827 chrome::HOST_DESKTOP_TYPE_ASH); 828 chrome::HOST_DESKTOP_TYPE_ASH);
828 scoped_ptr<Browser> browser( 829 scoped_ptr<Browser> browser(
829 chrome::CreateBrowserWithTestWindowForParams(&native_params)); 830 chrome::CreateBrowserWithTestWindowForParams(&native_params));
830 831
831 gfx::Rect display_bounds = ash::Shell::GetInstance()->GetScreen()-> 832 gfx::Rect display_bounds =
832 GetPrimaryDisplay().bounds(); 833 gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds();
833 gfx::Rect specified_bounds = display_bounds; 834 gfx::Rect specified_bounds = display_bounds;
834 835
835 // Make a window bigger than the display work area. 836 // Make a window bigger than the display work area.
836 specified_bounds.Inset(-20, -20); 837 specified_bounds.Inset(-20, -20);
837 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; 838 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT;
838 gfx::Rect bounds; 839 gfx::Rect bounds;
839 WindowSizer::GetBrowserWindowBoundsAndShowState( 840 WindowSizer::GetBrowserWindowBoundsAndShowState(
840 std::string(), specified_bounds, browser.get(), &bounds, &show_state); 841 std::string(), specified_bounds, browser.get(), &bounds, &show_state);
841 // The window should start maximized with its restore bounds shrunken. 842 // The window should start maximized with its restore bounds shrunken.
842 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, show_state); 843 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, show_state);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 EXPECT_EQ( 906 EXPECT_EQ(
906 ui::SHOW_STATE_DEFAULT, 907 ui::SHOW_STATE_DEFAULT,
907 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, 908 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH,
908 trusted_popup.get(), p1280x1024, p1600x1200)); 909 trusted_popup.get(), p1280x1024, p1600x1200));
909 // A popup that is sized to occupy the whole work area has default state. 910 // A popup that is sized to occupy the whole work area has default state.
910 EXPECT_EQ( 911 EXPECT_EQ(
911 ui::SHOW_STATE_DEFAULT, 912 ui::SHOW_STATE_DEFAULT,
912 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, 913 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH,
913 trusted_popup.get(), p1600x1200, p1600x1200)); 914 trusted_popup.get(), p1600x1200, p1600x1200));
914 } 915 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698