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 "web/tests/sim/SimNetwork.h" | 5 #include "web/tests/sim/SimNetwork.h" |
6 | 6 |
7 #include "public/platform/Platform.h" | 7 #include "public/platform/Platform.h" |
8 #include "public/platform/WebURLError.h" | 8 #include "public/platform/WebURLError.h" |
9 #include "public/platform/WebURLLoader.h" | 9 #include "public/platform/WebURLLoader.h" |
10 #include "public/platform/WebURLLoaderClient.h" | 10 #include "public/platform/WebURLLoaderClient.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 client->didReceiveResponse(response); | 44 client->didReceiveResponse(response); |
45 return; | 45 return; |
46 } | 46 } |
47 DCHECK(it->value); | 47 DCHECK(it->value); |
48 m_currentRequest = it->value; | 48 m_currentRequest = it->value; |
49 m_currentRequest->didReceiveResponse(client, response); | 49 m_currentRequest->didReceiveResponse(client, response); |
50 } | 50 } |
51 | 51 |
52 void SimNetwork::didReceiveData(WebURLLoaderClient* client, | 52 void SimNetwork::didReceiveData(WebURLLoaderClient* client, |
53 const char* data, | 53 const char* data, |
54 int dataLength, | 54 int dataLength) { |
55 int encodedDataLength) { | |
56 if (!m_currentRequest) | 55 if (!m_currentRequest) |
57 client->didReceiveData(data, dataLength, encodedDataLength); | 56 client->didReceiveData(data, dataLength); |
58 } | 57 } |
59 | 58 |
60 void SimNetwork::didFail(WebURLLoaderClient* client, | 59 void SimNetwork::didFail(WebURLLoaderClient* client, |
61 const WebURLError& error, | 60 const WebURLError& error, |
62 int64_t totalEncodedDataLength, | 61 int64_t totalEncodedDataLength, |
63 int64_t totalEncodedBodyLength) { | 62 int64_t totalEncodedBodyLength) { |
64 if (!m_currentRequest) { | 63 if (!m_currentRequest) { |
65 client->didFail(error, totalEncodedDataLength, totalEncodedBodyLength); | 64 client->didFail(error, totalEncodedDataLength, totalEncodedBodyLength); |
66 return; | 65 return; |
67 } | 66 } |
(...skipping 14 matching lines...) Expand all Loading... |
82 | 81 |
83 void SimNetwork::addRequest(SimRequest& request) { | 82 void SimNetwork::addRequest(SimRequest& request) { |
84 m_requests.add(request.url(), &request); | 83 m_requests.add(request.url(), &request); |
85 } | 84 } |
86 | 85 |
87 void SimNetwork::removeRequest(SimRequest& request) { | 86 void SimNetwork::removeRequest(SimRequest& request) { |
88 m_requests.remove(request.url()); | 87 m_requests.remove(request.url()); |
89 } | 88 } |
90 | 89 |
91 } // namespace blink | 90 } // namespace blink |
OLD | NEW |