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

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

Issue 99923002: Move temp file functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
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_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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_FileBody) { 121 TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_FileBody) {
122 { 122 {
123 ScopedVector<UploadElementReader> element_readers; 123 ScopedVector<UploadElementReader> element_readers;
124 124
125 // Create an empty temporary file. 125 // Create an empty temporary file.
126 base::ScopedTempDir temp_dir; 126 base::ScopedTempDir temp_dir;
127 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 127 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
128 base::FilePath temp_file_path; 128 base::FilePath temp_file_path;
129 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), 129 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(),
130 &temp_file_path)); 130 &temp_file_path));
131 131
132 element_readers.push_back( 132 element_readers.push_back(
133 new UploadFileElementReader(base::MessageLoopProxy::current().get(), 133 new UploadFileElementReader(base::MessageLoopProxy::current().get(),
134 temp_file_path, 134 temp_file_path,
135 0, 135 0,
136 0, 136 0,
137 base::Time())); 137 base::Time()));
138 138
139 scoped_ptr<UploadDataStream> body( 139 scoped_ptr<UploadDataStream> body(
140 new UploadDataStream(element_readers.Pass(), 0)); 140 new UploadDataStream(element_readers.Pass(), 0));
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 EXPECT_TRUE(response_info.headers->HasHeaderValue("Connection", "Upgrade")); 478 EXPECT_TRUE(response_info.headers->HasHeaderValue("Connection", "Upgrade"));
479 EXPECT_TRUE(response_info.headers->HasHeaderValue("Upgrade", "websocket")); 479 EXPECT_TRUE(response_info.headers->HasHeaderValue("Upgrade", "websocket"));
480 EXPECT_EQ(read_buffer->capacity(), read_buffer->offset()); 480 EXPECT_EQ(read_buffer->capacity(), read_buffer->offset());
481 EXPECT_EQ("a fake websocket frame", 481 EXPECT_EQ("a fake websocket frame",
482 base::StringPiece(read_buffer->StartOfBuffer(), 482 base::StringPiece(read_buffer->StartOfBuffer(),
483 read_buffer->capacity())); 483 read_buffer->capacity()));
484 } 484 }
485 485
486 486
487 } // namespace net 487 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/proxy/proxy_config_service_linux_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698