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

Side by Side Diff: trunk/src/net/base/file_stream_unittest.cc

Issue 105823009: Revert 239280 "Move more file_util functions to base namespace." (Closed) Base URL: svn://svn.chromium.org/chrome/
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/base/file_stream.h" 5 #include "net/base/file_stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 scoped_ptr<FileStream> write_stream( 194 scoped_ptr<FileStream> write_stream(
195 new FileStream(file, flags, NULL, base::MessageLoopProxy::current())); 195 new FileStream(file, flags, NULL, base::MessageLoopProxy::current()));
196 ASSERT_EQ(0, write_stream->SeekSync(FROM_BEGIN, 0)); 196 ASSERT_EQ(0, write_stream->SeekSync(FROM_BEGIN, 0));
197 ASSERT_EQ(kTestDataSize, 197 ASSERT_EQ(kTestDataSize,
198 write_stream->WriteSync(kTestData, kTestDataSize)); 198 write_stream->WriteSync(kTestData, kTestDataSize));
199 write_stream.reset(); 199 write_stream.reset();
200 200
201 // Read into buffer and compare to make sure the handle worked fine. 201 // Read into buffer and compare to make sure the handle worked fine.
202 ASSERT_EQ(kTestDataSize, 202 ASSERT_EQ(kTestDataSize,
203 base::ReadFile(temp_file_path(), buffer, kTestDataSize)); 203 file_util::ReadFile(temp_file_path(), buffer, kTestDataSize));
204 ASSERT_EQ(0, memcmp(kTestData, buffer, kTestDataSize)); 204 ASSERT_EQ(0, memcmp(kTestData, buffer, kTestDataSize));
205 } 205 }
206 206
207 TEST_F(FileStreamTest, UseClosedStream) { 207 TEST_F(FileStreamTest, UseClosedStream) {
208 FileStream stream(NULL, base::MessageLoopProxy::current()); 208 FileStream stream(NULL, base::MessageLoopProxy::current());
209 209
210 EXPECT_FALSE(stream.IsOpen()); 210 EXPECT_FALSE(stream.IsOpen());
211 211
212 // Try seeking... 212 // Try seeking...
213 int64 new_offset = stream.SeekSync(FROM_BEGIN, 5); 213 int64 new_offset = stream.SeekSync(FROM_BEGIN, 5);
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 total_bytes_read += rv; 1222 total_bytes_read += rv;
1223 data_read.append(buf->data(), rv); 1223 data_read.append(buf->data(), rv);
1224 } 1224 }
1225 EXPECT_EQ(file_size, total_bytes_read); 1225 EXPECT_EQ(file_size, total_bytes_read);
1226 } 1226 }
1227 #endif 1227 #endif
1228 1228
1229 } // namespace 1229 } // namespace
1230 1230
1231 } // namespace net 1231 } // namespace net
OLDNEW
« no previous file with comments | « trunk/src/net/android/keystore_unittest.cc ('k') | trunk/src/net/base/net_log_logger_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698