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 "ash/wm/window_modality_controller.h" | 5 #include "ash/wm/window_modality_controller.h" |
6 | 6 |
| 7 #include "ash/shell.h" |
7 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
8 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
9 #include "ui/aura/client/aura_constants.h" | 10 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/test/event_generator.h" | 11 #include "ui/aura/test/event_generator.h" |
11 #include "ui/aura/test/test_windows.h" | 12 #include "ui/aura/test/test_windows.h" |
12 #include "ui/aura/test/test_window_delegate.h" | 13 #include "ui/aura/test/test_window_delegate.h" |
13 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
14 #include "ui/base/ui_base_types.h" | 15 #include "ui/base/ui_base_types.h" |
15 | 16 |
16 namespace ash { | 17 namespace ash { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 aura::test::TestWindowDelegate d; | 178 aura::test::TestWindowDelegate d; |
178 scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(&d, -1, | 179 scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(&d, -1, |
179 gfx::Rect(0, 0, 100, 100), NULL)); | 180 gfx::Rect(0, 0, 100, 100), NULL)); |
180 scoped_ptr<aura::Window> w11(aura::test::CreateTestWindowWithDelegate(&d, -11, | 181 scoped_ptr<aura::Window> w11(aura::test::CreateTestWindowWithDelegate(&d, -11, |
181 gfx::Rect(20, 20, 50, 50), NULL)); | 182 gfx::Rect(20, 20, 50, 50), NULL)); |
182 | 183 |
183 w1->AddTransientChild(w11.get()); | 184 w1->AddTransientChild(w11.get()); |
184 | 185 |
185 { | 186 { |
186 // Clicking a point within w1 should activate that window. | 187 // Clicking a point within w1 should activate that window. |
187 aura::test::EventGenerator generator(gfx::Point(10, 10)); | 188 aura::test::EventGenerator generator(Shell::GetRootWindow(), |
| 189 gfx::Point(10, 10)); |
188 generator.ClickLeftButton(); | 190 generator.ClickLeftButton(); |
189 EXPECT_TRUE(IsActiveWindow(w1.get())); | 191 EXPECT_TRUE(IsActiveWindow(w1.get())); |
190 } | 192 } |
191 | 193 |
192 w11->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); | 194 w11->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); |
193 | 195 |
194 { | 196 { |
195 // Clicking a point within w1 should activate w11. | 197 // Clicking a point within w1 should activate w11. |
196 aura::test::EventGenerator generator(gfx::Point(10, 10)); | 198 aura::test::EventGenerator generator(Shell::GetRootWindow(), |
| 199 gfx::Point(10, 10)); |
197 generator.ClickLeftButton(); | 200 generator.ClickLeftButton(); |
198 EXPECT_TRUE(IsActiveWindow(w11.get())); | 201 EXPECT_TRUE(IsActiveWindow(w11.get())); |
199 } | 202 } |
200 } | 203 } |
201 | 204 |
202 | 205 |
203 } // namespace internal | 206 } // namespace internal |
204 } // namespace ash | 207 } // namespace ash |
OLD | NEW |