OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/throttled_file_system.h" | 5 #include "chrome/browser/chromeos/file_system_provider/throttled_file_system.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 protected: | 43 protected: |
44 FileSystemProviderThrottledFileSystemTest() {} | 44 FileSystemProviderThrottledFileSystemTest() {} |
45 virtual ~FileSystemProviderThrottledFileSystemTest() {} | 45 virtual ~FileSystemProviderThrottledFileSystemTest() {} |
46 | 46 |
47 virtual void SetUp() override {} | 47 virtual void SetUp() override {} |
48 | 48 |
49 // Initializes the throttled file system with |limit| number of opened files | 49 // Initializes the throttled file system with |limit| number of opened files |
50 // at once. If 0, then no limit. | 50 // at once. If 0, then no limit. |
51 void SetUpFileSystem(size_t limit) { | 51 void SetUpFileSystem(size_t limit) { |
52 MountOptions options(kFileSystemId, kDisplayName); | 52 MountOptions options(kFileSystemId, kDisplayName); |
53 if (limit) | 53 options.opened_files_limit = limit; |
54 options.opened_files_limit = limit; | |
55 | 54 |
56 ProvidedFileSystemInfo file_system_info(kExtensionId, options, | 55 ProvidedFileSystemInfo file_system_info(kExtensionId, options, |
57 base::FilePath() /* mount_path */); | 56 base::FilePath() /* mount_path */); |
58 | 57 |
59 file_system_.reset(new ThrottledFileSystem( | 58 file_system_.reset(new ThrottledFileSystem( |
60 make_scoped_ptr(new FakeProvidedFileSystem(file_system_info)))); | 59 make_scoped_ptr(new FakeProvidedFileSystem(file_system_info)))); |
61 } | 60 } |
62 | 61 |
63 content::TestBrowserThreadBundle thread_bundle_; | 62 content::TestBrowserThreadBundle thread_bundle_; |
64 scoped_ptr<ThrottledFileSystem> file_system_; | 63 scoped_ptr<ThrottledFileSystem> file_system_; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ASSERT_EQ(1u, abort_log.size()); | 167 ASSERT_EQ(1u, abort_log.size()); |
169 EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, abort_log[0]); | 168 EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, abort_log[0]); |
170 | 169 |
171 // Confirm, that the second task is not executed after a invalid abort of the | 170 // Confirm, that the second task is not executed after a invalid abort of the |
172 // first one. | 171 // first one. |
173 EXPECT_EQ(1u, first_open_log.size()); | 172 EXPECT_EQ(1u, first_open_log.size()); |
174 EXPECT_EQ(0u, second_open_log.size()); | 173 EXPECT_EQ(0u, second_open_log.size()); |
175 } | 174 } |
176 } // namespace file_system_provider | 175 } // namespace file_system_provider |
177 } // namespace chromeos | 176 } // namespace chromeos |
OLD | NEW |