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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 OpenLog second_open_log; | 149 OpenLog second_open_log; |
150 file_system_->OpenFile(base::FilePath(kFakeFilePath), | 150 file_system_->OpenFile(base::FilePath(kFakeFilePath), |
151 ThrottledFileSystem::OPEN_FILE_MODE_READ, | 151 ThrottledFileSystem::OPEN_FILE_MODE_READ, |
152 base::Bind(&LogOpen, &second_open_log)); | 152 base::Bind(&LogOpen, &second_open_log)); |
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 // The first file is opened, so the opening operation has completed, then | |
161 // aborting it should result in an error. This is tested, as from the queue | |
162 // point of view, the opening task stays in the queue until closing the file. | |
163 StatusLog abort_log; | |
164 abort_callback.Run(base::Bind(&LogStatus, &abort_log)); | |
165 base::RunLoop().RunUntilIdle(); | |
166 | |
167 ASSERT_EQ(1u, abort_log.size()); | |
168 EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, abort_log[0]); | |
169 | |
170 // Confirm, that the second task is not executed after a invalid abort of the | |
171 // first one. | |
172 EXPECT_EQ(1u, first_open_log.size()); | |
173 EXPECT_EQ(0u, second_open_log.size()); | |
174 } | |
175 } // namespace file_system_provider | 161 } // namespace file_system_provider |
176 } // namespace chromeos | 162 } // namespace chromeos |
OLD | NEW |