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_MOCK_RESOURCE_LOADER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_MOCK_RESOURCE_LOADER_H_ |
6 #define CONTENT_BROWSER_LOADER_MOCK_RESOURCE_LOADER_H_ | 6 #define CONTENT_BROWSER_LOADER_MOCK_RESOURCE_LOADER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 CANCELED, | 52 CANCELED, |
53 }; | 53 }; |
54 | 54 |
55 // These all run the corresponding methods on ResourceHandler, along with | 55 // These all run the corresponding methods on ResourceHandler, along with |
56 // basic sanity checks for the behavior of the handler. Each check returns the | 56 // basic sanity checks for the behavior of the handler. Each check returns the |
57 // current status of the ResourceLoader. | 57 // current status of the ResourceLoader. |
58 Status OnWillStart(const GURL& url); | 58 Status OnWillStart(const GURL& url); |
59 Status OnRequestRedirected(const net::RedirectInfo& redirect_info, | 59 Status OnRequestRedirected(const net::RedirectInfo& redirect_info, |
60 scoped_refptr<ResourceResponse> response); | 60 scoped_refptr<ResourceResponse> response); |
61 Status OnResponseStarted(scoped_refptr<ResourceResponse> response); | 61 Status OnResponseStarted(scoped_refptr<ResourceResponse> response); |
62 Status OnWillRead(int min_size); | 62 Status OnWillRead(); |
63 Status OnReadCompleted(base::StringPiece bytes); | 63 Status OnReadCompleted(base::StringPiece bytes); |
64 Status OnResponseCompleted(const net::URLRequestStatus& status); | 64 Status OnResponseCompleted(const net::URLRequestStatus& status); |
65 | 65 |
66 // Simulates an out-of-band cancel from some source other than the | 66 // Simulates an out-of-band cancel from some source other than the |
67 // ResourceHandler |this| was created with (like another ResourceHandler). The | 67 // ResourceHandler |this| was created with (like another ResourceHandler). The |
68 // difference between this and OnResponseCompleted() is that this has fewer | 68 // difference between this and OnResponseCompleted() is that this has fewer |
69 // sanity checks to validate the cancel was in-band. | 69 // sanity checks to validate the cancel was in-band. |
70 Status OnResponseCompletedFromExternalOutOfBandCancel( | 70 Status OnResponseCompletedFromExternalOutOfBandCancel( |
71 const net::URLRequestStatus& url_request_status); | 71 const net::URLRequestStatus& url_request_status); |
72 | 72 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 std::unique_ptr<base::RunLoop> canceled_or_idle_run_loop_; | 106 std::unique_ptr<base::RunLoop> canceled_or_idle_run_loop_; |
107 | 107 |
108 base::WeakPtrFactory<MockResourceLoader> weak_factory_; | 108 base::WeakPtrFactory<MockResourceLoader> weak_factory_; |
109 | 109 |
110 DISALLOW_COPY_AND_ASSIGN(MockResourceLoader); | 110 DISALLOW_COPY_AND_ASSIGN(MockResourceLoader); |
111 }; | 111 }; |
112 | 112 |
113 } // namespace content | 113 } // namespace content |
114 | 114 |
115 #endif // CONTENT_BROWSER_LOADER_TEST_RESOURCE_HANDLER_WRAPPER_H_ | 115 #endif // CONTENT_BROWSER_LOADER_TEST_RESOURCE_HANDLER_WRAPPER_H_ |
OLD | NEW |