Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: ash/wm/mru_window_tracker_unittest.cc

Issue 2258703002: Don't treat minimized windows as lower priority in MRU list (for Alt+Tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix mash Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/mus/wm/mru_window_tracker_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/aura/wm_window_aura.h" 7 #include "ash/aura/wm_window_aura.h"
8 #include "ash/common/shell_window_ids.h" 8 #include "ash/common/shell_window_ids.h"
9 #include "ash/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 wm::ActivateWindow(w2.get()); 44 wm::ActivateWindow(w2.get());
45 wm::ActivateWindow(w1.get()); 45 wm::ActivateWindow(w1.get());
46 46
47 aura::Window::Windows window_list = 47 aura::Window::Windows window_list =
48 WmWindowAura::ToAuraWindows(mru_window_tracker()->BuildMruWindowList()); 48 WmWindowAura::ToAuraWindows(mru_window_tracker()->BuildMruWindowList());
49 EXPECT_EQ(w1.get(), window_list[0]); 49 EXPECT_EQ(w1.get(), window_list[0]);
50 EXPECT_EQ(w2.get(), window_list[1]); 50 EXPECT_EQ(w2.get(), window_list[1]);
51 EXPECT_EQ(w3.get(), window_list[2]); 51 EXPECT_EQ(w3.get(), window_list[2]);
52 } 52 }
53 53
54 // Test that minimized windows are considered least recently used (but kept in 54 // Test that minimized windows are not treated specially.
55 // correct relative order).
56 TEST_F(MruWindowTrackerTest, MinimizedWindowsAreLru) { 55 TEST_F(MruWindowTrackerTest, MinimizedWindowsAreLru) {
57 std::unique_ptr<aura::Window> w1(CreateWindow()); 56 std::unique_ptr<aura::Window> w1(CreateWindow());
58 std::unique_ptr<aura::Window> w2(CreateWindow()); 57 std::unique_ptr<aura::Window> w2(CreateWindow());
59 std::unique_ptr<aura::Window> w3(CreateWindow()); 58 std::unique_ptr<aura::Window> w3(CreateWindow());
60 std::unique_ptr<aura::Window> w4(CreateWindow()); 59 std::unique_ptr<aura::Window> w4(CreateWindow());
61 std::unique_ptr<aura::Window> w5(CreateWindow()); 60 std::unique_ptr<aura::Window> w5(CreateWindow());
62 std::unique_ptr<aura::Window> w6(CreateWindow()); 61 std::unique_ptr<aura::Window> w6(CreateWindow());
63 wm::ActivateWindow(w6.get()); 62 wm::ActivateWindow(w6.get());
64 wm::ActivateWindow(w5.get()); 63 wm::ActivateWindow(w5.get());
65 wm::ActivateWindow(w4.get()); 64 wm::ActivateWindow(w4.get());
66 wm::ActivateWindow(w3.get()); 65 wm::ActivateWindow(w3.get());
67 wm::ActivateWindow(w2.get()); 66 wm::ActivateWindow(w2.get());
68 wm::ActivateWindow(w1.get()); 67 wm::ActivateWindow(w1.get());
69 68
70 wm::GetWindowState(w1.get())->Minimize(); 69 wm::GetWindowState(w1.get())->Minimize();
71 wm::GetWindowState(w4.get())->Minimize(); 70 wm::GetWindowState(w4.get())->Minimize();
72 wm::GetWindowState(w5.get())->Minimize(); 71 wm::GetWindowState(w5.get())->Minimize();
73 72
74 // Expect the relative order of minimized windows to remain the same, but all 73 // By minimizing the first window, we activate w2 which will move it to the
75 // minimized windows to be at the end of the list. 74 // front of the MRU queue.
75 EXPECT_TRUE(wm::GetWindowState(w2.get())->IsActive());
76
76 aura::Window::Windows window_list = 77 aura::Window::Windows window_list =
77 WmWindowAura::ToAuraWindows(mru_window_tracker()->BuildMruWindowList()); 78 WmWindowAura::ToAuraWindows(mru_window_tracker()->BuildMruWindowList());
78 EXPECT_EQ(w2.get(), window_list[0]); 79 EXPECT_EQ(w2.get(), window_list[0]);
79 EXPECT_EQ(w3.get(), window_list[1]); 80 EXPECT_EQ(w1.get(), window_list[1]);
80 EXPECT_EQ(w6.get(), window_list[2]); 81 EXPECT_EQ(w3.get(), window_list[2]);
81 EXPECT_EQ(w1.get(), window_list[3]); 82 EXPECT_EQ(w4.get(), window_list[3]);
82 EXPECT_EQ(w4.get(), window_list[4]); 83 EXPECT_EQ(w5.get(), window_list[4]);
83 EXPECT_EQ(w5.get(), window_list[5]); 84 EXPECT_EQ(w6.get(), window_list[5]);
84 } 85 }
85 86
86 // Tests that windows being dragged are only in the WindowList once. 87 // Tests that windows being dragged are only in the WindowList once.
87 TEST_F(MruWindowTrackerTest, DraggedWindowsInListOnlyOnce) { 88 TEST_F(MruWindowTrackerTest, DraggedWindowsInListOnlyOnce) {
88 std::unique_ptr<aura::Window> w1(CreateWindow()); 89 std::unique_ptr<aura::Window> w1(CreateWindow());
89 wm::ActivateWindow(w1.get()); 90 wm::ActivateWindow(w1.get());
90 91
91 // Start dragging the window. 92 // Start dragging the window.
92 wm::GetWindowState(w1.get())->CreateDragDetails( 93 wm::GetWindowState(w1.get())->CreateDragDetails(
93 gfx::Point(), HTRIGHT, aura::client::WINDOW_MOVE_SOURCE_TOUCH); 94 gfx::Point(), HTRIGHT, aura::client::WINDOW_MOVE_SOURCE_TOUCH);
(...skipping 30 matching lines...) Expand all
124 WmWindowAura::ToAuraWindows(mru_window_tracker()->BuildMruWindowList()); 125 WmWindowAura::ToAuraWindows(mru_window_tracker()->BuildMruWindowList());
125 126
126 EXPECT_EQ(window_list.end(), 127 EXPECT_EQ(window_list.end(),
127 std::find(window_list.begin(), window_list.end(), w1.get())); 128 std::find(window_list.begin(), window_list.end(), w1.get()));
128 EXPECT_EQ(window_list.end(), 129 EXPECT_EQ(window_list.end(),
129 std::find(window_list.begin(), window_list.end(), w3.get())); 130 std::find(window_list.begin(), window_list.end(), w3.get()));
130 EXPECT_EQ(1u, window_list.size()); 131 EXPECT_EQ(1u, window_list.size());
131 } 132 }
132 133
133 } // namespace ash 134 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/wm/mru_window_tracker_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698