OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 ASSERT_EQ(body_start + expected.length(), request.length()); | 214 ASSERT_EQ(body_start + expected.length(), request.length()); |
215 EXPECT_EQ(expected, request.substr(body_start)); | 215 EXPECT_EQ(expected, request.substr(body_start)); |
216 } | 216 } |
217 | 217 |
218 TEST(HTTPTransport, ValidFormData) { | 218 TEST(HTTPTransport, ValidFormData) { |
219 HTTPMultipartBuilder builder; | 219 HTTPMultipartBuilder builder; |
220 builder.SetFormData("key1", "test"); | 220 builder.SetFormData("key1", "test"); |
221 builder.SetFormData("key2", "--abcdefg123"); | 221 builder.SetFormData("key2", "--abcdefg123"); |
222 | 222 |
223 HTTPHeaders headers; | 223 HTTPHeaders headers; |
224 EXPECT_TRUE(headers.insert(builder.GetContentType()).second); | 224 builder.PopulateContentHeaders(&headers); |
| 225 |
| 226 HTTPTransportTestFixture test( |
| 227 headers, builder.GetBodyStream(), 200, &ValidFormData); |
| 228 test.Run(); |
| 229 } |
| 230 |
| 231 TEST(HTTPTransport, ValidFormData_Gzip) { |
| 232 HTTPMultipartBuilder builder; |
| 233 builder.SetGzipEnabled(true); |
| 234 builder.SetFormData("key1", "test"); |
| 235 builder.SetFormData("key2", "--abcdefg123"); |
| 236 |
| 237 HTTPHeaders headers; |
| 238 builder.PopulateContentHeaders(&headers); |
225 | 239 |
226 HTTPTransportTestFixture test(headers, builder.GetBodyStream(), 200, | 240 HTTPTransportTestFixture test(headers, builder.GetBodyStream(), 200, |
227 &ValidFormData); | 241 &ValidFormData); |
228 test.Run(); | 242 test.Run(); |
229 } | 243 } |
230 | 244 |
231 const char kTextPlain[] = "text/plain"; | 245 const char kTextPlain[] = "text/plain"; |
232 | 246 |
233 void ErrorResponse(HTTPTransportTestFixture* fixture, | 247 void ErrorResponse(HTTPTransportTestFixture* fixture, |
234 const std::string& request) { | 248 const std::string& request) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 } | 324 } |
311 | 325 |
312 TEST(HTTPTransport, Upload33k_LengthUnknown) { | 326 TEST(HTTPTransport, Upload33k_LengthUnknown) { |
313 // The same as Upload33k, but without declaring Content-Length ahead of time. | 327 // The same as Upload33k, but without declaring Content-Length ahead of time. |
314 RunUpload33k(false); | 328 RunUpload33k(false); |
315 } | 329 } |
316 | 330 |
317 } // namespace | 331 } // namespace |
318 } // namespace test | 332 } // namespace test |
319 } // namespace crashpad | 333 } // namespace crashpad |
OLD | NEW |