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

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

Issue 2411913003: Converts ash/wm/mru_window_tracker_unittest.cc to use AshTest (Closed)
Patch Set: comment Created 4 years, 2 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/property_util.cc ('k') | ash/wm/mru_window_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/common/wm/mru_window_tracker.h"
6
7 #include "ash/common/shell_window_ids.h"
8 #include "ash/common/wm/window_state.h"
9 #include "ash/common/wm_shell.h"
10 #include "ash/mus/bridge/wm_window_mus.h"
11 #include "ash/mus/test/wm_test_base.h"
12 #include "ui/base/hit_test.h"
13
14 namespace ash {
15
16 class MruWindowTrackerTest : public mus::WmTestBase {
17 public:
18 MruWindowTrackerTest() {}
19 ~MruWindowTrackerTest() override {}
20
21 WmWindow* CreateTestWindow() {
22 return mus::WmWindowMus::Get(
23 mus::WmTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400)));
24 }
25
26 MruWindowTracker* mru_window_tracker() {
27 return WmShell::Get()->mru_window_tracker();
28 }
29
30 private:
31 DISALLOW_COPY_AND_ASSIGN(MruWindowTrackerTest);
32 };
33
34 // Basic test that the activation order is tracked.
35 TEST_F(MruWindowTrackerTest, Basic) {
36 WmWindow* w1 = CreateTestWindow();
37 WmWindow* w2 = CreateTestWindow();
38 WmWindow* w3 = CreateTestWindow();
39 w3->Activate();
40 w2->Activate();
41 w1->Activate();
42
43 WmWindow::Windows window_list = mru_window_tracker()->BuildMruWindowList();
44 EXPECT_EQ(w1, window_list[0]);
45 EXPECT_EQ(w2, window_list[1]);
46 EXPECT_EQ(w3, window_list[2]);
47 }
48
49 // Test that minimized windows are not treated specially.
50 TEST_F(MruWindowTrackerTest, MinimizedWindowsAreLru) {
51 WmWindow* w1 = CreateTestWindow();
52 WmWindow* w2 = CreateTestWindow();
53 WmWindow* w3 = CreateTestWindow();
54 WmWindow* w4 = CreateTestWindow();
55 WmWindow* w5 = CreateTestWindow();
56 WmWindow* w6 = CreateTestWindow();
57 w6->Activate();
58 w5->Activate();
59 w4->Activate();
60 w3->Activate();
61 w2->Activate();
62 w1->Activate();
63
64 w1->GetWindowState()->Minimize();
65 w4->GetWindowState()->Minimize();
66 w5->GetWindowState()->Minimize();
67
68 WmWindow::Windows window_list = mru_window_tracker()->BuildMruWindowList();
69 EXPECT_EQ(w1, window_list[0]);
70 EXPECT_EQ(w2, window_list[1]);
71 EXPECT_EQ(w3, window_list[2]);
72 EXPECT_EQ(w4, window_list[3]);
73 EXPECT_EQ(w5, window_list[4]);
74 EXPECT_EQ(w6, window_list[5]);
75 }
76
77 // Tests that windows being dragged are only in the WindowList once.
78 // Disabled, see http://crbug.com/618058.
79 TEST_F(MruWindowTrackerTest, DISABLED_DraggedWindowsInListOnlyOnce) {
80 WmWindow* w1 = CreateTestWindow();
81 w1->Activate();
82
83 // Start dragging the window.
84 w1->GetWindowState()->CreateDragDetails(
85 gfx::Point(), HTRIGHT, aura::client::WINDOW_MOVE_SOURCE_TOUCH);
86
87 // During a drag the window is reparented by the Docked container.
88 WmWindow* drag_container = w1->GetRootWindow()->GetChildByShellWindowId(
89 kShellWindowId_DockedContainer);
90 drag_container->AddChild(w1);
91 EXPECT_TRUE(w1->GetWindowState()->is_dragged());
92
93 // The dragged window should only be in the list once.
94 WmWindow::Windows window_list =
95 mru_window_tracker()->BuildWindowListIgnoreModal();
96 EXPECT_EQ(1, std::count(window_list.begin(), window_list.end(), w1));
97 }
98
99 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/property_util.cc ('k') | ash/wm/mru_window_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698