Index: content/public/test/browser_test_utils.h |
diff --git a/content/public/test/browser_test_utils.h b/content/public/test/browser_test_utils.h |
index 4d02c44c9e6dae39b4f98780befcbc0443ea7688..0429a1be430f86903eb73c8cd12bae07b78f878f 100644 |
--- a/content/public/test/browser_test_utils.h |
+++ b/content/public/test/browser_test_utils.h |
@@ -612,11 +612,11 @@ class TestNavigationManager : public WebContentsObserver { |
// Waits until the navigation request is ready to be sent to the network |
// stack. Returns false if the request was aborted before starting. |
- WARN_UNUSED_RESULT bool WaitForWillStartRequest(); |
+ WARN_UNUSED_RESULT bool WaitForRequestStart(); |
// Waits until the navigation response has been sent received. Returns false |
// if the request was aborted before getting a response. |
- WARN_UNUSED_RESULT bool WaitForWillProcessResponse(); |
+ WARN_UNUSED_RESULT bool WaitForResponse(); |
// Waits until the navigation has been finished. Will automatically resume |
// navigations paused before this point. |
@@ -628,6 +628,13 @@ class TestNavigationManager : public WebContentsObserver { |
virtual bool ShouldMonitorNavigation(NavigationHandle* handle); |
private: |
+ enum class NavigationState { |
+ INITIAL = 0, |
+ STARTED = 1, |
+ RESPONSE = 2, |
+ FINISHED = 3, |
+ }; |
+ |
// WebContentsObserver: |
void DidStartNavigation(NavigationHandle* handle) override; |
void DidFinishNavigation(NavigationHandle* handle) override; |
@@ -640,17 +647,21 @@ class TestNavigationManager : public WebContentsObserver { |
// WillProcessResponse. |
void OnWillProcessResponse(); |
- // Resumes the navigation. |
- void ResumeNavigation(); |
+ // Waits for the desired state. Returns false if the desired state cannot be |
+ // reached (eg the navigation finishes before reaching this state). |
+ bool WaitForDesiredState(); |
+ |
+ // Called when the state of the navigation has changed. This will either stop |
+ // the message loop if the state specified by the user has been reached, or |
+ // resume the navigation if it hasn't been reached yet. |
+ void OnNavigationStateChanged(); |
const GURL url_; |
- bool navigation_paused_in_will_start_; |
- bool navigation_paused_in_will_process_response_; |
NavigationHandle* handle_; |
- bool handled_navigation_; |
- scoped_refptr<MessageLoopRunner> will_start_loop_runner_; |
- scoped_refptr<MessageLoopRunner> will_process_response_loop_runner_; |
- scoped_refptr<MessageLoopRunner> did_finish_loop_runner_; |
+ bool navigation_paused_; |
+ NavigationState current_state_; |
+ NavigationState desired_state_; |
+ scoped_refptr<MessageLoopRunner> loop_runner_; |
base::WeakPtrFactory<TestNavigationManager> weak_factory_; |