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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/operations/write_file_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/operations/write_file.h" 5 #include "chrome/browser/chromeos/file_system_provider/operations/write_file.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 29 matching lines...) Expand all
40 class FileSystemProviderOperationsWriteFileTest : public testing::Test { 40 class FileSystemProviderOperationsWriteFileTest : public testing::Test {
41 protected: 41 protected:
42 FileSystemProviderOperationsWriteFileTest() {} 42 FileSystemProviderOperationsWriteFileTest() {}
43 ~FileSystemProviderOperationsWriteFileTest() override {} 43 ~FileSystemProviderOperationsWriteFileTest() override {}
44 44
45 void SetUp() override { 45 void SetUp() override {
46 MountOptions mount_options(kFileSystemId, "" /* display_name */); 46 MountOptions mount_options(kFileSystemId, "" /* display_name */);
47 mount_options.writable = true; 47 mount_options.writable = true;
48 file_system_info_ = ProvidedFileSystemInfo( 48 file_system_info_ = ProvidedFileSystemInfo(
49 kExtensionId, mount_options, base::FilePath(), false /* configurable */, 49 kExtensionId, mount_options, base::FilePath(), false /* configurable */,
50 extensions::SOURCE_FILE); 50 true /* watchable */, extensions::SOURCE_FILE);
51 io_buffer_ = make_scoped_refptr(new net::StringIOBuffer(kWriteData)); 51 io_buffer_ = make_scoped_refptr(new net::StringIOBuffer(kWriteData));
52 } 52 }
53 53
54 ProvidedFileSystemInfo file_system_info_; 54 ProvidedFileSystemInfo file_system_info_;
55 scoped_refptr<net::StringIOBuffer> io_buffer_; 55 scoped_refptr<net::StringIOBuffer> io_buffer_;
56 }; 56 };
57 57
58 TEST_F(FileSystemProviderOperationsWriteFileTest, Execute) { 58 TEST_F(FileSystemProviderOperationsWriteFileTest, Execute) {
59 using extensions::api::file_system_provider::WriteFileRequestedOptions; 59 using extensions::api::file_system_provider::WriteFileRequestedOptions;
60 60
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 EXPECT_FALSE(write_file.Execute(kRequestId)); 114 EXPECT_FALSE(write_file.Execute(kRequestId));
115 } 115 }
116 116
117 TEST_F(FileSystemProviderOperationsWriteFileTest, Execute_ReadOnly) { 117 TEST_F(FileSystemProviderOperationsWriteFileTest, Execute_ReadOnly) {
118 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */); 118 util::LoggingDispatchEventImpl dispatcher(true /* dispatch_reply */);
119 util::StatusCallbackLog callback_log; 119 util::StatusCallbackLog callback_log;
120 120
121 const ProvidedFileSystemInfo read_only_file_system_info( 121 const ProvidedFileSystemInfo read_only_file_system_info(
122 kExtensionId, MountOptions(kFileSystemId, "" /* display_name */), 122 kExtensionId, MountOptions(kFileSystemId, "" /* display_name */),
123 base::FilePath() /* mount_path */, false /* configurable */, 123 base::FilePath() /* mount_path */, false /* configurable */,
124 extensions::SOURCE_FILE); 124 true /* watchable */, extensions::SOURCE_FILE);
125 125
126 WriteFile write_file(NULL, 126 WriteFile write_file(NULL,
127 read_only_file_system_info, 127 read_only_file_system_info,
128 kFileHandle, 128 kFileHandle,
129 io_buffer_.get(), 129 io_buffer_.get(),
130 kOffset, 130 kOffset,
131 io_buffer_->size(), 131 io_buffer_->size(),
132 base::Bind(&util::LogStatusCallback, &callback_log)); 132 base::Bind(&util::LogStatusCallback, &callback_log));
133 write_file.SetDispatchEventImplForTesting( 133 write_file.SetDispatchEventImplForTesting(
134 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl, 134 base::Bind(&util::LoggingDispatchEventImpl::OnDispatchEventImpl,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 scoped_ptr<RequestValue>(new RequestValue()), 182 scoped_ptr<RequestValue>(new RequestValue()),
183 base::File::FILE_ERROR_TOO_MANY_OPENED); 183 base::File::FILE_ERROR_TOO_MANY_OPENED);
184 184
185 ASSERT_EQ(1u, callback_log.size()); 185 ASSERT_EQ(1u, callback_log.size());
186 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]); 186 EXPECT_EQ(base::File::FILE_ERROR_TOO_MANY_OPENED, callback_log[0]);
187 } 187 }
188 188
189 } // namespace operations 189 } // namespace operations
190 } // namespace file_system_provider 190 } // namespace file_system_provider
191 } // namespace chromeos 191 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698