| OLD | NEW |
| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 void RunTest_Nesting(MessageLoop::Type message_loop_type) { | 602 void RunTest_Nesting(MessageLoop::Type message_loop_type) { |
| 603 MessageLoop loop(message_loop_type); | 603 MessageLoop loop(message_loop_type); |
| 604 | 604 |
| 605 int depth = 100; | 605 int depth = 100; |
| 606 MessageLoop::current()->PostTask(FROM_HERE, | 606 MessageLoop::current()->PostTask(FROM_HERE, |
| 607 Bind(&NestingFunc, &depth)); | 607 Bind(&NestingFunc, &depth)); |
| 608 MessageLoop::current()->Run(); | 608 MessageLoop::current()->Run(); |
| 609 EXPECT_EQ(depth, 0); | 609 EXPECT_EQ(depth, 0); |
| 610 } | 610 } |
| 611 | 611 |
| 612 const wchar_t* const kMessageBoxTitle = L"MessageLoop Unit Test"; | 612 #if defined(OS_WIN) |
| 613 const wchar_t kMessageBoxTitle[] = L"MessageLoop Unit Test"; |
| 614 #endif // defined(OS_WIN) |
| 613 | 615 |
| 614 enum TaskType { | 616 enum TaskType { |
| 615 MESSAGEBOX, | 617 MESSAGEBOX, |
| 616 ENDDIALOG, | 618 ENDDIALOG, |
| 617 RECURSIVE, | 619 RECURSIVE, |
| 618 TIMEDMESSAGELOOP, | 620 TIMEDMESSAGELOOP, |
| 619 QUITMESSAGELOOP, | 621 QUITMESSAGELOOP, |
| 620 ORDERED, | 622 ORDERED, |
| 621 PUMPS, | 623 PUMPS, |
| 622 SLEEP, | 624 SLEEP, |
| (...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2095 // On Linux, the pipe buffer size is 64KiB by default. The bug caused one | 2097 // On Linux, the pipe buffer size is 64KiB by default. The bug caused one |
| 2096 // byte accumulated in the pipe per two posts, so we should repeat 128K | 2098 // byte accumulated in the pipe per two posts, so we should repeat 128K |
| 2097 // times to reproduce the bug. | 2099 // times to reproduce the bug. |
| 2098 const int kNumTimes = 1 << 17; | 2100 const int kNumTimes = 1 << 17; |
| 2099 RunTest_RecursivePosts(MessageLoop::TYPE_DEFAULT, kNumTimes); | 2101 RunTest_RecursivePosts(MessageLoop::TYPE_DEFAULT, kNumTimes); |
| 2100 RunTest_RecursivePosts(MessageLoop::TYPE_UI, kNumTimes); | 2102 RunTest_RecursivePosts(MessageLoop::TYPE_UI, kNumTimes); |
| 2101 RunTest_RecursivePosts(MessageLoop::TYPE_IO, kNumTimes); | 2103 RunTest_RecursivePosts(MessageLoop::TYPE_IO, kNumTimes); |
| 2102 } | 2104 } |
| 2103 | 2105 |
| 2104 } // namespace base | 2106 } // namespace base |
| OLD | NEW |