| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 6485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6496 FilePath temp_file_path; | 6496 FilePath temp_file_path; |
| 6497 ASSERT_TRUE(file_util::CreateTemporaryFile(&temp_file_path)); | 6497 ASSERT_TRUE(file_util::CreateTemporaryFile(&temp_file_path)); |
| 6498 const uint64 kFakeSize = 100000; // file is actually blank | 6498 const uint64 kFakeSize = 100000; // file is actually blank |
| 6499 | 6499 |
| 6500 std::vector<UploadElement> elements; | 6500 std::vector<UploadElement> elements; |
| 6501 UploadElement element; | 6501 UploadElement element; |
| 6502 element.SetToFilePath(temp_file_path); | 6502 element.SetToFilePath(temp_file_path); |
| 6503 element.SetContentLength(kFakeSize); | 6503 element.SetContentLength(kFakeSize); |
| 6504 elements.push_back(element); | 6504 elements.push_back(element); |
| 6505 request.upload_data->SetElements(elements); | 6505 request.upload_data->SetElements(elements); |
| 6506 EXPECT_EQ(kFakeSize, request.upload_data->GetContentLengthSync()); | |
| 6507 | 6506 |
| 6508 MockRead data_reads[] = { | 6507 MockRead data_reads[] = { |
| 6509 MockRead("HTTP/1.0 200 OK\r\n\r\n"), | 6508 MockRead("HTTP/1.0 200 OK\r\n\r\n"), |
| 6510 MockRead("hello world"), | 6509 MockRead("hello world"), |
| 6511 MockRead(SYNCHRONOUS, OK), | 6510 MockRead(SYNCHRONOUS, OK), |
| 6512 }; | 6511 }; |
| 6513 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); | 6512 StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); |
| 6514 session_deps.socket_factory.AddSocketDataProvider(&data); | 6513 session_deps.socket_factory.AddSocketDataProvider(&data); |
| 6515 | 6514 |
| 6516 TestCompletionCallback callback; | 6515 TestCompletionCallback callback; |
| (...skipping 3650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10167 trans2.Start(&request2, callback2.callback(), BoundNetLog())); | 10166 trans2.Start(&request2, callback2.callback(), BoundNetLog())); |
| 10168 MessageLoop::current()->RunAllPending(); | 10167 MessageLoop::current()->RunAllPending(); |
| 10169 data2->RunFor(3); | 10168 data2->RunFor(3); |
| 10170 | 10169 |
| 10171 ASSERT_TRUE(callback2.have_result()); | 10170 ASSERT_TRUE(callback2.have_result()); |
| 10172 EXPECT_EQ(OK, callback2.WaitForResult()); | 10171 EXPECT_EQ(OK, callback2.WaitForResult()); |
| 10173 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 10172 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
| 10174 } | 10173 } |
| 10175 | 10174 |
| 10176 } // namespace net | 10175 } // namespace net |
| OLD | NEW |