| 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 <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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 WaitableEvent test_done_event(WaitableEvent::ResetPolicy::MANUAL, | 99 WaitableEvent test_done_event(WaitableEvent::ResetPolicy::MANUAL, |
| 100 WaitableEvent::InitialState::NOT_SIGNALED); | 100 WaitableEvent::InitialState::NOT_SIGNALED); |
| 101 | 101 |
| 102 std::unique_ptr<android::JavaHandlerThreadForTesting> java_thread; | 102 std::unique_ptr<android::JavaHandlerThreadForTesting> java_thread; |
| 103 java_thread.reset(new android::JavaHandlerThreadForTesting( | 103 java_thread.reset(new android::JavaHandlerThreadForTesting( |
| 104 "JavaHandlerThreadForTesting from AbortDontRunMoreTasks", | 104 "JavaHandlerThreadForTesting from AbortDontRunMoreTasks", |
| 105 &test_done_event)); | 105 &test_done_event)); |
| 106 java_thread->Start(); | 106 java_thread->Start(); |
| 107 | 107 |
| 108 if (delayed) { | 108 if (delayed) { |
| 109 java_thread->message_loop()->PostDelayedTask( | 109 java_thread->message_loop()->task_runner()->PostDelayedTask( |
| 110 FROM_HERE, Bind(&AbortMessagePump), TimeDelta::FromMilliseconds(10)); | 110 FROM_HERE, Bind(&AbortMessagePump), TimeDelta::FromMilliseconds(10)); |
| 111 } else { | 111 } else { |
| 112 java_thread->message_loop()->PostTask(FROM_HERE, Bind(&AbortMessagePump)); | 112 java_thread->message_loop()->task_runner()->PostTask( |
| 113 FROM_HERE, Bind(&AbortMessagePump)); |
| 113 } | 114 } |
| 114 | 115 |
| 115 // Wait to ensure we catch the correct exception (and don't crash) | 116 // Wait to ensure we catch the correct exception (and don't crash) |
| 116 test_done_event.Wait(); | 117 test_done_event.Wait(); |
| 117 | 118 |
| 118 java_thread->Stop(); | 119 java_thread->Stop(); |
| 119 java_thread.reset(); | 120 java_thread.reset(); |
| 120 } | 121 } |
| 121 | 122 |
| 122 TEST(MessageLoopTest, JavaExceptionAbort) { | 123 TEST(MessageLoopTest, JavaExceptionAbort) { |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 | 1024 |
| 1024 { | 1025 { |
| 1025 std::string kThreadName("bar"); | 1026 std::string kThreadName("bar"); |
| 1026 base::Thread thread(kThreadName); | 1027 base::Thread thread(kThreadName); |
| 1027 ASSERT_TRUE(thread.StartAndWaitForTesting()); | 1028 ASSERT_TRUE(thread.StartAndWaitForTesting()); |
| 1028 EXPECT_EQ(kThreadName, thread.message_loop()->GetThreadName()); | 1029 EXPECT_EQ(kThreadName, thread.message_loop()->GetThreadName()); |
| 1029 } | 1030 } |
| 1030 } | 1031 } |
| 1031 | 1032 |
| 1032 } // namespace base | 1033 } // namespace base |
| OLD | NEW |