| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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_H_ | 5 #ifndef CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ |
| 6 #define CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ | 6 #define CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/browser/frame_host/navigation_request_info.h" | 10 #include "content/browser/frame_host/navigation_request_info.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class StreamHandle; | 21 class StreamHandle; |
| 22 struct ResourceResponse; | 22 struct ResourceResponse; |
| 23 | 23 |
| 24 // PlzNavigate | 24 // PlzNavigate |
| 25 // Test implementation of NavigationURLLoader to simulate the network stack | 25 // Test implementation of NavigationURLLoader to simulate the network stack |
| 26 // response. | 26 // response. |
| 27 class TestNavigationURLLoader | 27 class TestNavigationURLLoader |
| 28 : public NavigationURLLoader, | 28 : public NavigationURLLoader, |
| 29 public base::SupportsWeakPtr<TestNavigationURLLoader> { | 29 public base::SupportsWeakPtr<TestNavigationURLLoader> { |
| 30 public: | 30 public: |
| 31 TestNavigationURLLoader(const CommonNavigationParams& common_params, | 31 TestNavigationURLLoader(scoped_ptr<NavigationRequestInfo> request_info, |
| 32 scoped_ptr<NavigationRequestInfo> request_info, | |
| 33 NavigationURLLoaderDelegate* delegate); | 32 NavigationURLLoaderDelegate* delegate); |
| 34 | 33 |
| 35 // NavigationURLLoader implementation. | 34 // NavigationURLLoader implementation. |
| 36 void FollowRedirect() override; | 35 void FollowRedirect() override; |
| 37 | 36 |
| 38 const CommonNavigationParams& common_params() const { return common_params_; } | |
| 39 NavigationRequestInfo* request_info() const { return request_info_.get(); } | 37 NavigationRequestInfo* request_info() const { return request_info_.get(); } |
| 40 | 38 |
| 41 void CallOnRequestRedirected(const net::RedirectInfo& redirect_info, | 39 void CallOnRequestRedirected(const net::RedirectInfo& redirect_info, |
| 42 const scoped_refptr<ResourceResponse>& response); | 40 const scoped_refptr<ResourceResponse>& response); |
| 43 void CallOnResponseStarted(const scoped_refptr<ResourceResponse>& response, | 41 void CallOnResponseStarted(const scoped_refptr<ResourceResponse>& response, |
| 44 scoped_ptr<StreamHandle> body); | 42 scoped_ptr<StreamHandle> body); |
| 45 | 43 |
| 46 int redirect_count() { return redirect_count_; } | 44 int redirect_count() { return redirect_count_; } |
| 47 | 45 |
| 48 private: | 46 private: |
| 49 ~TestNavigationURLLoader() override; | 47 ~TestNavigationURLLoader() override; |
| 50 | 48 |
| 51 CommonNavigationParams common_params_; | |
| 52 scoped_ptr<NavigationRequestInfo> request_info_; | 49 scoped_ptr<NavigationRequestInfo> request_info_; |
| 53 NavigationURLLoaderDelegate* delegate_; | 50 NavigationURLLoaderDelegate* delegate_; |
| 54 int redirect_count_; | 51 int redirect_count_; |
| 55 }; | 52 }; |
| 56 | 53 |
| 57 } // namespace content | 54 } // namespace content |
| 58 | 55 |
| 59 #endif // CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ | 56 #endif // CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ |
| OLD | NEW |