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

Unified Diff: Source/web/tests/sim/SimRequest.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/tests/sim/SimNetwork.h ('k') | Source/web/tests/sim/SimRequest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/sim/SimRequest.h
diff --git a/Source/web/tests/sim/SimRequest.h b/Source/web/tests/sim/SimRequest.h
index 42ba0fe6b398102c86bf15b4c558cf793277d30a..197f2c1bfd2c09c7a91f0b70788a4eb8cb494268 100644
--- a/Source/web/tests/sim/SimRequest.h
+++ b/Source/web/tests/sim/SimRequest.h
@@ -15,25 +15,38 @@ class SimNetwork;
class WebURLLoader;
class WebURLLoaderClient;
-class SimRequest {
+// Simulates a single request for a resource from the server. Requires a
+// SimNetwork to have been created first. Use the start(), write() and finish()
+// methods to simulate the response from the server. Note that all started
+// requests must be finished.
+class SimRequest final {
public:
SimRequest(String url, String mimeType);
+ ~SimRequest();
- void didReceiveResponse(WebURLLoaderClient*, WebURLLoader*, const WebURLResponse&);
- void didFail(const WebURLError&);
-
+ // Starts the response from the server, this is as if the headers and 200 OK
+ // reply had been received but no response body yet.
void start();
+
+ // Write a chunk of the response body.
void write(const String& data);
+
+ // Finish the response, this is as if the server closed the connection.
void finish();
- bool isReady() const { return m_isReady; }
const String& url() const { return m_url; }
const WebURLError& error() const { return m_error; }
const WebURLResponse& response() const { return m_response; }
+private:
+ friend class SimNetwork;
+
void reset();
-private:
+ // Used by SimNetwork.
+ void didReceiveResponse(WebURLLoaderClient*, WebURLLoader*, const WebURLResponse&);
+ void didFail(const WebURLError&);
+
String m_url;
WebURLLoader* m_loader;
WebURLResponse m_response;
« 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