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