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

Unified Diff: content/test/content_browser_test_utils_internal.h

Issue 2377453002: Deflake RaceCrossOriginNavigationAndSamePageHistoryNavigation test. (Closed)
Patch Set: Add a HasCommitted check. 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 side-by-side diff with in-line comments
Download patch
Index: content/test/content_browser_test_utils_internal.h
diff --git a/content/test/content_browser_test_utils_internal.h b/content/test/content_browser_test_utils_internal.h
index 21c282cdd6dc197ee0539a59ed92914d766755fb..d9f756dfe66289524b21679dc0b594485e0f02a1 100644
--- a/content/test/content_browser_test_utils_internal.h
+++ b/content/test/content_browser_test_utils_internal.h
@@ -174,6 +174,31 @@ class FrameTestNavigationManager : public TestNavigationManager {
DISALLOW_COPY_AND_ASSIGN(FrameTestNavigationManager);
};
+// An observer that can wait for a specific URL to be committed in a specific
+// frame.
+// Note: it does not track the start of a navigation, unlike other observers.
+class UrlCommitObserver : WebContentsObserver {
+ public:
+ explicit UrlCommitObserver(FrameTreeNode* frame_tree_node, const GURL& url);
+ ~UrlCommitObserver() override;
+
+ void Wait();
+
+ private:
+ void DidFinishNavigation(NavigationHandle* navigation_handle) override;
+
+ // The id of the FrameTreeNode in which navigations are peformed.
+ int frame_tree_node_id_;
+
+ // The URL this observer is expecting to be committed.
+ GURL url_;
+
+ // The MessageLoopRunner used to spin the message loop.
+ scoped_refptr<MessageLoopRunner> message_loop_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(UrlCommitObserver);
+};
+
} // namespace content
#endif // CONTENT_TEST_CONTENT_BROWSER_TEST_UTILS_INTERNAL_H_

Powered by Google App Engine
This is Rietveld 408576698