| 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/scoped_target_root_window.h" |
| 5 #include "ash/screen_ash.h" | 6 #include "ash/screen_ash.h" |
| 6 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 7 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 8 #include "ash/test/test_shell_delegate.h" | 9 #include "ash/test/test_shell_delegate.h" |
| 9 #include "ash/wm/window_positioner.h" | 10 #include "ash/wm/window_positioner.h" |
| 10 #include "ash/wm/window_resizer.h" | 11 #include "ash/wm/window_resizer.h" |
| 11 #include "ash/wm/window_state.h" | 12 #include "ash/wm/window_state.h" |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" | 15 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 browser_window->browser(), | 849 browser_window->browser(), |
| 849 p1600x1200), ui::SHOW_STATE_MAXIMIZED); | 850 p1600x1200), ui::SHOW_STATE_MAXIMIZED); |
| 850 | 851 |
| 851 // The popup should favor the initial show state over the command line. | 852 // The popup should favor the initial show state over the command line. |
| 852 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, | 853 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, |
| 853 ui::SHOW_STATE_NORMAL, | 854 ui::SHOW_STATE_NORMAL, |
| 854 BOTH, | 855 BOTH, |
| 855 browser_popup->browser(), | 856 browser_popup->browser(), |
| 856 p1600x1200), ui::SHOW_STATE_NORMAL); | 857 p1600x1200), ui::SHOW_STATE_NORMAL); |
| 857 } | 858 } |
| 859 |
| 860 // Test that the target root window is used as the destionation of |
| 861 // the non browser window. This differ from PersistedBoundsCase |
| 862 // in that this uses real ash shell implementations + StateProvider |
| 863 // TargetDisplayProvider, rather than mocks. |
| 864 TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) { |
| 865 if (!SupportsMultipleDisplays()) |
| 866 return; |
| 867 UpdateDisplay("500x500,600x600"); |
| 868 { |
| 869 aura::Window* first_root = |
| 870 ash::Shell::GetAllRootWindows()[0]; |
| 871 ash::internal::ScopedTargetRootWindow tmp( |
| 872 first_root); |
| 873 gfx::Rect bounds; |
| 874 ui::WindowShowState show_state; |
| 875 WindowSizer::GetBrowserWindowBoundsAndShowState( |
| 876 std::string(), |
| 877 gfx::Rect(), |
| 878 NULL, |
| 879 &bounds, |
| 880 &show_state); |
| 881 EXPECT_TRUE(first_root->GetBoundsInScreen().Contains(bounds)); |
| 882 } |
| 883 { |
| 884 aura::Window* second_root = |
| 885 ash::Shell::GetAllRootWindows()[1]; |
| 886 ash::internal::ScopedTargetRootWindow tmp( |
| 887 second_root); |
| 888 gfx::Rect bounds; |
| 889 ui::WindowShowState show_state; |
| 890 WindowSizer::GetBrowserWindowBoundsAndShowState( |
| 891 std::string(), |
| 892 gfx::Rect(), |
| 893 NULL, |
| 894 &bounds, |
| 895 &show_state); |
| 896 EXPECT_TRUE(second_root->GetBoundsInScreen().Contains(bounds)); |
| 897 } |
| 898 } |
| OLD | NEW |