OLD | NEW |
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 #include "config.h" | 5 #include "config.h" |
6 #include "web/tests/sim/SimRequest.h" | 6 #include "web/tests/sim/SimRequest.h" |
7 | 7 |
8 #include "platform/weborigin/KURL.h" | 8 #include "platform/weborigin/KURL.h" |
9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
10 #include "public/platform/WebURLLoaderClient.h" | 10 #include "public/platform/WebURLLoaderClient.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 , m_isReady(false) | 21 , m_isReady(false) |
22 { | 22 { |
23 KURL fullUrl(ParsedURLString, url); | 23 KURL fullUrl(ParsedURLString, url); |
24 WebURLResponse response(fullUrl); | 24 WebURLResponse response(fullUrl); |
25 response.setMIMEType(mimeType); | 25 response.setMIMEType(mimeType); |
26 response.setHTTPStatusCode(200); | 26 response.setHTTPStatusCode(200); |
27 Platform::current()->unitTestSupport()->registerMockedURL(fullUrl, response,
""); | 27 Platform::current()->unitTestSupport()->registerMockedURL(fullUrl, response,
""); |
28 SimNetwork::current().addRequest(*this); | 28 SimNetwork::current().addRequest(*this); |
29 } | 29 } |
30 | 30 |
31 SimRequest::~SimRequest() | |
32 { | |
33 ASSERT(!m_isReady); | |
34 } | |
35 | |
36 void SimRequest::didReceiveResponse(WebURLLoaderClient* client, WebURLLoader* lo
ader, const WebURLResponse& response) | 31 void SimRequest::didReceiveResponse(WebURLLoaderClient* client, WebURLLoader* lo
ader, const WebURLResponse& response) |
37 { | 32 { |
38 m_client = client; | 33 m_client = client; |
39 m_loader = loader; | 34 m_loader = loader; |
40 m_response = response; | 35 m_response = response; |
41 m_isReady = true; | 36 m_isReady = true; |
42 } | 37 } |
43 | 38 |
44 void SimRequest::didFail(const WebURLError& error) | 39 void SimRequest::didFail(const WebURLError& error) |
45 { | 40 { |
(...skipping 28 matching lines...) Expand all Loading... |
74 | 69 |
75 void SimRequest::reset() | 70 void SimRequest::reset() |
76 { | 71 { |
77 m_isReady = false; | 72 m_isReady = false; |
78 m_client = nullptr; | 73 m_client = nullptr; |
79 m_loader = nullptr; | 74 m_loader = nullptr; |
80 SimNetwork::current().removeRequest(*this); | 75 SimNetwork::current().removeRequest(*this); |
81 } | 76 } |
82 | 77 |
83 } // namespace blink | 78 } // namespace blink |
OLD | NEW |