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

Side by Side Diff: base/message_loop/message_loop_unittest.cc

Issue 2692273008: Hacky slashy (Closed)
Patch Set: . Created 3 years, 10 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 message_loop.task_runner()->PostDelayedTask( 705 message_loop.task_runner()->PostDelayedTask(
706 FROM_HERE, Bind(&PostNTasksThenQuit, 1), kSlowTimer); 706 FROM_HERE, Bind(&PostNTasksThenQuit, 1), kSlowTimer);
707 EXPECT_FALSE(message_loop.HasHighResolutionTasks()); 707 EXPECT_FALSE(message_loop.HasHighResolutionTasks());
708 RunLoop().Run(); 708 RunLoop().Run();
709 EXPECT_FALSE(message_loop.HasHighResolutionTasks()); 709 EXPECT_FALSE(message_loop.HasHighResolutionTasks());
710 Time::EnableHighResolutionTimer(false); 710 Time::EnableHighResolutionTimer(false);
711 } 711 }
712 712
713 #endif // defined(OS_WIN) 713 #endif // defined(OS_WIN)
714 714
715 #if defined(OS_POSIX) && !defined(OS_NACL) 715 #if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_FUCHSIA)
716 716
717 namespace { 717 namespace {
718 718
719 class QuitDelegate : public MessageLoopForIO::Watcher { 719 class QuitDelegate : public MessageLoopForIO::Watcher {
720 public: 720 public:
721 void OnFileCanWriteWithoutBlocking(int fd) override { 721 void OnFileCanWriteWithoutBlocking(int fd) override {
722 MessageLoop::current()->QuitWhenIdle(); 722 MessageLoop::current()->QuitWhenIdle();
723 } 723 }
724 void OnFileCanReadWithoutBlocking(int fd) override { 724 void OnFileCanReadWithoutBlocking(int fd) override {
725 MessageLoop::current()->QuitWhenIdle(); 725 MessageLoop::current()->QuitWhenIdle();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 } 775 }
776 } 776 }
777 if (IGNORE_EINTR(close(pipefds[0])) < 0) 777 if (IGNORE_EINTR(close(pipefds[0])) < 0)
778 PLOG(ERROR) << "close"; 778 PLOG(ERROR) << "close";
779 if (IGNORE_EINTR(close(pipefds[1])) < 0) 779 if (IGNORE_EINTR(close(pipefds[1])) < 0)
780 PLOG(ERROR) << "close"; 780 PLOG(ERROR) << "close";
781 } 781 }
782 782
783 } // namespace 783 } // namespace
784 784
785 #endif // defined(OS_POSIX) && !defined(OS_NACL) 785 #endif // defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_FUCHSIA)
786 786
787 namespace { 787 namespace {
788 // Inject a test point for recording the destructor calls for Closure objects 788 // Inject a test point for recording the destructor calls for Closure objects
789 // send to MessageLoop::PostTask(). It is awkward usage since we are trying to 789 // send to MessageLoop::PostTask(). It is awkward usage since we are trying to
790 // hook the actual destruction, which is not a common operation. 790 // hook the actual destruction, which is not a common operation.
791 class DestructionObserverProbe : 791 class DestructionObserverProbe :
792 public RefCounted<DestructionObserverProbe> { 792 public RefCounted<DestructionObserverProbe> {
793 public: 793 public:
794 DestructionObserverProbe(bool* task_destroyed, 794 DestructionObserverProbe(bool* task_destroyed,
795 bool* destruction_observer_called) 795 bool* destruction_observer_called)
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 1021
1022 { 1022 {
1023 std::string kThreadName("bar"); 1023 std::string kThreadName("bar");
1024 base::Thread thread(kThreadName); 1024 base::Thread thread(kThreadName);
1025 ASSERT_TRUE(thread.StartAndWaitForTesting()); 1025 ASSERT_TRUE(thread.StartAndWaitForTesting());
1026 EXPECT_EQ(kThreadName, thread.message_loop()->GetThreadName()); 1026 EXPECT_EQ(kThreadName, thread.message_loop()->GetThreadName());
1027 } 1027 }
1028 } 1028 }
1029 1029
1030 } // namespace base 1030 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698