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

Side by Side Diff: content/browser/fileapi/file_system_file_stream_reader_unittest.cc

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "webkit/browser/fileapi/file_system_file_stream_reader.h" 5 #include "webkit/browser/fileapi/file_system_file_stream_reader.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 base::Time test_file_modification_time() const { 102 base::Time test_file_modification_time() const {
103 return test_file_modification_time_; 103 return test_file_modification_time_;
104 } 104 }
105 105
106 void WriteFile(const std::string& file_name, 106 void WriteFile(const std::string& file_name,
107 const char* buf, 107 const char* buf,
108 int buf_size, 108 int buf_size,
109 base::Time* modification_time) { 109 base::Time* modification_time) {
110 FileSystemURL url = GetFileSystemURL(file_name); 110 FileSystemURL url = GetFileSystemURL(file_name);
111 111
112 ASSERT_EQ(base::PLATFORM_FILE_OK, 112 ASSERT_EQ(base::File::FILE_OK,
113 fileapi::AsyncFileTestHelper::CreateFileWithData( 113 fileapi::AsyncFileTestHelper::CreateFileWithData(
114 file_system_context_, url, buf, buf_size)); 114 file_system_context_, url, buf, buf_size));
115 115
116 base::PlatformFileInfo file_info; 116 base::File::Info file_info;
117 ASSERT_EQ(base::PLATFORM_FILE_OK, 117 ASSERT_EQ(base::File::FILE_OK,
118 AsyncFileTestHelper::GetMetadata( 118 AsyncFileTestHelper::GetMetadata(
119 file_system_context_, url, &file_info)); 119 file_system_context_, url, &file_info));
120 if (modification_time) 120 if (modification_time)
121 *modification_time = file_info.last_modified; 121 *modification_time = file_info.last_modified;
122 } 122 }
123 123
124 private: 124 private:
125 static void OnOpenFileSystem(const GURL& root_url, 125 static void OnOpenFileSystem(const GURL& root_url,
126 const std::string& name, 126 const std::string& name,
127 base::PlatformFileError result) { 127 base::File::Error result) {
128 ASSERT_EQ(base::PLATFORM_FILE_OK, result); 128 ASSERT_EQ(base::File::FILE_OK, result);
129 } 129 }
130 130
131 FileSystemURL GetFileSystemURL(const std::string& file_name) { 131 FileSystemURL GetFileSystemURL(const std::string& file_name) {
132 return file_system_context_->CreateCrackedFileSystemURL( 132 return file_system_context_->CreateCrackedFileSystemURL(
133 GURL(kURLOrigin), 133 GURL(kURLOrigin),
134 fileapi::kFileSystemTypeTemporary, 134 fileapi::kFileSystemTypeTemporary,
135 base::FilePath().AppendASCII(file_name)); 135 base::FilePath().AppendASCII(file_name));
136 } 136 }
137 137
138 base::MessageLoopForIO message_loop_; 138 base::MessageLoopForIO message_loop_;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 new net::IOBufferWithSize(kTestDataSize)); 263 new net::IOBufferWithSize(kTestDataSize));
264 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled)); 264 int rv = reader->Read(buf.get(), buf->size(), base::Bind(&NeverCalled));
265 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); 265 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0);
266 266
267 // Delete immediately. 267 // Delete immediately.
268 // Should not crash; nor should NeverCalled be callback. 268 // Should not crash; nor should NeverCalled be callback.
269 reader.reset(); 269 reader.reset();
270 } 270 }
271 271
272 } // namespace content 272 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698