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 "ui/aura/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 EXPECT_EQ(gfx::Point(12, 23).ToString(), | 934 EXPECT_EQ(gfx::Point(12, 23).ToString(), |
935 recorder.mouse_locations()[0].ToString()); | 935 recorder.mouse_locations()[0].ToString()); |
936 } | 936 } |
937 | 937 |
938 // Verifies that a direct call to ProcessedTouchEvent() does not cause a crash. | 938 // Verifies that a direct call to ProcessedTouchEvent() does not cause a crash. |
939 TEST_P(WindowEventDispatcherTest, CallToProcessedTouchEvent) { | 939 TEST_P(WindowEventDispatcherTest, CallToProcessedTouchEvent) { |
940 test::TestWindowDelegate delegate; | 940 test::TestWindowDelegate delegate; |
941 std::unique_ptr<aura::Window> window(CreateTestWindowWithDelegate( | 941 std::unique_ptr<aura::Window> window(CreateTestWindowWithDelegate( |
942 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); | 942 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); |
943 | 943 |
944 host()->dispatcher()->ProcessedTouchEvent(0, window.get(), ui::ER_UNHANDLED); | 944 host()->dispatcher()->ProcessedTouchEvent( |
| 945 0, window.get(), ui::ER_UNHANDLED, |
| 946 false /* is_source_touch_event_set_non_blocking */); |
945 } | 947 } |
946 | 948 |
947 // This event handler requests the dispatcher to start holding pointer-move | 949 // This event handler requests the dispatcher to start holding pointer-move |
948 // events when it receives the first scroll-update gesture. | 950 // events when it receives the first scroll-update gesture. |
949 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler { | 951 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler { |
950 public: | 952 public: |
951 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher, | 953 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher, |
952 EventFilterRecorder* filter) | 954 EventFilterRecorder* filter) |
953 : dispatcher_(dispatcher), | 955 : dispatcher_(dispatcher), |
954 filter_(filter), | 956 filter_(filter), |
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2597 : dispatcher_(dispatcher), window_(nullptr) {} | 2599 : dispatcher_(dispatcher), window_(nullptr) {} |
2598 | 2600 |
2599 void set_window(Window* window) { | 2601 void set_window(Window* window) { |
2600 window_ = window; | 2602 window_ = window; |
2601 } | 2603 } |
2602 private: | 2604 private: |
2603 void OnTouchEvent(ui::TouchEvent* event) override { | 2605 void OnTouchEvent(ui::TouchEvent* event) override { |
2604 // Convert touch event back to root window coordinates. | 2606 // Convert touch event back to root window coordinates. |
2605 event->ConvertLocationToTarget(window_, window_->GetRootWindow()); | 2607 event->ConvertLocationToTarget(window_, window_->GetRootWindow()); |
2606 event->DisableSynchronousHandling(); | 2608 event->DisableSynchronousHandling(); |
2607 dispatcher_->ProcessedTouchEvent(event->unique_event_id(), window_, | 2609 dispatcher_->ProcessedTouchEvent( |
2608 ui::ER_UNHANDLED); | 2610 event->unique_event_id(), window_, ui::ER_UNHANDLED, |
| 2611 false /* is_source_touch_event_set_non_blocking */); |
2609 event->StopPropagation(); | 2612 event->StopPropagation(); |
2610 } | 2613 } |
2611 | 2614 |
2612 WindowEventDispatcher* dispatcher_; | 2615 WindowEventDispatcher* dispatcher_; |
2613 Window* window_; | 2616 Window* window_; |
2614 | 2617 |
2615 DISALLOW_COPY_AND_ASSIGN(AsyncWindowDelegate); | 2618 DISALLOW_COPY_AND_ASSIGN(AsyncWindowDelegate); |
2616 }; | 2619 }; |
2617 | 2620 |
2618 // Tests that gesture events dispatched through the asynchronous flow have | 2621 // Tests that gesture events dispatched through the asynchronous flow have |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2949 EXPECT_EQ(1, last_event_location_delegate.mouse_event_count()); | 2952 EXPECT_EQ(1, last_event_location_delegate.mouse_event_count()); |
2950 EXPECT_EQ(1, last_event_location_delegate.nested_message_loop_count()); | 2953 EXPECT_EQ(1, last_event_location_delegate.nested_message_loop_count()); |
2951 EXPECT_EQ(mouse_location, last_event_location_delegate.last_mouse_location()); | 2954 EXPECT_EQ(mouse_location, last_event_location_delegate.last_mouse_location()); |
2952 | 2955 |
2953 // After dispatch the location should fallback to that of the | 2956 // After dispatch the location should fallback to that of the |
2954 // WindowTreeClient, which defaults to 0,0. | 2957 // WindowTreeClient, which defaults to 0,0. |
2955 EXPECT_EQ(gfx::Point(0, 0), Env::GetInstance()->last_mouse_location()); | 2958 EXPECT_EQ(gfx::Point(0, 0), Env::GetInstance()->last_mouse_location()); |
2956 } | 2959 } |
2957 | 2960 |
2958 } // namespace aura | 2961 } // namespace aura |
OLD | NEW |