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/service.h" | 5 #include "chrome/browser/chromeos/file_system_provider/service.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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 ProvidedFileSystemInfo file_system_info_; | 61 ProvidedFileSystemInfo file_system_info_; |
62 base::File::Error error_; | 62 base::File::Error error_; |
63 }; | 63 }; |
64 | 64 |
65 LoggingObserver() {} | 65 LoggingObserver() {} |
66 virtual ~LoggingObserver() {} | 66 virtual ~LoggingObserver() {} |
67 | 67 |
68 // file_system_provider::Observer overrides. | 68 // file_system_provider::Observer overrides. |
69 virtual void OnProvidedFileSystemMount( | 69 virtual void OnProvidedFileSystemMount( |
70 const ProvidedFileSystemInfo& file_system_info, | 70 const ProvidedFileSystemInfo& file_system_info, |
71 base::File::Error error) OVERRIDE { | 71 base::File::Error error) override { |
72 mounts.push_back(Event(file_system_info, error)); | 72 mounts.push_back(Event(file_system_info, error)); |
73 } | 73 } |
74 | 74 |
75 virtual void OnProvidedFileSystemUnmount( | 75 virtual void OnProvidedFileSystemUnmount( |
76 const ProvidedFileSystemInfo& file_system_info, | 76 const ProvidedFileSystemInfo& file_system_info, |
77 base::File::Error error) OVERRIDE { | 77 base::File::Error error) override { |
78 unmounts.push_back(Event(file_system_info, error)); | 78 unmounts.push_back(Event(file_system_info, error)); |
79 } | 79 } |
80 | 80 |
81 std::vector<Event> mounts; | 81 std::vector<Event> mounts; |
82 std::vector<Event> unmounts; | 82 std::vector<Event> unmounts; |
83 }; | 83 }; |
84 | 84 |
85 // Creates a fake extension with the specified |extension_id|. | 85 // Creates a fake extension with the specified |extension_id|. |
86 scoped_refptr<extensions::Extension> createFakeExtension( | 86 scoped_refptr<extensions::Extension> createFakeExtension( |
87 const std::string& extension_id) { | 87 const std::string& extension_id) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 } // namespace | 125 } // namespace |
126 | 126 |
127 class FileSystemProviderServiceTest : public testing::Test { | 127 class FileSystemProviderServiceTest : public testing::Test { |
128 protected: | 128 protected: |
129 FileSystemProviderServiceTest() : profile_(NULL) {} | 129 FileSystemProviderServiceTest() : profile_(NULL) {} |
130 | 130 |
131 virtual ~FileSystemProviderServiceTest() {} | 131 virtual ~FileSystemProviderServiceTest() {} |
132 | 132 |
133 virtual void SetUp() OVERRIDE { | 133 virtual void SetUp() override { |
134 profile_manager_.reset( | 134 profile_manager_.reset( |
135 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 135 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
136 ASSERT_TRUE(profile_manager_->SetUp()); | 136 ASSERT_TRUE(profile_manager_->SetUp()); |
137 profile_ = profile_manager_->CreateTestingProfile("test-user@example.com"); | 137 profile_ = profile_manager_->CreateTestingProfile("test-user@example.com"); |
138 user_manager_ = new FakeUserManager(); | 138 user_manager_ = new FakeUserManager(); |
139 user_manager_->AddUser(profile_->GetProfileName()); | 139 user_manager_->AddUser(profile_->GetProfileName()); |
140 user_manager_enabler_.reset(new ScopedUserManagerEnabler(user_manager_)); | 140 user_manager_enabler_.reset(new ScopedUserManagerEnabler(user_manager_)); |
141 extension_registry_.reset(new extensions::ExtensionRegistry(profile_)); | 141 extension_registry_.reset(new extensions::ExtensionRegistry(profile_)); |
142 service_.reset(new Service(profile_, extension_registry_.get())); | 142 service_.reset(new Service(profile_, extension_registry_.get())); |
143 service_->SetFileSystemFactoryForTesting( | 143 service_->SetFileSystemFactoryForTesting( |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 const base::DictionaryValue* file_systems = NULL; | 479 const base::DictionaryValue* file_systems = NULL; |
480 EXPECT_FALSE(extensions->GetDictionaryWithoutPathExpansion(kExtensionId, | 480 EXPECT_FALSE(extensions->GetDictionaryWithoutPathExpansion(kExtensionId, |
481 &file_systems)); | 481 &file_systems)); |
482 } | 482 } |
483 | 483 |
484 service_->RemoveObserver(&observer); | 484 service_->RemoveObserver(&observer); |
485 } | 485 } |
486 | 486 |
487 } // namespace file_system_provider | 487 } // namespace file_system_provider |
488 } // namespace chromeos | 488 } // namespace chromeos |
OLD | NEW |