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

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

Issue 2692273008: Hacky slashy (Closed)
Patch Set: rebase on config CL, and minor fixes Created 3 years, 7 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
« no previous file with comments | « base/message_loop/message_loop.cc ('k') | base/process/kill.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 message_loop.task_runner()->PostDelayedTask( 721 message_loop.task_runner()->PostDelayedTask(
722 FROM_HERE, BindOnce(&PostNTasksThenQuit, 1), kSlowTimer); 722 FROM_HERE, BindOnce(&PostNTasksThenQuit, 1), kSlowTimer);
723 EXPECT_FALSE(message_loop.HasHighResolutionTasks()); 723 EXPECT_FALSE(message_loop.HasHighResolutionTasks());
724 RunLoop().Run(); 724 RunLoop().Run();
725 EXPECT_FALSE(message_loop.HasHighResolutionTasks()); 725 EXPECT_FALSE(message_loop.HasHighResolutionTasks());
726 Time::EnableHighResolutionTimer(false); 726 Time::EnableHighResolutionTimer(false);
727 } 727 }
728 728
729 #endif // defined(OS_WIN) 729 #endif // defined(OS_WIN)
730 730
731 #if defined(OS_POSIX) && !defined(OS_NACL) 731 #if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_FUCHSIA)
732 732
733 namespace { 733 namespace {
734 734
735 class QuitDelegate : public MessageLoopForIO::Watcher { 735 class QuitDelegate : public MessageLoopForIO::Watcher {
736 public: 736 public:
737 void OnFileCanWriteWithoutBlocking(int fd) override { 737 void OnFileCanWriteWithoutBlocking(int fd) override {
738 MessageLoop::current()->QuitWhenIdle(); 738 MessageLoop::current()->QuitWhenIdle();
739 } 739 }
740 void OnFileCanReadWithoutBlocking(int fd) override { 740 void OnFileCanReadWithoutBlocking(int fd) override {
741 MessageLoop::current()->QuitWhenIdle(); 741 MessageLoop::current()->QuitWhenIdle();
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 } 791 }
792 } 792 }
793 if (IGNORE_EINTR(close(pipefds[0])) < 0) 793 if (IGNORE_EINTR(close(pipefds[0])) < 0)
794 PLOG(ERROR) << "close"; 794 PLOG(ERROR) << "close";
795 if (IGNORE_EINTR(close(pipefds[1])) < 0) 795 if (IGNORE_EINTR(close(pipefds[1])) < 0)
796 PLOG(ERROR) << "close"; 796 PLOG(ERROR) << "close";
797 } 797 }
798 798
799 } // namespace 799 } // namespace
800 800
801 #endif // defined(OS_POSIX) && !defined(OS_NACL) 801 #endif // defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_FUCHSIA)
802 802
803 namespace { 803 namespace {
804 // Inject a test point for recording the destructor calls for Closure objects 804 // Inject a test point for recording the destructor calls for Closure objects
805 // send to MessageLoop::PostTask(). It is awkward usage since we are trying to 805 // send to MessageLoop::PostTask(). It is awkward usage since we are trying to
806 // hook the actual destruction, which is not a common operation. 806 // hook the actual destruction, which is not a common operation.
807 class DestructionObserverProbe : 807 class DestructionObserverProbe :
808 public RefCounted<DestructionObserverProbe> { 808 public RefCounted<DestructionObserverProbe> {
809 public: 809 public:
810 DestructionObserverProbe(bool* task_destroyed, 810 DestructionObserverProbe(bool* task_destroyed,
811 bool* destruction_observer_called) 811 bool* destruction_observer_called)
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 1037
1038 { 1038 {
1039 std::string kThreadName("bar"); 1039 std::string kThreadName("bar");
1040 base::Thread thread(kThreadName); 1040 base::Thread thread(kThreadName);
1041 ASSERT_TRUE(thread.StartAndWaitForTesting()); 1041 ASSERT_TRUE(thread.StartAndWaitForTesting());
1042 EXPECT_EQ(kThreadName, thread.message_loop()->GetThreadName()); 1042 EXPECT_EQ(kThreadName, thread.message_loop()->GetThreadName());
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 } // namespace base 1046 } // namespace base
OLDNEW
« no previous file with comments | « base/message_loop/message_loop.cc ('k') | base/process/kill.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698