| OLD | NEW |
| 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/aura/scoped_root_window_for_new_windows_aura.h" |
| 5 #include "ash/common/wm/window_positioner.h" | 6 #include "ash/common/wm/window_positioner.h" |
| 6 #include "ash/common/wm/window_resizer.h" | 7 #include "ash/common/wm/window_resizer.h" |
| 7 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
| 8 #include "ash/scoped_target_root_window.h" | |
| 9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/wm/window_state_aura.h" | 12 #include "ash/wm/window_state_aura.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/ui/ash/ash_util.h" | 15 #include "chrome/browser/ui/ash/ash_util.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" | 17 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" |
| 18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 // the non browser window. This differ from PersistedBoundsCase | 817 // the non browser window. This differ from PersistedBoundsCase |
| 818 // in that this uses real ash shell implementations + StateProvider | 818 // in that this uses real ash shell implementations + StateProvider |
| 819 // TargetDisplayProvider, rather than mocks. | 819 // TargetDisplayProvider, rather than mocks. |
| 820 TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) { | 820 TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) { |
| 821 if (!SupportsMultipleDisplays() || !chrome::ShouldOpenAshOnStartup()) | 821 if (!SupportsMultipleDisplays() || !chrome::ShouldOpenAshOnStartup()) |
| 822 return; | 822 return; |
| 823 UpdateDisplay("500x500,600x600"); | 823 UpdateDisplay("500x500,600x600"); |
| 824 { | 824 { |
| 825 aura::Window* first_root = | 825 aura::Window* first_root = |
| 826 ash::Shell::GetAllRootWindows()[0]; | 826 ash::Shell::GetAllRootWindows()[0]; |
| 827 ash::ScopedTargetRootWindow tmp(first_root); | 827 ash::ScopedRootWindowForNewWindowsAura tmp(first_root); |
| 828 gfx::Rect bounds; | 828 gfx::Rect bounds; |
| 829 ui::WindowShowState show_state; | 829 ui::WindowShowState show_state; |
| 830 WindowSizer::GetBrowserWindowBoundsAndShowState( | 830 WindowSizer::GetBrowserWindowBoundsAndShowState( |
| 831 std::string(), | 831 std::string(), |
| 832 gfx::Rect(), | 832 gfx::Rect(), |
| 833 NULL, | 833 NULL, |
| 834 &bounds, | 834 &bounds, |
| 835 &show_state); | 835 &show_state); |
| 836 EXPECT_TRUE(first_root->GetBoundsInScreen().Contains(bounds)); | 836 EXPECT_TRUE(first_root->GetBoundsInScreen().Contains(bounds)); |
| 837 } | 837 } |
| 838 { | 838 { |
| 839 aura::Window* second_root = | 839 aura::Window* second_root = |
| 840 ash::Shell::GetAllRootWindows()[1]; | 840 ash::Shell::GetAllRootWindows()[1]; |
| 841 ash::ScopedTargetRootWindow tmp(second_root); | 841 ash::ScopedRootWindowForNewWindowsAura tmp(second_root); |
| 842 gfx::Rect bounds; | 842 gfx::Rect bounds; |
| 843 ui::WindowShowState show_state; | 843 ui::WindowShowState show_state; |
| 844 WindowSizer::GetBrowserWindowBoundsAndShowState( | 844 WindowSizer::GetBrowserWindowBoundsAndShowState( |
| 845 std::string(), | 845 std::string(), |
| 846 gfx::Rect(), | 846 gfx::Rect(), |
| 847 NULL, | 847 NULL, |
| 848 &bounds, | 848 &bounds, |
| 849 &show_state); | 849 &show_state); |
| 850 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds)); | 850 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds)); |
| 851 } | 851 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 865 EXPECT_EQ( | 865 EXPECT_EQ( |
| 866 ui::SHOW_STATE_DEFAULT, | 866 ui::SHOW_STATE_DEFAULT, |
| 867 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, | 867 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, |
| 868 trusted_popup.get(), p1280x1024, p1600x1200)); | 868 trusted_popup.get(), p1280x1024, p1600x1200)); |
| 869 // A popup that is sized to occupy the whole work area has default state. | 869 // A popup that is sized to occupy the whole work area has default state. |
| 870 EXPECT_EQ( | 870 EXPECT_EQ( |
| 871 ui::SHOW_STATE_DEFAULT, | 871 ui::SHOW_STATE_DEFAULT, |
| 872 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, | 872 GetWindowShowState(ui::SHOW_STATE_DEFAULT, ui::SHOW_STATE_NORMAL, BOTH, |
| 873 trusted_popup.get(), p1600x1200, p1600x1200)); | 873 trusted_popup.get(), p1600x1200, p1600x1200)); |
| 874 } | 874 } |
| OLD | NEW |