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

Side by Side Diff: content/browser/fileapi/upload_file_system_file_element_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/upload_file_system_file_element_reader.h" 5 #include "webkit/browser/fileapi/upload_file_system_file_element_reader.h"
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "content/public/test/test_file_system_context.h" 10 #include "content/public/test/test_file_system_context.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void WriteFileSystemFile(const std::string& filename, 88 void WriteFileSystemFile(const std::string& filename,
89 const char* buf, 89 const char* buf,
90 int buf_size, 90 int buf_size,
91 base::Time* modification_time) { 91 base::Time* modification_time) {
92 fileapi::FileSystemURL url = 92 fileapi::FileSystemURL url =
93 file_system_context_->CreateCrackedFileSystemURL( 93 file_system_context_->CreateCrackedFileSystemURL(
94 GURL(kFileSystemURLOrigin), 94 GURL(kFileSystemURLOrigin),
95 kFileSystemType, 95 kFileSystemType,
96 base::FilePath().AppendASCII(filename)); 96 base::FilePath().AppendASCII(filename));
97 97
98 ASSERT_EQ(base::PLATFORM_FILE_OK, 98 ASSERT_EQ(base::File::FILE_OK,
99 AsyncFileTestHelper::CreateFileWithData( 99 AsyncFileTestHelper::CreateFileWithData(
100 file_system_context_, url, buf, buf_size)); 100 file_system_context_, url, buf, buf_size));
101 101
102 base::PlatformFileInfo file_info; 102 base::File::Info file_info;
103 ASSERT_EQ(base::PLATFORM_FILE_OK, 103 ASSERT_EQ(base::File::FILE_OK,
104 AsyncFileTestHelper::GetMetadata( 104 AsyncFileTestHelper::GetMetadata(
105 file_system_context_, url, &file_info)); 105 file_system_context_, url, &file_info));
106 *modification_time = file_info.last_modified; 106 *modification_time = file_info.last_modified;
107 } 107 }
108 108
109 void OnOpenFileSystem(const GURL& root, 109 void OnOpenFileSystem(const GURL& root,
110 const std::string& name, 110 const std::string& name,
111 base::PlatformFileError result) { 111 base::File::Error result) {
112 ASSERT_EQ(base::PLATFORM_FILE_OK, result); 112 ASSERT_EQ(base::File::FILE_OK, result);
113 ASSERT_TRUE(root.is_valid()); 113 ASSERT_TRUE(root.is_valid());
114 file_system_root_url_ = root; 114 file_system_root_url_ = root;
115 } 115 }
116 116
117 base::MessageLoopForIO message_loop_; 117 base::MessageLoopForIO message_loop_;
118 base::ScopedTempDir temp_dir_; 118 base::ScopedTempDir temp_dir_;
119 scoped_refptr<FileSystemContext> file_system_context_; 119 scoped_refptr<FileSystemContext> file_system_context_;
120 GURL file_system_root_url_; 120 GURL file_system_root_url_;
121 std::vector<char> file_data_; 121 std::vector<char> file_data_;
122 GURL file_url_; 122 GURL file_url_;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 TEST_F(UploadFileSystemFileElementReaderTest, WrongURL) { 275 TEST_F(UploadFileSystemFileElementReaderTest, WrongURL) {
276 const GURL wrong_url = GetFileSystemURL("wrong_file_name.dat"); 276 const GURL wrong_url = GetFileSystemURL("wrong_file_name.dat");
277 reader_.reset(new UploadFileSystemFileElementReader( 277 reader_.reset(new UploadFileSystemFileElementReader(
278 file_system_context_.get(), wrong_url, 0, kuint64max, base::Time())); 278 file_system_context_.get(), wrong_url, 0, kuint64max, base::Time()));
279 net::TestCompletionCallback init_callback; 279 net::TestCompletionCallback init_callback;
280 ASSERT_EQ(net::ERR_IO_PENDING, reader_->Init(init_callback.callback())); 280 ASSERT_EQ(net::ERR_IO_PENDING, reader_->Init(init_callback.callback()));
281 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, init_callback.WaitForResult()); 281 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, init_callback.WaitForResult());
282 } 282 }
283 283
284 } // namespace content 284 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/transient_file_util_unittest.cc ('k') | content/browser/loader/redirect_to_file_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698