Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: webrtc/base/task_queue_unittest.cc

Issue 2716473002: Use TaskQueue in IncomingVideoStream (Closed)
Patch Set: Print render_time_ms instead of timestamp Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/common_video/include/incoming_video_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 TEST(TaskQueueTest, PostLambda) { 74 TEST(TaskQueueTest, PostLambda) {
75 static const char kQueueName[] = "PostLambda"; 75 static const char kQueueName[] = "PostLambda";
76 Event event(false, false); 76 Event event(false, false);
77 TaskQueue queue(kQueueName); 77 TaskQueue queue(kQueueName);
78 78
79 queue.PostTask([&event]() { event.Set(); }); 79 queue.PostTask([&event]() { event.Set(); });
80 EXPECT_TRUE(event.Wait(1000)); 80 EXPECT_TRUE(event.Wait(1000));
81 } 81 }
82 82
83 TEST(TaskQueueTest, PostDelayedZero) {
84 static const char kQueueName[] = "PostDelayedZero";
85 Event event(false, false);
86 TaskQueue queue(kQueueName);
87
88 queue.PostDelayedTask([&event]() { event.Set(); }, 0);
89 EXPECT_TRUE(event.Wait(1000));
90 }
91
83 TEST(TaskQueueTest, PostFromQueue) { 92 TEST(TaskQueueTest, PostFromQueue) {
84 static const char kQueueName[] = "PostFromQueue"; 93 static const char kQueueName[] = "PostFromQueue";
85 Event event(false, false); 94 Event event(false, false);
86 TaskQueue queue(kQueueName); 95 TaskQueue queue(kQueueName);
87 96
88 queue.PostTask( 97 queue.PostTask(
89 [&event, &queue]() { queue.PostTask([&event]() { event.Set(); }); }); 98 [&event, &queue]() { queue.PostTask([&event]() { event.Set(); }); });
90 EXPECT_TRUE(event.Wait(1000)); 99 EXPECT_TRUE(event.Wait(1000));
91 } 100 }
92 101
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 queue.PostTask(NewClosure([&tasks_executed]() { ++tasks_executed; }, 275 queue.PostTask(NewClosure([&tasks_executed]() { ++tasks_executed; },
267 [&tasks_cleaned_up]() { ++tasks_cleaned_up; })); 276 [&tasks_cleaned_up]() { ++tasks_cleaned_up; }));
268 event.Set(); // Unblock the first task. 277 event.Set(); // Unblock the first task.
269 } 278 }
270 279
271 EXPECT_GE(tasks_cleaned_up, tasks_executed); 280 EXPECT_GE(tasks_cleaned_up, tasks_executed);
272 EXPECT_EQ(kTaskCount, tasks_cleaned_up); 281 EXPECT_EQ(kTaskCount, tasks_cleaned_up);
273 } 282 }
274 283
275 } // namespace rtc 284 } // namespace rtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/common_video/include/incoming_video_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698