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

Unified Diff: content/browser/loader/test_url_loader_client.h

Issue 2467833002: Implement redirect handling on MojoAsyncResourceHandler (Closed)
Patch Set: rebase Created 4 years, 1 month 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/browser/loader/test_url_loader_client.h
diff --git a/content/browser/loader/test_url_loader_client.h b/content/browser/loader/test_url_loader_client.h
index 31790781f9c94a3a3962f18c9c7532ca810a5e91..a12709bcca6cf691e044a1ef5d00f7458bfca6d0 100644
--- a/content/browser/loader/test_url_loader_client.h
+++ b/content/browser/loader/test_url_loader_client.h
@@ -15,6 +15,7 @@
#include "content/public/common/resource_response.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
+#include "net/url_request/redirect_info.h"
namespace content {
@@ -28,15 +29,19 @@ class TestURLLoaderClient final : public mojom::URLLoaderClient {
~TestURLLoaderClient() override;
void OnReceiveResponse(const ResourceResponseHead& response_head) override;
+ void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
+ const ResourceResponseHead& response_head) override;
void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override;
void OnStartLoadingResponseBody(
mojo::ScopedDataPipeConsumerHandle body) override;
void OnComplete(const ResourceRequestCompletionStatus& status) override;
bool has_received_response() const { return has_received_response_; }
+ bool has_received_redirect() const { return has_received_redirect_; }
bool has_data_downloaded() const { return has_data_downloaded_; }
bool has_received_completion() const { return has_received_completion_; }
const ResourceResponseHead& response_head() const { return response_head_; }
+ const net::RedirectInfo& redirect_info() const { return redirect_info_; }
mojo::DataPipeConsumerHandle response_body() { return response_body_.get(); }
const ResourceRequestCompletionStatus& completion_status() const {
return completion_status_;
@@ -46,6 +51,7 @@ class TestURLLoaderClient final : public mojom::URLLoaderClient {
return encoded_download_data_length_;
}
+ void ClearHasReceivedRedirect();
// Creates an AssociatedPtrInfo, binds it to |*this| and returns it. The
// returned PtrInfo is marked as remote, i.e., expected to be passed to the
// remote endpoint.
@@ -55,6 +61,7 @@ class TestURLLoaderClient final : public mojom::URLLoaderClient {
void Unbind();
void RunUntilResponseReceived();
+ void RunUntilRedirectReceived();
void RunUntilDataDownloaded();
void RunUntilResponseBodyArrived();
void RunUntilComplete();
@@ -62,12 +69,15 @@ class TestURLLoaderClient final : public mojom::URLLoaderClient {
private:
mojo::AssociatedBinding<mojom::URLLoaderClient> binding_;
ResourceResponseHead response_head_;
+ net::RedirectInfo redirect_info_;
mojo::ScopedDataPipeConsumerHandle response_body_;
ResourceRequestCompletionStatus completion_status_;
bool has_received_response_ = false;
+ bool has_received_redirect_ = false;
bool has_data_downloaded_ = false;
bool has_received_completion_ = false;
- base::Closure quit_closure_for_on_received_response_;
+ base::Closure quit_closure_for_on_receive_response_;
+ base::Closure quit_closure_for_on_receive_redirect_;
base::Closure quit_closure_for_on_data_downloaded_;
base::Closure quit_closure_for_on_start_loading_response_body_;
base::Closure quit_closure_for_on_complete_;
« no previous file with comments | « content/browser/loader/mojo_async_resource_handler_unittest.cc ('k') | content/browser/loader/test_url_loader_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698