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

Unified Diff: content/browser/web_contents/web_contents_view_aura_browsertest.cc

Issue 2640473003: Convert tests to use the non-deprecated WebContentsObserver navigation methods. (Closed)
Patch Set: review comments Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_impl_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_view_aura_browsertest.cc
diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
index 88785e40412260eace366f13d59ea528f1d17865..ea911422863f97c33d9a29c8e4b4f85ef038b983 100644
--- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc
+++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
@@ -159,38 +159,6 @@ class ScreenshotTracker : public NavigationEntryScreenshotManager {
DISALLOW_COPY_AND_ASSIGN(ScreenshotTracker);
};
-class NavigationWatcher : public WebContentsObserver {
- public:
- explicit NavigationWatcher(WebContents* contents)
- : WebContentsObserver(contents),
- navigated_(false),
- should_quit_loop_(false) {
- }
-
- ~NavigationWatcher() override {}
-
- void WaitUntilNavigationStarts() {
- if (navigated_)
- return;
- should_quit_loop_ = true;
- base::RunLoop().Run();
- }
-
- private:
- // Overridden from WebContentsObserver:
- void DidStartNavigationToPendingEntry(const GURL& validated_url,
- ReloadType reload_type) override {
- navigated_ = true;
- if (should_quit_loop_)
- base::MessageLoop::current()->QuitWhenIdle();
- }
-
- bool navigated_;
- bool should_quit_loop_;
-
- DISALLOW_COPY_AND_ASSIGN(NavigationWatcher);
-};
-
class InputEventMessageFilterWaitsForAcks : public BrowserMessageFilter {
public:
InputEventMessageFilterWaitsForAcks()
@@ -848,14 +816,15 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest,
// right.
base::string16 expected_title = base::ASCIIToUTF16("Title: #2");
content::TitleWatcher title_watcher(web_contents, expected_title);
- NavigationWatcher nav_watcher(web_contents);
+ TestNavigationManager nav_watcher(web_contents,
+ embedded_test_server()->GetURL("/overscroll_navigation.html#2"));
generator.GestureScrollSequence(
gfx::Point(bounds.right() - 10, bounds.y() + 10),
gfx::Point(bounds.x() + 2, bounds.y() + 10),
base::TimeDelta::FromMilliseconds(2000),
10);
- nav_watcher.WaitUntilNavigationStarts();
+ nav_watcher.WaitForNavigationFinished();
clamy 2017/01/19 14:59:37 This doesn't correspond to the same point in time
jam 2017/01/20 05:52:16 I originally tried WaitForRequestStart() to keep
generator.GestureScrollSequence(
gfx::Point(bounds.x() + 2, bounds.y() + 10),
« no previous file with comments | « content/browser/web_contents/web_contents_impl_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698