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

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: 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 23 matching lines...) Expand all
34 namespace { 34 namespace {
35 35
36 const char kNonBlockingEventDataURL[] = 36 const char kNonBlockingEventDataURL[] =
37 "data:text/html;charset=utf-8," 37 "data:text/html;charset=utf-8,"
38 "<!DOCTYPE html>" 38 "<!DOCTYPE html>"
39 "<meta name='viewport' content='width=device-width'/>" 39 "<meta name='viewport' content='width=device-width'/>"
40 "<style>" 40 "<style>"
41 "html, body {" 41 "html, body {"
42 " margin: 0;" 42 " margin: 0;"
43 "}" 43 "}"
44 ".spacer { height: 1000px; }" 44 ".spacer { height: 10000px; }"
45 "</style>" 45 "</style>"
46 "<div class=spacer></div>" 46 "<div class=spacer></div>"
47 "<script>" 47 "<script>"
48 " document.addEventListener('wheel', function(e) { while(true) {} }, " 48 " document.addEventListener('wheel', function(e) { while(true) {} }, "
49 "{'passive': true});" 49 "{'passive': true});"
50 " document.addEventListener('touchstart', function(e) { while(true) {} }, " 50 " document.addEventListener('touchstart', function(e) { while(true) {} }, "
51 "{'passive': true});" 51 "{'passive': true});"
52 " document.title='ready';" 52 " document.title='ready';"
53 "</script>"; 53 "</script>";
54 54
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 int GetScrollTop() { 104 int GetScrollTop() {
105 return ExecuteScriptAndExtractInt("document.scrollingElement.scrollTop"); 105 return ExecuteScriptAndExtractInt("document.scrollingElement.scrollTop");
106 } 106 }
107 107
108 void DoWheelScroll() { 108 void DoWheelScroll() {
109 EXPECT_EQ(0, GetScrollTop()); 109 EXPECT_EQ(0, GetScrollTop());
110 110
111 int scrollHeight = 111 int scrollHeight =
112 ExecuteScriptAndExtractInt("document.documentElement.scrollHeight"); 112 ExecuteScriptAndExtractInt("document.documentElement.scrollHeight");
113 EXPECT_EQ(1000, scrollHeight); 113 EXPECT_EQ(10000, scrollHeight);
tdresser 2016/03/11 13:27:23 Can we factor this out into a constant, with a com
114 114
115 scoped_refptr<FrameWatcher> frame_watcher(new FrameWatcher()); 115 scoped_refptr<FrameWatcher> frame_watcher(new FrameWatcher());
116 GetWidgetHost()->GetProcess()->AddFilter(frame_watcher.get()); 116 GetWidgetHost()->GetProcess()->AddFilter(frame_watcher.get());
117 scoped_refptr<InputMsgWatcher> input_msg_watcher( 117 scoped_refptr<InputMsgWatcher> input_msg_watcher(
118 new InputMsgWatcher(GetWidgetHost(), blink::WebInputEvent::MouseWheel)); 118 new InputMsgWatcher(GetWidgetHost(), blink::WebInputEvent::MouseWheel));
119 119
120 GetWidgetHost()->ForwardWheelEvent( 120 GetWidgetHost()->ForwardWheelEvent(
121 SyntheticWebMouseWheelEventBuilder::Build(10, 10, 0, -53, 0, true)); 121 SyntheticWebMouseWheelEventBuilder::Build(10, 10, 0, -53, 0, true));
122 122
123 // Runs until we get the InputMsgAck callback 123 // Runs until we get the InputMsgAck callback
124 EXPECT_EQ(INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING, 124 EXPECT_EQ(INPUT_EVENT_ACK_STATE_SET_NON_BLOCKING,
125 input_msg_watcher->WaitForAck()); 125 input_msg_watcher->WaitForAck());
126 frame_watcher->WaitFrames(1); 126 frame_watcher->WaitFrames(1);
127 127
128 // Expect that the compositor scrolled at least one pixel while the 128 // Expect that the compositor scrolled at least one pixel while the
129 // main thread was in a busy loop. 129 // main thread was in a busy loop.
130 EXPECT_LT(0, frame_watcher->LastMetadata().root_scroll_offset.y()); 130 EXPECT_LT(0, frame_watcher->LastMetadata().root_scroll_offset.y());
131 } 131 }
132 132
133 void DoTouchScroll() { 133 void DoTouchScroll() {
134 EXPECT_EQ(0, GetScrollTop()); 134 EXPECT_EQ(0, GetScrollTop());
135 135
136 int scrollHeight = 136 int scrollHeight =
137 ExecuteScriptAndExtractInt("document.documentElement.scrollHeight"); 137 ExecuteScriptAndExtractInt("document.documentElement.scrollHeight");
138 EXPECT_EQ(1000, scrollHeight); 138 EXPECT_EQ(10000, scrollHeight);
139 139
140 scoped_refptr<FrameWatcher> frame_watcher(new FrameWatcher()); 140 scoped_refptr<FrameWatcher> frame_watcher(new FrameWatcher());
141 GetWidgetHost()->GetProcess()->AddFilter(frame_watcher.get()); 141 GetWidgetHost()->GetProcess()->AddFilter(frame_watcher.get());
142 142
143 SyntheticSmoothScrollGestureParams params; 143 SyntheticSmoothScrollGestureParams params;
144 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT; 144 params.gesture_source_type = SyntheticGestureParams::TOUCH_INPUT;
145 params.anchor = gfx::PointF(50, 50); 145 params.anchor = gfx::PointF(50, 50);
146 params.distances.push_back(gfx::Vector2d(0, -45)); 146 params.distances.push_back(gfx::Vector2d(0, -45));
147 147
148 scoped_ptr<SyntheticSmoothScrollGesture> gesture( 148 scoped_ptr<SyntheticSmoothScrollGesture> gesture(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 #define MAYBE_TouchStart DISABLED_TouchStart 184 #define MAYBE_TouchStart DISABLED_TouchStart
185 #else 185 #else
186 #define MAYBE_TouchStart TouchStart 186 #define MAYBE_TouchStart TouchStart
187 #endif 187 #endif
188 IN_PROC_BROWSER_TEST_F(NonBlockingEventBrowserTest, MAYBE_TouchStart) { 188 IN_PROC_BROWSER_TEST_F(NonBlockingEventBrowserTest, MAYBE_TouchStart) {
189 LoadURL(); 189 LoadURL();
190 DoTouchScroll(); 190 DoTouchScroll();
191 } 191 }
192 192
193 } // namespace content 193 } // 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