Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: net/http/http_stream_parser_unittest.cc

Issue 11778016: net: Stop using base::WorkerPool from UploadFileElementReader (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: _ Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 FilePath temp_file_path; 124 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(new UploadFileElementReader(
129 temp_file_path, 0, 0, base::Time())); 129 base::MessageLoopProxy::current(), temp_file_path, 0, 0, base::Time()));
130 130
131 scoped_ptr<UploadDataStream> body(new UploadDataStream(&element_readers, 0)); 131 scoped_ptr<UploadDataStream> body(new UploadDataStream(&element_readers, 0));
132 TestCompletionCallback callback; 132 TestCompletionCallback callback;
133 ASSERT_EQ(ERR_IO_PENDING, body->Init(callback.callback())); 133 ASSERT_EQ(ERR_IO_PENDING, body->Init(callback.callback()));
134 ASSERT_EQ(OK, callback.WaitForResult()); 134 ASSERT_EQ(OK, callback.WaitForResult());
135 // Shouldn't be merged if upload data carries a file, as it's not in-memory. 135 // Shouldn't be merged if upload data carries a file, as it's not in-memory.
136 ASSERT_FALSE(HttpStreamParser::ShouldMergeRequestHeadersAndBody( 136 ASSERT_FALSE(HttpStreamParser::ShouldMergeRequestHeadersAndBody(
137 "some header", body.get())); 137 "some header", body.get()));
138 } 138 }
139 139
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 rv = parser.ReadResponseBody(body_buffer, kBodySize, callback.callback()); 295 rv = parser.ReadResponseBody(body_buffer, kBodySize, callback.callback());
296 ASSERT_EQ(ERR_IO_PENDING, rv); 296 ASSERT_EQ(ERR_IO_PENDING, rv);
297 data.RunFor(1); 297 data.RunFor(1);
298 298
299 ASSERT_TRUE(callback.have_result()); 299 ASSERT_TRUE(callback.have_result());
300 rv = callback.WaitForResult(); 300 rv = callback.WaitForResult();
301 ASSERT_EQ(kBodySize, rv); 301 ASSERT_EQ(kBodySize, rv);
302 } 302 }
303 303
304 } // namespace net 304 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698