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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 ASSERT_EQ(body_start + expected.length(), request.length()); | 215 ASSERT_EQ(body_start + expected.length(), request.length()); |
216 EXPECT_EQ(expected, request.substr(body_start)); | 216 EXPECT_EQ(expected, request.substr(body_start)); |
217 } | 217 } |
218 | 218 |
219 TEST(HTTPTransport, ValidFormData) { | 219 TEST(HTTPTransport, ValidFormData) { |
220 HTTPMultipartBuilder builder; | 220 HTTPMultipartBuilder builder; |
221 builder.SetFormData("key1", "test"); | 221 builder.SetFormData("key1", "test"); |
222 builder.SetFormData("key2", "--abcdefg123"); | 222 builder.SetFormData("key2", "--abcdefg123"); |
223 | 223 |
224 HTTPHeaders headers; | 224 HTTPHeaders headers; |
225 headers.insert(builder.GetContentType()); | 225 EXPECT_TRUE(headers.insert(builder.GetContentType()).second); |
226 | 226 |
227 HTTPTransportTestFixture test(headers, builder.GetBodyStream(), 200, | 227 HTTPTransportTestFixture test(headers, builder.GetBodyStream(), 200, |
228 &ValidFormData); | 228 &ValidFormData); |
229 test.Run(); | 229 test.Run(); |
230 } | 230 } |
231 | 231 |
232 const char kTextPlain[] = "text/plain"; | 232 const char kTextPlain[] = "text/plain"; |
233 | 233 |
234 void ErrorResponse(HTTPTransportTestFixture* fixture, | 234 void ErrorResponse(HTTPTransportTestFixture* fixture, |
235 const std::string& request) { | 235 const std::string& request) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 headers[kContentLength] = base::StringPrintf("%" PRIuS, strlen(kTextBody)); | 274 headers[kContentLength] = base::StringPrintf("%" PRIuS, strlen(kTextBody)); |
275 | 275 |
276 HTTPTransportTestFixture test(headers, body_stream.Pass(), 200, | 276 HTTPTransportTestFixture test(headers, body_stream.Pass(), 200, |
277 &UnchunkedPlainText); | 277 &UnchunkedPlainText); |
278 test.Run(); | 278 test.Run(); |
279 } | 279 } |
280 | 280 |
281 } // namespace | 281 } // namespace |
282 } // namespace test | 282 } // namespace test |
283 } // namespace crashpad | 283 } // namespace crashpad |
OLD | NEW |