diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-05 02:10:16 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-05 02:10:16 +0000 |
commit | 9c66adca4f62f3b85593068aea30cf1568690987 (patch) | |
tree | f20fc834b45b09babbfb19742b2c7b39b471e02f /ash/shell_unittest.cc | |
parent | fdf1c47e612fb821ed0336a07929514e7d2441a2 (diff) | |
download | chromium_src-9c66adca4f62f3b85593068aea30cf1568690987.zip chromium_src-9c66adca4f62f3b85593068aea30cf1568690987.tar.gz chromium_src-9c66adca4f62f3b85593068aea30cf1568690987.tar.bz2 |
Aura: Toggling window mode in about:flags works on CrOS devices
The problem was that programmatically modifying the command line doesn't change switches visible in about:flags -- they are in a special section. Reworked the code to:
* Not modify the command line when automatically setting the mode. We now store the mode in ash::Shell.
* Add an "automatic" option for window mode, equivalent to not specifying anything on the command line.
BUG=109002
TEST=aura_shell_unittests for Shell, manual on device modifying about:flags
Review URL: http://codereview.chromium.org/9093002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116438 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/shell_unittest.cc')
-rw-r--r-- | ash/shell_unittest.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 0871ee8..cab9f9f 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -264,7 +264,7 @@ TEST_F(ShellTest, IsScreenLocked) { EXPECT_FALSE(Shell::GetInstance()->IsScreenLocked()); } -TEST_F(ShellTest, DefaultToCompactWindowMode) { +TEST_F(ShellTest, ComputeWindowMode) { // We only change default window mode with full-screen host windows. AutoResetUseFullscreenHostWindow use_fullscreen_host_window(true); @@ -272,21 +272,33 @@ TEST_F(ShellTest, DefaultToCompactWindowMode) { Shell* shell = Shell::GetInstance(); gfx::Size monitor_size(1440, 900); CommandLine command_line(CommandLine::NO_PROGRAM); - EXPECT_FALSE(shell->DefaultToCompactWindowMode(monitor_size, &command_line)); + EXPECT_EQ(Shell::NORMAL_MODE, + shell->ComputeWindowMode(monitor_size, &command_line)); // Alex-sized screens need compact mode. monitor_size.SetSize(1280, 800); - EXPECT_TRUE(shell->DefaultToCompactWindowMode(monitor_size, &command_line)); + EXPECT_EQ(Shell::COMPACT_MODE, + shell->ComputeWindowMode(monitor_size, &command_line)); // ZGB-sized screens need compact mode. monitor_size.SetSize(1366, 768); - EXPECT_TRUE(shell->DefaultToCompactWindowMode(monitor_size, &command_line)); + EXPECT_EQ(Shell::COMPACT_MODE, + shell->ComputeWindowMode(monitor_size, &command_line)); // Even for a small screen, the user can force normal mode. monitor_size.SetSize(800, 600); command_line.AppendSwitchASCII(ash::switches::kAuraWindowMode, ash::switches::kAuraWindowModeNormal); - EXPECT_FALSE(shell->DefaultToCompactWindowMode(monitor_size, &command_line)); + EXPECT_EQ(Shell::NORMAL_MODE, + 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::COMPACT_MODE, + shell->ComputeWindowMode(monitor_size, &command_line2)); } } // namespace ash |