| 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 "base/message_loop/message_loop_test.h" | 5 #include "base/message_loop/message_loop_test.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 MessageLoop::current()->SetNestableTasksAllowed(true); | 361 MessageLoop::current()->SetNestableTasksAllowed(true); |
| 362 RunLoop().Run(); | 362 RunLoop().Run(); |
| 363 } | 363 } |
| 364 MessageLoop::current()->QuitWhenIdle(); | 364 MessageLoop::current()->QuitWhenIdle(); |
| 365 } | 365 } |
| 366 | 366 |
| 367 void RunTest_Nesting(MessagePumpFactory factory) { | 367 void RunTest_Nesting(MessagePumpFactory factory) { |
| 368 std::unique_ptr<MessagePump> pump(factory()); | 368 std::unique_ptr<MessagePump> pump(factory()); |
| 369 MessageLoop loop(std::move(pump)); | 369 MessageLoop loop(std::move(pump)); |
| 370 | 370 |
| 371 int depth = 50; | 371 int depth = 100; |
| 372 ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 372 ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 373 BindOnce(&NestingFunc, &depth)); | 373 BindOnce(&NestingFunc, &depth)); |
| 374 RunLoop().Run(); | 374 RunLoop().Run(); |
| 375 EXPECT_EQ(depth, 0); | 375 EXPECT_EQ(depth, 0); |
| 376 } | 376 } |
| 377 | 377 |
| 378 enum TaskType { | 378 enum TaskType { |
| 379 MESSAGEBOX, | 379 MESSAGEBOX, |
| 380 ENDDIALOG, | 380 ENDDIALOG, |
| 381 RECURSIVE, | 381 RECURSIVE, |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 const int kNumTimes = 1 << 17; | 986 const int kNumTimes = 1 << 17; |
| 987 std::unique_ptr<MessagePump> pump(factory()); | 987 std::unique_ptr<MessagePump> pump(factory()); |
| 988 MessageLoop loop(std::move(pump)); | 988 MessageLoop loop(std::move(pump)); |
| 989 loop.task_runner()->PostTask(FROM_HERE, | 989 loop.task_runner()->PostTask(FROM_HERE, |
| 990 BindOnce(&PostNTasksThenQuit, kNumTimes)); | 990 BindOnce(&PostNTasksThenQuit, kNumTimes)); |
| 991 RunLoop().Run(); | 991 RunLoop().Run(); |
| 992 } | 992 } |
| 993 | 993 |
| 994 } // namespace test | 994 } // namespace test |
| 995 } // namespace base | 995 } // namespace base |
| OLD | NEW |