| 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 "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" | 5 #include "chrome/browser/ui/window_sizer/window_sizer_common_unittest.h" |
| 6 | 6 |
| 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_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 // Non tabbed windows should always follow the window saved visibility state. | 736 // Non tabbed windows should always follow the window saved visibility state. |
| 737 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, | 737 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, |
| 738 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, | 738 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, |
| 739 ui::SHOW_STATE_MINIMIZED, | 739 ui::SHOW_STATE_MINIMIZED, |
| 740 BOTH, | 740 BOTH, |
| 741 popup_browser.get(), | 741 popup_browser.get(), |
| 742 p1600x1200)); | 742 p1600x1200)); |
| 743 | 743 |
| 744 // In smaller screen resolutions we default to maximized if there is no other | 744 // In smaller screen resolutions we default to maximized if there is no other |
| 745 // window visible. | 745 // window visible. |
| 746 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, | 746 int min_size = WindowSizer::GetForceMaximizedWidthLimit() / 2; |
| 747 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, | 747 if (min_size > 0) { |
| 748 ui::SHOW_STATE_DEFAULT, | 748 const gfx::Rect tiny_screen(0, 0, min_size, min_size); |
| 749 BOTH, | 749 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, |
| 750 browser2.get(), | 750 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, |
| 751 p1024x768)); | 751 ui::SHOW_STATE_DEFAULT, |
| 752 window->Hide(); | 752 BOTH, |
| 753 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, | 753 browser2.get(), |
| 754 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, | 754 tiny_screen)); |
| 755 ui::SHOW_STATE_DEFAULT, | 755 window->Hide(); |
| 756 BOTH, | 756 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, |
| 757 browser2.get(), | 757 GetWindowShowState(ui::SHOW_STATE_MAXIMIZED, |
| 758 p1024x768)); | 758 ui::SHOW_STATE_DEFAULT, |
| 759 BOTH, |
| 760 browser2.get(), |
| 761 tiny_screen)); |
| 762 |
| 763 } |
| 759 } | 764 } |
| 760 | 765 |
| 761 // Test that the default show state override behavior is properly handled. | 766 // Test that the default show state override behavior is properly handled. |
| 762 TEST_F(WindowSizerTestWithBrowser, TestShowStateDefaults) { | 767 TEST_F(WindowSizerTestWithBrowser, TestShowStateDefaults) { |
| 763 // Creating a browser & window to play with. | 768 // Creating a browser & window to play with. |
| 764 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); | 769 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
| 765 window->SetBounds(gfx::Rect(16, 32, 640, 320)); | 770 window->SetBounds(gfx::Rect(16, 32, 640, 320)); |
| 766 | 771 |
| 767 scoped_ptr<TestingProfile> profile(new TestingProfile()); | 772 scoped_ptr<TestingProfile> profile(new TestingProfile()); |
| 768 | 773 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 browser.get(), | 825 browser.get(), |
| 821 p1600x1200), ui::SHOW_STATE_MAXIMIZED); | 826 p1600x1200), ui::SHOW_STATE_MAXIMIZED); |
| 822 | 827 |
| 823 // The popup should favor the initial show state over the command line. | 828 // The popup should favor the initial show state over the command line. |
| 824 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, | 829 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, |
| 825 ui::SHOW_STATE_NORMAL, | 830 ui::SHOW_STATE_NORMAL, |
| 826 BOTH, | 831 BOTH, |
| 827 popup_browser.get(), | 832 popup_browser.get(), |
| 828 p1600x1200), ui::SHOW_STATE_NORMAL); | 833 p1600x1200), ui::SHOW_STATE_NORMAL); |
| 829 } | 834 } |
| OLD | NEW |