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

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

Issue 2714393003: Revert of Use TaskQueue in IncomingVideoStream (Closed)
Patch Set: 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
92 TEST(TaskQueueTest, PostFromQueue) { 83 TEST(TaskQueueTest, PostFromQueue) {
93 static const char kQueueName[] = "PostFromQueue"; 84 static const char kQueueName[] = "PostFromQueue";
94 Event event(false, false); 85 Event event(false, false);
95 TaskQueue queue(kQueueName); 86 TaskQueue queue(kQueueName);
96 87
97 queue.PostTask( 88 queue.PostTask(
98 [&event, &queue]() { queue.PostTask([&event]() { event.Set(); }); }); 89 [&event, &queue]() { queue.PostTask([&event]() { event.Set(); }); });
99 EXPECT_TRUE(event.Wait(1000)); 90 EXPECT_TRUE(event.Wait(1000));
100 } 91 }
101 92
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 queue.PostTask(NewClosure([&tasks_executed]() { ++tasks_executed; }, 266 queue.PostTask(NewClosure([&tasks_executed]() { ++tasks_executed; },
276 [&tasks_cleaned_up]() { ++tasks_cleaned_up; })); 267 [&tasks_cleaned_up]() { ++tasks_cleaned_up; }));
277 event.Set(); // Unblock the first task. 268 event.Set(); // Unblock the first task.
278 } 269 }
279 270
280 EXPECT_GE(tasks_cleaned_up, tasks_executed); 271 EXPECT_GE(tasks_cleaned_up, tasks_executed);
281 EXPECT_EQ(kTaskCount, tasks_cleaned_up); 272 EXPECT_EQ(kTaskCount, tasks_cleaned_up);
282 } 273 }
283 274
284 } // namespace rtc 275 } // 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