OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef SimNetwork_h |
| 6 #define SimNetwork_h |
| 7 |
| 8 #include "public/platform/WebURLLoaderTestDelegate.h" |
| 9 #include "wtf/HashMap.h" |
| 10 #include "wtf/text/StringHash.h" |
| 11 #include "wtf/text/WTFString.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 class SimRequest; |
| 16 class WebURLLoader; |
| 17 class WebURLLoaderClient; |
| 18 class WebURLResponse; |
| 19 |
| 20 class SimNetwork final : public WebURLLoaderTestDelegate { |
| 21 public: |
| 22 SimNetwork(); |
| 23 ~SimNetwork(); |
| 24 |
| 25 private: |
| 26 friend class SimRequest; |
| 27 |
| 28 static SimNetwork& current(); |
| 29 |
| 30 void servePendingRequests(); |
| 31 void addRequest(SimRequest&); |
| 32 void removeRequest(SimRequest&); |
| 33 |
| 34 // WebURLLoaderTestDelegate |
| 35 void didReceiveResponse(WebURLLoaderClient*, WebURLLoader*, const WebURLResp
onse&) override; |
| 36 void didReceiveData(WebURLLoaderClient*, WebURLLoader*, const char* data, in
t dataLength, int encodedDataLength) override; |
| 37 void didFail(WebURLLoaderClient*, WebURLLoader*, const WebURLError&) overrid
e; |
| 38 void didFinishLoading(WebURLLoaderClient*, WebURLLoader*, double finishTime,
int64_t totalEncodedDataLength) override; |
| 39 |
| 40 SimRequest* m_currentRequest; |
| 41 HashMap<String, SimRequest*> m_requests; |
| 42 }; |
| 43 |
| 44 } // namespace blink |
| 45 |
| 46 #endif |
OLD | NEW |