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/screen_ash.h" | 5 #include "ash/screen_ash.h" |
6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
8 #include "ash/test/test_shell_delegate.h" | 8 #include "ash/test/test_shell_delegate.h" |
9 #include "ash/wm/window_positioner.h" | 9 #include "ash/wm/window_positioner.h" |
10 #include "ash/wm/window_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 new TestBrowserWindowAura(window)); | 85 new TestBrowserWindowAura(window)); |
86 browser_window->CreateBrowser(params); | 86 browser_window->CreateBrowser(params); |
87 return browser_window.Pass(); | 87 return browser_window.Pass(); |
88 } | 88 } |
89 | 89 |
90 } // namespace | 90 } // namespace |
91 | 91 |
92 // Test that the window is sized appropriately for the first run experience | 92 // Test that the window is sized appropriately for the first run experience |
93 // where the default window bounds calculation is invoked. | 93 // where the default window bounds calculation is invoked. |
94 TEST_F(WindowSizerAshTest, DefaultSizeCase) { | 94 TEST_F(WindowSizerAshTest, DefaultSizeCase) { |
| 95 #if defined(OS_WIN) |
| 96 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kOpenAsh); |
| 97 #endif |
95 { // 4:3 monitor case, 1024x768, no taskbar | 98 { // 4:3 monitor case, 1024x768, no taskbar |
96 gfx::Rect window_bounds; | 99 gfx::Rect window_bounds; |
97 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), | 100 GetWindowBounds(p1024x768, p1024x768, gfx::Rect(), gfx::Rect(), |
98 gfx::Rect(), DEFAULT, NULL, gfx::Rect(), &window_bounds); | 101 gfx::Rect(), DEFAULT, NULL, gfx::Rect(), &window_bounds); |
99 EXPECT_EQ(gfx::Rect(ash::WindowPositioner::kDesktopBorderSize, | 102 EXPECT_EQ(gfx::Rect(ash::WindowPositioner::kDesktopBorderSize, |
100 ash::WindowPositioner::kDesktopBorderSize, | 103 ash::WindowPositioner::kDesktopBorderSize, |
101 1024 - ash::WindowPositioner::kDesktopBorderSize * 2, | 104 1024 - ash::WindowPositioner::kDesktopBorderSize * 2, |
102 768 - ash::WindowPositioner::kDesktopBorderSize), | 105 768 - ash::WindowPositioner::kDesktopBorderSize), |
103 window_bounds); | 106 window_bounds); |
104 } | 107 } |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 gfx::Rect(), // The second monitor. | 579 gfx::Rect(), // The second monitor. |
577 gfx::Rect(), // The (persisted) bounds. | 580 gfx::Rect(), // The (persisted) bounds. |
578 p1600x1200, // The overall work area. | 581 p1600x1200, // The overall work area. |
579 ui::SHOW_STATE_NORMAL, // The persisted show state. | 582 ui::SHOW_STATE_NORMAL, // The persisted show state. |
580 ui::SHOW_STATE_DEFAULT, // The last show state. | 583 ui::SHOW_STATE_DEFAULT, // The last show state. |
581 DEFAULT, // No persisted values. | 584 DEFAULT, // No persisted values. |
582 browser.get(), // Use this browser. | 585 browser.get(), // Use this browser. |
583 gfx::Rect(), // Don't request valid bounds. | 586 gfx::Rect(), // Don't request valid bounds. |
584 &window_bounds, | 587 &window_bounds, |
585 &out_show_state3); | 588 &out_show_state3); |
| 589 #if defined(OS_WIN) |
| 590 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, out_show_state3); |
| 591 #else |
586 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, out_show_state3); | 592 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, out_show_state3); |
| 593 #endif |
587 } | 594 } |
588 | 595 |
589 #if defined(OS_CHROMEOS) | 596 #if defined(OS_CHROMEOS) |
590 #define MAYBE_PlaceNewWindowsOnMultipleDisplays PlaceNewWindowsOnMultipleDisplay
s | 597 #define MAYBE_PlaceNewWindowsOnMultipleDisplays PlaceNewWindowsOnMultipleDisplay
s |
591 #else | 598 #else |
592 // No multiple displays on windows ash. | 599 // No multiple displays on windows ash. |
593 #define MAYBE_PlaceNewWindowsOnMultipleDisplays DISABLED_PlaceNewWindowsOnMultip
leDisplays | 600 #define MAYBE_PlaceNewWindowsOnMultipleDisplays DISABLED_PlaceNewWindowsOnMultip
leDisplays |
594 #endif | 601 #endif |
595 | 602 |
596 // Test the placement of newly created windows on multiple dislays. | 603 // Test the placement of newly created windows on multiple dislays. |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 | 798 |
792 // Create also a popup browser since that behaves slightly different for | 799 // Create also a popup browser since that behaves slightly different for |
793 // defaults. | 800 // defaults. |
794 scoped_ptr<TestBrowserWindowAura> browser_popup(CreateTestBrowserWindow( | 801 scoped_ptr<TestBrowserWindowAura> browser_popup(CreateTestBrowserWindow( |
795 CreateTestWindowInShellWithId(1), | 802 CreateTestWindowInShellWithId(1), |
796 gfx::Rect(16, 32, 128, 256), | 803 gfx::Rect(16, 32, 128, 256), |
797 Browser::CreateParams(Browser::TYPE_POPUP, profile.get(), | 804 Browser::CreateParams(Browser::TYPE_POPUP, profile.get(), |
798 chrome::HOST_DESKTOP_TYPE_ASH))); | 805 chrome::HOST_DESKTOP_TYPE_ASH))); |
799 | 806 |
800 // Check that a browser creation state always get used if not given as | 807 // Check that a browser creation state always get used if not given as |
801 // SHOW_STATE_DEFAULT. | 808 // SHOW_STATE_DEFAULT. On Windows ASH it should be SHOW_STATE_MAXIMIZED. |
802 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, | 809 ui::WindowShowState window_show_state = |
803 ui::SHOW_STATE_MAXIMIZED, | 810 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, |
804 DEFAULT, | 811 ui::SHOW_STATE_MAXIMIZED, |
805 browser_window->browser(), | 812 DEFAULT, |
806 p1600x1200), ui::SHOW_STATE_DEFAULT); | 813 browser_window->browser(), |
| 814 p1600x1200); |
| 815 #if defined(OS_WIN) |
| 816 EXPECT_EQ(window_show_state, ui::SHOW_STATE_MAXIMIZED); |
| 817 #else |
| 818 EXPECT_EQ(window_show_state, ui::SHOW_STATE_DEFAULT); |
| 819 #endif |
| 820 |
807 browser_window->browser()->set_initial_show_state(ui::SHOW_STATE_MINIMIZED); | 821 browser_window->browser()->set_initial_show_state(ui::SHOW_STATE_MINIMIZED); |
808 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, | 822 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, |
809 ui::SHOW_STATE_MAXIMIZED, | 823 ui::SHOW_STATE_MAXIMIZED, |
810 BOTH, | 824 BOTH, |
811 browser_window->browser(), | 825 browser_window->browser(), |
812 p1600x1200), ui::SHOW_STATE_MINIMIZED); | 826 p1600x1200), ui::SHOW_STATE_MINIMIZED); |
813 browser_window->browser()->set_initial_show_state(ui::SHOW_STATE_NORMAL); | 827 browser_window->browser()->set_initial_show_state(ui::SHOW_STATE_NORMAL); |
814 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, | 828 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, |
815 ui::SHOW_STATE_MAXIMIZED, | 829 ui::SHOW_STATE_MAXIMIZED, |
816 BOTH, | 830 BOTH, |
(...skipping 17 matching lines...) Expand all Loading... |
834 browser_window->browser(), | 848 browser_window->browser(), |
835 p1600x1200), ui::SHOW_STATE_MAXIMIZED); | 849 p1600x1200), ui::SHOW_STATE_MAXIMIZED); |
836 | 850 |
837 // The popup should favor the initial show state over the command line. | 851 // The popup should favor the initial show state over the command line. |
838 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, | 852 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, |
839 ui::SHOW_STATE_NORMAL, | 853 ui::SHOW_STATE_NORMAL, |
840 BOTH, | 854 BOTH, |
841 browser_popup->browser(), | 855 browser_popup->browser(), |
842 p1600x1200), ui::SHOW_STATE_NORMAL); | 856 p1600x1200), ui::SHOW_STATE_NORMAL); |
843 } | 857 } |
OLD | NEW |