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/registry.h" | 5 #include "chrome/browser/chromeos/file_system_provider/registry.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" | 12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info
.h" |
| 13 #include "chrome/common/extensions/api/file_system_provider_capabilities/file_sy
stem_provider_capabilities_handler.h" |
13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
14 #include "chrome/test/base/testing_browser_process.h" | 15 #include "chrome/test/base/testing_browser_process.h" |
15 #include "chrome/test/base/testing_pref_service_syncable.h" | 16 #include "chrome/test/base/testing_pref_service_syncable.h" |
16 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
17 #include "chrome/test/base/testing_profile_manager.h" | 18 #include "chrome/test/base/testing_profile_manager.h" |
18 #include "components/user_prefs/user_prefs.h" | 19 #include "components/user_prefs/user_prefs.h" |
19 #include "content/public/test/test_browser_thread_bundle.h" | 20 #include "content/public/test/test_browser_thread_bundle.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
21 | 22 |
22 namespace chromeos { | 23 namespace chromeos { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 EXPECT_EQ(fake_watcher_.last_tag, restored_watcher_it->second.last_tag); | 151 EXPECT_EQ(fake_watcher_.last_tag, restored_watcher_it->second.last_tag); |
151 } | 152 } |
152 | 153 |
153 TEST_F(FileSystemProviderRegistryTest, RememberFileSystem) { | 154 TEST_F(FileSystemProviderRegistryTest, RememberFileSystem) { |
154 MountOptions options(kFileSystemId, kDisplayName); | 155 MountOptions options(kFileSystemId, kDisplayName); |
155 options.writable = true; | 156 options.writable = true; |
156 options.supports_notify_tag = true; | 157 options.supports_notify_tag = true; |
157 options.opened_files_limit = kOpenedFilesLimit; | 158 options.opened_files_limit = kOpenedFilesLimit; |
158 | 159 |
159 ProvidedFileSystemInfo file_system_info( | 160 ProvidedFileSystemInfo file_system_info( |
160 kExtensionId, options, base::FilePath(FILE_PATH_LITERAL("/a/b/c"))); | 161 kExtensionId, options, base::FilePath(FILE_PATH_LITERAL("/a/b/c")), |
| 162 false /* configurable */, extensions::SOURCE_FILE); |
161 | 163 |
162 Watchers watchers; | 164 Watchers watchers; |
163 watchers[WatcherKey(fake_watcher_.entry_path, fake_watcher_.recursive)] = | 165 watchers[WatcherKey(fake_watcher_.entry_path, fake_watcher_.recursive)] = |
164 fake_watcher_; | 166 fake_watcher_; |
165 | 167 |
166 registry_->RememberFileSystem(file_system_info, watchers); | 168 registry_->RememberFileSystem(file_system_info, watchers); |
167 | 169 |
168 TestingPrefServiceSyncable* const pref_service = | 170 TestingPrefServiceSyncable* const pref_service = |
169 profile_->GetTestingPrefService(); | 171 profile_->GetTestingPrefService(); |
170 ASSERT_TRUE(pref_service); | 172 ASSERT_TRUE(pref_service); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 EXPECT_FALSE(extensions->GetDictionaryWithoutPathExpansion(kExtensionId, | 267 EXPECT_FALSE(extensions->GetDictionaryWithoutPathExpansion(kExtensionId, |
266 &file_systems)); | 268 &file_systems)); |
267 } | 269 } |
268 | 270 |
269 TEST_F(FileSystemProviderRegistryTest, UpdateWatcherTag) { | 271 TEST_F(FileSystemProviderRegistryTest, UpdateWatcherTag) { |
270 MountOptions options(kFileSystemId, kDisplayName); | 272 MountOptions options(kFileSystemId, kDisplayName); |
271 options.writable = true; | 273 options.writable = true; |
272 options.supports_notify_tag = true; | 274 options.supports_notify_tag = true; |
273 | 275 |
274 ProvidedFileSystemInfo file_system_info( | 276 ProvidedFileSystemInfo file_system_info( |
275 kExtensionId, options, base::FilePath(FILE_PATH_LITERAL("/a/b/c"))); | 277 kExtensionId, options, base::FilePath(FILE_PATH_LITERAL("/a/b/c")), |
| 278 false /* configurable */, extensions::SOURCE_FILE); |
276 | 279 |
277 Watchers watchers; | 280 Watchers watchers; |
278 watchers[WatcherKey(fake_watcher_.entry_path, fake_watcher_.recursive)] = | 281 watchers[WatcherKey(fake_watcher_.entry_path, fake_watcher_.recursive)] = |
279 fake_watcher_; | 282 fake_watcher_; |
280 | 283 |
281 registry_->RememberFileSystem(file_system_info, watchers); | 284 registry_->RememberFileSystem(file_system_info, watchers); |
282 | 285 |
283 fake_watcher_.last_tag = "updated-tag"; | 286 fake_watcher_.last_tag = "updated-tag"; |
284 registry_->UpdateWatcherTag(file_system_info, fake_watcher_); | 287 registry_->UpdateWatcherTag(file_system_info, fake_watcher_); |
285 | 288 |
(...skipping 25 matching lines...) Expand all Loading... |
311 fake_watcher_.entry_path.value(), &watcher)); | 314 fake_watcher_.entry_path.value(), &watcher)); |
312 | 315 |
313 std::string last_tag; | 316 std::string last_tag; |
314 EXPECT_TRUE(watcher->GetStringWithoutPathExpansion(kPrefKeyWatcherLastTag, | 317 EXPECT_TRUE(watcher->GetStringWithoutPathExpansion(kPrefKeyWatcherLastTag, |
315 &last_tag)); | 318 &last_tag)); |
316 EXPECT_EQ(fake_watcher_.last_tag, last_tag); | 319 EXPECT_EQ(fake_watcher_.last_tag, last_tag); |
317 } | 320 } |
318 | 321 |
319 } // namespace file_system_provider | 322 } // namespace file_system_provider |
320 } // namespace chromeos | 323 } // namespace chromeos |
OLD | NEW |