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

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

Issue 2780373002: Use observer pattern instead of sniffing SwapCompositorFrame IPC (Closed)
Patch Set: Addressed comments Created 3 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 EXPECT_EQ(SyntheticGesture::GESTURE_FINISHED, result); 76 EXPECT_EQ(SyntheticGesture::GESTURE_FINISHED, result);
77 runner_->Quit(); 77 runner_->Quit();
78 } 78 }
79 79
80 protected: 80 protected:
81 void LoadURL() { 81 void LoadURL() {
82 const GURL data_url(kCompositedScrollingDataURL); 82 const GURL data_url(kCompositedScrollingDataURL);
83 NavigateToURL(shell(), data_url); 83 NavigateToURL(shell(), data_url);
84 84
85 RenderWidgetHostImpl* host = GetWidgetHost(); 85 RenderWidgetHostImpl* host = GetWidgetHost();
86 scoped_refptr<FrameWatcher> frame_watcher(new FrameWatcher()); 86 FrameWatcher frame_watcher(shell()->web_contents());
87 frame_watcher->AttachTo(shell()->web_contents());
88 host->GetView()->SetSize(gfx::Size(400, 400)); 87 host->GetView()->SetSize(gfx::Size(400, 400));
89 88
90 base::string16 ready_title(base::ASCIIToUTF16("ready")); 89 base::string16 ready_title(base::ASCIIToUTF16("ready"));
91 TitleWatcher watcher(shell()->web_contents(), ready_title); 90 TitleWatcher watcher(shell()->web_contents(), ready_title);
92 ignore_result(watcher.WaitAndGetTitle()); 91 ignore_result(watcher.WaitAndGetTitle());
93 92
94 // We need to wait until at least one frame has been composited 93 // We need to wait until at least one frame has been composited
95 // otherwise the injection of the synthetic gestures may get 94 // otherwise the injection of the synthetic gestures may get
96 // dropped because of MainThread/Impl thread sync of touch event 95 // dropped because of MainThread/Impl thread sync of touch event
97 // regions. 96 // regions.
98 frame_watcher->WaitFrames(1); 97 frame_watcher.WaitFrames(1);
99 } 98 }
100 99
101 // ContentBrowserTest: 100 // ContentBrowserTest:
102 int ExecuteScriptAndExtractInt(const std::string& script) { 101 int ExecuteScriptAndExtractInt(const std::string& script) {
103 int value = 0; 102 int value = 0;
104 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( 103 EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
105 shell(), "domAutomationController.send(" + script + ")", &value)); 104 shell(), "domAutomationController.send(" + script + ")", &value));
106 return value; 105 return value;
107 } 106 }
108 107
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 MAYBE_Scroll3DTransformedScroller) { 159 MAYBE_Scroll3DTransformedScroller) {
161 LoadURL(); 160 LoadURL();
162 int scrollDistance = 161 int scrollDistance =
163 DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 100)); 162 DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 100));
164 // The scroll distance is increased due to the rotation of the scroller. 163 // The scroll distance is increased due to the rotation of the scroller.
165 EXPECT_EQ(std::floor(100 / std::cos(cc::MathUtil::Deg2Rad(30.f))) - 1, 164 EXPECT_EQ(std::floor(100 / std::cos(cc::MathUtil::Deg2Rad(30.f))) - 1,
166 scrollDistance); 165 scrollDistance);
167 } 166 }
168 167
169 } // namespace content 168 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698