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