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

Side by Side Diff: net/base/file_stream_unittest.cc

Issue 1398973003: Don't use base::MessageLoop::{Quit,QuitClosure} in net/ (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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/base/file_stream.h" 5 #include "net/base/file_stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 { 550 {
551 base::MessageLoop::ScopedNestableTaskAllower allow( 551 base::MessageLoop::ScopedNestableTaskAllower allow(
552 base::MessageLoop::current()); 552 base::MessageLoop::current());
553 EXPECT_LE(0, callback64.WaitForResult()); 553 EXPECT_LE(0, callback64.WaitForResult());
554 } 554 }
555 } 555 }
556 556
557 result_ = *total_bytes_written_; 557 result_ = *total_bytes_written_;
558 have_result_ = true; 558 have_result_ = true;
559 if (waiting_for_result_) 559 if (waiting_for_result_)
560 base::MessageLoop::current()->Quit(); 560 base::MessageLoop::current()->QuitWhenIdle();
561 } 561 }
562 562
563 int result_; 563 int result_;
564 bool have_result_; 564 bool have_result_;
565 bool waiting_for_result_; 565 bool waiting_for_result_;
566 FileStream* stream_; 566 FileStream* stream_;
567 int* total_bytes_written_; 567 int* total_bytes_written_;
568 int* total_bytes_read_; 568 int* total_bytes_read_;
569 std::string* data_read_; 569 std::string* data_read_;
570 const CompletionCallback callback_; 570 const CompletionCallback callback_;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 drainable_.get(), drainable_->BytesRemaining(), callback.callback()); 658 drainable_.get(), drainable_->BytesRemaining(), callback.callback());
659 DCHECK_EQ(ERR_IO_PENDING, rv); 659 DCHECK_EQ(ERR_IO_PENDING, rv);
660 rv = callback.WaitForResult(); 660 rv = callback.WaitForResult();
661 drainable_->DidConsume(total_bytes_written); 661 drainable_->DidConsume(total_bytes_written);
662 *total_bytes_written_ += total_bytes_written; 662 *total_bytes_written_ += total_bytes_written;
663 } 663 }
664 664
665 result_ = *total_bytes_written_; 665 result_ = *total_bytes_written_;
666 have_result_ = true; 666 have_result_ = true;
667 if (waiting_for_result_) 667 if (waiting_for_result_)
668 base::MessageLoop::current()->Quit(); 668 base::MessageLoop::current()->QuitWhenIdle();
669 } 669 }
670 670
671 int result_; 671 int result_;
672 bool have_result_; 672 bool have_result_;
673 bool waiting_for_result_; 673 bool waiting_for_result_;
674 FileStream* stream_; 674 FileStream* stream_;
675 int* total_bytes_written_; 675 int* total_bytes_written_;
676 const CompletionCallback callback_; 676 const CompletionCallback callback_;
677 scoped_refptr<IOBufferWithSize> test_data_; 677 scoped_refptr<IOBufferWithSize> test_data_;
678 scoped_refptr<DrainableIOBuffer> drainable_; 678 scoped_refptr<DrainableIOBuffer> drainable_;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 total_bytes_read += rv; 833 total_bytes_read += rv;
834 data_read.append(buf->data(), rv); 834 data_read.append(buf->data(), rv);
835 } 835 }
836 EXPECT_EQ(file_size, total_bytes_read); 836 EXPECT_EQ(file_size, total_bytes_read);
837 } 837 }
838 #endif 838 #endif
839 839
840 } // namespace 840 } // namespace
841 841
842 } // namespace net 842 } // namespace net
OLDNEW
« no previous file with comments | « net/android/network_change_notifier_android_unittest.cc ('k') | net/base/network_change_notifier_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698