Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Side by Side Diff: Source/web/tests/sim/SimNetwork.h

Issue 1316673009: Revert of Add a FOUC painting test. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/tests/sim/SimLayerTreeView.h ('k') | Source/web/tests/sim/SimRequest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 SimNetwork_h 5 #ifndef SimNetwork_h
6 #define SimNetwork_h 6 #define SimNetwork_h
7 7
8 #include "public/platform/WebURLLoaderTestDelegate.h" 8 #include "public/platform/WebURLLoaderTestDelegate.h"
9 #include "wtf/HashMap.h" 9 #include "wtf/HashMap.h"
10 #include "wtf/text/StringHash.h" 10 #include "wtf/text/StringHash.h"
11 #include "wtf/text/WTFString.h" 11 #include "wtf/text/WTFString.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 class SimRequest; 15 class SimRequest;
16 class WebURLLoader; 16 class WebURLLoader;
17 class WebURLLoaderClient; 17 class WebURLLoaderClient;
18 class WebURLResponse; 18 class WebURLResponse;
19 19
20 // Simulates a network with precise flow control so you can make requests
21 // return, write data, and finish in a specific order in a unit test. One of
22 // these must be created before using the SimRequest to issue requests.
23 class SimNetwork final : public WebURLLoaderTestDelegate { 20 class SimNetwork final : public WebURLLoaderTestDelegate {
24 public: 21 public:
25 SimNetwork(); 22 SimNetwork();
26 ~SimNetwork(); 23 ~SimNetwork();
27 24
28 private: 25 private:
29 friend class SimRequest; 26 friend class SimRequest;
30 27
31 static SimNetwork& current(); 28 static SimNetwork& current();
32 29
33 void servePendingRequests(); 30 void servePendingRequests();
34 void addRequest(SimRequest&); 31 void addRequest(SimRequest&);
35 void removeRequest(SimRequest&); 32 void removeRequest(SimRequest&);
36 33
37 // WebURLLoaderTestDelegate 34 // WebURLLoaderTestDelegate
38 void didReceiveResponse(WebURLLoaderClient*, WebURLLoader*, const WebURLResp onse&) override; 35 void didReceiveResponse(WebURLLoaderClient*, WebURLLoader*, const WebURLResp onse&) override;
39 void didReceiveData(WebURLLoaderClient*, WebURLLoader*, const char* data, in t dataLength, int encodedDataLength) override; 36 void didReceiveData(WebURLLoaderClient*, WebURLLoader*, const char* data, in t dataLength, int encodedDataLength) override;
40 void didFail(WebURLLoaderClient*, WebURLLoader*, const WebURLError&) overrid e; 37 void didFail(WebURLLoaderClient*, WebURLLoader*, const WebURLError&) overrid e;
41 void didFinishLoading(WebURLLoaderClient*, WebURLLoader*, double finishTime, int64_t totalEncodedDataLength) override; 38 void didFinishLoading(WebURLLoaderClient*, WebURLLoader*, double finishTime, int64_t totalEncodedDataLength) override;
42 39
43 SimRequest* m_currentRequest; 40 SimRequest* m_currentRequest;
44 HashMap<String, SimRequest*> m_requests; 41 HashMap<String, SimRequest*> m_requests;
45 }; 42 };
46 43
47 } // namespace blink 44 } // namespace blink
48 45
49 #endif 46 #endif
OLDNEW
« no previous file with comments | « Source/web/tests/sim/SimLayerTreeView.h ('k') | Source/web/tests/sim/SimRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698