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 18 matching lines...) Expand all Loading... |
29 TestURLLoaderClient(); | 29 TestURLLoaderClient(); |
30 ~TestURLLoaderClient() override; | 30 ~TestURLLoaderClient() override; |
31 | 31 |
32 void OnReceiveResponse(const ResourceResponseHead& response_head, | 32 void OnReceiveResponse(const ResourceResponseHead& response_head, |
33 mojom::DownloadedTempFilePtr downloaded_file) override; | 33 mojom::DownloadedTempFilePtr downloaded_file) override; |
34 void OnReceiveRedirect(const net::RedirectInfo& redirect_info, | 34 void OnReceiveRedirect(const net::RedirectInfo& redirect_info, |
35 const ResourceResponseHead& response_head) override; | 35 const ResourceResponseHead& response_head) override; |
36 void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override; | 36 void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override; |
37 void OnReceiveCachedMetadata(const std::vector<uint8_t>& data) override; | 37 void OnReceiveCachedMetadata(const std::vector<uint8_t>& data) override; |
38 void OnTransferSizeUpdated(int32_t transfer_size_diff) override; | 38 void OnTransferSizeUpdated(int32_t transfer_size_diff) override; |
| 39 void OnUploadProgress(int64_t current_position, |
| 40 int64_t total_size, |
| 41 const base::Closure& ack_callback) override; |
39 void OnStartLoadingResponseBody( | 42 void OnStartLoadingResponseBody( |
40 mojo::ScopedDataPipeConsumerHandle body) override; | 43 mojo::ScopedDataPipeConsumerHandle body) override; |
41 void OnComplete(const ResourceRequestCompletionStatus& status) override; | 44 void OnComplete(const ResourceRequestCompletionStatus& status) override; |
42 | 45 |
43 bool has_received_response() const { return has_received_response_; } | 46 bool has_received_response() const { return has_received_response_; } |
44 bool has_received_redirect() const { return has_received_redirect_; } | 47 bool has_received_redirect() const { return has_received_redirect_; } |
45 bool has_data_downloaded() const { return has_data_downloaded_; } | 48 bool has_data_downloaded() const { return has_data_downloaded_; } |
46 bool has_received_cached_metadata() const { | 49 bool has_received_cached_metadata() const { |
47 return has_received_cached_metadata_; | 50 return has_received_cached_metadata_; |
48 } | 51 } |
49 bool has_received_completion() const { return has_received_completion_; } | 52 bool has_received_completion() const { return has_received_completion_; } |
50 const ResourceResponseHead& response_head() const { return response_head_; } | 53 const ResourceResponseHead& response_head() const { return response_head_; } |
51 const net::RedirectInfo& redirect_info() const { return redirect_info_; } | 54 const net::RedirectInfo& redirect_info() const { return redirect_info_; } |
52 const std::string& cached_metadata() const { | 55 const std::string& cached_metadata() const { |
53 return cached_metadata_; | 56 return cached_metadata_; |
54 } | 57 } |
55 mojo::DataPipeConsumerHandle response_body() { return response_body_.get(); } | 58 mojo::DataPipeConsumerHandle response_body() { return response_body_.get(); } |
56 const ResourceRequestCompletionStatus& completion_status() const { | 59 const ResourceRequestCompletionStatus& completion_status() const { |
57 return completion_status_; | 60 return completion_status_; |
58 } | 61 } |
59 int64_t download_data_length() const { return download_data_length_; } | 62 int64_t download_data_length() const { return download_data_length_; } |
60 int64_t encoded_download_data_length() const { | 63 int64_t encoded_download_data_length() const { |
61 return encoded_download_data_length_; | 64 return encoded_download_data_length_; |
62 } | 65 } |
63 int64_t body_transfer_size() const { return body_transfer_size_; } | 66 int64_t body_transfer_size() const { return body_transfer_size_; } |
| 67 int64_t current_upload_position() const { return current_upload_position_; } |
| 68 int64_t total_upload_size() const { return total_upload_size_; } |
64 | 69 |
65 void ClearHasReceivedRedirect(); | 70 void ClearHasReceivedRedirect(); |
66 // Creates an AssociatedPtrInfo, binds it to |*this| and returns it. The | 71 // Creates an AssociatedPtrInfo, binds it to |*this| and returns it. The |
67 // returned PtrInfo is marked as remote, i.e., expected to be passed to the | 72 // returned PtrInfo is marked as remote, i.e., expected to be passed to the |
68 // remote endpoint. | 73 // remote endpoint. |
69 mojom::URLLoaderClientAssociatedPtrInfo CreateRemoteAssociatedPtrInfo( | 74 mojom::URLLoaderClientAssociatedPtrInfo CreateRemoteAssociatedPtrInfo( |
70 mojo::AssociatedGroup* associated_group); | 75 mojo::AssociatedGroup* associated_group); |
71 | 76 |
72 void Unbind(); | 77 void Unbind(); |
73 | 78 |
(...skipping 19 matching lines...) Expand all Loading... |
93 base::Closure quit_closure_for_on_receive_response_; | 98 base::Closure quit_closure_for_on_receive_response_; |
94 base::Closure quit_closure_for_on_receive_redirect_; | 99 base::Closure quit_closure_for_on_receive_redirect_; |
95 base::Closure quit_closure_for_on_data_downloaded_; | 100 base::Closure quit_closure_for_on_data_downloaded_; |
96 base::Closure quit_closure_for_on_receive_cached_metadata_; | 101 base::Closure quit_closure_for_on_receive_cached_metadata_; |
97 base::Closure quit_closure_for_on_start_loading_response_body_; | 102 base::Closure quit_closure_for_on_start_loading_response_body_; |
98 base::Closure quit_closure_for_on_complete_; | 103 base::Closure quit_closure_for_on_complete_; |
99 mojom::URLLoaderFactoryPtr url_loader_factory_; | 104 mojom::URLLoaderFactoryPtr url_loader_factory_; |
100 int64_t download_data_length_ = 0; | 105 int64_t download_data_length_ = 0; |
101 int64_t encoded_download_data_length_ = 0; | 106 int64_t encoded_download_data_length_ = 0; |
102 int64_t body_transfer_size_ = 0; | 107 int64_t body_transfer_size_ = 0; |
| 108 int64_t current_upload_position_ = 0; |
| 109 int64_t total_upload_size_ = 0; |
103 | 110 |
104 DISALLOW_COPY_AND_ASSIGN(TestURLLoaderClient); | 111 DISALLOW_COPY_AND_ASSIGN(TestURLLoaderClient); |
105 }; | 112 }; |
106 | 113 |
107 } // namespace content | 114 } // namespace content |
108 | 115 |
109 #endif // CONTENT_BROWSER_LOADER_TEST_URL_LOADER_CLIENT_H_ | 116 #endif // CONTENT_BROWSER_LOADER_TEST_URL_LOADER_CLIENT_H_ |
OLD | NEW |