| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "webrtc/base/timeutils.h" |
| 16 #include "webrtc/modules/include/module.h" | 17 #include "webrtc/modules/include/module.h" |
| 17 #include "webrtc/modules/utility/source/process_thread_impl.h" | 18 #include "webrtc/modules/utility/source/process_thread_impl.h" |
| 18 #include "webrtc/system_wrappers/include/tick_util.h" | |
| 19 | 19 |
| 20 namespace webrtc { | 20 namespace webrtc { |
| 21 | 21 |
| 22 using ::testing::_; | 22 using ::testing::_; |
| 23 using ::testing::DoAll; | 23 using ::testing::DoAll; |
| 24 using ::testing::InSequence; | 24 using ::testing::InSequence; |
| 25 using ::testing::Invoke; | 25 using ::testing::Invoke; |
| 26 using ::testing::Return; | 26 using ::testing::Return; |
| 27 using ::testing::SetArgPointee; | 27 using ::testing::SetArgPointee; |
| 28 | 28 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 | 44 |
| 45 ACTION_P(SetEvent, event) { | 45 ACTION_P(SetEvent, event) { |
| 46 event->Set(); | 46 event->Set(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 ACTION_P(Increment, counter) { | 49 ACTION_P(Increment, counter) { |
| 50 ++(*counter); | 50 ++(*counter); |
| 51 } | 51 } |
| 52 | 52 |
| 53 ACTION_P(SetTimestamp, ptr) { | 53 ACTION_P(SetTimestamp, ptr) { |
| 54 *ptr = TickTime::MillisecondTimestamp(); | 54 *ptr = rtc::TimeMillis(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 TEST(ProcessThreadImpl, StartStop) { | 57 TEST(ProcessThreadImpl, StartStop) { |
| 58 ProcessThreadImpl thread("ProcessThread"); | 58 ProcessThreadImpl thread("ProcessThread"); |
| 59 thread.Start(); | 59 thread.Start(); |
| 60 thread.Stop(); | 60 thread.Stop(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 TEST(ProcessThreadImpl, MultipleStartStop) { | 63 TEST(ProcessThreadImpl, MultipleStartStop) { |
| 64 ProcessThreadImpl thread("ProcessThread"); | 64 ProcessThreadImpl thread("ProcessThread"); |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 ProcessThreadImpl thread("ProcessThread"); | 296 ProcessThreadImpl thread("ProcessThread"); |
| 297 std::unique_ptr<EventWrapper> task_ran(EventWrapper::Create()); | 297 std::unique_ptr<EventWrapper> task_ran(EventWrapper::Create()); |
| 298 std::unique_ptr<RaiseEventTask> task(new RaiseEventTask(task_ran.get())); | 298 std::unique_ptr<RaiseEventTask> task(new RaiseEventTask(task_ran.get())); |
| 299 thread.Start(); | 299 thread.Start(); |
| 300 thread.PostTask(std::move(task)); | 300 thread.PostTask(std::move(task)); |
| 301 EXPECT_EQ(kEventSignaled, task_ran->Wait(100)); | 301 EXPECT_EQ(kEventSignaled, task_ran->Wait(100)); |
| 302 thread.Stop(); | 302 thread.Stop(); |
| 303 } | 303 } |
| 304 | 304 |
| 305 } // namespace webrtc | 305 } // namespace webrtc |
| OLD | NEW |