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

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

Issue 1398153002: Don't use base::MessageLoop::{Quit,QuitClosure} in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 <vector> 5 #include <vector>
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 FileSystemOperation::StatusCallback RecordCancelCallback() { 125 FileSystemOperation::StatusCallback RecordCancelCallback() {
126 return base::Bind(&FileSystemOperationImplWriteTest::DidCancel, 126 return base::Bind(&FileSystemOperationImplWriteTest::DidCancel,
127 weak_factory_.GetWeakPtr()); 127 weak_factory_.GetWeakPtr());
128 } 128 }
129 129
130 void DidWrite(base::File::Error status, int64 bytes, bool complete) { 130 void DidWrite(base::File::Error status, int64 bytes, bool complete) {
131 if (status == base::File::FILE_OK) { 131 if (status == base::File::FILE_OK) {
132 add_bytes_written(bytes, complete); 132 add_bytes_written(bytes, complete);
133 if (complete) 133 if (complete)
134 base::MessageLoop::current()->Quit(); 134 base::MessageLoop::current()->QuitWhenIdle();
135 } else { 135 } else {
136 EXPECT_FALSE(complete_); 136 EXPECT_FALSE(complete_);
137 EXPECT_EQ(status_, base::File::FILE_OK); 137 EXPECT_EQ(status_, base::File::FILE_OK);
138 complete_ = true; 138 complete_ = true;
139 status_ = status; 139 status_ = status;
140 if (base::MessageLoop::current()->is_running()) 140 if (base::MessageLoop::current()->is_running())
141 base::MessageLoop::current()->Quit(); 141 base::MessageLoop::current()->QuitWhenIdle();
142 } 142 }
143 } 143 }
144 144
145 void DidCancel(base::File::Error status) { 145 void DidCancel(base::File::Error status) {
146 cancel_status_ = status; 146 cancel_status_ = status;
147 } 147 }
148 148
149 const MockBlobURLRequestContext& url_request_context() const { 149 const MockBlobURLRequestContext& url_request_context() const {
150 return *url_request_context_; 150 return *url_request_context_;
151 } 151 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 EXPECT_EQ(base::File::FILE_ERROR_ABORT, status()); 321 EXPECT_EQ(base::File::FILE_ERROR_ABORT, status());
322 EXPECT_EQ(base::File::FILE_OK, cancel_status()); 322 EXPECT_EQ(base::File::FILE_OK, cancel_status());
323 EXPECT_TRUE(complete()); 323 EXPECT_TRUE(complete());
324 324
325 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count()); 325 EXPECT_EQ(0, change_observer()->get_and_reset_modify_file_count());
326 } 326 }
327 327
328 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases. 328 // TODO(ericu,dmikurube,kinuko): Add more tests for cancel cases.
329 329
330 } // namespace content 330 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/download/mhtml_generation_browsertest.cc ('k') | content/browser/fileapi/file_writer_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698