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

Side by Side Diff: Source/web/tests/sim/SimRequest.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/SimNetwork.h ('k') | Source/web/tests/sim/SimRequest.cpp » ('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 SimRequest_h 5 #ifndef SimRequest_h
6 #define SimRequest_h 6 #define SimRequest_h
7 7
8 #include "public/platform/WebURLError.h" 8 #include "public/platform/WebURLError.h"
9 #include "public/platform/WebURLResponse.h" 9 #include "public/platform/WebURLResponse.h"
10 #include "wtf/text/WTFString.h" 10 #include "wtf/text/WTFString.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class SimNetwork; 14 class SimNetwork;
15 class WebURLLoader; 15 class WebURLLoader;
16 class WebURLLoaderClient; 16 class WebURLLoaderClient;
17 17
18 // Simulates a single request for a resource from the server. Requires a 18 class SimRequest {
19 // 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
21 // requests must be finished.
22 class SimRequest final {
23 public: 19 public:
24 SimRequest(String url, String mimeType); 20 SimRequest(String url, String mimeType);
25 ~SimRequest();
26 21
27 // Starts the response from the server, this is as if the headers and 200 OK 22 void didReceiveResponse(WebURLLoaderClient*, WebURLLoader*, const WebURLResp onse&);
28 // reply had been received but no response body yet. 23 void didFail(const WebURLError&);
24
29 void start(); 25 void start();
30
31 // Write a chunk of the response body.
32 void write(const String& data); 26 void write(const String& data);
33
34 // Finish the response, this is as if the server closed the connection.
35 void finish(); 27 void finish();
36 28
29 bool isReady() const { return m_isReady; }
37 const String& url() const { return m_url; } 30 const String& url() const { return m_url; }
38 const WebURLError& error() const { return m_error; } 31 const WebURLError& error() const { return m_error; }
39 const WebURLResponse& response() const { return m_response; } 32 const WebURLResponse& response() const { return m_response; }
40 33
41 private:
42 friend class SimNetwork;
43
44 void reset(); 34 void reset();
45 35
46 // Used by SimNetwork. 36 private:
47 void didReceiveResponse(WebURLLoaderClient*, WebURLLoader*, const WebURLResp onse&);
48 void didFail(const WebURLError&);
49
50 String m_url; 37 String m_url;
51 WebURLLoader* m_loader; 38 WebURLLoader* m_loader;
52 WebURLResponse m_response; 39 WebURLResponse m_response;
53 WebURLError m_error; 40 WebURLError m_error;
54 WebURLLoaderClient* m_client; 41 WebURLLoaderClient* m_client;
55 unsigned m_totalEncodedDataLength; 42 unsigned m_totalEncodedDataLength;
56 bool m_isReady; 43 bool m_isReady;
57 }; 44 };
58 45
59 } // namespace blink 46 } // namespace blink
60 47
61 #endif 48 #endif
OLDNEW
« no previous file with comments | « Source/web/tests/sim/SimNetwork.h ('k') | Source/web/tests/sim/SimRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698