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

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

Issue 2347903002: Allow for 1px rounding errors in scroll tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 frame_watcher->LastMetadata().root_scroll_offset.y() < 167 frame_watcher->LastMetadata().root_scroll_offset.y() <
168 distance.y()) { 168 distance.y()) {
169 frame_watcher->WaitFrames(1); 169 frame_watcher->WaitFrames(1);
170 } 170 }
171 171
172 // Check the scroll offset 172 // Check the scroll offset
173 int scrollTop = GetScrollTop(); 173 int scrollTop = GetScrollTop();
174 if (scrollTop == 0) 174 if (scrollTop == 0)
175 return false; 175 return false;
176 176
177 EXPECT_EQ(distance.y(), scrollTop); 177 // Allow for 1px rounding inaccuracies for some screen sizes.
178 EXPECT_NEAR(distance.y(), scrollTop, 1);
178 return true; 179 return true;
179 } 180 }
180 181
181 private: 182 private:
182 scoped_refptr<MessageLoopRunner> runner_; 183 scoped_refptr<MessageLoopRunner> runner_;
183 184
184 DISALLOW_COPY_AND_ASSIGN(TouchActionBrowserTest); 185 DISALLOW_COPY_AND_ASSIGN(TouchActionBrowserTest);
185 }; 186 };
186 187
187 // Mac doesn't yet have a gesture recognizer, so can't support turning touch 188 // Mac doesn't yet have a gesture recognizer, so can't support turning touch
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45), false); 223 DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45), false);
223 EXPECT_FALSE(scrolled); 224 EXPECT_FALSE(scrolled);
224 225
225 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); 226 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart"));
226 EXPECT_GE(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1); 227 EXPECT_GE(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1);
227 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); 228 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend"));
228 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); 229 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel"));
229 } 230 }
230 231
231 } // namespace content 232 } // 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