| 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 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 // A TestURLLoaderClient records URLLoaderClient function calls. It also calls | 22 // A TestURLLoaderClient records URLLoaderClient function calls. It also calls |
| 23 // the closure set via set_quit_closure if set, in order to make it possible to | 23 // the closure set via set_quit_closure if set, in order to make it possible to |
| 24 // create a base::RunLoop, set its quit closure to this client and then run the | 24 // create a base::RunLoop, set its quit closure to this client and then run the |
| 25 // RunLoop. | 25 // RunLoop. |
| 26 class TestURLLoaderClient final : public mojom::URLLoaderClient { | 26 class TestURLLoaderClient final : public mojom::URLLoaderClient { |
| 27 public: | 27 public: |
| 28 TestURLLoaderClient(); | 28 TestURLLoaderClient(); |
| 29 ~TestURLLoaderClient() override; | 29 ~TestURLLoaderClient() override; |
| 30 | 30 |
| 31 void OnReceiveResponse(const ResourceResponseHead& response_head) override; | 31 void OnReceiveResponse(const ResourceResponseHead& response_head, |
| 32 mojom::DownloadedTempFilePtr downloaded_file) override; |
| 32 void OnReceiveRedirect(const net::RedirectInfo& redirect_info, | 33 void OnReceiveRedirect(const net::RedirectInfo& redirect_info, |
| 33 const ResourceResponseHead& response_head) override; | 34 const ResourceResponseHead& response_head) override; |
| 34 void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override; | 35 void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override; |
| 35 void OnStartLoadingResponseBody( | 36 void OnStartLoadingResponseBody( |
| 36 mojo::ScopedDataPipeConsumerHandle body) override; | 37 mojo::ScopedDataPipeConsumerHandle body) override; |
| 37 void OnComplete(const ResourceRequestCompletionStatus& status) override; | 38 void OnComplete(const ResourceRequestCompletionStatus& status) override; |
| 38 | 39 |
| 39 bool has_received_response() const { return has_received_response_; } | 40 bool has_received_response() const { return has_received_response_; } |
| 40 bool has_received_redirect() const { return has_received_redirect_; } | 41 bool has_received_redirect() const { return has_received_redirect_; } |
| 41 bool has_data_downloaded() const { return has_data_downloaded_; } | 42 bool has_data_downloaded() const { return has_data_downloaded_; } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 mojom::URLLoaderFactoryPtr url_loader_factory_; | 85 mojom::URLLoaderFactoryPtr url_loader_factory_; |
| 85 int64_t download_data_length_ = 0; | 86 int64_t download_data_length_ = 0; |
| 86 int64_t encoded_download_data_length_ = 0; | 87 int64_t encoded_download_data_length_ = 0; |
| 87 | 88 |
| 88 DISALLOW_COPY_AND_ASSIGN(TestURLLoaderClient); | 89 DISALLOW_COPY_AND_ASSIGN(TestURLLoaderClient); |
| 89 }; | 90 }; |
| 90 | 91 |
| 91 } // namespace content | 92 } // namespace content |
| 92 | 93 |
| 93 #endif // CONTENT_BROWSER_LOADER_TEST_URL_LOADER_CLIENT_H_ | 94 #endif // CONTENT_BROWSER_LOADER_TEST_URL_LOADER_CLIENT_H_ |
| OLD | NEW |