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

Side by Side Diff: ash/drag_drop/drag_drop_tracker_unittest.cc

Issue 2886253002: mash: remove more shell/shelf WmWindow usage. (Closed)
Patch Set: Fix WmShelf::ForWindow. Created 3 years, 7 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/aura/shell_port_classic.cc ('k') | ash/first_run/first_run_helper_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/drag_drop/drag_drop_tracker.h" 5 #include "ash/drag_drop/drag_drop_tracker.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/public/cpp/shell_window_ids.h" 9 #include "ash/public/cpp/shell_window_ids.h"
10 #include "ash/scoped_root_window_for_new_windows.h" 10 #include "ash/scoped_root_window_for_new_windows.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 std::unique_ptr<aura::Window> window1( 60 std::unique_ptr<aura::Window> window1(
61 CreateTestWindow(gfx::Rect(300, 100, 100, 100))); 61 CreateTestWindow(gfx::Rect(300, 100, 100, 100)));
62 window1->Show(); 62 window1->Show();
63 EXPECT_EQ(root_windows[0], window0->GetRootWindow()); 63 EXPECT_EQ(root_windows[0], window0->GetRootWindow());
64 EXPECT_EQ(root_windows[1], window1->GetRootWindow()); 64 EXPECT_EQ(root_windows[1], window1->GetRootWindow());
65 EXPECT_EQ("0,0 100x100", window0->GetBoundsInScreen().ToString()); 65 EXPECT_EQ("0,0 100x100", window0->GetBoundsInScreen().ToString());
66 EXPECT_EQ("300,100 100x100", window1->GetBoundsInScreen().ToString()); 66 EXPECT_EQ("300,100 100x100", window1->GetBoundsInScreen().ToString());
67 67
68 // RootWindow0 is active so the capture window is parented to it. 68 // RootWindow0 is active so the capture window is parented to it.
69 EXPECT_EQ(WmWindow::Get(root_windows[0]), 69 EXPECT_EQ(root_windows[0], Shell::GetRootWindowForNewWindows());
70 Shell::GetWmRootWindowForNewWindows());
71 70
72 // Start tracking from the RootWindow1 and check the point on RootWindow0 that 71 // Start tracking from the RootWindow1 and check the point on RootWindow0 that
73 // |window0| covers. 72 // |window0| covers.
74 EXPECT_EQ(window0.get(), GetTarget(gfx::Point(50, 50))); 73 EXPECT_EQ(window0.get(), GetTarget(gfx::Point(50, 50)));
75 74
76 // Start tracking from the RootWindow0 and check the point on RootWindow0 that 75 // Start tracking from the RootWindow0 and check the point on RootWindow0 that
77 // neither |window0| nor |window1| covers. 76 // neither |window0| nor |window1| covers.
78 EXPECT_NE(window0.get(), GetTarget(gfx::Point(150, 150))); 77 EXPECT_NE(window0.get(), GetTarget(gfx::Point(150, 150)));
79 EXPECT_NE(window1.get(), GetTarget(gfx::Point(150, 150))); 78 EXPECT_NE(window1.get(), GetTarget(gfx::Point(150, 150)));
80 79
81 // Start tracking from the RootWindow0 and check the point on RootWindow1 that 80 // Start tracking from the RootWindow0 and check the point on RootWindow1 that
82 // |window1| covers. 81 // |window1| covers.
83 EXPECT_EQ(window1.get(), GetTarget(gfx::Point(350, 150))); 82 EXPECT_EQ(window1.get(), GetTarget(gfx::Point(350, 150)));
84 83
85 // Start tracking from the RootWindow0 and check the point on RootWindow1 that 84 // Start tracking from the RootWindow0 and check the point on RootWindow1 that
86 // neither |window0| nor |window1| covers. 85 // neither |window0| nor |window1| covers.
87 EXPECT_NE(window0.get(), GetTarget(gfx::Point(50, 250))); 86 EXPECT_NE(window0.get(), GetTarget(gfx::Point(50, 250)));
88 EXPECT_NE(window1.get(), GetTarget(gfx::Point(50, 250))); 87 EXPECT_NE(window1.get(), GetTarget(gfx::Point(50, 250)));
89 88
90 // Make RootWindow1 active so that capture window is parented to it. 89 // Make RootWindow1 active so that capture window is parented to it.
91 ScopedRootWindowForNewWindows root_for_new_windows( 90 ScopedRootWindowForNewWindows root_for_new_windows(root_windows[1]);
92 WmWindow::Get(root_windows[1]));
93 91
94 // Start tracking from the RootWindow1 and check the point on RootWindow0 that 92 // Start tracking from the RootWindow1 and check the point on RootWindow0 that
95 // |window0| covers. 93 // |window0| covers.
96 EXPECT_EQ(window0.get(), GetTarget(gfx::Point(-150, 50))); 94 EXPECT_EQ(window0.get(), GetTarget(gfx::Point(-150, 50)));
97 95
98 // Start tracking from the RootWindow1 and check the point on RootWindow0 that 96 // Start tracking from the RootWindow1 and check the point on RootWindow0 that
99 // neither |window0| nor |window1| covers. 97 // neither |window0| nor |window1| covers.
100 EXPECT_NE(window0.get(), GetTarget(gfx::Point(150, -50))); 98 EXPECT_NE(window0.get(), GetTarget(gfx::Point(150, -50)));
101 EXPECT_NE(window1.get(), GetTarget(gfx::Point(150, -50))); 99 EXPECT_NE(window1.get(), GetTarget(gfx::Point(150, -50)));
102 100
(...skipping 14 matching lines...) Expand all
117 115
118 std::unique_ptr<aura::Window> window0( 116 std::unique_ptr<aura::Window> window0(
119 CreateTestWindow(gfx::Rect(0, 0, 100, 100))); 117 CreateTestWindow(gfx::Rect(0, 0, 100, 100)));
120 window0->Show(); 118 window0->Show();
121 119
122 std::unique_ptr<aura::Window> window1( 120 std::unique_ptr<aura::Window> window1(
123 CreateTestWindow(gfx::Rect(300, 100, 100, 100))); 121 CreateTestWindow(gfx::Rect(300, 100, 100, 100)));
124 window1->Show(); 122 window1->Show();
125 123
126 // RootWindow0 is active so the capture window is parented to it. 124 // RootWindow0 is active so the capture window is parented to it.
127 EXPECT_EQ(WmWindow::Get(root_windows[0]), 125 EXPECT_EQ(root_windows[0], Shell::GetRootWindowForNewWindows());
128 Shell::GetWmRootWindowForNewWindows());
129 126
130 // Start tracking from the RootWindow0 and converts the mouse event into 127 // Start tracking from the RootWindow0 and converts the mouse event into
131 // |window0|'s coodinates. 128 // |window0|'s coodinates.
132 ui::MouseEvent original00(ui::ET_MOUSE_DRAGGED, gfx::Point(50, 50), 129 ui::MouseEvent original00(ui::ET_MOUSE_DRAGGED, gfx::Point(50, 50),
133 gfx::Point(50, 50), ui::EventTimeForNow(), 130 gfx::Point(50, 50), ui::EventTimeForNow(),
134 ui::EF_NONE, ui::EF_NONE); 131 ui::EF_NONE, ui::EF_NONE);
135 std::unique_ptr<ui::LocatedEvent> converted00( 132 std::unique_ptr<ui::LocatedEvent> converted00(
136 ConvertEvent(window0.get(), original00)); 133 ConvertEvent(window0.get(), original00));
137 EXPECT_EQ(original00.type(), converted00->type()); 134 EXPECT_EQ(original00.type(), converted00->type());
138 EXPECT_EQ("50,50", converted00->location().ToString()); 135 EXPECT_EQ("50,50", converted00->location().ToString());
139 EXPECT_EQ("50,50", converted00->root_location().ToString()); 136 EXPECT_EQ("50,50", converted00->root_location().ToString());
140 EXPECT_EQ(original00.flags(), converted00->flags()); 137 EXPECT_EQ(original00.flags(), converted00->flags());
141 138
142 // Start tracking from the RootWindow0 and converts the mouse event into 139 // Start tracking from the RootWindow0 and converts the mouse event into
143 // |window1|'s coodinates. 140 // |window1|'s coodinates.
144 ui::MouseEvent original01(ui::ET_MOUSE_DRAGGED, gfx::Point(350, 150), 141 ui::MouseEvent original01(ui::ET_MOUSE_DRAGGED, gfx::Point(350, 150),
145 gfx::Point(350, 150), ui::EventTimeForNow(), 142 gfx::Point(350, 150), ui::EventTimeForNow(),
146 ui::EF_NONE, ui::EF_NONE); 143 ui::EF_NONE, ui::EF_NONE);
147 std::unique_ptr<ui::LocatedEvent> converted01( 144 std::unique_ptr<ui::LocatedEvent> converted01(
148 ConvertEvent(window1.get(), original01)); 145 ConvertEvent(window1.get(), original01));
149 EXPECT_EQ(original01.type(), converted01->type()); 146 EXPECT_EQ(original01.type(), converted01->type());
150 EXPECT_EQ("50,50", converted01->location().ToString()); 147 EXPECT_EQ("50,50", converted01->location().ToString());
151 EXPECT_EQ("150,150", converted01->root_location().ToString()); 148 EXPECT_EQ("150,150", converted01->root_location().ToString());
152 EXPECT_EQ(original01.flags(), converted01->flags()); 149 EXPECT_EQ(original01.flags(), converted01->flags());
153 150
154 // Make RootWindow1 active so that capture window is parented to it. 151 // Make RootWindow1 active so that capture window is parented to it.
155 ScopedRootWindowForNewWindows root_for_new_windows( 152 ScopedRootWindowForNewWindows root_for_new_windows(root_windows[1]);
156 WmWindow::Get(root_windows[1]));
157 153
158 // Start tracking from the RootWindow1 and converts the mouse event into 154 // Start tracking from the RootWindow1 and converts the mouse event into
159 // |window0|'s coodinates. 155 // |window0|'s coodinates.
160 ui::MouseEvent original10(ui::ET_MOUSE_DRAGGED, gfx::Point(-150, 50), 156 ui::MouseEvent original10(ui::ET_MOUSE_DRAGGED, gfx::Point(-150, 50),
161 gfx::Point(-150, 50), ui::EventTimeForNow(), 157 gfx::Point(-150, 50), ui::EventTimeForNow(),
162 ui::EF_NONE, ui::EF_NONE); 158 ui::EF_NONE, ui::EF_NONE);
163 std::unique_ptr<ui::LocatedEvent> converted10( 159 std::unique_ptr<ui::LocatedEvent> converted10(
164 ConvertEvent(window0.get(), original10)); 160 ConvertEvent(window0.get(), original10));
165 EXPECT_EQ(original10.type(), converted10->type()); 161 EXPECT_EQ(original10.type(), converted10->type());
166 EXPECT_EQ("50,50", converted10->location().ToString()); 162 EXPECT_EQ("50,50", converted10->location().ToString());
167 EXPECT_EQ("50,50", converted10->root_location().ToString()); 163 EXPECT_EQ("50,50", converted10->root_location().ToString());
168 EXPECT_EQ(original10.flags(), converted10->flags()); 164 EXPECT_EQ(original10.flags(), converted10->flags());
169 165
170 // Start tracking from the RootWindow1 and converts the mouse event into 166 // Start tracking from the RootWindow1 and converts the mouse event into
171 // |window1|'s coodinates. 167 // |window1|'s coodinates.
172 ui::MouseEvent original11(ui::ET_MOUSE_DRAGGED, gfx::Point(150, 150), 168 ui::MouseEvent original11(ui::ET_MOUSE_DRAGGED, gfx::Point(150, 150),
173 gfx::Point(150, 150), ui::EventTimeForNow(), 169 gfx::Point(150, 150), ui::EventTimeForNow(),
174 ui::EF_NONE, ui::EF_NONE); 170 ui::EF_NONE, ui::EF_NONE);
175 std::unique_ptr<ui::LocatedEvent> converted11( 171 std::unique_ptr<ui::LocatedEvent> converted11(
176 ConvertEvent(window1.get(), original11)); 172 ConvertEvent(window1.get(), original11));
177 EXPECT_EQ(original11.type(), converted11->type()); 173 EXPECT_EQ(original11.type(), converted11->type());
178 EXPECT_EQ("50,50", converted11->location().ToString()); 174 EXPECT_EQ("50,50", converted11->location().ToString());
179 EXPECT_EQ("150,150", converted11->root_location().ToString()); 175 EXPECT_EQ("150,150", converted11->root_location().ToString());
180 EXPECT_EQ(original11.flags(), converted11->flags()); 176 EXPECT_EQ(original11.flags(), converted11->flags());
181 } 177 }
182 178
183 } // namespace test 179 } // namespace test
184 } // namespace aura 180 } // namespace aura
OLDNEW
« no previous file with comments | « ash/aura/shell_port_classic.cc ('k') | ash/first_run/first_run_helper_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698