| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SimRequest_h | 5 #ifndef SimRequest_h |
| 6 #define SimRequest_h | 6 #define SimRequest_h |
| 7 | 7 |
| 8 #include "platform/wtf/text/WTFString.h" | 8 #include "platform/wtf/text/WTFString.h" |
| 9 #include "public/platform/WebURLError.h" | 9 #include "public/platform/WebURLError.h" |
| 10 #include "public/platform/WebURLResponse.h" | 10 #include "public/platform/WebURLResponse.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class SimNetwork; | 14 class SimNetwork; |
| 15 class WebURLLoader; | |
| 16 class WebURLLoaderClient; | 15 class WebURLLoaderClient; |
| 17 | 16 |
| 18 // Simulates a single request for a resource from the server. Requires a | 17 // Simulates a single request for a resource from the server. Requires a |
| 19 // SimNetwork to have been created first. Use the start(), write() and finish() | 18 // SimNetwork to have been created first. Use the start(), write() and finish() |
| 20 // methods to simulate the response from the server. Note that all started | 19 // methods to simulate the response from the server. Note that all started |
| 21 // requests must be finished. | 20 // requests must be finished. |
| 22 class SimRequest final { | 21 class SimRequest final { |
| 23 public: | 22 public: |
| 24 SimRequest(String url, String mime_type); | 23 SimRequest(String url, String mime_type); |
| 25 ~SimRequest(); | 24 ~SimRequest(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 44 private: | 43 private: |
| 45 friend class SimNetwork; | 44 friend class SimNetwork; |
| 46 | 45 |
| 47 void Reset(); | 46 void Reset(); |
| 48 | 47 |
| 49 // Used by SimNetwork. | 48 // Used by SimNetwork. |
| 50 void DidReceiveResponse(WebURLLoaderClient*, const WebURLResponse&); | 49 void DidReceiveResponse(WebURLLoaderClient*, const WebURLResponse&); |
| 51 void DidFail(const WebURLError&); | 50 void DidFail(const WebURLError&); |
| 52 | 51 |
| 53 String url_; | 52 String url_; |
| 54 WebURLLoader* loader_; | |
| 55 WebURLResponse response_; | 53 WebURLResponse response_; |
| 56 WebURLError error_; | 54 WebURLError error_; |
| 57 WebURLLoaderClient* client_; | 55 WebURLLoaderClient* client_; |
| 58 unsigned total_encoded_data_length_; | 56 unsigned total_encoded_data_length_; |
| 59 bool is_ready_; | 57 bool is_ready_; |
| 60 }; | 58 }; |
| 61 | 59 |
| 62 } // namespace blink | 60 } // namespace blink |
| 63 | 61 |
| 64 #endif | 62 #endif |
| OLD | NEW |