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

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

Issue 2399153002: Fix precision problem in TouchActionBrowserTest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 2 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 <limits>
5 #include <utility> 6 #include <utility>
6 7
7 #include "base/auto_reset.h" 8 #include "base/auto_reset.h"
8 #include "base/bind.h" 9 #include "base/bind.h"
9 #include "base/command_line.h" 10 #include "base/command_line.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/run_loop.h" 12 #include "base/run_loop.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
14 #include "content/browser/renderer_host/input/synthetic_gesture.h" 15 #include "content/browser/renderer_host/input/synthetic_gesture.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 base::Bind(&TouchActionBrowserTest::OnSyntheticGestureCompleted, 158 base::Bind(&TouchActionBrowserTest::OnSyntheticGestureCompleted,
158 base::Unretained(this))); 159 base::Unretained(this)));
159 160
160 // Runs until we get the OnSyntheticGestureCompleted callback 161 // Runs until we get the OnSyntheticGestureCompleted callback
161 runner_->Run(); 162 runner_->Run();
162 runner_ = NULL; 163 runner_ = NULL;
163 164
164 // Expect that the compositor scrolled at least one pixel while the 165 // Expect that the compositor scrolled at least one pixel while the
165 // main thread was in a busy loop. 166 // main thread was in a busy loop.
166 while (wait_until_scrolled && 167 while (wait_until_scrolled &&
167 frame_watcher->LastMetadata().root_scroll_offset.y() < 168 (frame_watcher->LastMetadata().root_scroll_offset.y() -
168 distance.y()) { 169 distance.y()) > std::numeric_limits<double>::epsilon()) {
aelias_OOO_until_Jul13 2016/10/06 19:33:51 This is the second time we've had precision proble
huapengl 2016/10/07 16:59:40 Done.
169 frame_watcher->WaitFrames(1); 170 frame_watcher->WaitFrames(1);
170 } 171 }
171 172
172 // Check the scroll offset 173 // Check the scroll offset
173 int scrollTop = GetScrollTop(); 174 int scrollTop = GetScrollTop();
174 if (scrollTop == 0) 175 if (scrollTop == 0)
175 return false; 176 return false;
176 177
177 // Allow for 1px rounding inaccuracies for some screen sizes. 178 // Allow for 1px rounding inaccuracies for some screen sizes.
178 EXPECT_NEAR(distance.y(), scrollTop, 1); 179 EXPECT_NEAR(distance.y(), scrollTop, 1);
aelias_OOO_until_Jul13 2016/10/06 19:33:51 Please replace this line by EXPECT_LT(distance.y()
huapengl 2016/10/07 16:59:40 Done.
179 return true; 180 return true;
180 } 181 }
181 182
182 private: 183 private:
183 scoped_refptr<MessageLoopRunner> runner_; 184 scoped_refptr<MessageLoopRunner> runner_;
184 185
185 DISALLOW_COPY_AND_ASSIGN(TouchActionBrowserTest); 186 DISALLOW_COPY_AND_ASSIGN(TouchActionBrowserTest);
186 }; 187 };
187 188
188 // Mac doesn't yet have a gesture recognizer, so can't support turning touch 189 // 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
223 DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45), false); 224 DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45), false);
224 EXPECT_FALSE(scrolled); 225 EXPECT_FALSE(scrolled);
225 226
226 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); 227 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart"));
227 EXPECT_GE(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1); 228 EXPECT_GE(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1);
228 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); 229 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend"));
229 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); 230 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel"));
230 } 231 }
231 232
232 } // namespace content 233 } // 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