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

Unified Diff: content/test/test_frame_navigation_observer.h

Issue 1816733002: Change TestFrameNavigationObserver to wait for load stop instead of commit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded observer and Wait call. Created 4 years, 9 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/site_per_process_browsertest.cc ('k') | content/test/test_frame_navigation_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/test_frame_navigation_observer.h
diff --git a/content/test/test_frame_navigation_observer.h b/content/test/test_frame_navigation_observer.h
index ff572e8e930c26580e9238a01a136e2f6a9c3ae0..45805e75afe4eae42da46e818b59d40aa82b1752 100644
--- a/content/test/test_frame_navigation_observer.h
+++ b/content/test/test_frame_navigation_observer.h
@@ -23,22 +23,24 @@ class WebContents;
struct LoadCommittedDetails;
// For content_browsertests, which run on the UI thread, run a second
-// MessageLoop and quit when the navigation in a specific frame completes
-// loading.
+// MessageLoop and quit when the navigation in a specific frame (and all of its
+// subframes) has completed loading.
class TestFrameNavigationObserver : public WebContentsObserver {
public:
// Create and register a new TestFrameNavigationObserver which will track
// navigations performed in the specified |node| of the frame tree.
- TestFrameNavigationObserver(FrameTreeNode* node, int number_of_navigations);
- // As above but waits for one navigation.
explicit TestFrameNavigationObserver(FrameTreeNode* node);
~TestFrameNavigationObserver() override;
- // Runs a nested message loop and blocks until the expected number of
- // navigations are complete.
+ // Runs a nested message loop and blocks until the full load has
+ // completed.
void Wait();
+ // Runs a nested message loop and blocks until the navigation in the
+ // associated FrameTreeNode has committed.
+ void WaitForCommit();
+
private:
// WebContentsObserver
void DidStartProvisionalLoadForFrame(RenderFrameHost* render_frame_host,
@@ -49,6 +51,7 @@ class TestFrameNavigationObserver : public WebContentsObserver {
RenderFrameHost* render_frame_host,
const GURL& url,
ui::PageTransition transition_type) override;
+ void DidStopLoading() override;
// The id of the FrameTreeNode in which navigations are peformed.
int frame_tree_node_id_;
@@ -56,11 +59,12 @@ class TestFrameNavigationObserver : public WebContentsObserver {
// If true the navigation has started.
bool navigation_started_;
- // The number of navigations that have been completed.
- int navigations_completed_;
+ // If true, the navigation has committed.
+ bool has_committed_;
- // The number of navigations to wait for.
- int number_of_navigations_;
+ // If true, this object is waiting for commit only, not for the full load
+ // of the document.
+ bool wait_for_commit_;
// The MessageLoopRunner used to spin the message loop.
scoped_refptr<MessageLoopRunner> message_loop_runner_;
« no previous file with comments | « content/browser/site_per_process_browsertest.cc ('k') | content/test/test_frame_navigation_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698