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

Side by Side Diff: content/renderer/render_widget_unittest.cc

Issue 2734563002: Re-enable passthrough touch event queue. (Closed)
Patch Set: Created 3 years, 9 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "content/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <tuple> 7 #include <tuple>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/test/histogram_tester.h" 11 #include "base/test/histogram_tester.h"
12 #include "content/common/input/synthetic_web_input_event_builders.h" 12 #include "content/common/input/synthetic_web_input_event_builders.h"
13 #include "content/common/input_messages.h" 13 #include "content/common/input_messages.h"
14 #include "content/common/resize_params.h" 14 #include "content/common/resize_params.h"
15 #include "content/public/common/content_features.h"
15 #include "content/public/test/mock_render_thread.h" 16 #include "content/public/test/mock_render_thread.h"
16 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h" 17 #include "content/renderer/devtools/render_widget_screen_metrics_emulator.h"
17 #include "content/test/fake_compositor_dependencies.h" 18 #include "content/test/fake_compositor_dependencies.h"
18 #include "content/test/mock_render_process.h" 19 #include "content/test/mock_render_process.h"
19 #include "ipc/ipc_test_sink.h" 20 #include "ipc/ipc_test_sink.h"
20 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 #include "third_party/WebKit/public/platform/WebCoalescedInputEvent.h" 23 #include "third_party/WebKit/public/platform/WebCoalescedInputEvent.h"
23 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h" 24 #include "third_party/WebKit/public/web/WebDeviceEmulationParams.h"
24 #include "ui/events/base_event_utils.h" 25 #include "ui/events/base_event_utils.h"
(...skipping 14 matching lines...) Expand all
39 PASSIVE_LISTENER_UMA_ENUM_PASSIVE, 40 PASSIVE_LISTENER_UMA_ENUM_PASSIVE,
40 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE, 41 PASSIVE_LISTENER_UMA_ENUM_UNCANCELABLE,
41 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED, 42 PASSIVE_LISTENER_UMA_ENUM_SUPPRESSED,
42 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE, 43 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE,
43 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED, 44 PASSIVE_LISTENER_UMA_ENUM_CANCELABLE_AND_CANCELED,
44 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING, 45 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_FLING,
45 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPONSIVENES S, 46 PASSIVE_LISTENER_UMA_ENUM_FORCED_NON_BLOCKING_DUE_TO_MAIN_THREAD_RESPONSIVENES S,
46 PASSIVE_LISTENER_UMA_ENUM_COUNT 47 PASSIVE_LISTENER_UMA_ENUM_COUNT
47 }; 48 };
48 49
50 bool ShouldBlockEventStream(const blink::WebInputEvent& event) {
51 return ui::WebInputEventTraits::ShouldBlockEventStream(
52 event,
53 base::FeatureList::IsEnabled(features::kRafAlignedTouchInputEvents));
54 }
55
49 class MockWebWidget : public blink::WebWidget { 56 class MockWebWidget : public blink::WebWidget {
50 public: 57 public:
51 MOCK_METHOD1( 58 MOCK_METHOD1(
52 handleInputEvent, 59 handleInputEvent,
53 blink::WebInputEventResult(const blink::WebCoalescedInputEvent&)); 60 blink::WebInputEventResult(const blink::WebCoalescedInputEvent&));
54 }; 61 };
55 62
56 } // namespace 63 } // namespace
57 64
58 class InteractiveRenderWidget : public RenderWidget { 65 class InteractiveRenderWidget : public RenderWidget {
(...skipping 10 matching lines...) Expand all
69 Init(RenderWidget::ShowCallback(), mock_webwidget()); 76 Init(RenderWidget::ShowCallback(), mock_webwidget());
70 } 77 }
71 78
72 void SetTouchRegion(const std::vector<gfx::Rect>& rects) { 79 void SetTouchRegion(const std::vector<gfx::Rect>& rects) {
73 rects_ = rects; 80 rects_ = rects;
74 } 81 }
75 82
76 void SendInputEvent(const blink::WebInputEvent& event) { 83 void SendInputEvent(const blink::WebInputEvent& event) {
77 OnHandleInputEvent( 84 OnHandleInputEvent(
78 &event, std::vector<const blink::WebInputEvent*>(), ui::LatencyInfo(), 85 &event, std::vector<const blink::WebInputEvent*>(), ui::LatencyInfo(),
79 ui::WebInputEventTraits::ShouldBlockEventStream(event) 86 ShouldBlockEventStream(event)
80 ? InputEventDispatchType::DISPATCH_TYPE_BLOCKING 87 ? InputEventDispatchType::DISPATCH_TYPE_BLOCKING
81 : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING); 88 : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING);
82 } 89 }
83 90
84 void set_always_overscroll(bool overscroll) { 91 void set_always_overscroll(bool overscroll) {
85 always_overscroll_ = overscroll; 92 always_overscroll_ = overscroll;
86 } 93 }
87 94
88 IPC::TestSink* sink() { return &sink_; } 95 IPC::TestSink* sink() { return &sink_; }
89 96
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 blink::WebRect popup_emulated_rect(130, 170, 100, 400); 533 blink::WebRect popup_emulated_rect(130, 170, 100, 400);
527 widget()->setWindowRect(popup_emulated_rect); 534 widget()->setWindowRect(popup_emulated_rect);
528 535
529 EXPECT_EQ(popup_emulated_rect.x, widget()->windowRect().x); 536 EXPECT_EQ(popup_emulated_rect.x, widget()->windowRect().x);
530 EXPECT_EQ(popup_emulated_rect.y, widget()->windowRect().y); 537 EXPECT_EQ(popup_emulated_rect.y, widget()->windowRect().y);
531 EXPECT_EQ(popup_emulated_rect.x, widget()->viewRect().x); 538 EXPECT_EQ(popup_emulated_rect.x, widget()->viewRect().x);
532 EXPECT_EQ(popup_emulated_rect.y, widget()->viewRect().y); 539 EXPECT_EQ(popup_emulated_rect.y, widget()->viewRect().y);
533 } 540 }
534 541
535 } // namespace content 542 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698