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/activation_controller.h" | 5 #include "ash/wm/activation_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/test/test_activation_delegate.h" | 9 #include "ash/test/test_activation_delegate.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 aura::test::TestWindowDelegate wd; | 126 aura::test::TestWindowDelegate wd; |
127 TestActivationDelegate ad1; | 127 TestActivationDelegate ad1; |
128 TestActivationDelegate ad2(false); | 128 TestActivationDelegate ad2(false); |
129 | 129 |
130 scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate( | 130 scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate( |
131 &wd, 1, gfx::Rect(100, 100), NULL)); | 131 &wd, 1, gfx::Rect(100, 100), NULL)); |
132 ad1.SetWindow(w1.get()); | 132 ad1.SetWindow(w1.get()); |
133 EXPECT_TRUE(IsActiveWindow(NULL)); | 133 EXPECT_TRUE(IsActiveWindow(NULL)); |
134 | 134 |
135 // Clicking on an activatable window activtes the window. | 135 // Clicking on an activatable window activtes the window. |
136 aura::test::EventGenerator generator(w1.get()); | 136 aura::test::EventGenerator generator(Shell::GetRootWindow(), w1.get()); |
137 generator.ClickLeftButton(); | 137 generator.ClickLeftButton(); |
138 EXPECT_TRUE(IsActiveWindow(w1.get())); | 138 EXPECT_TRUE(IsActiveWindow(w1.get())); |
139 | 139 |
140 // Creates a menu that covers the transient parent. | 140 // Creates a menu that covers the transient parent. |
141 scoped_ptr<aura::Window> menu(aura::test::CreateTestWindowWithDelegateAndType( | 141 scoped_ptr<aura::Window> menu(aura::test::CreateTestWindowWithDelegateAndType( |
142 &wd, aura::client::WINDOW_TYPE_MENU, 2, gfx::Rect(100, 100), NULL)); | 142 &wd, aura::client::WINDOW_TYPE_MENU, 2, gfx::Rect(100, 100), NULL)); |
143 ad2.SetWindow(menu.get()); | 143 ad2.SetWindow(menu.get()); |
144 w1->AddTransientChild(menu.get()); | 144 w1->AddTransientChild(menu.get()); |
145 | 145 |
146 // Clicking on a menu whose transient parent is active window shouldn't | 146 // Clicking on a menu whose transient parent is active window shouldn't |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 283 |
284 // Try focusing |w21|. Same rules apply. | 284 // Try focusing |w21|. Same rules apply. |
285 EXPECT_FALSE(IsActiveWindow(w2.get())); | 285 EXPECT_FALSE(IsActiveWindow(w2.get())); |
286 EXPECT_FALSE(w21->HasFocus()); | 286 EXPECT_FALSE(w21->HasFocus()); |
287 EXPECT_TRUE(IsActiveWindow(w1.get())); | 287 EXPECT_TRUE(IsActiveWindow(w1.get())); |
288 EXPECT_TRUE(w1->HasFocus()); | 288 EXPECT_TRUE(w1->HasFocus()); |
289 } | 289 } |
290 | 290 |
291 } // namespace test | 291 } // namespace test |
292 } // namespace ash | 292 } // namespace ash |
OLD | NEW |