mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
Add WaitForPreviouslyPostedTasks to TaskQueueForTest.
Add an utility function to TaskQueueForTest to execute all already posted tasks on the queue. Bug: webrtc:11380 Change-Id: I6cf75bc543cfd2dd1c363935134d3f7bd55eec58 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174140 Commit-Queue: Marina Ciocea <marinaciocea@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#31152}
This commit is contained in:
parent
1148fd5cef
commit
ce1320cc4d
1 changed files with 8 additions and 0 deletions
|
@ -66,6 +66,14 @@ class RTC_LOCKABLE TaskQueueForTest : public rtc::TaskQueue {
|
|||
void SendTask(Closure&& task, rtc::Location loc) {
|
||||
::webrtc::SendTask(loc, Get(), std::forward<Closure>(task));
|
||||
}
|
||||
|
||||
// Wait for the completion of all tasks posted prior to the
|
||||
// WaitForPreviouslyPostedTasks() call.
|
||||
void WaitForPreviouslyPostedTasks() {
|
||||
// Post an empty task on the queue and wait for it to finish, to ensure
|
||||
// that all already posted tasks on the queue get executed.
|
||||
SendTask([]() {}, RTC_FROM_HERE);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
Loading…
Reference in a new issue