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_stream_parser.h" | 5 #include "net/http/http_stream_parser.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_FileBody) { | 118 TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_FileBody) { |
119 ScopedVector<UploadElementReader> element_readers; | 119 ScopedVector<UploadElementReader> element_readers; |
120 | 120 |
121 // Create an empty temporary file. | 121 // Create an empty temporary file. |
122 base::ScopedTempDir temp_dir; | 122 base::ScopedTempDir temp_dir; |
123 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 123 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
124 base::FilePath temp_file_path; | 124 base::FilePath temp_file_path; |
125 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), | 125 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), |
126 &temp_file_path)); | 126 &temp_file_path)); |
127 | 127 |
128 element_readers.push_back(new UploadFileElementReader( | 128 element_readers.push_back( |
129 base::MessageLoopProxy::current(), temp_file_path, 0, 0, base::Time())); | 129 new UploadFileElementReader(base::MessageLoopProxy::current().get(), |
| 130 temp_file_path, |
| 131 0, |
| 132 0, |
| 133 base::Time())); |
130 | 134 |
131 scoped_ptr<UploadDataStream> body(new UploadDataStream(&element_readers, 0)); | 135 scoped_ptr<UploadDataStream> body(new UploadDataStream(&element_readers, 0)); |
132 TestCompletionCallback callback; | 136 TestCompletionCallback callback; |
133 ASSERT_EQ(ERR_IO_PENDING, body->Init(callback.callback())); | 137 ASSERT_EQ(ERR_IO_PENDING, body->Init(callback.callback())); |
134 ASSERT_EQ(OK, callback.WaitForResult()); | 138 ASSERT_EQ(OK, callback.WaitForResult()); |
135 // Shouldn't be merged if upload data carries a file, as it's not in-memory. | 139 // Shouldn't be merged if upload data carries a file, as it's not in-memory. |
136 ASSERT_FALSE(HttpStreamParser::ShouldMergeRequestHeadersAndBody( | 140 ASSERT_FALSE(HttpStreamParser::ShouldMergeRequestHeadersAndBody( |
137 "some header", body.get())); | 141 "some header", body.get())); |
138 } | 142 } |
139 | 143 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 } else { | 407 } else { |
404 EXPECT_EQ(ERR_HEADERS_TRUNCATED, rv); | 408 EXPECT_EQ(ERR_HEADERS_TRUNCATED, rv); |
405 EXPECT_FALSE(response_info.headers.get()); | 409 EXPECT_FALSE(response_info.headers.get()); |
406 } | 410 } |
407 } | 411 } |
408 } | 412 } |
409 } | 413 } |
410 } | 414 } |
411 | 415 |
412 } // namespace net | 416 } // namespace net |
OLD | NEW |