| OLD | NEW | 
|---|
| 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  Loading... | 
| 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  Loading... | 
| 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 | 
| OLD | NEW | 
|---|