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

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

Issue 2718663005: Replace NULL with nullptr or null in webrtc/base/. (Closed)
Patch Set: Fixing Windows and formatting issues. 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 | « webrtc/base/messagequeue.cc ('k') | webrtc/base/nat_unittest.cc » ('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 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 *deleted = true; 50 *deleted = true;
51 *was_locked = test->IsLocked(); 51 *was_locked = test->IsLocked();
52 } 52 }
53 MessageQueueTest* test; 53 MessageQueueTest* test;
54 bool* was_locked; 54 bool* was_locked;
55 bool* deleted; 55 bool* deleted;
56 }; 56 };
57 57
58 static void DelayedPostsWithIdenticalTimesAreProcessedInFifoOrder( 58 static void DelayedPostsWithIdenticalTimesAreProcessedInFifoOrder(
59 MessageQueue* q) { 59 MessageQueue* q) {
60 EXPECT_TRUE(q != NULL); 60 EXPECT_TRUE(q != nullptr);
61 int64_t now = TimeMillis(); 61 int64_t now = TimeMillis();
62 q->PostAt(RTC_FROM_HERE, now, NULL, 3); 62 q->PostAt(RTC_FROM_HERE, now, nullptr, 3);
63 q->PostAt(RTC_FROM_HERE, now - 2, NULL, 0); 63 q->PostAt(RTC_FROM_HERE, now - 2, nullptr, 0);
64 q->PostAt(RTC_FROM_HERE, now - 1, NULL, 1); 64 q->PostAt(RTC_FROM_HERE, now - 1, nullptr, 1);
65 q->PostAt(RTC_FROM_HERE, now, NULL, 4); 65 q->PostAt(RTC_FROM_HERE, now, nullptr, 4);
66 q->PostAt(RTC_FROM_HERE, now - 1, NULL, 2); 66 q->PostAt(RTC_FROM_HERE, now - 1, nullptr, 2);
67 67
68 Message msg; 68 Message msg;
69 for (size_t i=0; i<5; ++i) { 69 for (size_t i=0; i<5; ++i) {
70 memset(&msg, 0, sizeof(msg)); 70 memset(&msg, 0, sizeof(msg));
71 EXPECT_TRUE(q->Get(&msg, 0)); 71 EXPECT_TRUE(q->Get(&msg, 0));
72 EXPECT_EQ(i, msg.message_id); 72 EXPECT_EQ(i, msg.message_id);
73 } 73 }
74 74
75 EXPECT_FALSE(q->Get(&msg, 0)); // No more messages 75 EXPECT_FALSE(q->Get(&msg, 0)); // No more messages
76 } 76 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 // First, post a dispose. 113 // First, post a dispose.
114 Dispose(handler); 114 Dispose(handler);
115 // Now, post a message, which should *not* be returned by Get(). 115 // Now, post a message, which should *not* be returned by Get().
116 Post(RTC_FROM_HERE, handler, 1); 116 Post(RTC_FROM_HERE, handler, 1);
117 Message msg; 117 Message msg;
118 EXPECT_FALSE(Get(&msg, 0)); 118 EXPECT_FALSE(Get(&msg, 0));
119 EXPECT_TRUE(deleted); 119 EXPECT_TRUE(deleted);
120 } 120 }
121 121
122 struct UnwrapMainThreadScope { 122 struct UnwrapMainThreadScope {
123 UnwrapMainThreadScope() : rewrap_(Thread::Current() != NULL) { 123 UnwrapMainThreadScope() : rewrap_(Thread::Current() != nullptr) {
124 if (rewrap_) ThreadManager::Instance()->UnwrapCurrentThread(); 124 if (rewrap_) ThreadManager::Instance()->UnwrapCurrentThread();
125 } 125 }
126 ~UnwrapMainThreadScope() { 126 ~UnwrapMainThreadScope() {
127 if (rewrap_) ThreadManager::Instance()->WrapCurrentThread(); 127 if (rewrap_) ThreadManager::Instance()->WrapCurrentThread();
128 } 128 }
129 private: 129 private:
130 bool rewrap_; 130 bool rewrap_;
131 }; 131 };
132 132
133 TEST(MessageQueueManager, Clear) { 133 TEST(MessageQueueManager, Clear) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 FunctorMessageHandler<void, std::function<void()>> event_signaler( 208 FunctorMessageHandler<void, std::function<void()>> event_signaler(
209 [&entered_process_all_message_queues] { 209 [&entered_process_all_message_queues] {
210 entered_process_all_message_queues.Set(); 210 entered_process_all_message_queues.Set();
211 }); 211 });
212 212
213 // Post messages (both delayed and non delayed) to both threads. 213 // Post messages (both delayed and non delayed) to both threads.
214 t.Post(RTC_FROM_HERE, &clearer); 214 t.Post(RTC_FROM_HERE, &clearer);
215 rtc::Thread::Current()->Post(RTC_FROM_HERE, &event_signaler); 215 rtc::Thread::Current()->Post(RTC_FROM_HERE, &event_signaler);
216 MessageQueueManager::ProcessAllMessageQueues(); 216 MessageQueueManager::ProcessAllMessageQueues();
217 } 217 }
OLDNEW
« no previous file with comments | « webrtc/base/messagequeue.cc ('k') | webrtc/base/nat_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698