Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/browser/chromeos/file_system_provider/provided_file_system_unittest.cc

Issue 1221093002: Add support for refreshing contents of providers which don't support watchers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed tests. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 profile_.reset(new TestingProfile); 227 profile_.reset(new TestingProfile);
228 const base::FilePath mount_path = 228 const base::FilePath mount_path =
229 util::GetMountPath(profile_.get(), kExtensionId, kFileSystemId); 229 util::GetMountPath(profile_.get(), kExtensionId, kFileSystemId);
230 MountOptions mount_options; 230 MountOptions mount_options;
231 mount_options.file_system_id = kFileSystemId; 231 mount_options.file_system_id = kFileSystemId;
232 mount_options.display_name = kDisplayName; 232 mount_options.display_name = kDisplayName;
233 mount_options.supports_notify_tag = true; 233 mount_options.supports_notify_tag = true;
234 mount_options.writable = true; 234 mount_options.writable = true;
235 file_system_info_.reset(new ProvidedFileSystemInfo( 235 file_system_info_.reset(new ProvidedFileSystemInfo(
236 kExtensionId, mount_options, mount_path, false /* configurable */, 236 kExtensionId, mount_options, mount_path, false /* configurable */,
237 extensions::SOURCE_FILE)); 237 true /* watchable */, extensions::SOURCE_FILE));
238 provided_file_system_.reset( 238 provided_file_system_.reset(
239 new ProvidedFileSystem(profile_.get(), *file_system_info_.get())); 239 new ProvidedFileSystem(profile_.get(), *file_system_info_.get()));
240 event_router_.reset( 240 event_router_.reset(
241 new FakeEventRouter(profile_.get(), provided_file_system_.get())); 241 new FakeEventRouter(profile_.get(), provided_file_system_.get()));
242 event_router_->AddEventListener(extensions::api::file_system_provider:: 242 event_router_->AddEventListener(extensions::api::file_system_provider::
243 OnAddWatcherRequested::kEventName, 243 OnAddWatcherRequested::kEventName,
244 NULL, 244 NULL,
245 kExtensionId); 245 kExtensionId);
246 event_router_->AddEventListener(extensions::api::file_system_provider:: 246 event_router_->AddEventListener(extensions::api::file_system_provider::
247 OnRemoveWatcherRequested::kEventName, 247 OnRemoveWatcherRequested::kEventName,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 // 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
408 // tag, though. 408 // tag, though.
409 const base::FilePath mount_path = 409 const base::FilePath mount_path =
410 util::GetMountPath(profile_.get(), kExtensionId, kFileSystemId); 410 util::GetMountPath(profile_.get(), kExtensionId, kFileSystemId);
411 MountOptions mount_options; 411 MountOptions mount_options;
412 mount_options.file_system_id = kFileSystemId; 412 mount_options.file_system_id = kFileSystemId;
413 mount_options.display_name = kDisplayName; 413 mount_options.display_name = kDisplayName;
414 mount_options.supports_notify_tag = false; 414 mount_options.supports_notify_tag = false;
415 ProvidedFileSystemInfo file_system_info( 415 ProvidedFileSystemInfo file_system_info(
416 kExtensionId, mount_options, mount_path, false /* configurable */, 416 kExtensionId, mount_options, mount_path, false /* configurable */,
417 extensions::SOURCE_FILE); 417 true /* watchable */, extensions::SOURCE_FILE);
418 ProvidedFileSystem simple_provided_file_system(profile_.get(), 418 ProvidedFileSystem simple_provided_file_system(profile_.get(),
419 file_system_info); 419 file_system_info);
420 simple_provided_file_system.SetEventRouterForTesting(event_router_.get()); 420 simple_provided_file_system.SetEventRouterForTesting(event_router_.get());
421 simple_provided_file_system.SetNotificationManagerForTesting( 421 simple_provided_file_system.SetNotificationManagerForTesting(
422 make_scoped_ptr(new StubNotificationManager)); 422 make_scoped_ptr(new StubNotificationManager));
423 423
424 simple_provided_file_system.AddObserver(&observer); 424 simple_provided_file_system.AddObserver(&observer);
425 425
426 simple_provided_file_system.AddWatcher( 426 simple_provided_file_system.AddWatcher(
427 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
912 912
913 ASSERT_EQ(1u, close_log.size()); 913 ASSERT_EQ(1u, close_log.size());
914 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, close_log[0]); 914 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, close_log[0]);
915 EXPECT_EQ(0u, opened_files.size()); 915 EXPECT_EQ(0u, opened_files.size());
916 916
917 provided_file_system_->RemoveObserver(&observer); 917 provided_file_system_->RemoveObserver(&observer);
918 } 918 }
919 919
920 } // namespace file_system_provider 920 } // namespace file_system_provider
921 } // namespace chromeos 921 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698