Index: content/public/browser/navigation_handle.h |
diff --git a/content/public/browser/navigation_handle.h b/content/public/browser/navigation_handle.h |
index 0f3892c7015bb271d10eb5716dbc3c3aad61d274..4a6365dd841d8b0750d3b39d52fcb1e4ffd5af52 100644 |
--- a/content/public/browser/navigation_handle.h |
+++ b/content/public/browser/navigation_handle.h |
@@ -39,6 +39,9 @@ class WebContents; |
// destroyed. |
class CONTENT_EXPORT NavigationHandle { |
public: |
+ typedef base::Callback<void(NavigationThrottle::ThrottleCheckResult)> |
+ ThrottleChecksFinishedCallback; |
+ |
virtual ~NavigationHandle() {} |
// Parameters available at navigation start time ----------------------------- |
@@ -250,26 +253,36 @@ class CONTENT_EXPORT NavigationHandle { |
virtual void RegisterThrottleForTesting( |
std::unique_ptr<NavigationThrottle> navigation_throttle) = 0; |
+ // The Call*ForTesting methods return the synchronous throttle check result |
+ // and DEFER if the checks are completing asynchronously. To observe async |
+ // checks, use the optionally null |complete_callback|, which will be called |
+ // whenever the checks are completely finished. |
+ |
// Simulates the network request starting. |
virtual NavigationThrottle::ThrottleCheckResult |
- CallWillStartRequestForTesting(bool is_post, |
- const Referrer& sanitized_referrer, |
- bool has_user_gesture, |
- ui::PageTransition transition, |
- bool is_external_protocol) = 0; |
+ CallWillStartRequestForTesting( |
+ bool is_post, |
+ const Referrer& sanitized_referrer, |
+ bool has_user_gesture, |
+ ui::PageTransition transition, |
+ bool is_external_protocol, |
+ const ThrottleChecksFinishedCallback& complete_callback) = 0; |
// Simulates the network request being redirected. |
virtual NavigationThrottle::ThrottleCheckResult |
- CallWillRedirectRequestForTesting(const GURL& new_url, |
- bool new_method_is_post, |
- const GURL& new_referrer_url, |
- bool new_is_external_protocol) = 0; |
+ CallWillRedirectRequestForTesting( |
+ const GURL& new_url, |
+ bool new_method_is_post, |
+ const GURL& new_referrer_url, |
+ bool new_is_external_protocol, |
+ const ThrottleChecksFinishedCallback& complete_callback) = 0; |
// Simulates the reception of the network response. |
virtual NavigationThrottle::ThrottleCheckResult |
CallWillProcessResponseForTesting( |
RenderFrameHost* render_frame_host, |
- const std::string& raw_response_headers) = 0; |
+ const std::string& raw_response_headers, |
+ const ThrottleChecksFinishedCallback& complete_callback) = 0; |
// Simulates the navigation being committed. |
virtual void CallDidCommitNavigationForTesting(const GURL& url) = 0; |