Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: ui/aura/window_event_dispatcher_unittest.cc

Issue 2869823003: [VSync Queue] Plug touch ack to gesture events and flush vsync queue if necessary (Closed)
Patch Set: Use seperate bool for set_non_blocking Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 EXPECT_EQ(gfx::Point(12, 23).ToString(), 933 EXPECT_EQ(gfx::Point(12, 23).ToString(),
934 recorder.mouse_locations()[0].ToString()); 934 recorder.mouse_locations()[0].ToString());
935 } 935 }
936 936
937 // Verifies that a direct call to ProcessedTouchEvent() does not cause a crash. 937 // Verifies that a direct call to ProcessedTouchEvent() does not cause a crash.
938 TEST_P(WindowEventDispatcherTest, CallToProcessedTouchEvent) { 938 TEST_P(WindowEventDispatcherTest, CallToProcessedTouchEvent) {
939 test::TestWindowDelegate delegate; 939 test::TestWindowDelegate delegate;
940 std::unique_ptr<aura::Window> window(CreateTestWindowWithDelegate( 940 std::unique_ptr<aura::Window> window(CreateTestWindowWithDelegate(
941 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window())); 941 &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window()));
942 942
943 host()->dispatcher()->ProcessedTouchEvent(0, window.get(), ui::ER_UNHANDLED); 943 host()->dispatcher()->ProcessedTouchEvent(
944 0, window.get(), ui::ER_UNHANDLED,
945 false /* is_source_touch_event_set_non_blocking */);
944 } 946 }
945 947
946 // This event handler requests the dispatcher to start holding pointer-move 948 // This event handler requests the dispatcher to start holding pointer-move
947 // events when it receives the first scroll-update gesture. 949 // events when it receives the first scroll-update gesture.
948 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler { 950 class HoldPointerOnScrollHandler : public ui::test::TestEventHandler {
949 public: 951 public:
950 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher, 952 HoldPointerOnScrollHandler(WindowEventDispatcher* dispatcher,
951 EventFilterRecorder* filter) 953 EventFilterRecorder* filter)
952 : dispatcher_(dispatcher), 954 : dispatcher_(dispatcher),
953 filter_(filter), 955 filter_(filter),
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 : dispatcher_(dispatcher), window_(nullptr) {} 2598 : dispatcher_(dispatcher), window_(nullptr) {}
2597 2599
2598 void set_window(Window* window) { 2600 void set_window(Window* window) {
2599 window_ = window; 2601 window_ = window;
2600 } 2602 }
2601 private: 2603 private:
2602 void OnTouchEvent(ui::TouchEvent* event) override { 2604 void OnTouchEvent(ui::TouchEvent* event) override {
2603 // Convert touch event back to root window coordinates. 2605 // Convert touch event back to root window coordinates.
2604 event->ConvertLocationToTarget(window_, window_->GetRootWindow()); 2606 event->ConvertLocationToTarget(window_, window_->GetRootWindow());
2605 event->DisableSynchronousHandling(); 2607 event->DisableSynchronousHandling();
2606 dispatcher_->ProcessedTouchEvent(event->unique_event_id(), window_, 2608 dispatcher_->ProcessedTouchEvent(
2607 ui::ER_UNHANDLED); 2609 event->unique_event_id(), window_, ui::ER_UNHANDLED,
2610 false /* is_source_touch_event_set_non_blocking */);
2608 event->StopPropagation(); 2611 event->StopPropagation();
2609 } 2612 }
2610 2613
2611 WindowEventDispatcher* dispatcher_; 2614 WindowEventDispatcher* dispatcher_;
2612 Window* window_; 2615 Window* window_;
2613 2616
2614 DISALLOW_COPY_AND_ASSIGN(AsyncWindowDelegate); 2617 DISALLOW_COPY_AND_ASSIGN(AsyncWindowDelegate);
2615 }; 2618 };
2616 2619
2617 // Tests that gesture events dispatched through the asynchronous flow have 2620 // Tests that gesture events dispatched through the asynchronous flow have
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
2948 EXPECT_EQ(1, last_event_location_delegate.mouse_event_count()); 2951 EXPECT_EQ(1, last_event_location_delegate.mouse_event_count());
2949 EXPECT_EQ(1, last_event_location_delegate.nested_message_loop_count()); 2952 EXPECT_EQ(1, last_event_location_delegate.nested_message_loop_count());
2950 EXPECT_EQ(mouse_location, last_event_location_delegate.last_mouse_location()); 2953 EXPECT_EQ(mouse_location, last_event_location_delegate.last_mouse_location());
2951 2954
2952 // After dispatch the location should fallback to that of the 2955 // After dispatch the location should fallback to that of the
2953 // WindowTreeClient, which defaults to 0,0. 2956 // WindowTreeClient, which defaults to 0,0.
2954 EXPECT_EQ(gfx::Point(0, 0), Env::GetInstance()->last_mouse_location()); 2957 EXPECT_EQ(gfx::Point(0, 0), Env::GetInstance()->last_mouse_location());
2955 } 2958 }
2956 2959
2957 } // namespace aura 2960 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698