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/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/test/test_activation_delegate.h" | 10 #include "ash/test/test_activation_delegate.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 aura::test::TestWindowDelegate wd; | 201 aura::test::TestWindowDelegate wd; |
202 TestActivationDelegate ad1; | 202 TestActivationDelegate ad1; |
203 TestActivationDelegate ad2(false); | 203 TestActivationDelegate ad2(false); |
204 | 204 |
205 scoped_ptr<aura::Window> w1(CreateTestWindowInShellWithDelegate( | 205 scoped_ptr<aura::Window> w1(CreateTestWindowInShellWithDelegate( |
206 &wd, 1, gfx::Rect(100, 100))); | 206 &wd, 1, gfx::Rect(100, 100))); |
207 ad1.SetWindow(w1.get()); | 207 ad1.SetWindow(w1.get()); |
208 EXPECT_EQ(NULL, wm::GetActiveWindow()); | 208 EXPECT_EQ(NULL, wm::GetActiveWindow()); |
209 | 209 |
210 // Clicking on an activatable window activates the window. | 210 // Clicking on an activatable window activates the window. |
211 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), w1.get()); | 211 aura::test::EventGenerator& generator = GetEventGenerator(); |
| 212 generator.MoveMouseToCenterOf(w1.get()); |
212 generator.ClickLeftButton(); | 213 generator.ClickLeftButton(); |
213 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); | 214 EXPECT_TRUE(wm::IsActiveWindow(w1.get())); |
214 | 215 |
215 // Creates a menu that covers the transient parent. | 216 // Creates a menu that covers the transient parent. |
216 scoped_ptr<aura::Window> menu(CreateTestWindowInShellWithDelegateAndType( | 217 scoped_ptr<aura::Window> menu(CreateTestWindowInShellWithDelegateAndType( |
217 &wd, aura::client::WINDOW_TYPE_MENU, 2, gfx::Rect(100, 100))); | 218 &wd, aura::client::WINDOW_TYPE_MENU, 2, gfx::Rect(100, 100))); |
218 ad2.SetWindow(menu.get()); | 219 ad2.SetWindow(menu.get()); |
219 w1->AddTransientChild(menu.get()); | 220 w1->AddTransientChild(menu.get()); |
220 | 221 |
221 // Clicking on a menu whose transient parent is active window shouldn't | 222 // Clicking on a menu whose transient parent is active window shouldn't |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 EXPECT_EQ(w2_d1.get(), client->GetActiveWindow()); | 563 EXPECT_EQ(w2_d1.get(), client->GetActiveWindow()); |
563 | 564 |
564 client->ActivateWindow(w3_d2.get()); | 565 client->ActivateWindow(w3_d2.get()); |
565 EXPECT_EQ(w3_d2.get(), client->GetActiveWindow()); | 566 EXPECT_EQ(w3_d2.get(), client->GetActiveWindow()); |
566 w3_d2.reset(); | 567 w3_d2.reset(); |
567 EXPECT_EQ(w4_d2.get(), client->GetActiveWindow()); | 568 EXPECT_EQ(w4_d2.get(), client->GetActiveWindow()); |
568 } | 569 } |
569 | 570 |
570 } // namespace test | 571 } // namespace test |
571 } // namespace ash | 572 } // namespace ash |
OLD | NEW |