| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 int value = 0; | 104 int value = 0; |
| 105 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | 105 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( |
| 106 shell(), "domAutomationController.send(" + script + ")", &value)); | 106 shell(), "domAutomationController.send(" + script + ")", &value)); |
| 107 return value; | 107 return value; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void DoMouseMove() { | 110 void DoMouseMove() { |
| 111 // Send a click event to cause some jankiness. This is done via a click | 111 // Send a click event to cause some jankiness. This is done via a click |
| 112 // event as ExecuteScript is synchronous. | 112 // event as ExecuteScript is synchronous. |
| 113 SimulateMouseClick(shell()->web_contents(), 0, | 113 SimulateMouseClick(shell()->web_contents(), 0, |
| 114 blink::WebPointerProperties::ButtonLeft); | 114 blink::WebPointerProperties::Button::Left); |
| 115 scoped_refptr<InputMsgWatcher> input_msg_watcher( | 115 scoped_refptr<InputMsgWatcher> input_msg_watcher( |
| 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. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 143 kEvents[1].PressPoint(10, 10); | 143 kEvents[1].PressPoint(10, 10); |
| 144 kEvents[1].MovePoint(0, 20, 20); | 144 kEvents[1].MovePoint(0, 20, 20); |
| 145 kEvents[2].PressPoint(10, 10); | 145 kEvents[2].PressPoint(10, 10); |
| 146 kEvents[2].MovePoint(0, 30, 30); | 146 kEvents[2].MovePoint(0, 30, 30); |
| 147 kEvents[3].PressPoint(10, 10); | 147 kEvents[3].PressPoint(10, 10); |
| 148 kEvents[3].MovePoint(0, 35, 40); | 148 kEvents[3].MovePoint(0, 35, 40); |
| 149 | 149 |
| 150 // Send a click event to cause some jankiness. This is done via a click | 150 // Send a click event to cause some jankiness. This is done via a click |
| 151 // event as ExecuteScript is synchronous. | 151 // event as ExecuteScript is synchronous. |
| 152 SimulateMouseClick(shell()->web_contents(), 0, | 152 SimulateMouseClick(shell()->web_contents(), 0, |
| 153 blink::WebPointerProperties::ButtonLeft); | 153 blink::WebPointerProperties::Button::Left); |
| 154 scoped_refptr<InputMsgWatcher> input_msg_watcher( | 154 scoped_refptr<InputMsgWatcher> input_msg_watcher( |
| 155 new InputMsgWatcher(GetWidgetHost(), blink::WebInputEvent::TouchMove)); | 155 new InputMsgWatcher(GetWidgetHost(), blink::WebInputEvent::TouchMove)); |
| 156 | 156 |
| 157 for (const auto& event : kEvents) | 157 for (const auto& event : kEvents) |
| 158 GetWidgetHost()->ForwardEmulatedTouchEvent(event); | 158 GetWidgetHost()->ForwardEmulatedTouchEvent(event); |
| 159 | 159 |
| 160 // Runs until we get the InputMsgAck callback. | 160 // Runs until we get the InputMsgAck callback. |
| 161 EXPECT_EQ(INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING, | 161 EXPECT_EQ(INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING, |
| 162 input_msg_watcher->WaitForAck()); | 162 input_msg_watcher->WaitForAck()); |
| 163 | 163 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 188 #define MAYBE_TouchMove DISABLED_TouchMove | 188 #define MAYBE_TouchMove DISABLED_TouchMove |
| 189 #else | 189 #else |
| 190 #define MAYBE_TouchMove TouchMove | 190 #define MAYBE_TouchMove TouchMove |
| 191 #endif | 191 #endif |
| 192 IN_PROC_BROWSER_TEST_F(MainThreadEventQueueBrowserTest, MAYBE_TouchMove) { | 192 IN_PROC_BROWSER_TEST_F(MainThreadEventQueueBrowserTest, MAYBE_TouchMove) { |
| 193 LoadURL(kJankyPageURL); | 193 LoadURL(kJankyPageURL); |
| 194 DoTouchMove(); | 194 DoTouchMove(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace content | 197 } // namespace content |
| OLD | NEW |