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/provided_file_system.h" | 5 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" | 17 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" |
18 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" | 18 #include "chrome/browser/chromeos/file_system_provider/notification_manager.h" |
19 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" | 19 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" |
20 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" | 20 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" |
21 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" | 21 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_obse
rver.h" |
22 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" | 22 #include "chrome/browser/chromeos/file_system_provider/request_manager.h" |
23 #include "chrome/browser/chromeos/file_system_provider/watcher.h" | 23 #include "chrome/browser/chromeos/file_system_provider/watcher.h" |
24 #include "chrome/common/extensions/api/file_system_provider.h" | 24 #include "chrome/common/extensions/api/file_system_provider.h" |
| 25 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_sy
stem_provider_capabilities_handler.h" |
25 #include "chrome/common/extensions/api/file_system_provider_internal.h" | 26 #include "chrome/common/extensions/api/file_system_provider_internal.h" |
26 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
27 #include "content/public/test/test_browser_thread_bundle.h" | 28 #include "content/public/test/test_browser_thread_bundle.h" |
28 #include "extensions/browser/event_router.h" | 29 #include "extensions/browser/event_router.h" |
29 #include "storage/browser/fileapi/watcher_manager.h" | 30 #include "storage/browser/fileapi/watcher_manager.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
31 | 32 |
32 namespace chromeos { | 33 namespace chromeos { |
33 namespace file_system_provider { | 34 namespace file_system_provider { |
34 namespace { | 35 namespace { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 | 225 |
225 void SetUp() override { | 226 void SetUp() override { |
226 profile_.reset(new TestingProfile); | 227 profile_.reset(new TestingProfile); |
227 const base::FilePath mount_path = | 228 const base::FilePath mount_path = |
228 util::GetMountPath(profile_.get(), kExtensionId, kFileSystemId); | 229 util::GetMountPath(profile_.get(), kExtensionId, kFileSystemId); |
229 MountOptions mount_options; | 230 MountOptions mount_options; |
230 mount_options.file_system_id = kFileSystemId; | 231 mount_options.file_system_id = kFileSystemId; |
231 mount_options.display_name = kDisplayName; | 232 mount_options.display_name = kDisplayName; |
232 mount_options.supports_notify_tag = true; | 233 mount_options.supports_notify_tag = true; |
233 mount_options.writable = true; | 234 mount_options.writable = true; |
234 file_system_info_.reset( | 235 file_system_info_.reset(new ProvidedFileSystemInfo( |
235 new ProvidedFileSystemInfo(kExtensionId, mount_options, mount_path)); | 236 kExtensionId, mount_options, mount_path, false /* configurable */, |
| 237 extensions::SOURCE_FILE)); |
236 provided_file_system_.reset( | 238 provided_file_system_.reset( |
237 new ProvidedFileSystem(profile_.get(), *file_system_info_.get())); | 239 new ProvidedFileSystem(profile_.get(), *file_system_info_.get())); |
238 event_router_.reset( | 240 event_router_.reset( |
239 new FakeEventRouter(profile_.get(), provided_file_system_.get())); | 241 new FakeEventRouter(profile_.get(), provided_file_system_.get())); |
240 event_router_->AddEventListener(extensions::api::file_system_provider:: | 242 event_router_->AddEventListener(extensions::api::file_system_provider:: |
241 OnAddWatcherRequested::kEventName, | 243 OnAddWatcherRequested::kEventName, |
242 NULL, | 244 NULL, |
243 kExtensionId); | 245 kExtensionId); |
244 event_router_->AddEventListener(extensions::api::file_system_provider:: | 246 event_router_->AddEventListener(extensions::api::file_system_provider:: |
245 OnRemoveWatcherRequested::kEventName, | 247 OnRemoveWatcherRequested::kEventName, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 406 |
405 // Create a provided file system interface, which does not support a notify | 407 // Create a provided file system interface, which does not support a notify |
406 // tag, though. | 408 // tag, though. |
407 const base::FilePath mount_path = | 409 const base::FilePath mount_path = |
408 util::GetMountPath(profile_.get(), kExtensionId, kFileSystemId); | 410 util::GetMountPath(profile_.get(), kExtensionId, kFileSystemId); |
409 MountOptions mount_options; | 411 MountOptions mount_options; |
410 mount_options.file_system_id = kFileSystemId; | 412 mount_options.file_system_id = kFileSystemId; |
411 mount_options.display_name = kDisplayName; | 413 mount_options.display_name = kDisplayName; |
412 mount_options.supports_notify_tag = false; | 414 mount_options.supports_notify_tag = false; |
413 ProvidedFileSystemInfo file_system_info( | 415 ProvidedFileSystemInfo file_system_info( |
414 kExtensionId, mount_options, mount_path); | 416 kExtensionId, mount_options, mount_path, false /* configurable */, |
| 417 extensions::SOURCE_FILE); |
415 ProvidedFileSystem simple_provided_file_system(profile_.get(), | 418 ProvidedFileSystem simple_provided_file_system(profile_.get(), |
416 file_system_info); | 419 file_system_info); |
417 simple_provided_file_system.SetEventRouterForTesting(event_router_.get()); | 420 simple_provided_file_system.SetEventRouterForTesting(event_router_.get()); |
418 simple_provided_file_system.SetNotificationManagerForTesting( | 421 simple_provided_file_system.SetNotificationManagerForTesting( |
419 make_scoped_ptr(new StubNotificationManager)); | 422 make_scoped_ptr(new StubNotificationManager)); |
420 | 423 |
421 simple_provided_file_system.AddObserver(&observer); | 424 simple_provided_file_system.AddObserver(&observer); |
422 | 425 |
423 simple_provided_file_system.AddWatcher( | 426 simple_provided_file_system.AddWatcher( |
424 GURL(kOrigin), base::FilePath(kDirectoryPath), false /* recursive */, | 427 GURL(kOrigin), base::FilePath(kDirectoryPath), false /* recursive */, |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 | 912 |
910 ASSERT_EQ(1u, close_log.size()); | 913 ASSERT_EQ(1u, close_log.size()); |
911 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, close_log[0]); | 914 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, close_log[0]); |
912 EXPECT_EQ(0u, opened_files.size()); | 915 EXPECT_EQ(0u, opened_files.size()); |
913 | 916 |
914 provided_file_system_->RemoveObserver(&observer); | 917 provided_file_system_->RemoveObserver(&observer); |
915 } | 918 } |
916 | 919 |
917 } // namespace file_system_provider | 920 } // namespace file_system_provider |
918 } // namespace chromeos | 921 } // namespace chromeos |
OLD | NEW |