OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_LOADER_TEST_URL_LOADER_CLIENT_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_TEST_URL_LOADER_CLIENT_H_ |
6 #define CONTENT_BROWSER_LOADER_TEST_URL_LOADER_CLIENT_H_ | 6 #define CONTENT_BROWSER_LOADER_TEST_URL_LOADER_CLIENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 mojom::URLLoaderClientPtr CreateInterfacePtr(); | 84 mojom::URLLoaderClientPtr CreateInterfacePtr(); |
85 | 85 |
86 void Unbind(); | 86 void Unbind(); |
87 | 87 |
88 void RunUntilResponseReceived(); | 88 void RunUntilResponseReceived(); |
89 void RunUntilRedirectReceived(); | 89 void RunUntilRedirectReceived(); |
90 void RunUntilDataDownloaded(); | 90 void RunUntilDataDownloaded(); |
91 void RunUntilCachedMetadataReceived(); | 91 void RunUntilCachedMetadataReceived(); |
92 void RunUntilResponseBodyArrived(); | 92 void RunUntilResponseBodyArrived(); |
93 void RunUntilComplete(); | 93 void RunUntilComplete(); |
| 94 void RunUntilConnectionError(); |
94 | 95 |
95 private: | 96 private: |
| 97 void OnConnectionError(); |
| 98 |
96 mojo::Binding<mojom::URLLoaderClient> binding_; | 99 mojo::Binding<mojom::URLLoaderClient> binding_; |
97 ResourceResponseHead response_head_; | 100 ResourceResponseHead response_head_; |
98 base::Optional<net::SSLInfo> ssl_info_; | 101 base::Optional<net::SSLInfo> ssl_info_; |
99 net::RedirectInfo redirect_info_; | 102 net::RedirectInfo redirect_info_; |
100 std::string cached_metadata_; | 103 std::string cached_metadata_; |
101 mojo::ScopedDataPipeConsumerHandle response_body_; | 104 mojo::ScopedDataPipeConsumerHandle response_body_; |
102 ResourceRequestCompletionStatus completion_status_; | 105 ResourceRequestCompletionStatus completion_status_; |
103 bool has_received_response_ = false; | 106 bool has_received_response_ = false; |
104 bool has_received_redirect_ = false; | 107 bool has_received_redirect_ = false; |
105 bool has_data_downloaded_ = false; | 108 bool has_data_downloaded_ = false; |
106 bool has_received_upload_progress_ = false; | 109 bool has_received_upload_progress_ = false; |
107 bool has_received_cached_metadata_ = false; | 110 bool has_received_cached_metadata_ = false; |
108 bool has_received_completion_ = false; | 111 bool has_received_completion_ = false; |
| 112 bool has_received_connection_error_ = false; |
| 113 |
109 base::Closure quit_closure_for_on_receive_response_; | 114 base::Closure quit_closure_for_on_receive_response_; |
110 base::Closure quit_closure_for_on_receive_redirect_; | 115 base::Closure quit_closure_for_on_receive_redirect_; |
111 base::Closure quit_closure_for_on_data_downloaded_; | 116 base::Closure quit_closure_for_on_data_downloaded_; |
112 base::Closure quit_closure_for_on_receive_cached_metadata_; | 117 base::Closure quit_closure_for_on_receive_cached_metadata_; |
113 base::Closure quit_closure_for_on_start_loading_response_body_; | 118 base::Closure quit_closure_for_on_start_loading_response_body_; |
114 base::Closure quit_closure_for_on_complete_; | 119 base::Closure quit_closure_for_on_complete_; |
| 120 base::Closure quit_closure_for_on_connection_error_; |
| 121 |
115 mojom::URLLoaderFactoryPtr url_loader_factory_; | 122 mojom::URLLoaderFactoryPtr url_loader_factory_; |
116 int64_t download_data_length_ = 0; | 123 int64_t download_data_length_ = 0; |
117 int64_t encoded_download_data_length_ = 0; | 124 int64_t encoded_download_data_length_ = 0; |
118 int64_t body_transfer_size_ = 0; | 125 int64_t body_transfer_size_ = 0; |
119 int64_t current_upload_position_ = 0; | 126 int64_t current_upload_position_ = 0; |
120 int64_t total_upload_size_ = 0; | 127 int64_t total_upload_size_ = 0; |
121 | 128 |
122 DISALLOW_COPY_AND_ASSIGN(TestURLLoaderClient); | 129 DISALLOW_COPY_AND_ASSIGN(TestURLLoaderClient); |
123 }; | 130 }; |
124 | 131 |
125 } // namespace content | 132 } // namespace content |
126 | 133 |
127 #endif // CONTENT_BROWSER_LOADER_TEST_URL_LOADER_CLIENT_H_ | 134 #endif // CONTENT_BROWSER_LOADER_TEST_URL_LOADER_CLIENT_H_ |
OLD | NEW |