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

Unified Diff: chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc

Issue 427493002: [fsp] Do not allow write operations on read only file systems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
diff --git a/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
index c70dc2d2f42457830a541128fb459ca6bca79b9c..9a40423918839ba27efc0841f83c7cb4f1983750 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/delete_entry_unittest.cc
@@ -41,7 +41,7 @@ class FileSystemProviderOperationsDeleteEntryTest : public testing::Test {
ProvidedFileSystemInfo(kExtensionId,
kFileSystemId,
"" /* file_system_name */,
- false /* writable */,
+ true /* writable */,
base::FilePath() /* mount_path */);
}
@@ -107,6 +107,29 @@ TEST_F(FileSystemProviderOperationsDeleteEntryTest, Execute_NoListener) {
EXPECT_FALSE(delete_entry.Execute(kRequestId));
}
+TEST_F(FileSystemProviderOperationsDeleteEntryTest, Execute_ReadOnly) {
+ util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
+ util::StatusCallbackLog callback_log;
+
+ const ProvidedFileSystemInfo read_only_file_system_info(
+ kExtensionId,
+ kFileSystemId,
+ "" /* file_system_name */,
+ false /* writable */,
+ base::FilePath() /* mount_path */);
+
+ DeleteEntry delete_entry(NULL,
+ read_only_file_system_info,
+ base::FilePath::FromUTF8Unsafe(kEntryPath),
+ true /* recursive */,
+ base::Bind(&util::LogStatusCallback, &callback_log));
+ delete_entry.SetDispatchEventImplForTesting(
+ base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
+ base::Unretained(&dispatcher)));
+
+ EXPECT_FALSE(delete_entry.Execute(kRequestId));
+}
+
TEST_F(FileSystemProviderOperationsDeleteEntryTest, OnSuccess) {
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
util::StatusCallbackLog callback_log;

Powered by Google App Engine
This is Rietveld 408576698