OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 thread_(&Run, this, "call_do_stuff_on_thread"), | 28 thread_(&Run, this, "call_do_stuff_on_thread"), |
29 sequenced_task_checker_(sequenced_task_checker) { | 29 sequenced_task_checker_(sequenced_task_checker) { |
30 thread_.Start(); | 30 thread_.Start(); |
31 } | 31 } |
32 ~CallCalledSequentiallyOnThread() { | 32 ~CallCalledSequentiallyOnThread() { |
33 EXPECT_TRUE(thread_has_run_event_.Wait(1000)); | 33 EXPECT_TRUE(thread_has_run_event_.Wait(1000)); |
34 thread_.Stop(); | 34 thread_.Stop(); |
35 } | 35 } |
36 | 36 |
37 private: | 37 private: |
38 static bool Run(void* obj) { | 38 static void Run(void* obj) { |
39 CallCalledSequentiallyOnThread* call_stuff_on_thread = | 39 CallCalledSequentiallyOnThread* call_stuff_on_thread = |
40 static_cast<CallCalledSequentiallyOnThread*>(obj); | 40 static_cast<CallCalledSequentiallyOnThread*>(obj); |
41 EXPECT_EQ( | 41 EXPECT_EQ( |
42 call_stuff_on_thread->expect_true_, | 42 call_stuff_on_thread->expect_true_, |
43 call_stuff_on_thread->sequenced_task_checker_->CalledSequentially()); | 43 call_stuff_on_thread->sequenced_task_checker_->CalledSequentially()); |
44 call_stuff_on_thread->thread_has_run_event_.Set(); | 44 call_stuff_on_thread->thread_has_run_event_.Set(); |
45 return false; | |
46 } | 45 } |
47 | 46 |
48 const bool expect_true_; | 47 const bool expect_true_; |
49 Event thread_has_run_event_; | 48 Event thread_has_run_event_; |
50 PlatformThread thread_; | 49 PlatformThread thread_; |
51 SequencedTaskChecker* const sequenced_task_checker_; | 50 SequencedTaskChecker* const sequenced_task_checker_; |
52 | 51 |
53 RTC_DISALLOW_COPY_AND_ASSIGN(CallCalledSequentiallyOnThread); | 52 RTC_DISALLOW_COPY_AND_ASSIGN(CallCalledSequentiallyOnThread); |
54 }; | 53 }; |
55 | 54 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 TEST(SequencedTaskCheckerTest, TestAnnotationsOnWrongQueueDebug) { | 264 TEST(SequencedTaskCheckerTest, TestAnnotationsOnWrongQueueDebug) { |
266 ASSERT_DEATH({ TestAnnotationsOnWrongQueue(); }, ""); | 265 ASSERT_DEATH({ TestAnnotationsOnWrongQueue(); }, ""); |
267 } | 266 } |
268 #else | 267 #else |
269 TEST(SequencedTaskCheckerTest, TestAnnotationsOnWrongQueueRelease) { | 268 TEST(SequencedTaskCheckerTest, TestAnnotationsOnWrongQueueRelease) { |
270 TestAnnotationsOnWrongQueue(); | 269 TestAnnotationsOnWrongQueue(); |
271 } | 270 } |
272 #endif | 271 #endif |
273 #endif // GTEST_HAS_DEATH_TEST | 272 #endif // GTEST_HAS_DEATH_TEST |
274 } // namespace rtc | 273 } // namespace rtc |
OLD | NEW |