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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/truncate_unittest.cc

Issue 624903002: [fsp] Group arguments for mounting into a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a bug. Created 6 years, 2 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/operations/truncate.h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/truncate.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 20 matching lines...) Expand all
31 const int64 kTruncateLength = 64; 31 const int64 kTruncateLength = 64;
32 32
33 } // namespace 33 } // namespace
34 34
35 class FileSystemProviderOperationsTruncateTest : public testing::Test { 35 class FileSystemProviderOperationsTruncateTest : public testing::Test {
36 protected: 36 protected:
37 FileSystemProviderOperationsTruncateTest() {} 37 FileSystemProviderOperationsTruncateTest() {}
38 virtual ~FileSystemProviderOperationsTruncateTest() {} 38 virtual ~FileSystemProviderOperationsTruncateTest() {}
39 39
40 virtual void SetUp() override { 40 virtual void SetUp() override {
41 MountOptions mount_options(kFileSystemId, "" /* display_name */);
42 mount_options.writable = true;
41 file_system_info_ = 43 file_system_info_ =
42 ProvidedFileSystemInfo(kExtensionId, 44 ProvidedFileSystemInfo(kExtensionId, mount_options, base::FilePath());
43 kFileSystemId,
44 "" /* file_system_name */,
45 true /* writable */,
46 false /* supports_notify_tag */,
47 base::FilePath() /* mount_path */);
48 } 45 }
49 46
50 ProvidedFileSystemInfo file_system_info_; 47 ProvidedFileSystemInfo file_system_info_;
51 }; 48 };
52 49
53 TEST_F(FileSystemProviderOperationsTruncateTest, Execute) { 50 TEST_F(FileSystemProviderOperationsTruncateTest, Execute) {
54 using extensions::api::file_system_provider::TruncateRequestedOptions; 51 using extensions::api::file_system_provider::TruncateRequestedOptions;
55 52
56 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); 53 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
57 util::StatusCallbackLog callback_log; 54 util::StatusCallbackLog callback_log;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 98
102 EXPECT_FALSE(truncate.Execute(kRequestId)); 99 EXPECT_FALSE(truncate.Execute(kRequestId));
103 } 100 }
104 101
105 TEST_F(FileSystemProviderOperationsTruncateTest, Execute_ReadOnly) { 102 TEST_F(FileSystemProviderOperationsTruncateTest, Execute_ReadOnly) {
106 util::LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */); 103 util::LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */);
107 util::StatusCallbackLog callback_log; 104 util::StatusCallbackLog callback_log;
108 105
109 const ProvidedFileSystemInfo read_only_file_system_info( 106 const ProvidedFileSystemInfo read_only_file_system_info(
110 kExtensionId, 107 kExtensionId,
111 kFileSystemId, 108 MountOptions(kFileSystemId, "" /* display_name */),
112 "" /* file_system_name */,
113 false /* writable */,
114 false /* supports_notify_tag */,
115 base::FilePath() /* mount_path */); 109 base::FilePath() /* mount_path */);
116 110
117 Truncate truncate(NULL, 111 Truncate truncate(NULL,
118 file_system_info_, 112 file_system_info_,
119 base::FilePath::FromUTF8Unsafe(kFilePath), 113 base::FilePath::FromUTF8Unsafe(kFilePath),
120 kTruncateLength, 114 kTruncateLength,
121 base::Bind(&util::LogStatusCallback, &callback_log)); 115 base::Bind(&util::LogStatusCallback, &callback_log));
122 truncate.SetDispatchEventImplForTesting( 116 truncate.SetDispatchEventImplForTesting(
123 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 117 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
124 base::Unretained(&dispatcher))); 118 base::Unretained(&dispatcher)));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 truncate.OnError(kRequestId, 160 truncate.OnError(kRequestId,
167 scoped_ptr<RequestValue>(new RequestValue()), 161 scoped_ptr<RequestValue>(new RequestValue()),
168 base::File::FILE_ERROR_TOO_MANY_OPENED); 162 base::File::FILE_ERROR_TOO_MANY_OPENED);
169 ASSERT_EQ(1u, callback_log.size()); 163 ASSERT_EQ(1u, callback_log.size());
170 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); 164 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]);
171 } 165 }
172 166
173 } // namespace operations 167 } // namespace operations
174 } // namespace file_system_provider 168 } // namespace file_system_provider
175 } // namespace chromeos 169 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698