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

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

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « jingle/glue/logging_unittest.cc ('k') | net/base/gzip_filter_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/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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 ASSERT_EQ(4, write_stream->Truncate(4)); 1010 ASSERT_EQ(4, write_stream->Truncate(4));
1011 1011
1012 // Write again. 1012 // Write again.
1013 write_stream->WriteSync(test_data, 4); 1013 write_stream->WriteSync(test_data, 4);
1014 1014
1015 // Close the stream. 1015 // Close the stream.
1016 write_stream.reset(); 1016 write_stream.reset();
1017 1017
1018 // Read in the contents and make sure we get back what we expected. 1018 // Read in the contents and make sure we get back what we expected.
1019 std::string read_contents; 1019 std::string read_contents;
1020 EXPECT_TRUE(file_util::ReadFileToString(temp_file_path(), &read_contents)); 1020 EXPECT_TRUE(base::ReadFileToString(temp_file_path(), &read_contents));
1021 1021
1022 EXPECT_EQ("01230123", read_contents); 1022 EXPECT_EQ("01230123", read_contents);
1023 } 1023 }
1024 1024
1025 TEST_F(FileStreamTest, AsyncOpenAndDelete) { 1025 TEST_F(FileStreamTest, AsyncOpenAndDelete) {
1026 scoped_ptr<FileStream> stream(new FileStream(NULL)); 1026 scoped_ptr<FileStream> stream(new FileStream(NULL));
1027 int flags = base::PLATFORM_FILE_OPEN | 1027 int flags = base::PLATFORM_FILE_OPEN |
1028 base::PLATFORM_FILE_WRITE | 1028 base::PLATFORM_FILE_WRITE |
1029 base::PLATFORM_FILE_ASYNC; 1029 base::PLATFORM_FILE_ASYNC;
1030 TestCompletionCallback open_callback; 1030 TestCompletionCallback open_callback;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 scoped_refptr<IOBuffer> buf = new WrappedIOBuffer(NULL); 1073 scoped_refptr<IOBuffer> buf = new WrappedIOBuffer(NULL);
1074 rv = stream->Read(buf.get(), 1, callback.callback()); 1074 rv = stream->Read(buf.get(), 1, callback.callback());
1075 if (rv == ERR_IO_PENDING) 1075 if (rv == ERR_IO_PENDING)
1076 rv = callback.WaitForResult(); 1076 rv = callback.WaitForResult();
1077 EXPECT_LT(rv, 0); 1077 EXPECT_LT(rv, 0);
1078 } 1078 }
1079 1079
1080 } // namespace 1080 } // namespace
1081 1081
1082 } // namespace net 1082 } // namespace net
OLDNEW
« no previous file with comments | « jingle/glue/logging_unittest.cc ('k') | net/base/gzip_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698