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 3613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10130 trans2.Start(&request2, callback2.callback(), BoundNetLog())); | 10129 trans2.Start(&request2, callback2.callback(), BoundNetLog())); |
10131 MessageLoop::current()->RunAllPending(); | 10130 MessageLoop::current()->RunAllPending(); |
10132 data2->RunFor(3); | 10131 data2->RunFor(3); |
10133 | 10132 |
10134 ASSERT_TRUE(callback2.have_result()); | 10133 ASSERT_TRUE(callback2.have_result()); |
10135 EXPECT_EQ(OK, callback2.WaitForResult()); | 10134 EXPECT_EQ(OK, callback2.WaitForResult()); |
10136 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); | 10135 EXPECT_TRUE(trans2.GetResponseInfo()->was_fetched_via_spdy); |
10137 } | 10136 } |
10138 | 10137 |
10139 } // namespace net | 10138 } // namespace net |
OLD | NEW |