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

Unified Diff: components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc

Issue 893843003: Add RedirectInfo as a redirect parameter to ResourceThrottles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Document ResourceThrottle Created 5 years, 10 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: components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc
diff --git a/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc b/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc
index bb1e26aefe0ab0d36d7bee52b614d20f0449f6a5..52ba76a98046d2b2556f5695c0eac5162b70c885 100644
--- a/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc
+++ b/components/navigation_interception/intercept_navigation_resource_throttle_unittest.cc
@@ -25,6 +25,7 @@
#include "net/base/request_priority.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
+#include "net/url_request/redirect_info.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -154,9 +155,10 @@ class TestIOThreadState {
throttle_->WillStartRequest(defer);
}
- void ThrottleWillRedirectRequest(const GURL& new_url, bool* defer) {
+ void ThrottleWillRedirectRequest(const net::RedirectInfo& redirect_info,
+ bool* defer) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
- throttle_->WillRedirectRequest(new_url, defer);
+ throttle_->WillRedirectRequest(redirect_info, defer);
}
bool request_resumed() const {
@@ -218,10 +220,15 @@ class InterceptNavigationResourceThrottleTest
SetIOThreadState(io_thread_state);
- if (redirect_mode == REDIRECT_MODE_NO_REDIRECT)
+ if (redirect_mode == REDIRECT_MODE_NO_REDIRECT) {
io_thread_state->ThrottleWillStartRequest(defer);
- else
- io_thread_state->ThrottleWillRedirectRequest(url, defer);
+ } else {
+ // 302 redirects convert POSTs to gets.
+ net::RedirectInfo redirect_info;
+ redirect_info.new_url = url;
+ redirect_info.new_method = "GET";
+ io_thread_state->ThrottleWillRedirectRequest(redirect_info, defer);
+ }
}
protected:

Powered by Google App Engine
This is Rietveld 408576698