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/activation_controller.h" | 10 #include "ash/wm/activation_controller.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 void set_key_event_handling_result(ui::EventResult result) { | 48 void set_key_event_handling_result(ui::EventResult result) { |
49 key_result_ = result; | 49 key_result_ = result; |
50 } | 50 } |
51 | 51 |
52 void set_mouse_event_handling_result(ui::EventResult result) { | 52 void set_mouse_event_handling_result(ui::EventResult result) { |
53 mouse_result_ = result; | 53 mouse_result_ = result; |
54 } | 54 } |
55 | 55 |
56 // Overridden from ui::EventHandler: | 56 // Overridden from ui::EventHandler: |
57 virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE { | 57 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE { |
58 ui::EventResult result = aura::test::TestEventHandler::OnKeyEvent(event); | 58 aura::test::TestEventHandler::OnKeyEvent(event); |
59 return key_result_ == ui::ER_UNHANDLED ? result : key_result_; | 59 if (key_result_ & ui::ER_HANDLED) |
| 60 event->SetHandled(); |
| 61 if (key_result_ & ui::ER_CONSUMED) |
| 62 event->StopPropagation(); |
60 } | 63 } |
61 | 64 |
62 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 65 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
63 ui::EventResult result = aura::test::TestEventHandler::OnMouseEvent(event); | 66 ui::EventResult result = aura::test::TestEventHandler::OnMouseEvent(event); |
64 return mouse_result_ == ui::ER_UNHANDLED ? result : mouse_result_; | 67 return mouse_result_ == ui::ER_UNHANDLED ? result : mouse_result_; |
65 } | 68 } |
66 | 69 |
67 private: | 70 private: |
68 ui::EventResult key_result_; | 71 ui::EventResult key_result_; |
69 ui::EventResult mouse_result_; | 72 ui::EventResult mouse_result_; |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 EXPECT_TRUE(cursor_manager->IsCursorVisible()); | 684 EXPECT_TRUE(cursor_manager->IsCursorVisible()); |
682 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2); | 685 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_pressed2); |
683 EXPECT_FALSE(cursor_manager->IsCursorVisible()); | 686 EXPECT_FALSE(cursor_manager->IsCursorVisible()); |
684 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); | 687 root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_moved); |
685 EXPECT_TRUE(cursor_manager->IsCursorVisible()); | 688 EXPECT_TRUE(cursor_manager->IsCursorVisible()); |
686 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_released2); | 689 root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch_released2); |
687 EXPECT_TRUE(cursor_manager->IsCursorVisible()); | 690 EXPECT_TRUE(cursor_manager->IsCursorVisible()); |
688 } | 691 } |
689 | 692 |
690 } // namespace ash | 693 } // namespace ash |
OLD | NEW |