| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 void SetUpFileSystem(size_t limit) { | 54 void SetUpFileSystem(size_t limit) { |
| 55 MountOptions options(kFileSystemId, kDisplayName); | 55 MountOptions options(kFileSystemId, kDisplayName); |
| 56 options.opened_files_limit = limit; | 56 options.opened_files_limit = limit; |
| 57 | 57 |
| 58 ProvidedFileSystemInfo file_system_info( | 58 ProvidedFileSystemInfo file_system_info( |
| 59 kExtensionId, options, base::FilePath() /* mount_path */, | 59 kExtensionId, options, base::FilePath() /* mount_path */, |
| 60 false /* configurable */, true /* watchable */, | 60 false /* configurable */, true /* watchable */, |
| 61 extensions::SOURCE_FILE); | 61 extensions::SOURCE_FILE); |
| 62 | 62 |
| 63 file_system_.reset(new ThrottledFileSystem( | 63 file_system_.reset(new ThrottledFileSystem( |
| 64 base::WrapUnique(new FakeProvidedFileSystem(file_system_info)))); | 64 base::MakeUnique<FakeProvidedFileSystem>(file_system_info))); |
| 65 } | 65 } |
| 66 | 66 |
| 67 content::TestBrowserThreadBundle thread_bundle_; | 67 content::TestBrowserThreadBundle thread_bundle_; |
| 68 std::unique_ptr<ThrottledFileSystem> file_system_; | 68 std::unique_ptr<ThrottledFileSystem> file_system_; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 TEST_F(FileSystemProviderThrottledFileSystemTest, OpenFile_LimitedToOneAtOnce) { | 71 TEST_F(FileSystemProviderThrottledFileSystemTest, OpenFile_LimitedToOneAtOnce) { |
| 72 SetUpFileSystem(1); | 72 SetUpFileSystem(1); |
| 73 | 73 |
| 74 OpenLog first_open_log; | 74 OpenLog first_open_log; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 base::RunLoop().RunUntilIdle(); | 154 base::RunLoop().RunUntilIdle(); |
| 155 | 155 |
| 156 ASSERT_EQ(1u, first_open_log.size()); | 156 ASSERT_EQ(1u, first_open_log.size()); |
| 157 EXPECT_EQ(base::File::FILE_OK, first_open_log[0].second); | 157 EXPECT_EQ(base::File::FILE_OK, first_open_log[0].second); |
| 158 EXPECT_EQ(0u, second_open_log.size()); | 158 EXPECT_EQ(0u, second_open_log.size()); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace file_system_provider | 161 } // namespace file_system_provider |
| 162 } // namespace chromeos | 162 } // namespace chromeos |
| OLD | NEW |