summaryrefslogtreecommitdiff
path: root/chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-03 13:42:47 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-15 10:27:51 +0000
commit8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (patch)
treed29d987c4d7b173cf853279b79a51598f104b403 /chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc
parent830c9e163d31a9180fadca926b3e1d7dfffb5021 (diff)
downloadqtwebengine-chromium-8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec.tar.gz
BASELINE: Update Chromium to 66.0.3359.156
Change-Id: I0c9831ad39911a086b6377b16f995ad75a51e441 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc')
-rw-r--r--chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc65
1 files changed, 36 insertions, 29 deletions
diff --git a/chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc b/chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc
index 9c214ece654..fbd77cb7d43 100644
--- a/chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc
+++ b/chromium/content/browser/renderer_host/input/wheel_scroll_latching_browsertest.cc
@@ -127,6 +127,12 @@ class WheelScrollLatchingBrowserTest : public ContentBrowserTest {
shell(), "domAutomationController.send(" + script + ")", &value));
return value;
}
+ double ExecuteScriptAndExtractDouble(const std::string& script) {
+ double value = 0;
+ EXPECT_TRUE(content::ExecuteScriptAndExtractDouble(
+ shell(), "domAutomationController.send(" + script + ")", &value));
+ return value;
+ }
std::string ExecuteScriptAndExtractString(const std::string& script) {
std::string value = "";
EXPECT_TRUE(content::ExecuteScriptAndExtractString(
@@ -185,11 +191,11 @@ void WheelScrollLatchingBrowserTest::WheelEventTargetTest() {
auto input_msg_watcher = std::make_unique<InputMsgWatcher>(
GetWidgetHost(), blink::WebInputEvent::kMouseWheel);
- float scrollable_div_top =
- ExecuteScriptAndExtractInt("scrollableDiv.getBoundingClientRect().top");
- float x = (ExecuteScriptAndExtractInt(
+ float scrollable_div_top = ExecuteScriptAndExtractDouble(
+ "scrollableDiv.getBoundingClientRect().top");
+ float x = (ExecuteScriptAndExtractDouble(
"scrollableDiv.getBoundingClientRect().left") +
- ExecuteScriptAndExtractInt(
+ ExecuteScriptAndExtractDouble(
"scrollableDiv.getBoundingClientRect().right")) /
2;
float y = 0.5 * scrollable_div_top;
@@ -207,12 +213,12 @@ void WheelScrollLatchingBrowserTest::WheelEventTargetTest() {
EXPECT_EQ(INPUT_EVENT_ACK_STATE_NOT_CONSUMED,
input_msg_watcher->WaitForAck());
- while (ExecuteScriptAndExtractInt("document.scrollingElement.scrollTop") <
+ while (ExecuteScriptAndExtractDouble("document.scrollingElement.scrollTop") <
-delta_y) {
frame_observer.Wait();
}
- EXPECT_EQ(0, ExecuteScriptAndExtractInt("scrollableDiv.scrollTop"));
+ EXPECT_EQ(0, ExecuteScriptAndExtractDouble("scrollableDiv.scrollTop"));
EXPECT_EQ(1, ExecuteScriptAndExtractInt("documentWheelEventCounter"));
EXPECT_EQ(0, ExecuteScriptAndExtractInt("scrollableDivWheelEventCounter"));
@@ -227,16 +233,17 @@ void WheelScrollLatchingBrowserTest::WheelEventTargetTest() {
}
if (wheel_scroll_latching_enabled_) {
- while (ExecuteScriptAndExtractInt("document.scrollingElement.scrollTop") <
- -2 * delta_y) {
+ while (ExecuteScriptAndExtractDouble(
+ "document.scrollingElement.scrollTop") < -2 * delta_y) {
frame_observer.Wait();
}
- EXPECT_EQ(0, ExecuteScriptAndExtractInt("scrollableDiv.scrollTop"));
+ EXPECT_EQ(0, ExecuteScriptAndExtractDouble("scrollableDiv.scrollTop"));
EXPECT_EQ(2, ExecuteScriptAndExtractInt("documentWheelEventCounter"));
EXPECT_EQ(0, ExecuteScriptAndExtractInt("scrollableDivWheelEventCounter"));
} else { // !wheel_scroll_latching_enabled_
- while (ExecuteScriptAndExtractInt("scrollableDiv.scrollTop") < -delta_y)
+ while (ExecuteScriptAndExtractDouble("scrollableDiv.scrollTop") <
+ -delta_y)
frame_observer.Wait();
EXPECT_EQ(1, ExecuteScriptAndExtractInt("documentWheelEventCounter"));
@@ -282,11 +289,11 @@ void WheelScrollLatchingBrowserTest::WheelEventRetargetWhenTargetRemovedTest() {
auto update_msg_watcher = std::make_unique<InputMsgWatcher>(
GetWidgetHost(), blink::WebInputEvent::kGestureScrollUpdate);
- float scrollable_div_top =
- ExecuteScriptAndExtractInt("scrollableDiv.getBoundingClientRect().top");
- float x = (ExecuteScriptAndExtractInt(
+ float scrollable_div_top = ExecuteScriptAndExtractDouble(
+ "scrollableDiv.getBoundingClientRect().top");
+ float x = (ExecuteScriptAndExtractDouble(
"scrollableDiv.getBoundingClientRect().left") +
- ExecuteScriptAndExtractInt(
+ ExecuteScriptAndExtractDouble(
"scrollableDiv.getBoundingClientRect().right")) /
2;
float y = 1.1 * scrollable_div_top;
@@ -302,8 +309,8 @@ void WheelScrollLatchingBrowserTest::WheelEventRetargetWhenTargetRemovedTest() {
// Runs until we get the UpdateMsgAck callback.
EXPECT_EQ(INPUT_EVENT_ACK_STATE_CONSUMED, update_msg_watcher->WaitForAck());
- EXPECT_EQ(0,
- ExecuteScriptAndExtractInt("document.scrollingElement.scrollTop"));
+ EXPECT_EQ(
+ 0, ExecuteScriptAndExtractDouble("document.scrollingElement.scrollTop"));
EXPECT_EQ(0, ExecuteScriptAndExtractInt("documentWheelEventCounter"));
EXPECT_EQ(1, ExecuteScriptAndExtractInt("scrollableDivWheelEventCounter"));
@@ -349,19 +356,19 @@ void WheelScrollLatchingBrowserTest::
return;
LoadURL();
- EXPECT_EQ(ExecuteScriptAndExtractInt("document.scrollingElement.scrollTop"),
- 0);
- EXPECT_EQ(ExecuteScriptAndExtractInt("scrollableDiv.scrollTop"), 0);
- float x = (ExecuteScriptAndExtractInt(
+ EXPECT_EQ(
+ ExecuteScriptAndExtractDouble("document.scrollingElement.scrollTop"), 0);
+ EXPECT_EQ(ExecuteScriptAndExtractDouble("scrollableDiv.scrollTop"), 0);
+ float x = (ExecuteScriptAndExtractDouble(
"scrollableDiv.getBoundingClientRect().left") +
- ExecuteScriptAndExtractInt(
+ ExecuteScriptAndExtractDouble(
"scrollableDiv.getBoundingClientRect().right")) /
2;
- float y =
- (ExecuteScriptAndExtractInt("scrollableDiv.getBoundingClientRect().top") +
- ExecuteScriptAndExtractInt(
- "scrollableDiv.getBoundingClientRect().bottom")) /
- 2;
+ float y = (ExecuteScriptAndExtractDouble(
+ "scrollableDiv.getBoundingClientRect().top") +
+ ExecuteScriptAndExtractDouble(
+ "scrollableDiv.getBoundingClientRect().bottom")) /
+ 2;
#if defined(OS_CHROMEOS)
bool precise = true;
#else
@@ -371,7 +378,7 @@ void WheelScrollLatchingBrowserTest::
blink::WebGestureEvent gesture_scroll_begin(
blink::WebGestureEvent::kGestureScrollBegin,
blink::WebInputEvent::kNoModifiers,
- blink::WebInputEvent::kTimeStampForTesting);
+ blink::WebInputEvent::GetStaticTimeStampForTests());
gesture_scroll_begin.source_device = blink::kWebGestureDeviceTouchpad;
gesture_scroll_begin.data.scroll_begin.delta_hint_units =
precise ? blink::WebGestureEvent::ScrollUnits::kPrecisePixels
@@ -395,7 +402,7 @@ void WheelScrollLatchingBrowserTest::
GetRootView()->ProcessGestureEvent(gesture_scroll_update, ui::LatencyInfo());
// Wait for the scrollableDiv to scroll.
- while (ExecuteScriptAndExtractInt("scrollableDiv.scrollTop") < 20)
+ while (ExecuteScriptAndExtractDouble("scrollableDiv.scrollTop") < 20)
GiveItSomeTime();
// Remove the scrollableDiv which is the current scroller and send the second
@@ -404,7 +411,7 @@ void WheelScrollLatchingBrowserTest::
shell(), "scrollableDiv.parentNode.removeChild(scrollableDiv)"));
GiveItSomeTime();
GetRootView()->ProcessGestureEvent(gesture_scroll_update, ui::LatencyInfo());
- while (ExecuteScriptAndExtractInt("document.scrollingElement.scrollTop") <
+ while (ExecuteScriptAndExtractDouble("document.scrollingElement.scrollTop") <
20) {
GiveItSomeTime();
}