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

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

Issue 424463002: Makes a window that has been resized to maximized bounds, then maximized and then restored shrink (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Maximizes a window that has been resized to maximized bounds (comments and restrict to ash) Created 6 years, 4 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 | Annotate | Revision Log
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_target_root_window.h" 5 #include "ash/scoped_target_root_window.h"
6 #include "ash/screen_util.h" 6 #include "ash/screen_util.h"
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_positioner.h" 10 #include "ash/wm/window_positioner.h"
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 p1600x1200), ui::SHOW_STATE_MAXIMIZED); 884 p1600x1200), ui::SHOW_STATE_MAXIMIZED);
885 885
886 // The popup should favor the initial show state over the command line. 886 // The popup should favor the initial show state over the command line.
887 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL, 887 EXPECT_EQ(GetWindowShowState(ui::SHOW_STATE_NORMAL,
888 ui::SHOW_STATE_NORMAL, 888 ui::SHOW_STATE_NORMAL,
889 BOTH, 889 BOTH,
890 browser_popup->browser(), 890 browser_popup->browser(),
891 p1600x1200), ui::SHOW_STATE_NORMAL); 891 p1600x1200), ui::SHOW_STATE_NORMAL);
892 } 892 }
893 893
894 // Test that the target root window is used as the destionation of 894 TEST_F(WindowSizerAshTest, DefaultStateBecomesMaximized) {
895 // Create a browser which we can use to pass into the GetWindowBounds
896 // function.
897 scoped_ptr<TestingProfile> profile(new TestingProfile());
898 Browser::CreateParams native_params(profile.get(),
899 chrome::HOST_DESKTOP_TYPE_ASH);
900 scoped_ptr<Browser> browser(
901 chrome::CreateBrowserWithTestWindowForParams(&native_params));
902
903 gfx::Rect display_bounds = ash::Shell::GetInstance()->GetScreen()->
904 GetPrimaryDisplay().bounds();
905 gfx::Rect specified_bounds = display_bounds;
906
907 // Make a window bigger than the display work area.
908 specified_bounds.Inset(-20, -20);
909 ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT;
910 gfx::Rect bounds;
911 WindowSizer::GetBrowserWindowBoundsAndShowState(
912 std::string(), specified_bounds, browser.get(), &bounds, &show_state);
913 // The window should start maximized with its restore bounds shrunken.
914 EXPECT_EQ(ui::SHOW_STATE_MAXIMIZED, show_state);
915 EXPECT_NE(display_bounds.ToString(), bounds.ToString());
916 EXPECT_TRUE(display_bounds.Contains(bounds));
917
918 // Make a window smaller than the display work area.
919 specified_bounds.Inset(100, 100);
920 show_state = ui::SHOW_STATE_DEFAULT;
921 WindowSizer::GetBrowserWindowBoundsAndShowState(
922 std::string(), specified_bounds, browser.get(), &bounds, &show_state);
923 // The window should start in default state.
924 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, show_state);
925 EXPECT_EQ(specified_bounds.ToString(), bounds.ToString());
926 }
927
928 // Test that the target root window is used as the destination of
895 // the non browser window. This differ from PersistedBoundsCase 929 // the non browser window. This differ from PersistedBoundsCase
896 // in that this uses real ash shell implementations + StateProvider 930 // in that this uses real ash shell implementations + StateProvider
897 // TargetDisplayProvider, rather than mocks. 931 // TargetDisplayProvider, rather than mocks.
898 TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) { 932 TEST_F(WindowSizerAshTest, DefaultBoundsInTargetDisplay) {
899 if (!SupportsMultipleDisplays() || !chrome::ShouldOpenAshOnStartup()) 933 if (!SupportsMultipleDisplays() || !chrome::ShouldOpenAshOnStartup())
900 return; 934 return;
901 UpdateDisplay("500x500,600x600"); 935 UpdateDisplay("500x500,600x600");
902 { 936 {
903 aura::Window* first_root = 937 aura::Window* first_root =
904 ash::Shell::GetAllRootWindows()[0]; 938 ash::Shell::GetAllRootWindows()[0];
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 trusted_popup_create_params)); 975 trusted_popup_create_params));
942 // Trusted popup windows should follow the saved show state and ignore the 976 // Trusted popup windows should follow the saved show state and ignore the
943 // last show state. 977 // last show state.
944 EXPECT_EQ(ui::SHOW_STATE_DEFAULT, 978 EXPECT_EQ(ui::SHOW_STATE_DEFAULT,
945 GetWindowShowState(ui::SHOW_STATE_DEFAULT, 979 GetWindowShowState(ui::SHOW_STATE_DEFAULT,
946 ui::SHOW_STATE_NORMAL, 980 ui::SHOW_STATE_NORMAL,
947 BOTH, 981 BOTH,
948 trusted_popup->browser(), 982 trusted_popup->browser(),
949 p1600x1200)); 983 p1600x1200));
950 } 984 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698