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/common/wm/mru_window_tracker.h" | 5 #include "ash/common/wm/mru_window_tracker.h" |
6 | 6 |
7 #include "ash/common/test/ash_test.h" | 7 #include "ash/common/test/ash_test.h" |
8 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
9 #include "ash/common/wm_shell.h" | 9 #include "ash/common/wm_shell.h" |
10 #include "ash/common/wm_window.h" | 10 #include "ash/common/wm_window.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Tests that windows being dragged are only in the WindowList once. | 94 // Tests that windows being dragged are only in the WindowList once. |
95 TEST_F(MruWindowTrackerTest, DraggedWindowsInListOnlyOnce) { | 95 TEST_F(MruWindowTrackerTest, DraggedWindowsInListOnlyOnce) { |
96 std::unique_ptr<WindowOwner> w1_owner(CreateTestWindow()); | 96 std::unique_ptr<WindowOwner> w1_owner(CreateTestWindow()); |
97 WmWindow* w1 = w1_owner->window(); | 97 WmWindow* w1 = w1_owner->window(); |
98 w1->Activate(); | 98 w1->Activate(); |
99 | 99 |
100 // Start dragging the window. | 100 // Start dragging the window. |
101 w1->GetWindowState()->CreateDragDetails( | 101 w1->GetWindowState()->CreateDragDetails( |
102 gfx::Point(), HTRIGHT, aura::client::WINDOW_MOVE_SOURCE_TOUCH); | 102 gfx::Point(), HTRIGHT, aura::client::WINDOW_MOVE_SOURCE_TOUCH); |
103 | 103 |
104 // During a drag the window is reparented by the Docked container. | |
105 WmWindow* drag_container = w1->GetRootWindow()->GetChildByShellWindowId( | |
106 kShellWindowId_DockedContainer); | |
107 drag_container->AddChild(w1); | |
108 EXPECT_TRUE(w1->GetWindowState()->is_dragged()); | |
109 | |
110 // The dragged window should only be in the list once. | 104 // The dragged window should only be in the list once. |
111 WmWindow::Windows window_list = | 105 WmWindow::Windows window_list = |
112 mru_window_tracker()->BuildWindowListIgnoreModal(); | 106 mru_window_tracker()->BuildWindowListIgnoreModal(); |
113 EXPECT_EQ(1, std::count(window_list.begin(), window_list.end(), w1)); | 107 EXPECT_EQ(1, std::count(window_list.begin(), window_list.end(), w1)); |
114 } | 108 } |
115 | 109 |
116 } // namespace ash | 110 } // namespace ash |
OLD | NEW |