| OLD | NEW |
| 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 "content/browser/fileapi/upload_file_system_file_element_reader.h" | 5 #include "content/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/async_file_test_helper.h" | 10 #include "content/public/test/async_file_test_helper.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 int buf_size, | 89 int buf_size, |
| 90 base::Time* modification_time) { | 90 base::Time* modification_time) { |
| 91 storage::FileSystemURL url = | 91 storage::FileSystemURL url = |
| 92 file_system_context_->CreateCrackedFileSystemURL( | 92 file_system_context_->CreateCrackedFileSystemURL( |
| 93 GURL(kFileSystemURLOrigin), | 93 GURL(kFileSystemURLOrigin), |
| 94 kFileSystemType, | 94 kFileSystemType, |
| 95 base::FilePath().AppendASCII(filename)); | 95 base::FilePath().AppendASCII(filename)); |
| 96 | 96 |
| 97 ASSERT_EQ(base::File::FILE_OK, | 97 ASSERT_EQ(base::File::FILE_OK, |
| 98 AsyncFileTestHelper::CreateFileWithData( | 98 AsyncFileTestHelper::CreateFileWithData( |
| 99 file_system_context_, url, buf, buf_size)); | 99 file_system_context_.get(), url, buf, buf_size)); |
| 100 | 100 |
| 101 base::File::Info file_info; | 101 base::File::Info file_info; |
| 102 ASSERT_EQ(base::File::FILE_OK, | 102 ASSERT_EQ(base::File::FILE_OK, |
| 103 AsyncFileTestHelper::GetMetadata( | 103 AsyncFileTestHelper::GetMetadata( |
| 104 file_system_context_, url, &file_info)); | 104 file_system_context_.get(), url, &file_info)); |
| 105 *modification_time = file_info.last_modified; | 105 *modification_time = file_info.last_modified; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void OnOpenFileSystem(const GURL& root, | 108 void OnOpenFileSystem(const GURL& root, |
| 109 const std::string& name, | 109 const std::string& name, |
| 110 base::File::Error result) { | 110 base::File::Error result) { |
| 111 ASSERT_EQ(base::File::FILE_OK, result); | 111 ASSERT_EQ(base::File::FILE_OK, result); |
| 112 ASSERT_TRUE(root.is_valid()); | 112 ASSERT_TRUE(root.is_valid()); |
| 113 file_system_root_url_ = root; | 113 file_system_root_url_ = root; |
| 114 } | 114 } |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 TEST_F(UploadFileSystemFileElementReaderTest, WrongURL) { | 274 TEST_F(UploadFileSystemFileElementReaderTest, WrongURL) { |
| 275 const GURL wrong_url = GetFileSystemURL("wrong_file_name.dat"); | 275 const GURL wrong_url = GetFileSystemURL("wrong_file_name.dat"); |
| 276 reader_.reset(new UploadFileSystemFileElementReader( | 276 reader_.reset(new UploadFileSystemFileElementReader( |
| 277 file_system_context_.get(), wrong_url, 0, kuint64max, base::Time())); | 277 file_system_context_.get(), wrong_url, 0, kuint64max, base::Time())); |
| 278 net::TestCompletionCallback init_callback; | 278 net::TestCompletionCallback init_callback; |
| 279 ASSERT_EQ(net::ERR_IO_PENDING, reader_->Init(init_callback.callback())); | 279 ASSERT_EQ(net::ERR_IO_PENDING, reader_->Init(init_callback.callback())); |
| 280 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, init_callback.WaitForResult()); | 280 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, init_callback.WaitForResult()); |
| 281 } | 281 } |
| 282 | 282 |
| 283 } // namespace content | 283 } // namespace content |
| OLD | NEW |