| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 kShellWindowId_DockedContainer); | 106 kShellWindowId_DockedContainer); |
| 107 drag_container->AddChild(w1); | 107 drag_container->AddChild(w1); |
| 108 EXPECT_TRUE(w1->GetWindowState()->is_dragged()); | 108 EXPECT_TRUE(w1->GetWindowState()->is_dragged()); |
| 109 | 109 |
| 110 // The dragged window should only be in the list once. | 110 // The dragged window should only be in the list once. |
| 111 WmWindow::Windows window_list = | 111 WmWindow::Windows window_list = |
| 112 mru_window_tracker()->BuildWindowListIgnoreModal(); | 112 mru_window_tracker()->BuildWindowListIgnoreModal(); |
| 113 EXPECT_EQ(1, std::count(window_list.begin(), window_list.end(), w1)); | 113 EXPECT_EQ(1, std::count(window_list.begin(), window_list.end(), w1)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Tests that windows with propery of |kExcludeFromMruKey|==true are not in the | |
| 117 // window list. | |
| 118 TEST_F(MruWindowTrackerTest, ExcludedFromMru) { | |
| 119 std::unique_ptr<WindowOwner> w1_owner(CreateTestWindow()); | |
| 120 WmWindow* w1 = w1_owner->window(); | |
| 121 std::unique_ptr<WindowOwner> w2_owner(CreateTestWindow()); | |
| 122 WmWindow* w2 = w2_owner->window(); | |
| 123 std::unique_ptr<WindowOwner> w3_owner(CreateTestWindow()); | |
| 124 WmWindow* w3 = w3_owner->window(); | |
| 125 | |
| 126 w1->GetWindowState()->SetExcludedFromMru(true); | |
| 127 w3->GetWindowState()->SetExcludedFromMru(true); | |
| 128 | |
| 129 w3->Activate(); | |
| 130 w2->Activate(); | |
| 131 w1->Activate(); | |
| 132 | |
| 133 // Expect the windows with |kExcludeFromMruKey| property being true are not | |
| 134 // in the list. | |
| 135 WmWindow::Windows window_list = mru_window_tracker()->BuildMruWindowList(); | |
| 136 | |
| 137 // As |w1| and |w3| are excluded from the list, only |w2| should be present. | |
| 138 ASSERT_EQ(1u, window_list.size()); | |
| 139 EXPECT_EQ(w2, window_list[0]); | |
| 140 } | |
| 141 | |
| 142 } // namespace ash | 116 } // namespace ash |
| OLD | NEW |