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

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

Issue 1329553004: Add a FOUC painting test. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix build. 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.
20 class SimNetwork final : public WebURLLoaderTestDelegate { 23 class SimNetwork final : public WebURLLoaderTestDelegate {
21 public: 24 public:
22 SimNetwork(); 25 SimNetwork();
23 ~SimNetwork(); 26 ~SimNetwork();
24 27
25 private: 28 private:
26 friend class SimRequest; 29 friend class SimRequest;
27 30
28 static SimNetwork& current(); 31 static SimNetwork& current();
29 32
30 void servePendingRequests(); 33 void servePendingRequests();
31 void addRequest(SimRequest&); 34 void addRequest(SimRequest&);
32 void removeRequest(SimRequest&); 35 void removeRequest(SimRequest&);
33 36
34 // WebURLLoaderTestDelegate 37 // WebURLLoaderTestDelegate
35 void didReceiveResponse(WebURLLoaderClient*, WebURLLoader*, const WebURLResp onse&) override; 38 void didReceiveResponse(WebURLLoaderClient*, WebURLLoader*, const WebURLResp onse&) override;
36 void didReceiveData(WebURLLoaderClient*, WebURLLoader*, const char* data, in t dataLength, int encodedDataLength) override; 39 void didReceiveData(WebURLLoaderClient*, WebURLLoader*, const char* data, in t dataLength, int encodedDataLength) override;
37 void didFail(WebURLLoaderClient*, WebURLLoader*, const WebURLError&) overrid e; 40 void didFail(WebURLLoaderClient*, WebURLLoader*, const WebURLError&) overrid e;
38 void didFinishLoading(WebURLLoaderClient*, WebURLLoader*, double finishTime, int64_t totalEncodedDataLength) override; 41 void didFinishLoading(WebURLLoaderClient*, WebURLLoader*, double finishTime, int64_t totalEncodedDataLength) override;
39 42
40 SimRequest* m_currentRequest; 43 SimRequest* m_currentRequest;
41 HashMap<String, SimRequest*> m_requests; 44 HashMap<String, SimRequest*> m_requests;
42 }; 45 };
43 46
44 } // namespace blink 47 } // namespace blink
45 48
46 #endif 49 #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