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

Side by Side Diff: content/browser/fileapi/file_system_operation_impl_write_unittest.cc

Issue 2818533003: Make nesting/running states a RunLoop rather than a MessageLoop concept. (Closed)
Patch Set: fix compile and add RunLoopTests Created 3 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 void DidWrite(base::File::Error status, int64_t bytes, bool complete) { 134 void DidWrite(base::File::Error status, int64_t bytes, bool complete) {
135 if (status == base::File::FILE_OK) { 135 if (status == base::File::FILE_OK) {
136 add_bytes_written(bytes, complete); 136 add_bytes_written(bytes, complete);
137 if (complete) 137 if (complete)
138 base::MessageLoop::current()->QuitWhenIdle(); 138 base::MessageLoop::current()->QuitWhenIdle();
139 } else { 139 } else {
140 EXPECT_FALSE(complete_); 140 EXPECT_FALSE(complete_);
141 EXPECT_EQ(status_, base::File::FILE_OK); 141 EXPECT_EQ(status_, base::File::FILE_OK);
142 complete_ = true; 142 complete_ = true;
143 status_ = status; 143 status_ = status;
144 if (base::MessageLoop::current()->is_running()) 144 if (base::RunLoop::IsRunningOnCurrentThread())
145 base::MessageLoop::current()->QuitWhenIdle(); 145 base::MessageLoop::current()->QuitWhenIdle();
146 } 146 }
147 } 147 }
148 148
149 void DidCancel(base::File::Error status) { 149 void DidCancel(base::File::Error status) {
150 cancel_status_ = status; 150 cancel_status_ = status;
151 } 151 }
152 152
153 const MockBlobURLRequestContext& url_request_context() const { 153 const MockBlobURLRequestContext& url_request_context() const {
154 return *url_request_context_; 154 return *url_request_context_;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 EXPECT_EQ(base::File::FILE_ERROR_ABORT, status()); 325 EXPECT_EQ(base::File::FILE_ERROR_ABORT, status());
326 EXPECT_EQ(base::File::FILE_OK, cancel_status()); 326 EXPECT_EQ(base::File::FILE_OK, cancel_status());
327 EXPECT_TRUE(complete()); 327 EXPECT_TRUE(complete());
328 328
329 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); 329 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count());
330 } 330 }
331 331
332 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. 332 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases.
333 333
334 } // namespace content 334 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698