| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "services/window_manager/view_targeter.h" | 5 #include "services/window_manager/view_targeter.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" |
| 7 #include "services/window_manager/basic_focus_rules.h" | 8 #include "services/window_manager/basic_focus_rules.h" |
| 8 #include "services/window_manager/capture_controller.h" | 9 #include "services/window_manager/capture_controller.h" |
| 9 #include "services/window_manager/focus_controller.h" | 10 #include "services/window_manager/focus_controller.h" |
| 10 #include "services/window_manager/view_event_dispatcher.h" | 11 #include "services/window_manager/view_event_dispatcher.h" |
| 11 #include "services/window_manager/window_manager_test_util.h" | 12 #include "services/window_manager/window_manager_test_util.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/events/test/test_event_handler.h" | 14 #include "ui/events/test/test_event_handler.h" |
| 14 | 15 |
| 15 namespace window_manager { | 16 namespace window_manager { |
| 16 | 17 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 TestView one(2, gfx::Rect(0, 0, 500, 100)); | 49 TestView one(2, gfx::Rect(0, 0, 500, 100)); |
| 49 TestView two(3, gfx::Rect(501, 0, 500, 1000)); | 50 TestView two(3, gfx::Rect(501, 0, 500, 1000)); |
| 50 | 51 |
| 51 root.AddChild(&one); | 52 root.AddChild(&one); |
| 52 root.AddChild(&two); | 53 root.AddChild(&two); |
| 53 | 54 |
| 54 ui::test::TestEventHandler handler; | 55 ui::test::TestEventHandler handler; |
| 55 one.target()->AddPreTargetHandler(&handler); | 56 one.target()->AddPreTargetHandler(&handler); |
| 56 | 57 |
| 57 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, gfx::Point(20, 20), | 58 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, gfx::Point(20, 20), |
| 58 gfx::Point(20, 20), ui::EF_NONE, ui::EF_NONE); | 59 gfx::Point(20, 20), base::TimeDelta(), |
| 60 ui::EF_NONE, ui::EF_NONE); |
| 59 ui::EventDispatchDetails details = | 61 ui::EventDispatchDetails details = |
| 60 view_event_dispatcher_->OnEventFromSource(&press); | 62 view_event_dispatcher_->OnEventFromSource(&press); |
| 61 ASSERT_FALSE(details.dispatcher_destroyed); | 63 ASSERT_FALSE(details.dispatcher_destroyed); |
| 62 | 64 |
| 63 EXPECT_EQ(1, handler.num_mouse_events()); | 65 EXPECT_EQ(1, handler.num_mouse_events()); |
| 64 | 66 |
| 65 one.target()->RemovePreTargetHandler(&handler); | 67 one.target()->RemovePreTargetHandler(&handler); |
| 66 } | 68 } |
| 67 | 69 |
| 68 TEST_F(ViewTargeterTest, KeyTest) { | 70 TEST_F(ViewTargeterTest, KeyTest) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 ui::KeyEvent key_event_two(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); | 105 ui::KeyEvent key_event_two(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); |
| 104 details = view_event_dispatcher_->OnEventFromSource(&key_event_two); | 106 details = view_event_dispatcher_->OnEventFromSource(&key_event_two); |
| 105 ASSERT_FALSE(details.dispatcher_destroyed); | 107 ASSERT_FALSE(details.dispatcher_destroyed); |
| 106 EXPECT_EQ(1, two_handler.num_key_events()); | 108 EXPECT_EQ(1, two_handler.num_key_events()); |
| 107 | 109 |
| 108 two.target()->RemovePreTargetHandler(&two_handler); | 110 two.target()->RemovePreTargetHandler(&two_handler); |
| 109 one.target()->RemovePreTargetHandler(&one_handler); | 111 one.target()->RemovePreTargetHandler(&one_handler); |
| 110 } | 112 } |
| 111 | 113 |
| 112 } // namespace window_manager | 114 } // namespace window_manager |
| OLD | NEW |