| 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 builder.PopulateContentHeaders(&headers); | 224 EXPECT_TRUE(headers.insert(builder.GetContentType()).second); |
| 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); | |
| 239 | 225 |
| 240 HTTPTransportTestFixture test(headers, builder.GetBodyStream(), 200, | 226 HTTPTransportTestFixture test(headers, builder.GetBodyStream(), 200, |
| 241 &ValidFormData); | 227 &ValidFormData); |
| 242 test.Run(); | 228 test.Run(); |
| 243 } | 229 } |
| 244 | 230 |
| 245 const char kTextPlain[] = "text/plain"; | 231 const char kTextPlain[] = "text/plain"; |
| 246 | 232 |
| 247 void ErrorResponse(HTTPTransportTestFixture* fixture, | 233 void ErrorResponse(HTTPTransportTestFixture* fixture, |
| 248 const std::string& request) { | 234 const std::string& request) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 310 } |
| 325 | 311 |
| 326 TEST(HTTPTransport, Upload33k_LengthUnknown) { | 312 TEST(HTTPTransport, Upload33k_LengthUnknown) { |
| 327 // The same as Upload33k, but without declaring Content-Length ahead of time. | 313 // The same as Upload33k, but without declaring Content-Length ahead of time. |
| 328 RunUpload33k(false); | 314 RunUpload33k(false); |
| 329 } | 315 } |
| 330 | 316 |
| 331 } // namespace | 317 } // namespace |
| 332 } // namespace test | 318 } // namespace test |
| 333 } // namespace crashpad | 319 } // namespace crashpad |
| OLD | NEW |