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/shell.h" | 5 #include "ash/shell.h" |
6 #include "ash/shell_window_ids.h" | 6 #include "ash/shell_window_ids.h" |
7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
8 #include "ash/test/shell_test_api.h" | 8 #include "ash/test/shell_test_api.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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 w121.get()); | 178 w121.get()); |
179 generator.ClickLeftButton(); | 179 generator.ClickLeftButton(); |
180 | 180 |
181 aura::client::FocusClient* focus_client = | 181 aura::client::FocusClient* focus_client = |
182 aura::client::GetFocusClient(w121.get()); | 182 aura::client::GetFocusClient(w121.get()); |
183 EXPECT_EQ(w121.get(), focus_client->GetFocusedWindow()); | 183 EXPECT_EQ(w121.get(), focus_client->GetFocusedWindow()); |
184 | 184 |
185 ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor(); | 185 ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor(); |
186 | 186 |
187 // The key press should be sent to the focused sub-window. | 187 // The key press should be sent to the focused sub-window. |
188 ui::KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_E, 0, false); | 188 ui::KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_E, ui::EF_NONE); |
189 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&keyev); | 189 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&keyev); |
190 ASSERT_FALSE(details.dispatcher_destroyed); | 190 ASSERT_FALSE(details.dispatcher_destroyed); |
191 EXPECT_EQ(ui::VKEY_E, w121delegate->last_key_code()); | 191 EXPECT_EQ(ui::VKEY_E, w121delegate->last_key_code()); |
192 | 192 |
193 // Touch on a sub-window (w122) to focus it. | 193 // Touch on a sub-window (w122) to focus it. |
194 gfx::Point click_point = w122->bounds().CenterPoint(); | 194 gfx::Point click_point = w122->bounds().CenterPoint(); |
195 aura::Window::ConvertPointToTarget(w122->parent(), root_window, &click_point); | 195 aura::Window::ConvertPointToTarget(w122->parent(), root_window, &click_point); |
196 ui::TouchEvent touchev(ui::ET_TOUCH_PRESSED, click_point, 0, getTime()); | 196 ui::TouchEvent touchev(ui::ET_TOUCH_PRESSED, click_point, 0, getTime()); |
197 details = dispatcher->OnEventFromSource(&touchev); | 197 details = dispatcher->OnEventFromSource(&touchev); |
198 ASSERT_FALSE(details.dispatcher_destroyed); | 198 ASSERT_FALSE(details.dispatcher_destroyed); |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 scoped_ptr<CustomEventHandler> f1(new CustomEventHandler); | 664 scoped_ptr<CustomEventHandler> f1(new CustomEventHandler); |
665 scoped_ptr<CustomEventHandler> f2(new CustomEventHandler); | 665 scoped_ptr<CustomEventHandler> f2(new CustomEventHandler); |
666 | 666 |
667 // Adds them to root window event filter. | 667 // Adds them to root window event filter. |
668 ::wm::CompoundEventFilter* env_filter = | 668 ::wm::CompoundEventFilter* env_filter = |
669 Shell::GetInstance()->env_filter(); | 669 Shell::GetInstance()->env_filter(); |
670 env_filter->AddHandler(f1.get()); | 670 env_filter->AddHandler(f1.get()); |
671 env_filter->AddHandler(f2.get()); | 671 env_filter->AddHandler(f2.get()); |
672 | 672 |
673 // Dispatches mouse and keyboard events. | 673 // Dispatches mouse and keyboard events. |
674 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, false); | 674 ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); |
675 ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor(); | 675 ui::EventProcessor* dispatcher = root_window->GetHost()->event_processor(); |
676 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&key_event); | 676 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&key_event); |
677 ASSERT_FALSE(details.dispatcher_destroyed); | 677 ASSERT_FALSE(details.dispatcher_destroyed); |
678 ui::MouseEvent mouse_pressed( | 678 ui::MouseEvent mouse_pressed( |
679 ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), 0, 0); | 679 ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), 0, 0); |
680 details = dispatcher->OnEventFromSource(&mouse_pressed); | 680 details = dispatcher->OnEventFromSource(&mouse_pressed); |
681 ASSERT_FALSE(details.dispatcher_destroyed); | 681 ASSERT_FALSE(details.dispatcher_destroyed); |
682 | 682 |
683 // Both filters should get the events. | 683 // Both filters should get the events. |
684 EXPECT_EQ(1, f1->num_key_events()); | 684 EXPECT_EQ(1, f1->num_key_events()); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 observer_a.reset(); | 832 observer_a.reset(); |
833 observer_b.reset(); | 833 observer_b.reset(); |
834 generator.MoveMouseTo(50, 50); | 834 generator.MoveMouseTo(50, 50); |
835 EXPECT_TRUE(observer_a.did_visibility_change()); | 835 EXPECT_TRUE(observer_a.did_visibility_change()); |
836 EXPECT_FALSE(observer_b.did_visibility_change()); | 836 EXPECT_FALSE(observer_b.did_visibility_change()); |
837 EXPECT_TRUE(observer_a.is_cursor_visible()); | 837 EXPECT_TRUE(observer_a.is_cursor_visible()); |
838 } | 838 } |
839 #endif // defined(OS_CHROMEOS) | 839 #endif // defined(OS_CHROMEOS) |
840 | 840 |
841 } // namespace ash | 841 } // namespace ash |
OLD | NEW |