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

Unified Diff: chrome/browser/chromeos/file_system_provider/operations/truncate_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/truncate_unittest.cc
diff --git a/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc b/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc
index 66e2adcbede4aaa307cd7550bdedaaf83f223650..1ba6a14c29f743934b8957fc66f7c6411113fcf4 100644
--- a/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc
+++ b/chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc
@@ -108,6 +108,29 @@ TEST_F(FileSystemProviderOperationsTruncateTest, Execute_NoListener) {
EXPECT_FALSE(truncate.Execute(kRequestId));
}
+TEST_F(FileSystemProviderOperationsTruncateTest, Execute_ReadOnly) {
+ util::LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */);
+ util::StatusCallbackLog callback_log;
+
+ const ProvidedFileSystemInfo read_only_file_system_info(
+ kExtensionId,
+ kFileSystemId,
+ "" /* file_system_name */,
+ false /* writable */,
+ base::FilePath() /* mount_path */);
+
+ Truncate truncate(NULL,
+ file_system_info_,
+ base::FilePath::FromUTF8Unsafe(kFilePath),
+ kTruncateLength,
+ base::Bind(&util::LogStatusCallback, &callback_log));
+ truncate.SetDispatchEventImplForTesting(
+ base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
+ base::Unretained(&dispatcher)));
+
+ EXPECT_FALSE(truncate.Execute(kRequestId));
+}
+
TEST_F(FileSystemProviderOperationsTruncateTest, OnSuccess) {
util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
util::StatusCallbackLog callback_log;

Powered by Google App Engine
This is Rietveld 408576698