OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/accelerators/accelerator_commands.h" | 5 #include "ash/accelerators/accelerator_commands.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ash/common/wm/window_state.h" | 9 #include "ash/common/wm/window_state.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
11 #include "ash/wm/window_state_aura.h" | 11 #include "ash/wm/window_state_aura.h" |
| 12 #include "ash/wm/window_util.h" |
12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
13 | 14 |
14 // Note: The unit tests for |ToggleMaximized()| and | 15 // Note: The unit tests for |ToggleMaximized()| and |
15 // |ToggleFullscreen()| are in | 16 // |ToggleFullscreen()| are in |
16 // chrome/browser/ui/ash/accelerator_commands_browsertests.cc. | 17 // chrome/browser/ui/ash/accelerator_commands_browsertests.cc. |
17 // because they depends on chrome implementation of | 18 // because they depends on chrome implementation of |
18 // |ash::wm::WindowStateDelegate|. | 19 // |ash::wm::WindowStateDelegate|. |
19 | 20 |
20 namespace ash { | 21 namespace ash { |
21 namespace accelerators { | 22 namespace accelerators { |
(...skipping 21 matching lines...) Expand all Loading... |
43 EXPECT_FALSE(window_state1->IsActive()); | 44 EXPECT_FALSE(window_state1->IsActive()); |
44 | 45 |
45 // Toggling minimize when there are no active windows should unminimize and | 46 // Toggling minimize when there are no active windows should unminimize and |
46 // activate the last active window. | 47 // activate the last active window. |
47 ToggleMinimized(); | 48 ToggleMinimized(); |
48 EXPECT_FALSE(window_state1->IsMinimized()); | 49 EXPECT_FALSE(window_state1->IsMinimized()); |
49 EXPECT_TRUE(window_state1->IsNormalStateType()); | 50 EXPECT_TRUE(window_state1->IsNormalStateType()); |
50 EXPECT_TRUE(window_state1->IsActive()); | 51 EXPECT_TRUE(window_state1->IsActive()); |
51 } | 52 } |
52 | 53 |
| 54 TEST_F(AcceleratorCommandsTest, Unpin) { |
| 55 std::unique_ptr<aura::Window> window1( |
| 56 CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
| 57 wm::WindowState* window_state1 = wm::GetWindowState(window1.get()); |
| 58 window_state1->Activate(); |
| 59 |
| 60 wm::PinWindow(window1.get()); |
| 61 EXPECT_TRUE(window_state1->IsPinned()); |
| 62 |
| 63 Unpin(); |
| 64 EXPECT_FALSE(window_state1->IsPinned()); |
| 65 } |
| 66 |
53 } // namespace accelerators | 67 } // namespace accelerators |
54 } // namespace ash | 68 } // namespace ash |
OLD | NEW |