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

Side by Side Diff: chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: feedback Created 3 years, 8 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_root_window_for_new_windows.h" 5 #include "ash/scoped_root_window_for_new_windows.h"
6 #include "ash/shell.h" 6 #include "ash/shell.h"
7 #include "ash/shell_port.h"
7 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
8 #include "ash/wm/window_positioner.h" 9 #include "ash/wm/window_positioner.h"
9 #include "ash/wm/window_resizer.h" 10 #include "ash/wm/window_resizer.h"
10 #include "ash/wm/window_state.h" 11 #include "ash/wm/window_state.h"
11 #include "ash/wm/window_state_aura.h" 12 #include "ash/wm/window_state_aura.h"
12 #include "ash/wm_shell.h"
13 #include "ash/wm_window.h" 13 #include "ash/wm_window.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/browser/ui/ash/ash_util.h" 16 #include "chrome/browser/ui/ash/ash_util.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" 18 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/test/base/test_browser_window_aura.h" 20 #include "chrome/test/base/test_browser_window_aura.h"
21 #include "chrome/test/base/testing_profile.h" 21 #include "chrome/test/base/testing_profile.h"
22 #include "content/public/test/render_view_test.h" 22 #include "content/public/test/render_view_test.h"
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 // Test that the target root window is used as the destination of 817 // Test that the target root window is used as the destination of
818 // the non browser window. This differ from PersistedBoundsCase 818 // the non browser window. This differ from PersistedBoundsCase
819 // in that this uses real ash shell implementations + StateProvider 819 // in that this uses real ash shell implementations + StateProvider
820 // TargetDisplayProvider, rather than mocks. 820 // TargetDisplayProvider, rather than mocks.
821 TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) { 821 TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) {
822 if (!ash_util::ShouldOpenAshOnStartup()) 822 if (!ash_util::ShouldOpenAshOnStartup())
823 return; 823 return;
824 UpdateDisplay("500x500,600x600"); 824 UpdateDisplay("500x500,600x600");
825 825
826 // By default windows are placed on the primary display. 826 // By default windows are placed on the primary display.
827 ash::WmWindow* first_root = ash::WmShell::Get()->GetAllRootWindows()[0]; 827 ash::WmWindow* first_root = ash::ShellPort::Get()->GetAllRootWindows()[0];
828 EXPECT_EQ(first_root, ash::Shell::GetWmRootWindowForNewWindows()); 828 EXPECT_EQ(first_root, ash::Shell::GetWmRootWindowForNewWindows());
829 gfx::Rect bounds; 829 gfx::Rect bounds;
830 ui::WindowShowState show_state; 830 ui::WindowShowState show_state;
831 WindowSizer::GetBrowserWindowBoundsAndShowState(std::string(), gfx::Rect(), 831 WindowSizer::GetBrowserWindowBoundsAndShowState(std::string(), gfx::Rect(),
832 NULL, &bounds, &show_state); 832 NULL, &bounds, &show_state);
833 EXPECT_TRUE(first_root->GetBoundsInScreen().Contains(bounds)); 833 EXPECT_TRUE(first_root->GetBoundsInScreen().Contains(bounds));
834 834
835 { 835 {
836 // When the second display is active new windows are placed there. 836 // When the second display is active new windows are placed there.
837 ash::WmWindow* second_root = ash::WmShell::Get()->GetAllRootWindows()[1]; 837 ash::WmWindow* second_root = ash::ShellPort::Get()->GetAllRootWindows()[1];
838 ash::ScopedRootWindowForNewWindows tmp(second_root); 838 ash::ScopedRootWindowForNewWindows tmp(second_root);
839 gfx::Rect bounds; 839 gfx::Rect bounds;
840 ui::WindowShowState show_state; 840 ui::WindowShowState show_state;
841 WindowSizer::GetBrowserWindowBoundsAndShowState( 841 WindowSizer::GetBrowserWindowBoundsAndShowState(
842 std::string(), 842 std::string(),
843 gfx::Rect(), 843 gfx::Rect(),
844 NULL, 844 NULL,
845 &bounds, 845 &bounds,
846 &show_state); 846 &show_state);
847 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds)); 847 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds));
(...skipping 14 matching lines...) Expand all
862 EXPECT_EQ( 862 EXPECT_EQ(
863 ui::SHOW_STATE_DEFAULT, 863 ui::SHOW_STATE_DEFAULT,
864 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, 864 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH,
865 trusted_popup.get(), p1280x1024, p1600x1200)); 865 trusted_popup.get(), p1280x1024, p1600x1200));
866 // A popup that is sized to occupy the whole work area has default state. 866 // A popup that is sized to occupy the whole work area has default state.
867 EXPECT_EQ( 867 EXPECT_EQ(
868 ui::SHOW_STATE_DEFAULT, 868 ui::SHOW_STATE_DEFAULT,
869 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, 869 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH,
870 trusted_popup.get(), p1600x1200, p1600x1200)); 870 trusted_popup.get(), p1600x1200, p1600x1200));
871 } 871 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698