| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 new InputMsgWatcher(GetWidgetHost(), blink::WebInputEvent::MouseMove)); | 116 new InputMsgWatcher(GetWidgetHost(), blink::WebInputEvent::MouseMove)); |
| 117 GetWidgetHost()->ForwardMouseEvent(SyntheticWebMouseEventBuilder::Build( | 117 GetWidgetHost()->ForwardMouseEvent(SyntheticWebMouseEventBuilder::Build( |
| 118 blink::WebInputEvent::MouseMove, 10, 10, 0)); | 118 blink::WebInputEvent::MouseMove, 10, 10, 0)); |
| 119 GetWidgetHost()->ForwardMouseEvent(SyntheticWebMouseEventBuilder::Build( | 119 GetWidgetHost()->ForwardMouseEvent(SyntheticWebMouseEventBuilder::Build( |
| 120 blink::WebInputEvent::MouseMove, 15, 15, 0)); | 120 blink::WebInputEvent::MouseMove, 15, 15, 0)); |
| 121 GetWidgetHost()->ForwardMouseEvent(SyntheticWebMouseEventBuilder::Build( | 121 GetWidgetHost()->ForwardMouseEvent(SyntheticWebMouseEventBuilder::Build( |
| 122 blink::WebInputEvent::MouseMove, 20, 25, 0)); | 122 blink::WebInputEvent::MouseMove, 20, 25, 0)); |
| 123 | 123 |
| 124 // Runs until we get the InputMsgAck callback. | 124 // Runs until we get the InputMsgAck callback. |
| 125 EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, input_msg_watcher->WaitForAck()); | 125 EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, input_msg_watcher->WaitForAck()); |
| 126 EXPECT_EQ(InputEventAckSource::MAIN_THREAD, |
| 127 static_cast<InputEventAckSource>( |
| 128 input_msg_watcher->last_event_ack_source())); |
| 126 | 129 |
| 127 int mouse_move_count = 0; | 130 int mouse_move_count = 0; |
| 128 while (mouse_move_count <= 0) | 131 while (mouse_move_count <= 0) |
| 129 mouse_move_count = ExecuteScriptAndExtractInt("window.mouseMoveCount"); | 132 mouse_move_count = ExecuteScriptAndExtractInt("window.mouseMoveCount"); |
| 130 EXPECT_EQ(1, mouse_move_count); | 133 EXPECT_EQ(1, mouse_move_count); |
| 131 | 134 |
| 132 int last_mouse_x = | 135 int last_mouse_x = |
| 133 ExecuteScriptAndExtractInt("window.lastMouseMoveEvent.x"); | 136 ExecuteScriptAndExtractInt("window.lastMouseMoveEvent.x"); |
| 134 int last_mouse_y = | 137 int last_mouse_y = |
| 135 ExecuteScriptAndExtractInt("window.lastMouseMoveEvent.y"); | 138 ExecuteScriptAndExtractInt("window.lastMouseMoveEvent.y"); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 153 blink::WebPointerProperties::Button::Left); | 156 blink::WebPointerProperties::Button::Left); |
| 154 scoped_refptr<InputMsgWatcher> input_msg_watcher( | 157 scoped_refptr<InputMsgWatcher> input_msg_watcher( |
| 155 new InputMsgWatcher(GetWidgetHost(), blink::WebInputEvent::TouchMove)); | 158 new InputMsgWatcher(GetWidgetHost(), blink::WebInputEvent::TouchMove)); |
| 156 | 159 |
| 157 for (const auto& event : kEvents) | 160 for (const auto& event : kEvents) |
| 158 GetWidgetHost()->ForwardEmulatedTouchEvent(event); | 161 GetWidgetHost()->ForwardEmulatedTouchEvent(event); |
| 159 | 162 |
| 160 // Runs until we get the InputMsgAck callback. | 163 // Runs until we get the InputMsgAck callback. |
| 161 EXPECT_EQ(INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING, | 164 EXPECT_EQ(INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING, |
| 162 input_msg_watcher->WaitForAck()); | 165 input_msg_watcher->WaitForAck()); |
| 166 EXPECT_EQ(InputEventAckSource::COMPOSITOR_THREAD, |
| 167 static_cast<InputEventAckSource>( |
| 168 input_msg_watcher->last_event_ack_source())); |
| 163 | 169 |
| 164 int touch_move_count = 0; | 170 int touch_move_count = 0; |
| 165 while (touch_move_count <= 0) | 171 while (touch_move_count <= 0) |
| 166 touch_move_count = ExecuteScriptAndExtractInt("window.touchMoveCount"); | 172 touch_move_count = ExecuteScriptAndExtractInt("window.touchMoveCount"); |
| 167 EXPECT_EQ(1, touch_move_count); | 173 EXPECT_EQ(1, touch_move_count); |
| 168 | 174 |
| 169 int last_touch_x = ExecuteScriptAndExtractInt( | 175 int last_touch_x = ExecuteScriptAndExtractInt( |
| 170 "window.lastTouchMoveEvent.touches[0].pageX"); | 176 "window.lastTouchMoveEvent.touches[0].pageX"); |
| 171 int last_touch_y = ExecuteScriptAndExtractInt( | 177 int last_touch_y = ExecuteScriptAndExtractInt( |
| 172 "window.lastTouchMoveEvent.touches[0].pageY"); | 178 "window.lastTouchMoveEvent.touches[0].pageY"); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 188 #define MAYBE_TouchMove DISABLED_TouchMove | 194 #define MAYBE_TouchMove DISABLED_TouchMove |
| 189 #else | 195 #else |
| 190 #define MAYBE_TouchMove TouchMove | 196 #define MAYBE_TouchMove TouchMove |
| 191 #endif | 197 #endif |
| 192 IN_PROC_BROWSER_TEST_F(MainThreadEventQueueBrowserTest, MAYBE_TouchMove) { | 198 IN_PROC_BROWSER_TEST_F(MainThreadEventQueueBrowserTest, MAYBE_TouchMove) { |
| 193 LoadURL(kJankyPageURL); | 199 LoadURL(kJankyPageURL); |
| 194 DoTouchMove(); | 200 DoTouchMove(); |
| 195 } | 201 } |
| 196 | 202 |
| 197 } // namespace content | 203 } // namespace content |
| OLD | NEW |