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

Side by Side Diff: content/browser/renderer_host/input/non_blocking_event_browsertest.cc

Issue 1781133002: Change page size for NonBlockingEventBrowserTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed raw string literal Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
26 #include "content/public/test/test_utils.h" 26 #include "content/public/test/test_utils.h"
27 #include "content/shell/browser/shell.h" 27 #include "content/shell/browser/shell.h"
28 #include "third_party/WebKit/public/web/WebInputEvent.h" 28 #include "third_party/WebKit/public/web/WebInputEvent.h"
29 #include "ui/events/event_switches.h" 29 #include "ui/events/event_switches.h"
30 #include "ui/events/latency_info.h" 30 #include "ui/events/latency_info.h"
31 31
32 using blink::WebInputEvent; 32 using blink::WebInputEvent;
33 33
34 namespace { 34 namespace {
35 35
36 // This value has to be larger than the height of the device this test is
37 // executed on, otherwise the device will be unable to scroll thus failing
38 // tests.
39 const int kWebsiteHeight = 10000;
40
36 const char kNonBlockingEventDataURL[] = 41 const char kNonBlockingEventDataURL[] =
37 "data:text/html;charset=utf-8," 42 "data:text/html;charset=utf-8,"
38 "<!DOCTYPE html>" 43 "<!DOCTYPE html>"
39 "<meta name='viewport' content='width=device-width'/>" 44 "<meta name='viewport' content='width=device-width'/>"
40 "<style>" 45 "<style>"
41 "html, body {" 46 "html, body {"
42 " margin: 0;" 47 " margin: 0;"
43 "}" 48 "}"
44 ".spacer { height: 1000px; }" 49 ".spacer { height: 10000px; }"
45 "</style>" 50 "</style>"
46 "<div class=spacer></div>" 51 "<div class=spacer></div>"
47 "<script>" 52 "<script>"
48 " document.addEventListener('wheel', function(e) { while(true) {} }, " 53 " document.addEventListener('wheel', function(e) { while(true) {} }, "
49 "{'passive': true});" 54 "{'passive': true});"
50 " document.addEventListener('touchstart', function(e) { while(true) {} }, " 55 " document.addEventListener('touchstart', function(e) { while(true) {} }, "
51 "{'passive': true});" 56 "{'passive': true});"
52 " document.title='ready';" 57 " document.title='ready';"
53 "</script>"; 58 "</script>";
54 59
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 108
104 int GetScrollTop() { 109 int GetScrollTop() {
105 return ExecuteScriptAndExtractInt("document.scrollingElement.scrollTop"); 110 return ExecuteScriptAndExtractInt("document.scrollingElement.scrollTop");
106 } 111 }
107 112
108 void DoWheelScroll() { 113 void DoWheelScroll() {
109 EXPECT_EQ(0, GetScrollTop()); 114 EXPECT_EQ(0, GetScrollTop());
110 115
111 int scrollHeight = 116 int scrollHeight =
112 ExecuteScriptAndExtractInt("document.documentElement.scrollHeight"); 117 ExecuteScriptAndExtractInt("document.documentElement.scrollHeight");
113 EXPECT_EQ(1000, scrollHeight); 118 EXPECT_EQ(kWebsiteHeight, scrollHeight);
114 119
115 scoped_refptr<FrameWatcher> frame_watcher(new FrameWatcher()); 120 scoped_refptr<FrameWatcher> frame_watcher(new FrameWatcher());
116 GetWidgetHost()->GetProcess()->AddFilter(frame_watcher.get()); 121 GetWidgetHost()->GetProcess()->AddFilter(frame_watcher.get());
117 scoped_refptr<InputMsgWatcher> input_msg_watcher( 122 scoped_refptr<InputMsgWatcher> input_msg_watcher(
118 new InputMsgWatcher(GetWidgetHost(), blink::WebInputEvent::MouseWheel)); 123 new InputMsgWatcher(GetWidgetHost(), blink::WebInputEvent::MouseWheel));
119 124
120 GetWidgetHost()->ForwardWheelEvent( 125 GetWidgetHost()->ForwardWheelEvent(
121 SyntheticWebMouseWheelEventBuilder::Build(10, 10, 0, -53, 0, true)); 126 SyntheticWebMouseWheelEventBuilder::Build(10, 10, 0, -53, 0, true));
122 127
123 // Runs until we get the InputMsgAck callback 128 // Runs until we get the InputMsgAck callback
124 EXPECT_EQ(INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING, 129 EXPECT_EQ(INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING,
125 input_msg_watcher->WaitForAck()); 130 input_msg_watcher->WaitForAck());
126 frame_watcher->WaitFrames(1); 131 frame_watcher->WaitFrames(1);
127 132
128 // Expect that the compositor scrolled at least one pixel while the 133 // Expect that the compositor scrolled at least one pixel while the
129 // main thread was in a busy loop. 134 // main thread was in a busy loop.
130 EXPECT_LT(0, frame_watcher->LastMetadata().root_scroll_offset.y()); 135 EXPECT_LT(0, frame_watcher->LastMetadata().root_scroll_offset.y());
131 } 136 }
132 137
133 void DoTouchScroll() { 138 void DoTouchScroll() {
134 EXPECT_EQ(0, GetScrollTop()); 139 EXPECT_EQ(0, GetScrollTop());
135 140
136 int scrollHeight = 141 int scrollHeight =
137 ExecuteScriptAndExtractInt("document.documentElement.scrollHeight"); 142 ExecuteScriptAndExtractInt("document.documentElement.scrollHeight");
138 EXPECT_EQ(1000, scrollHeight); 143 EXPECT_EQ(kWebsiteHeight, scrollHeight);
139 144
140 scoped_refptr<FrameWatcher> frame_watcher(new FrameWatcher()); 145 scoped_refptr<FrameWatcher> frame_watcher(new FrameWatcher());
141 GetWidgetHost()->GetProcess()->AddFilter(frame_watcher.get()); 146 GetWidgetHost()->GetProcess()->AddFilter(frame_watcher.get());
142 147
143 SyntheticSmoothScrollGestureParams params; 148 SyntheticSmoothScrollGestureParams params;
144 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; 149 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
145 params.anchor = gfx::PointF(50, 50); 150 params.anchor = gfx::PointF(50, 50);
146 params.distances.push_back(gfx::Vector2d(0, -45)); 151 params.distances.push_back(gfx::Vector2d(0, -45));
147 152
148 scoped_ptr<SyntheticSmoothScrollGesture> gesture( 153 scoped_ptr<SyntheticSmoothScrollGesture> gesture(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 #define MAYBE_TouchStart DISABLED_TouchStart 189 #define MAYBE_TouchStart DISABLED_TouchStart
185 #else 190 #else
186 #define MAYBE_TouchStart TouchStart 191 #define MAYBE_TouchStart TouchStart
187 #endif 192 #endif
188 IN_PROC_BROWSER_TEST_F(NonBlockingEventBrowserTest, MAYBE_TouchStart) { 193 IN_PROC_BROWSER_TEST_F(NonBlockingEventBrowserTest, MAYBE_TouchStart) {
189 LoadURL(); 194 LoadURL();
190 DoTouchScroll(); 195 DoTouchScroll();
191 } 196 }
192 197
193 } // namespace content 198 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698