OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/web_url_loader_impl.h" | 5 #include "content/child/web_url_loader_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 delete_on_finish_(false), | 132 delete_on_finish_(false), |
133 delete_on_fail_(false), | 133 delete_on_fail_(false), |
134 did_receive_redirect_(false), | 134 did_receive_redirect_(false), |
135 did_receive_response_(false), | 135 did_receive_response_(false), |
136 check_redirect_request_priority_(false), | 136 check_redirect_request_priority_(false), |
137 did_finish_(false) {} | 137 did_finish_(false) {} |
138 | 138 |
139 ~TestWebURLLoaderClient() override {} | 139 ~TestWebURLLoaderClient() override {} |
140 | 140 |
141 // blink::WebURLLoaderClient implementation: | 141 // blink::WebURLLoaderClient implementation: |
142 void willFollowRedirect( | 142 bool willFollowRedirect( |
143 blink::WebURLLoader* loader, | 143 blink::WebURLLoader* loader, |
144 blink::WebURLRequest& newRequest, | 144 blink::WebURLRequest& newRequest, |
145 const blink::WebURLResponse& redirectResponse) override { | 145 const blink::WebURLResponse& redirectResponse) override { |
146 EXPECT_TRUE(loader_); | 146 EXPECT_TRUE(loader_); |
147 EXPECT_EQ(loader_.get(), loader); | 147 EXPECT_EQ(loader_.get(), loader); |
148 | 148 |
149 if (check_redirect_request_priority_) | 149 if (check_redirect_request_priority_) |
150 EXPECT_EQ(redirect_request_priority, newRequest.getPriority()); | 150 EXPECT_EQ(redirect_request_priority, newRequest.getPriority()); |
151 | 151 |
152 // No test currently simulates mutiple redirects. | 152 // No test currently simulates mutiple redirects. |
153 EXPECT_FALSE(did_receive_redirect_); | 153 EXPECT_FALSE(did_receive_redirect_); |
154 did_receive_redirect_ = true; | 154 did_receive_redirect_ = true; |
155 | 155 |
156 if (delete_on_receive_redirect_) | 156 if (delete_on_receive_redirect_) |
157 loader_.reset(); | 157 loader_.reset(); |
| 158 |
| 159 return true; |
158 } | 160 } |
159 | 161 |
160 void didSendData(blink::WebURLLoader* loader, | 162 void didSendData(blink::WebURLLoader* loader, |
161 unsigned long long bytesSent, | 163 unsigned long long bytesSent, |
162 unsigned long long totalBytesToBeSent) override { | 164 unsigned long long totalBytesToBeSent) override { |
163 EXPECT_TRUE(loader_); | 165 EXPECT_TRUE(loader_); |
164 EXPECT_EQ(loader_.get(), loader); | 166 EXPECT_EQ(loader_.get(), loader); |
165 } | 167 } |
166 | 168 |
167 void didReceiveResponse( | 169 void didReceiveResponse( |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 encoded_data_length); | 715 encoded_data_length); |
714 | 716 |
715 EXPECT_EQ(kEncodedBodyLength, response.encodedBodyLength()); | 717 EXPECT_EQ(kEncodedBodyLength, response.encodedBodyLength()); |
716 EXPECT_EQ(kEncodedDataLength, encoded_data_length); | 718 EXPECT_EQ(kEncodedDataLength, encoded_data_length); |
717 int expected_decoded_body_length = strlen(kBodyData); | 719 int expected_decoded_body_length = strlen(kBodyData); |
718 EXPECT_EQ(expected_decoded_body_length, response.decodedBodyLength()); | 720 EXPECT_EQ(expected_decoded_body_length, response.decodedBodyLength()); |
719 } | 721 } |
720 | 722 |
721 } // namespace | 723 } // namespace |
722 } // namespace content | 724 } // namespace content |
OLD | NEW |