diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-13 22:57:36 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-13 22:57:36 +0000 |
commit | d18357abad439f887cf3507b009146d1593008cf (patch) | |
tree | 01ec1166f64dd8b024b7cdcb79dc95aa73de19b7 /ash/shell_unittest.cc | |
parent | 42304ce243714c404622600abfb61a71db02f3d8 (diff) | |
download | chromium_src-d18357abad439f887cf3507b009146d1593008cf.zip chromium_src-d18357abad439f887cf3507b009146d1593008cf.tar.gz chromium_src-d18357abad439f887cf3507b009146d1593008cf.tar.bz2 |
Aura: Put resolution-based window mode switching behind a flag.
Putting this behind --aura-dynamic-window-mode until we're sure we need it. Reverted default window mode to overlapping, unless --aura-force-window-mode-compact is specified. This simplifies unit test setup, as the tests assume overlapping mode. I made the new flag set a bool so I can write unit tests without modifying CommandLine::ForCurrentProcess().
BUG=114018
TEST=aura_shell_unittests updated
Review URL: https://chromiumcodereview.appspot.com/9388013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121752 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shell_unittest.cc')
-rw-r--r-- | ash/shell_unittest.cc | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 87a3edf..a49f27dd 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -286,40 +286,46 @@ TEST_F(ShellTest, IsScreenLocked) { } TEST_F(ShellTest, ComputeWindowMode) { - // Since we're testing window mode computations, don't force overlapping. - ash::Shell::set_window_mode_overlapping_for_test(false); - - // Wide screens use normal window mode. + // By default, we use overlapping mode for large screens. Shell* shell = Shell::GetInstance(); gfx::Size monitor_size(1440, 900); - CommandLine command_line(CommandLine::NO_PROGRAM); + CommandLine command_line_blank(CommandLine::NO_PROGRAM); + EXPECT_EQ(Shell::MODE_OVERLAPPING, + shell->ComputeWindowMode(monitor_size, &command_line_blank)); + + // By default, we use overlapping mode for small screens too. + monitor_size.SetSize(800, 600); EXPECT_EQ(Shell::MODE_OVERLAPPING, - shell->ComputeWindowMode(monitor_size, &command_line)); + shell->ComputeWindowMode(monitor_size, &command_line_blank)); - // Alex-sized screens need compact mode. + // Even for a large screen, the user can force compact mode. + monitor_size.SetSize(1920, 1080); + CommandLine command_line_compact(CommandLine::NO_PROGRAM); + command_line_compact.AppendSwitchASCII(switches::kAuraWindowMode, + switches::kAuraWindowModeCompact); + EXPECT_EQ(Shell::MODE_COMPACT, + shell->ComputeWindowMode(monitor_size, &command_line_compact)); + + // Now test dynamic window mode computation. + Shell::GetInstance()->set_dynamic_window_mode(true); + + // Alex-sized screens need compact mode when choosing dynamically. monitor_size.SetSize(1280, 800); EXPECT_EQ(Shell::MODE_COMPACT, - shell->ComputeWindowMode(monitor_size, &command_line)); + shell->ComputeWindowMode(monitor_size, &command_line_blank)); - // ZGB-sized screens need compact mode. + // ZGB-sized screens need compact mode when choosing dynamically. monitor_size.SetSize(1366, 768); EXPECT_EQ(Shell::MODE_COMPACT, - shell->ComputeWindowMode(monitor_size, &command_line)); + shell->ComputeWindowMode(monitor_size, &command_line_blank)); // Even for a small screen, the user can force overlapping mode. monitor_size.SetSize(800, 600); - command_line.AppendSwitchASCII(ash::switches::kAuraWindowMode, - ash::switches::kAuraWindowModeOverlapping); + CommandLine command_line_force(CommandLine::NO_PROGRAM); + command_line_force.AppendSwitchASCII(switches::kAuraWindowMode, + switches::kAuraWindowModeOverlapping); EXPECT_EQ(Shell::MODE_OVERLAPPING, - shell->ComputeWindowMode(monitor_size, &command_line)); - - // Even for a large screen, the user can force compact mode. - monitor_size.SetSize(1920, 1080); - CommandLine command_line2(CommandLine::NO_PROGRAM); - command_line2.AppendSwitchASCII(ash::switches::kAuraWindowMode, - ash::switches::kAuraWindowModeCompact); - EXPECT_EQ(Shell::MODE_COMPACT, - shell->ComputeWindowMode(monitor_size, &command_line2)); + shell->ComputeWindowMode(monitor_size, &command_line_force)); } // Fails on Mac only. Need to be corrected. http://crbug.com/111279. @@ -397,8 +403,8 @@ TEST_F(ShellTest, MAYBE_ChangeWindowMode) { // only relevant on Chrome OS devices. #if defined(OS_CHROMEOS) TEST_F(ShellTest, ResizeRootWindow) { - // Since we're testing window mode computations, don't force overlapping. - ash::Shell::set_window_mode_overlapping_for_test(false); + // Allow dynamic window mode switching. + Shell::GetInstance()->set_dynamic_window_mode(true); // Switching to a small screen enables compact window mode. RootWindow::GetInstance()->SetHostSize(gfx::Size(1024, 768)); |