| 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_TEST_TEST_NAVIGATION_URL_LOADER_DELEGATE_H_ | 5 #ifndef CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_DELEGATE_H_ |
| 6 #define CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_DELEGATE_H_ | 6 #define CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "content/browser/loader/navigation_url_loader_delegate.h" | 13 #include "content/browser/loader/navigation_url_loader_delegate.h" |
| 14 #include "mojo/public/cpp/system/data_pipe.h" |
| 14 #include "net/url_request/redirect_info.h" | 15 #include "net/url_request/redirect_info.h" |
| 15 | 16 |
| 16 namespace base { | 17 namespace base { |
| 17 class RunLoop; | 18 class RunLoop; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace content { | 21 namespace content { |
| 21 | 22 |
| 22 class StreamHandle; | 23 class StreamHandle; |
| 23 struct ResourceResponse; | 24 struct ResourceResponse; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 49 void WaitForRequestStarted(); | 50 void WaitForRequestStarted(); |
| 50 | 51 |
| 51 void ReleaseBody(); | 52 void ReleaseBody(); |
| 52 | 53 |
| 53 // NavigationURLLoaderDelegate implementation. | 54 // NavigationURLLoaderDelegate implementation. |
| 54 void OnRequestRedirected( | 55 void OnRequestRedirected( |
| 55 const net::RedirectInfo& redirect_info, | 56 const net::RedirectInfo& redirect_info, |
| 56 const scoped_refptr<ResourceResponse>& response) override; | 57 const scoped_refptr<ResourceResponse>& response) override; |
| 57 void OnResponseStarted(const scoped_refptr<ResourceResponse>& response, | 58 void OnResponseStarted(const scoped_refptr<ResourceResponse>& response, |
| 58 std::unique_ptr<StreamHandle> body, | 59 std::unique_ptr<StreamHandle> body, |
| 60 mojo::ScopedDataPipeConsumerHandle consumer_handle, |
| 59 const SSLStatus& ssl_status, | 61 const SSLStatus& ssl_status, |
| 60 std::unique_ptr<NavigationData> navigation_data, | 62 std::unique_ptr<NavigationData> navigation_data, |
| 61 const GlobalRequestID& request_id, | 63 const GlobalRequestID& request_id, |
| 62 bool is_download, | 64 bool is_download, |
| 63 bool is_stream) override; | 65 bool is_stream) override; |
| 64 void OnRequestFailed(bool in_cache, int net_error) override; | 66 void OnRequestFailed(bool in_cache, int net_error) override; |
| 65 void OnRequestStarted(base::TimeTicks timestamp) override; | 67 void OnRequestStarted(base::TimeTicks timestamp) override; |
| 66 | 68 |
| 67 private: | 69 private: |
| 68 net::RedirectInfo redirect_info_; | 70 net::RedirectInfo redirect_info_; |
| 69 scoped_refptr<ResourceResponse> redirect_response_; | 71 scoped_refptr<ResourceResponse> redirect_response_; |
| 70 scoped_refptr<ResourceResponse> response_; | 72 scoped_refptr<ResourceResponse> response_; |
| 71 std::unique_ptr<StreamHandle> body_; | 73 std::unique_ptr<StreamHandle> body_; |
| 74 mojo::ScopedDataPipeConsumerHandle handle_; |
| 72 int net_error_; | 75 int net_error_; |
| 73 int on_request_handled_counter_; | 76 int on_request_handled_counter_; |
| 74 | 77 |
| 75 std::unique_ptr<base::RunLoop> request_redirected_; | 78 std::unique_ptr<base::RunLoop> request_redirected_; |
| 76 std::unique_ptr<base::RunLoop> response_started_; | 79 std::unique_ptr<base::RunLoop> response_started_; |
| 77 std::unique_ptr<base::RunLoop> request_failed_; | 80 std::unique_ptr<base::RunLoop> request_failed_; |
| 78 std::unique_ptr<base::RunLoop> request_started_; | 81 std::unique_ptr<base::RunLoop> request_started_; |
| 79 | 82 |
| 80 DISALLOW_COPY_AND_ASSIGN(TestNavigationURLLoaderDelegate); | 83 DISALLOW_COPY_AND_ASSIGN(TestNavigationURLLoaderDelegate); |
| 81 }; | 84 }; |
| 82 | 85 |
| 83 } // namespace content | 86 } // namespace content |
| 84 | 87 |
| 85 #endif // CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_DELEGATE_H | 88 #endif // CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_DELEGATE_H |
| OLD | NEW |