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

Side by Side Diff: third_party/WebKit/Source/web/tests/sim/SimNetwork.cpp

Issue 2519843002: Update ResourceResponse::encodedDataLength when response is completed (Closed)
Patch Set: Update ResourceResponse::encodedDataLength when response is completed Created 4 years 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
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 #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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 const char* data, 55 const char* data,
56 int dataLength, 56 int dataLength,
57 int encodedDataLength) { 57 int encodedDataLength) {
58 if (!m_currentRequest) 58 if (!m_currentRequest)
59 client->didReceiveData(loader, data, dataLength, encodedDataLength, 59 client->didReceiveData(loader, data, dataLength, encodedDataLength,
60 dataLength); 60 dataLength);
61 } 61 }
62 62
63 void SimNetwork::didFail(WebURLLoaderClient* client, 63 void SimNetwork::didFail(WebURLLoaderClient* client,
64 WebURLLoader* loader, 64 WebURLLoader* loader,
65 const WebURLError& error) { 65 const WebURLError& error,
66 int64_t encodedDataLength) {
66 if (!m_currentRequest) { 67 if (!m_currentRequest) {
67 client->didFail(loader, error); 68 client->didFail(loader, error, encodedDataLength);
68 return; 69 return;
69 } 70 }
70 m_currentRequest->didFail(error); 71 m_currentRequest->didFail(error);
71 } 72 }
72 73
73 void SimNetwork::didFinishLoading(WebURLLoaderClient* client, 74 void SimNetwork::didFinishLoading(WebURLLoaderClient* client,
74 WebURLLoader* loader, 75 WebURLLoader* loader,
75 double finishTime, 76 double finishTime,
76 int64_t totalEncodedDataLength) { 77 int64_t totalEncodedDataLength) {
77 if (!m_currentRequest) { 78 if (!m_currentRequest) {
78 client->didFinishLoading(loader, finishTime, totalEncodedDataLength); 79 client->didFinishLoading(loader, finishTime, totalEncodedDataLength);
79 return; 80 return;
80 } 81 }
81 m_currentRequest = nullptr; 82 m_currentRequest = nullptr;
82 } 83 }
83 84
84 void SimNetwork::addRequest(SimRequest& request) { 85 void SimNetwork::addRequest(SimRequest& request) {
85 m_requests.add(request.url(), &request); 86 m_requests.add(request.url(), &request);
86 } 87 }
87 88
88 void SimNetwork::removeRequest(SimRequest& request) { 89 void SimNetwork::removeRequest(SimRequest& request) {
89 m_requests.remove(request.url()); 90 m_requests.remove(request.url());
90 } 91 }
91 92
92 } // namespace blink 93 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/sim/SimNetwork.h ('k') | third_party/WebKit/Source/web/tests/sim/SimRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698