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/create_directo
ry.h" | 5 #include "chrome/browser/chromeos/file_system_provider/operations/create_directo
ry.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 25 matching lines...) Expand all Loading... |
36 class FileSystemProviderOperationsCreateDirectoryTest : public testing::Test { | 36 class FileSystemProviderOperationsCreateDirectoryTest : public testing::Test { |
37 protected: | 37 protected: |
38 FileSystemProviderOperationsCreateDirectoryTest() {} | 38 FileSystemProviderOperationsCreateDirectoryTest() {} |
39 ~FileSystemProviderOperationsCreateDirectoryTest() override {} | 39 ~FileSystemProviderOperationsCreateDirectoryTest() override {} |
40 | 40 |
41 void SetUp() override { | 41 void SetUp() override { |
42 MountOptions mount_options(kFileSystemId, "" /* display_name */); | 42 MountOptions mount_options(kFileSystemId, "" /* display_name */); |
43 mount_options.writable = true; | 43 mount_options.writable = true; |
44 file_system_info_ = ProvidedFileSystemInfo( | 44 file_system_info_ = ProvidedFileSystemInfo( |
45 kExtensionId, mount_options, base::FilePath(), false /* configurable */, | 45 kExtensionId, mount_options, base::FilePath(), false /* configurable */, |
46 extensions::SOURCE_FILE); | 46 true /* watchable */, extensions::SOURCE_FILE); |
47 } | 47 } |
48 | 48 |
49 ProvidedFileSystemInfo file_system_info_; | 49 ProvidedFileSystemInfo file_system_info_; |
50 }; | 50 }; |
51 | 51 |
52 TEST_F(FileSystemProviderOperationsCreateDirectoryTest, Execute) { | 52 TEST_F(FileSystemProviderOperationsCreateDirectoryTest, Execute) { |
53 using extensions::api::file_system_provider::CreateDirectoryRequestedOptions; | 53 using extensions::api::file_system_provider::CreateDirectoryRequestedOptions; |
54 | 54 |
55 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); | 55 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); |
56 util::StatusCallbackLog callback_log; | 56 util::StatusCallbackLog callback_log; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 EXPECT_FALSE(create_directory.Execute(kRequestId)); | 100 EXPECT_FALSE(create_directory.Execute(kRequestId)); |
101 } | 101 } |
102 | 102 |
103 TEST_F(FileSystemProviderOperationsCreateDirectoryTest, Execute_ReadOnly) { | 103 TEST_F(FileSystemProviderOperationsCreateDirectoryTest, 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 CreateDirectory create_directory( | 112 CreateDirectory create_directory( |
113 NULL, read_only_file_system_info, base::FilePath(kDirectoryPath), | 113 NULL, read_only_file_system_info, base::FilePath(kDirectoryPath), |
114 true /* recursive */, | 114 true /* recursive */, |
115 base::Bind(&util::LogStatusCallback, &callback_log)); | 115 base::Bind(&util::LogStatusCallback, &callback_log)); |
116 create_directory.SetDispatchEventImplForTesting( | 116 create_directory.SetDispatchEventImplForTesting( |
117 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, | 117 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, |
118 base::Unretained(&dispatcher))); | 118 base::Unretained(&dispatcher))); |
119 | 119 |
120 EXPECT_FALSE(create_directory.Execute(kRequestId)); | 120 EXPECT_FALSE(create_directory.Execute(kRequestId)); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 create_directory.OnError(kRequestId, | 158 create_directory.OnError(kRequestId, |
159 scoped_ptr<RequestValue>(new RequestValue()), | 159 scoped_ptr<RequestValue>(new RequestValue()), |
160 base::File::FILE_ERROR_TOO_MANY_OPENED); | 160 base::File::FILE_ERROR_TOO_MANY_OPENED); |
161 ASSERT_EQ(1u, callback_log.size()); | 161 ASSERT_EQ(1u, callback_log.size()); |
162 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); | 162 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); |
163 } | 163 } |
164 | 164 |
165 } // namespace operations | 165 } // namespace operations |
166 } // namespace file_system_provider | 166 } // namespace file_system_provider |
167 } // namespace chromeos | 167 } // namespace chromeos |
OLD | NEW |