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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/throttled_file_system_unittest.cc

Issue 845083005: [fsp] Simplify aborting logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a comment. Created 5 years, 11 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 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
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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_system_provider/throttled_file_system.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698