Index: Source/web/tests/sim/SimNetwork.h |
diff --git a/Source/web/tests/sim/SimNetwork.h b/Source/web/tests/sim/SimNetwork.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d95d4c62db47cad5d7ed8615a637853885890d2c |
--- /dev/null |
+++ b/Source/web/tests/sim/SimNetwork.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SimNetwork_h |
+#define SimNetwork_h |
+ |
+#include "public/platform/WebURLLoaderTestDelegate.h" |
+#include "wtf/HashMap.h" |
+#include "wtf/text/StringHash.h" |
+#include "wtf/text/WTFString.h" |
+ |
+namespace blink { |
+ |
+class SimRequest; |
+class WebURLLoader; |
+class WebURLLoaderClient; |
+class WebURLResponse; |
+ |
+class SimNetwork final : public WebURLLoaderTestDelegate { |
+public: |
+ SimNetwork(); |
+ ~SimNetwork(); |
+ |
+private: |
+ friend class SimRequest; |
+ |
+ static SimNetwork& current(); |
+ |
+ void servePendingRequests(); |
+ void addRequest(SimRequest&); |
+ void removeRequest(SimRequest&); |
+ |
+ // WebURLLoaderTestDelegate |
+ void didReceiveResponse(WebURLLoaderClient*, WebURLLoader*, const WebURLResponse&) override; |
+ void didReceiveData(WebURLLoaderClient*, WebURLLoader*, const char* data, int dataLength, int encodedDataLength) override; |
+ void didFail(WebURLLoaderClient*, WebURLLoader*, const WebURLError&) override; |
+ void didFinishLoading(WebURLLoaderClient*, WebURLLoader*, double finishTime, int64_t totalEncodedDataLength) override; |
+ |
+ SimRequest* m_currentRequest; |
+ HashMap<String, SimRequest*> m_requests; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif |