OLD | NEW |
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 "ui/wm/core/window_modality_controller.h" | 5 #include "ui/wm/core/window_modality_controller.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 { | 200 { |
201 // Clicking a point within w1 should activate w11. | 201 // Clicking a point within w1 should activate w11. |
202 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 202 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
203 gfx::Point(10, 10)); | 203 gfx::Point(10, 10)); |
204 generator.ClickLeftButton(); | 204 generator.ClickLeftButton(); |
205 EXPECT_TRUE(wm::IsActiveWindow(w11.get())); | 205 EXPECT_TRUE(wm::IsActiveWindow(w11.get())); |
206 } | 206 } |
207 } | 207 } |
208 | 208 |
| 209 // Events on modal parent activate. |
| 210 TEST_F(WindowModalityControllerTest, EventsForEclipsedWindows) { |
| 211 aura::test::TestWindowDelegate d; |
| 212 scoped_ptr<aura::Window> w1(CreateTestWindowInShellWithDelegate(&d, -1, |
| 213 gfx::Rect(0, 0, 100, 100))); |
| 214 scoped_ptr<aura::Window> w11(CreateTestWindowInShellWithDelegate(&d, -11, |
| 215 gfx::Rect(20, 20, 50, 50))); |
| 216 ::wm::AddTransientChild(w1.get(), w11.get()); |
| 217 scoped_ptr<aura::Window> w2(CreateTestWindowInShellWithDelegate(&d, -2, |
| 218 gfx::Rect(0, 0, 50, 50))); |
| 219 |
| 220 w11->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); |
| 221 |
| 222 // Partially eclipse w1 with w2. |
| 223 wm::ActivateWindow(w2.get()); |
| 224 { |
| 225 // Clicking a point on w1 that is not eclipsed by w2. |
| 226 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 227 gfx::Point(90, 90)); |
| 228 generator.ClickLeftButton(); |
| 229 EXPECT_TRUE(wm::IsActiveWindow(w11.get())); |
| 230 } |
| 231 } |
| 232 |
209 // Creates windows w1 and non activatiable child w11. Creates transient window | 233 // Creates windows w1 and non activatiable child w11. Creates transient window |
210 // w2 and adds it as a transeint child of w1. Ensures that w2 is parented to | 234 // w2 and adds it as a transeint child of w1. Ensures that w2 is parented to |
211 // the parent of w1, and that GetModalTransient(w11) returns w2. | 235 // the parent of w1, and that GetModalTransient(w11) returns w2. |
212 TEST_F(WindowModalityControllerTest, GetModalTransient) { | 236 TEST_F(WindowModalityControllerTest, GetModalTransient) { |
213 aura::test::TestWindowDelegate d; | 237 aura::test::TestWindowDelegate d; |
214 scoped_ptr<aura::Window> w1( | 238 scoped_ptr<aura::Window> w1( |
215 CreateTestWindowInShellWithDelegate(&d, -1, gfx::Rect())); | 239 CreateTestWindowInShellWithDelegate(&d, -1, gfx::Rect())); |
216 scoped_ptr<aura::Window> w11( | 240 scoped_ptr<aura::Window> w11( |
217 aura::test::CreateTestWindowWithDelegate(&d, -11, gfx::Rect(), w1.get())); | 241 aura::test::CreateTestWindowWithDelegate(&d, -11, gfx::Rect(), w1.get())); |
218 scoped_ptr<aura::Window> w2( | 242 scoped_ptr<aura::Window> w2( |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); | 577 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); |
554 | 578 |
555 wm::ActivateWindow(w3.get()); | 579 wm::ActivateWindow(w3.get()); |
556 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); | 580 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); |
557 | 581 |
558 wm::ActivateWindow(w4.get()); | 582 wm::ActivateWindow(w4.get()); |
559 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); | 583 EXPECT_TRUE(wm::IsActiveWindow(w4.get())); |
560 } | 584 } |
561 | 585 |
562 } // namespace ash | 586 } // namespace ash |
OLD | NEW |