OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ |
| 6 #define CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "content/browser/frame_host/navigation_request_info.h" |
| 11 #include "content/browser/loader/navigation_url_loader.h" |
| 12 #include "content/common/navigation_params.h" |
| 13 |
| 14 namespace net { |
| 15 |
| 16 struct RedirectInfo; |
| 17 } |
| 18 |
| 19 namespace content { |
| 20 |
| 21 class NavigationURLLoaderDelegate; |
| 22 class StreamHandle; |
| 23 struct ResourceResponse; |
| 24 |
| 25 // PlzNavigate |
| 26 // Test implementation of NavigationURLLoader to simulate the network stack |
| 27 // response. |
| 28 class TestNavigationURLLoader |
| 29 : public NavigationURLLoader, |
| 30 public base::SupportsWeakPtr<TestNavigationURLLoader> { |
| 31 public: |
| 32 TestNavigationURLLoader(const CommonNavigationParams& common_params, |
| 33 scoped_ptr<NavigationRequestInfo> request_info, |
| 34 NavigationURLLoaderDelegate* delegate); |
| 35 |
| 36 // NavigationURLLoader implementation. |
| 37 void FollowRedirect() override; |
| 38 |
| 39 const CommonNavigationParams& common_params() const { return common_params_; } |
| 40 NavigationRequestInfo* request_info() const { return request_info_.get(); } |
| 41 |
| 42 void CallOnRequestRedirected(const net::RedirectInfo& redirect_info, |
| 43 const scoped_refptr<ResourceResponse>& response); |
| 44 void CallOnResponseStarted(const scoped_refptr<ResourceResponse>& response, |
| 45 scoped_ptr<StreamHandle> body); |
| 46 |
| 47 int redirect_count() { return redirect_count_; } |
| 48 |
| 49 private: |
| 50 ~TestNavigationURLLoader(); |
| 51 |
| 52 CommonNavigationParams common_params_; |
| 53 scoped_ptr<NavigationRequestInfo> request_info_; |
| 54 NavigationURLLoaderDelegate* delegate_; |
| 55 int redirect_count_; |
| 56 }; |
| 57 |
| 58 } // namespace content |
| 59 |
| 60 #endif // CONTENT_TEST_TEST_NAVIGATION_URL_LOADER_H_ |
OLD | NEW |