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 142 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 // The first file is opened, so the opening operation has completed, then | 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 | 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. | 162 // point of view, the opening task stays in the queue until closing the file. |
163 StatusLog abort_log; | 163 abort_callback.Run(); |
164 abort_callback.Run(base::Bind(&LogStatus, &abort_log)); | |
165 base::RunLoop().RunUntilIdle(); | 164 base::RunLoop().RunUntilIdle(); |
166 | 165 |
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 | 166 // Confirm, that the second task is not executed after a invalid abort of the |
171 // first one. | 167 // first one. |
172 EXPECT_EQ(1u, first_open_log.size()); | 168 EXPECT_EQ(1u, first_open_log.size()); |
173 EXPECT_EQ(0u, second_open_log.size()); | 169 EXPECT_EQ(0u, second_open_log.size()); |
174 } | 170 } |
175 } // namespace file_system_provider | 171 } // namespace file_system_provider |
176 } // namespace chromeos | 172 } // namespace chromeos |
OLD | NEW |