| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/copy_entry.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 class FileSystemProviderOperationsCopyEntryTest : public testing::Test { | 38 class FileSystemProviderOperationsCopyEntryTest : public testing::Test { |
| 39 protected: | 39 protected: |
| 40 FileSystemProviderOperationsCopyEntryTest() {} | 40 FileSystemProviderOperationsCopyEntryTest() {} |
| 41 ~FileSystemProviderOperationsCopyEntryTest() override {} | 41 ~FileSystemProviderOperationsCopyEntryTest() override {} |
| 42 | 42 |
| 43 void SetUp() override { | 43 void SetUp() override { |
| 44 MountOptions mount_options(kFileSystemId, "" /* display_name */); | 44 MountOptions mount_options(kFileSystemId, "" /* display_name */); |
| 45 mount_options.writable = true; | 45 mount_options.writable = true; |
| 46 file_system_info_ = ProvidedFileSystemInfo( | 46 file_system_info_ = ProvidedFileSystemInfo( |
| 47 kExtensionId, mount_options, base::FilePath(), false /* configurable */, | 47 kExtensionId, mount_options, base::FilePath(), false /* configurable */, |
| 48 extensions::SOURCE_FILE); | 48 true /* watchable */, extensions::SOURCE_FILE); |
| 49 } | 49 } |
| 50 | 50 |
| 51 ProvidedFileSystemInfo file_system_info_; | 51 ProvidedFileSystemInfo file_system_info_; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 TEST_F(FileSystemProviderOperationsCopyEntryTest, Execute) { | 54 TEST_F(FileSystemProviderOperationsCopyEntryTest, Execute) { |
| 55 using extensions::api::file_system_provider::CopyEntryRequestedOptions; | 55 using extensions::api::file_system_provider::CopyEntryRequestedOptions; |
| 56 | 56 |
| 57 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); | 57 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); |
| 58 util::StatusCallbackLog callback_log; | 58 util::StatusCallbackLog callback_log; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 EXPECT_FALSE(copy_entry.Execute(kRequestId)); | 99 EXPECT_FALSE(copy_entry.Execute(kRequestId)); |
| 100 } | 100 } |
| 101 | 101 |
| 102 TEST_F(FileSystemProviderOperationsCopyEntryTest, Execute_ReadOnly) { | 102 TEST_F(FileSystemProviderOperationsCopyEntryTest, Execute_ReadOnly) { |
| 103 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); | 103 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); |
| 104 util::StatusCallbackLog callback_log; | 104 util::StatusCallbackLog callback_log; |
| 105 | 105 |
| 106 const ProvidedFileSystemInfo read_only_file_system_info( | 106 const ProvidedFileSystemInfo read_only_file_system_info( |
| 107 kExtensionId, MountOptions(kFileSystemId, "" /* display_name */), | 107 kExtensionId, MountOptions(kFileSystemId, "" /* display_name */), |
| 108 base::FilePath() /* mount_path */, false /* configurable */, | 108 base::FilePath() /* mount_path */, false /* configurable */, |
| 109 extensions::SOURCE_FILE); | 109 true /* watchable */, extensions::SOURCE_FILE); |
| 110 | 110 |
| 111 CopyEntry copy_entry(NULL, read_only_file_system_info, | 111 CopyEntry copy_entry(NULL, read_only_file_system_info, |
| 112 base::FilePath(kSourcePath), base::FilePath(kTargetPath), | 112 base::FilePath(kSourcePath), base::FilePath(kTargetPath), |
| 113 base::Bind(&util::LogStatusCallback, &callback_log)); | 113 base::Bind(&util::LogStatusCallback, &callback_log)); |
| 114 copy_entry.SetDispatchEventImplForTesting( | 114 copy_entry.SetDispatchEventImplForTesting( |
| 115 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, | 115 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, |
| 116 base::Unretained(&dispatcher))); | 116 base::Unretained(&dispatcher))); |
| 117 | 117 |
| 118 EXPECT_FALSE(copy_entry.Execute(kRequestId)); | 118 EXPECT_FALSE(copy_entry.Execute(kRequestId)); |
| 119 } | 119 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 copy_entry.OnError(kRequestId, | 154 copy_entry.OnError(kRequestId, |
| 155 scoped_ptr<RequestValue>(new RequestValue()), | 155 scoped_ptr<RequestValue>(new RequestValue()), |
| 156 base::File::FILE_ERROR_TOO_MANY_OPENED); | 156 base::File::FILE_ERROR_TOO_MANY_OPENED); |
| 157 ASSERT_EQ(1u, callback_log.size()); | 157 ASSERT_EQ(1u, callback_log.size()); |
| 158 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); | 158 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace operations | 161 } // namespace operations |
| 162 } // namespace file_system_provider | 162 } // namespace file_system_provider |
| 163 } // namespace chromeos | 163 } // namespace chromeos |
| OLD | NEW |