Regression: Search+Key pops up app launcher
[chromium-blink-merge.git] / ash / accelerators / accelerator_commands_unittest.cc
blob3bc1ece05e2cda21a41dfe2de038deee205c6861
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/accelerators/accelerator_commands.h"
7 #include "ash/test/ash_test_base.h"
8 #include "ash/wm/window_state.h"
9 #include "ui/aura/window.h"
11 // Note: The unit tests for |ToggleMaximized()| and
12 // |ToggleFullscreen()| are in
13 // chrome/browser/ui/ash/accelerator_commands_browsertests.cc.
14 // because they depends on chrome implementation of
15 // |ash::wm::WindowStateDelegate|.
17 namespace ash {
18 namespace accelerators {
20 typedef test::AshTestBase AcceleratorCommandsTest;
22 TEST_F(AcceleratorCommandsTest, ToggleMinimized) {
23 scoped_ptr<aura::Window> window1(
24 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
25 scoped_ptr<aura::Window> window2(
26 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
27 wm::WindowState* window_state1 = wm::GetWindowState(window1.get());
28 wm::WindowState* window_state2 = wm::GetWindowState(window2.get());
29 window_state1->Activate();
30 window_state2->Activate();
32 ToggleMinimized();
33 EXPECT_TRUE(window_state2->IsMinimized());
34 EXPECT_FALSE(window_state2->IsNormalStateType());
35 EXPECT_TRUE(window_state1->IsActive());
37 ToggleMinimized();
38 EXPECT_TRUE(window_state1->IsMinimized());
39 EXPECT_FALSE(window_state1->IsNormalStateType());
40 EXPECT_FALSE(window_state1->IsActive());
42 // Toggling minimize when there are no active windows should unminimize and
43 // activate the last active window.
44 ToggleMinimized();
45 EXPECT_FALSE(window_state1->IsMinimized());
46 EXPECT_TRUE(window_state1->IsNormalStateType());
47 EXPECT_TRUE(window_state1->IsActive());
50 } // namespace accelerators
51 } // namespace ash