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

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

Issue 196063002: Move wm/core to wm namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 9 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 | Annotate | Revision Log
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/wm/system_modal_container_layout_manager.h" 5 #include "ash/wm/system_modal_container_layout_manager.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/session_state_delegate.h" 8 #include "ash/session_state_delegate.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return widget->GetNativeView(); 155 return widget->GetNativeView();
156 } 156 }
157 }; 157 };
158 158
159 TEST_F(SystemModalContainerLayoutManagerTest, NonModalTransient) { 159 TEST_F(SystemModalContainerLayoutManagerTest, NonModalTransient) {
160 scoped_ptr<aura::Window> parent(OpenToplevelTestWindow(false)); 160 scoped_ptr<aura::Window> parent(OpenToplevelTestWindow(false));
161 aura::Window* transient = OpenTestWindowWithParent(parent.get(), false); 161 aura::Window* transient = OpenTestWindowWithParent(parent.get(), false);
162 TransientWindowObserver destruction_observer; 162 TransientWindowObserver destruction_observer;
163 transient->AddObserver(&destruction_observer); 163 transient->AddObserver(&destruction_observer);
164 164
165 EXPECT_EQ(parent.get(), views::corewm::GetTransientParent(transient)); 165 EXPECT_EQ(parent.get(), ::wm::GetTransientParent(transient));
166 EXPECT_EQ(parent->parent(), transient->parent()); 166 EXPECT_EQ(parent->parent(), transient->parent());
167 167
168 // The transient should be destroyed with its parent. 168 // The transient should be destroyed with its parent.
169 parent.reset(); 169 parent.reset();
170 EXPECT_TRUE(destruction_observer.destroyed()); 170 EXPECT_TRUE(destruction_observer.destroyed());
171 } 171 }
172 172
173 TEST_F(SystemModalContainerLayoutManagerTest, ModalTransient) { 173 TEST_F(SystemModalContainerLayoutManagerTest, ModalTransient) {
174 scoped_ptr<aura::Window> parent(OpenToplevelTestWindow(false)); 174 scoped_ptr<aura::Window> parent(OpenToplevelTestWindow(false));
175 // parent should be active. 175 // parent should be active.
176 EXPECT_TRUE(wm::IsActiveWindow(parent.get())); 176 EXPECT_TRUE(wm::IsActiveWindow(parent.get()));
177 aura::Window* t1 = OpenTestWindowWithParent(parent.get(), true); 177 aura::Window* t1 = OpenTestWindowWithParent(parent.get(), true);
178 178
179 TransientWindowObserver do1; 179 TransientWindowObserver do1;
180 t1->AddObserver(&do1); 180 t1->AddObserver(&do1);
181 181
182 EXPECT_EQ(parent.get(), views::corewm::GetTransientParent(t1)); 182 EXPECT_EQ(parent.get(), ::wm::GetTransientParent(t1));
183 EXPECT_EQ(GetModalContainer(), t1->parent()); 183 EXPECT_EQ(GetModalContainer(), t1->parent());
184 184
185 // t1 should now be active. 185 // t1 should now be active.
186 EXPECT_TRUE(wm::IsActiveWindow(t1)); 186 EXPECT_TRUE(wm::IsActiveWindow(t1));
187 187
188 // Attempting to click the parent should result in no activation change. 188 // Attempting to click the parent should result in no activation change.
189 aura::test::EventGenerator e1(Shell::GetPrimaryRootWindow(), parent.get()); 189 aura::test::EventGenerator e1(Shell::GetPrimaryRootWindow(), parent.get());
190 e1.ClickLeftButton(); 190 e1.ClickLeftButton();
191 EXPECT_TRUE(wm::IsActiveWindow(t1)); 191 EXPECT_TRUE(wm::IsActiveWindow(t1));
192 192
193 // Now open another modal transient parented to the original modal transient. 193 // Now open another modal transient parented to the original modal transient.
194 aura::Window* t2 = OpenTestWindowWithParent(t1, true); 194 aura::Window* t2 = OpenTestWindowWithParent(t1, true);
195 TransientWindowObserver do2; 195 TransientWindowObserver do2;
196 t2->AddObserver(&do2); 196 t2->AddObserver(&do2);
197 197
198 EXPECT_TRUE(wm::IsActiveWindow(t2)); 198 EXPECT_TRUE(wm::IsActiveWindow(t2));
199 199
200 EXPECT_EQ(t1, views::corewm::GetTransientParent(t2)); 200 EXPECT_EQ(t1, ::wm::GetTransientParent(t2));
201 EXPECT_EQ(GetModalContainer(), t2->parent()); 201 EXPECT_EQ(GetModalContainer(), t2->parent());
202 202
203 // t2 should still be active, even after clicking on t1. 203 // t2 should still be active, even after clicking on t1.
204 aura::test::EventGenerator e2(Shell::GetPrimaryRootWindow(), t1); 204 aura::test::EventGenerator e2(Shell::GetPrimaryRootWindow(), t1);
205 e2.ClickLeftButton(); 205 e2.ClickLeftButton();
206 EXPECT_TRUE(wm::IsActiveWindow(t2)); 206 EXPECT_TRUE(wm::IsActiveWindow(t2));
207 207
208 // Both transients should be destroyed with parent. 208 // Both transients should be destroyed with parent.
209 parent.reset(); 209 parent.reset();
210 EXPECT_TRUE(do1.destroyed()); 210 EXPECT_TRUE(do1.destroyed());
211 EXPECT_TRUE(do2.destroyed()); 211 EXPECT_TRUE(do2.destroyed());
212 } 212 }
213 213
214 TEST_F(SystemModalContainerLayoutManagerTest, ModalNonTransient) { 214 TEST_F(SystemModalContainerLayoutManagerTest, ModalNonTransient) {
215 scoped_ptr<aura::Window> t1(OpenToplevelTestWindow(true)); 215 scoped_ptr<aura::Window> t1(OpenToplevelTestWindow(true));
216 // parent should be active. 216 // parent should be active.
217 EXPECT_TRUE(wm::IsActiveWindow(t1.get())); 217 EXPECT_TRUE(wm::IsActiveWindow(t1.get()));
218 TransientWindowObserver do1; 218 TransientWindowObserver do1;
219 t1->AddObserver(&do1); 219 t1->AddObserver(&do1);
220 220
221 EXPECT_EQ(NULL, views::corewm::GetTransientParent(t1.get())); 221 EXPECT_EQ(NULL, ::wm::GetTransientParent(t1.get()));
222 EXPECT_EQ(GetModalContainer(), t1->parent()); 222 EXPECT_EQ(GetModalContainer(), t1->parent());
223 223
224 // t1 should now be active. 224 // t1 should now be active.
225 EXPECT_TRUE(wm::IsActiveWindow(t1.get())); 225 EXPECT_TRUE(wm::IsActiveWindow(t1.get()));
226 226
227 // Attempting to click the parent should result in no activation change. 227 // Attempting to click the parent should result in no activation change.
228 aura::test::EventGenerator e1(Shell::GetPrimaryRootWindow(), 228 aura::test::EventGenerator e1(Shell::GetPrimaryRootWindow(),
229 Shell::GetPrimaryRootWindow()); 229 Shell::GetPrimaryRootWindow());
230 e1.ClickLeftButton(); 230 e1.ClickLeftButton();
231 EXPECT_TRUE(wm::IsActiveWindow(t1.get())); 231 EXPECT_TRUE(wm::IsActiveWindow(t1.get()));
232 232
233 // Now open another modal transient parented to the original modal transient. 233 // Now open another modal transient parented to the original modal transient.
234 aura::Window* t2 = OpenTestWindowWithParent(t1.get(), true); 234 aura::Window* t2 = OpenTestWindowWithParent(t1.get(), true);
235 TransientWindowObserver do2; 235 TransientWindowObserver do2;
236 t2->AddObserver(&do2); 236 t2->AddObserver(&do2);
237 237
238 EXPECT_TRUE(wm::IsActiveWindow(t2)); 238 EXPECT_TRUE(wm::IsActiveWindow(t2));
239 239
240 EXPECT_EQ(t1, views::corewm::GetTransientParent(t2)); 240 EXPECT_EQ(t1, ::wm::GetTransientParent(t2));
241 EXPECT_EQ(GetModalContainer(), t2->parent()); 241 EXPECT_EQ(GetModalContainer(), t2->parent());
242 242
243 // t2 should still be active, even after clicking on t1. 243 // t2 should still be active, even after clicking on t1.
244 aura::test::EventGenerator e2(Shell::GetPrimaryRootWindow(), t1.get()); 244 aura::test::EventGenerator e2(Shell::GetPrimaryRootWindow(), t1.get());
245 e2.ClickLeftButton(); 245 e2.ClickLeftButton();
246 EXPECT_TRUE(wm::IsActiveWindow(t2)); 246 EXPECT_TRUE(wm::IsActiveWindow(t2));
247 247
248 // Both transients should be destroyed with parent. 248 // Both transients should be destroyed with parent.
249 t1.reset(); 249 t1.reset();
250 EXPECT_TRUE(do1.destroyed()); 250 EXPECT_TRUE(do1.destroyed());
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 487
488 // No more modal screen. 488 // No more modal screen.
489 modal1->Hide(); 489 modal1->Hide();
490 TestWindow::CloseTestWindow(modal1.release()); 490 TestWindow::CloseTestWindow(modal1.release());
491 EXPECT_FALSE(AllRootWindowsHaveModalBackgrounds()); 491 EXPECT_FALSE(AllRootWindowsHaveModalBackgrounds());
492 EXPECT_TRUE(wm::IsActiveWindow(normal.get())); 492 EXPECT_TRUE(wm::IsActiveWindow(normal.get()));
493 } 493 }
494 494
495 } // namespace test 495 } // namespace test
496 } // namespace ash 496 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/system_modal_container_layout_manager.cc ('k') | ash/wm/toplevel_window_event_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698