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 |
31 void SimRequest::didReceiveResponse(WebURLLoaderClient* client, WebURLLoader* lo
ader, const WebURLResponse& response) | 36 void SimRequest::didReceiveResponse(WebURLLoaderClient* client, WebURLLoader* lo
ader, const WebURLResponse& response) |
32 { | 37 { |
33 m_client = client; | 38 m_client = client; |
34 m_loader = loader; | 39 m_loader = loader; |
35 m_response = response; | 40 m_response = response; |
36 m_isReady = true; | 41 m_isReady = true; |
37 } | 42 } |
38 | 43 |
39 void SimRequest::didFail(const WebURLError& error) | 44 void SimRequest::didFail(const WebURLError& error) |
40 { | 45 { |
(...skipping 28 matching lines...) Expand all Loading... |
69 | 74 |
70 void SimRequest::reset() | 75 void SimRequest::reset() |
71 { | 76 { |
72 m_isReady = false; | 77 m_isReady = false; |
73 m_client = nullptr; | 78 m_client = nullptr; |
74 m_loader = nullptr; | 79 m_loader = nullptr; |
75 SimNetwork::current().removeRequest(*this); | 80 SimNetwork::current().removeRequest(*this); |
76 } | 81 } |
77 | 82 |
78 } // namespace blink | 83 } // namespace blink |
OLD | NEW |