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

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

Issue 11359217: Move scoped_temp_dir from base to base/files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/flash/storage_unittest.cc ('k') | net/http/infinite_cache_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
10 #include "base/scoped_temp_dir.h"
11 #include "base/string_piece.h" 11 #include "base/string_piece.h"
12 #include "base/stringprintf.h" 12 #include "base/stringprintf.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "net/base/io_buffer.h" 14 #include "net/base/io_buffer.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "net/base/test_completion_callback.h" 16 #include "net/base/test_completion_callback.h"
17 #include "net/base/upload_data.h" 17 #include "net/base/upload_data.h"
18 #include "net/base/upload_data_stream.h" 18 #include "net/base/upload_data_stream.h"
19 #include "net/http/http_request_headers.h" 19 #include "net/http/http_request_headers.h"
20 #include "net/http/http_request_info.h" 20 #include "net/http/http_request_info.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 ASSERT_EQ(OK, body->InitSync()); 113 ASSERT_EQ(OK, body->InitSync());
114 // Shouldn't be merged if upload data carries chunked data. 114 // Shouldn't be merged if upload data carries chunked data.
115 ASSERT_FALSE(HttpStreamParser::ShouldMergeRequestHeadersAndBody( 115 ASSERT_FALSE(HttpStreamParser::ShouldMergeRequestHeadersAndBody(
116 "some header", body.get())); 116 "some header", body.get()));
117 } 117 }
118 118
119 TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_FileBody) { 119 TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_FileBody) {
120 scoped_refptr<UploadData> upload_data = new UploadData; 120 scoped_refptr<UploadData> upload_data = new UploadData;
121 121
122 // Create an empty temporary file. 122 // Create an empty temporary file.
123 ScopedTempDir temp_dir; 123 base::ScopedTempDir temp_dir;
124 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 124 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
125 FilePath temp_file_path; 125 FilePath temp_file_path;
126 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), 126 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(),
127 &temp_file_path)); 127 &temp_file_path));
128 128
129 upload_data->AppendFileRange(temp_file_path, 0, 0, base::Time()); 129 upload_data->AppendFileRange(temp_file_path, 0, 0, base::Time());
130 130
131 scoped_ptr<UploadDataStream> body(new UploadDataStream(upload_data)); 131 scoped_ptr<UploadDataStream> body(new UploadDataStream(upload_data));
132 ASSERT_EQ(OK, body->InitSync()); 132 ASSERT_EQ(OK, body->InitSync());
133 // Shouldn't be merged if upload data carries a file, as it's not in-memory. 133 // Shouldn't be merged if upload data carries a file, as it's not in-memory.
(...skipping 161 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
« no previous file with comments | « net/disk_cache/flash/storage_unittest.cc ('k') | net/http/infinite_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698