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

Side by Side Diff: content/browser/web_contents/web_contents_view_aura_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/web_contents/web_contents_view_aura.h" 5 #include "content/browser/web_contents/web_contents_view_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <tuple> 8 #include <tuple>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 test_url = GURL(embedded_test_server()->GetURL(url)); 231 test_url = GURL(embedded_test_server()->GetURL(url));
232 NavigateToURL(shell(), test_url); 232 NavigateToURL(shell(), test_url);
233 233
234 WebContentsImpl* web_contents = 234 WebContentsImpl* web_contents =
235 static_cast<WebContentsImpl*>(shell()->web_contents()); 235 static_cast<WebContentsImpl*>(shell()->web_contents());
236 NavigationControllerImpl* controller = &web_contents->GetController(); 236 NavigationControllerImpl* controller = &web_contents->GetController();
237 237
238 screenshot_manager_ = new ScreenshotTracker(controller); 238 screenshot_manager_ = new ScreenshotTracker(controller);
239 controller->SetScreenshotManager(base::WrapUnique(screenshot_manager_)); 239 controller->SetScreenshotManager(base::WrapUnique(screenshot_manager_));
240 240
241 frame_watcher_ = new FrameWatcher(); 241 frame_watcher_.Observe(shell()->web_contents());
242 frame_watcher_->AttachTo(shell()->web_contents());
243 } 242 }
244 243
245 void SetUpCommandLine(base::CommandLine* cmd) override { 244 void SetUpCommandLine(base::CommandLine* cmd) override {
246 cmd->AppendSwitchASCII(switches::kTouchEventFeatureDetection, 245 cmd->AppendSwitchASCII(switches::kTouchEventFeatureDetection,
247 switches::kTouchEventFeatureDetectionEnabled); 246 switches::kTouchEventFeatureDetectionEnabled);
248 } 247 }
249 248
250 void TestOverscrollNavigation(bool touch_handler) { 249 void TestOverscrollNavigation(bool touch_handler) {
251 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html")); 250 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html"));
252 WebContentsImpl* web_contents = 251 WebContentsImpl* web_contents =
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 GetRenderViewHost()->GetWidget()->GetView()); 373 GetRenderViewHost()->GetWidget()->GetView());
375 } 374 }
376 375
377 InputEventMessageFilterWaitsForAcks* filter() { 376 InputEventMessageFilterWaitsForAcks* filter() {
378 return filter_.get(); 377 return filter_.get();
379 } 378 }
380 379
381 void WaitAFrame() { 380 void WaitAFrame() {
382 while (!GetRenderWidgetHost()->ScheduleComposite()) 381 while (!GetRenderWidgetHost()->ScheduleComposite())
383 GiveItSomeTime(); 382 GiveItSomeTime();
384 frame_watcher_->WaitFrames(1); 383 frame_watcher_.WaitFrames(1);
385 } 384 }
386 385
387 protected: 386 protected:
388 ScreenshotTracker* screenshot_manager() { return screenshot_manager_; } 387 ScreenshotTracker* screenshot_manager() { return screenshot_manager_; }
389 void set_min_screenshot_interval(int interval_ms) { 388 void set_min_screenshot_interval(int interval_ms) {
390 screenshot_manager_->SetScreenshotInterval(interval_ms); 389 screenshot_manager_->SetScreenshotInterval(interval_ms);
391 } 390 }
392 391
393 void AddInputEventMessageFilter() { 392 void AddInputEventMessageFilter() {
394 filter_ = new InputEventMessageFilterWaitsForAcks(); 393 filter_ = new InputEventMessageFilterWaitsForAcks();
395 GetRenderWidgetHost()->GetProcess()->AddFilter(filter_.get()); 394 GetRenderWidgetHost()->GetProcess()->AddFilter(filter_.get());
396 } 395 }
397 396
398 private: 397 private:
399 ScreenshotTracker* screenshot_manager_; 398 ScreenshotTracker* screenshot_manager_;
400 scoped_refptr<InputEventMessageFilterWaitsForAcks> filter_; 399 scoped_refptr<InputEventMessageFilterWaitsForAcks> filter_;
401 scoped_refptr<FrameWatcher> frame_watcher_; 400 FrameWatcher frame_watcher_;
402 401
403 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAuraTest); 402 DISALLOW_COPY_AND_ASSIGN(WebContentsViewAuraTest);
404 }; 403 };
405 404
406 // Flaky on Windows: http://crbug.com/305722 405 // Flaky on Windows: http://crbug.com/305722
407 // The test frequently times out on Linux, too. See crbug.com/440043. 406 // The test frequently times out on Linux, too. See crbug.com/440043.
408 #if defined(OS_WIN) || defined(OS_LINUX) 407 #if defined(OS_WIN) || defined(OS_LINUX)
409 #define MAYBE_OverscrollNavigation DISABLED_OverscrollNavigation 408 #define MAYBE_OverscrollNavigation DISABLED_OverscrollNavigation
410 #else 409 #else
411 #define MAYBE_OverscrollNavigation OverscrollNavigation 410 #define MAYBE_OverscrollNavigation OverscrollNavigation
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 details = sink->OnEventFromSource(&release); 1121 details = sink->OnEventFromSource(&release);
1123 ASSERT_FALSE(details.dispatcher_destroyed); 1122 ASSERT_FALSE(details.dispatcher_destroyed);
1124 WaitAFrame(); 1123 WaitAFrame();
1125 1124
1126 EXPECT_LT(0, tracker.num_overscroll_updates()); 1125 EXPECT_LT(0, tracker.num_overscroll_updates());
1127 EXPECT_FALSE(tracker.overscroll_completed()); 1126 EXPECT_FALSE(tracker.overscroll_completed());
1128 } 1127 }
1129 } 1128 }
1130 1129
1131 } // namespace content 1130 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/web_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698