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

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

Issue 2358993004: Enable the -Wundef warning for clang (Closed)
Patch Set: rebase Created 4 years, 2 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/rate_statistics_unittest.cc ('k') | webrtc/base/swap_queue_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 (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 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 #include "testing/gtest/include/gtest/gtest.h" 10 #include "webrtc/test/gtest.h"
11 #include "webrtc/base/checks.h" 11 #include "webrtc/base/checks.h"
12 #include "webrtc/base/constructormagic.h" 12 #include "webrtc/base/constructormagic.h"
13 #include "webrtc/base/platform_thread.h" 13 #include "webrtc/base/platform_thread.h"
14 #include "webrtc/base/sequenced_task_checker.h" 14 #include "webrtc/base/sequenced_task_checker.h"
15 #include "webrtc/base/task_queue.h" 15 #include "webrtc/base/task_queue.h"
16 16
17 namespace rtc { 17 namespace rtc {
18 18
19 namespace { 19 namespace {
20 // Calls SequencedTaskChecker::CalledSequentially on another thread. 20 // Calls SequencedTaskChecker::CalledSequentially on another thread.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 new SequencedTaskChecker()); 190 new SequencedTaskChecker());
191 191
192 sequenced_task_checker->Detach(); 192 sequenced_task_checker->Detach();
193 CallCalledSequentiallyOnThread call_on_thread(true, 193 CallCalledSequentiallyOnThread call_on_thread(true,
194 sequenced_task_checker.get()); 194 sequenced_task_checker.get());
195 done_event.Set(); 195 done_event.Set();
196 }); 196 });
197 EXPECT_TRUE(done_event.Wait(1000)); 197 EXPECT_TRUE(done_event.Wait(1000));
198 } 198 }
199 199
200 #if !NDEBUG || DCHECK_ALWAYS_ON 200 #if !defined(NDEBUG) || DCHECK_ALWAYS_ON
201 TEST(SequencedTaskCheckerTest, MethodNotAllowedOnDifferentThreadInDebug) { 201 TEST(SequencedTaskCheckerTest, MethodNotAllowedOnDifferentThreadInDebug) {
202 RunMethodOnDifferentThread(false); 202 RunMethodOnDifferentThread(false);
203 } 203 }
204 #else 204 #else
205 TEST(SequencedTaskCheckerTest, MethodAllowedOnDifferentThreadInRelease) { 205 TEST(SequencedTaskCheckerTest, MethodAllowedOnDifferentThreadInRelease) {
206 RunMethodOnDifferentThread(true); 206 RunMethodOnDifferentThread(true);
207 } 207 }
208 #endif 208 #endif
209 209
210 #if !NDEBUG || DCHECK_ALWAYS_ON 210 #if !defined(NDEBUG) || DCHECK_ALWAYS_ON
211 TEST(SequencedTaskCheckerTest, MethodNotAllowedOnDifferentTaskQueueInDebug) { 211 TEST(SequencedTaskCheckerTest, MethodNotAllowedOnDifferentTaskQueueInDebug) {
212 RunMethodOnDifferentTaskQueue(false); 212 RunMethodOnDifferentTaskQueue(false);
213 } 213 }
214 #else 214 #else
215 TEST(SequencedTaskCheckerTest, MethodAllowedOnDifferentTaskQueueInRelease) { 215 TEST(SequencedTaskCheckerTest, MethodAllowedOnDifferentTaskQueueInRelease) {
216 RunMethodOnDifferentTaskQueue(true); 216 RunMethodOnDifferentTaskQueue(true);
217 } 217 }
218 #endif 218 #endif
219 219
220 #if !NDEBUG || DCHECK_ALWAYS_ON 220 #if !defined(NDEBUG) || DCHECK_ALWAYS_ON
221 TEST(SequencedTaskCheckerTest, DetachFromTaskQueueInDebug) { 221 TEST(SequencedTaskCheckerTest, DetachFromTaskQueueInDebug) {
222 DetachThenCallFromDifferentTaskQueue(false); 222 DetachThenCallFromDifferentTaskQueue(false);
223 } 223 }
224 #else 224 #else
225 TEST(SequencedTaskCheckerTest, DetachFromTaskQueueInRelease) { 225 TEST(SequencedTaskCheckerTest, DetachFromTaskQueueInRelease) {
226 DetachThenCallFromDifferentTaskQueue(true); 226 DetachThenCallFromDifferentTaskQueue(true);
227 } 227 }
228 #endif 228 #endif
229 229
230 class TestAnnotations { 230 class TestAnnotations {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 TEST(SequencedTaskCheckerTest, TestAnnotationsOnWrongQueueDebug) { 264 TEST(SequencedTaskCheckerTest, TestAnnotationsOnWrongQueueDebug) {
265 ASSERT_DEATH({ TestAnnotationsOnWrongQueue(); }, ""); 265 ASSERT_DEATH({ TestAnnotationsOnWrongQueue(); }, "");
266 } 266 }
267 #else 267 #else
268 TEST(SequencedTaskCheckerTest, TestAnnotationsOnWrongQueueRelease) { 268 TEST(SequencedTaskCheckerTest, TestAnnotationsOnWrongQueueRelease) {
269 TestAnnotationsOnWrongQueue(); 269 TestAnnotationsOnWrongQueue();
270 } 270 }
271 #endif 271 #endif
272 #endif // GTEST_HAS_DEATH_TEST 272 #endif // GTEST_HAS_DEATH_TEST
273 } // namespace rtc 273 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/rate_statistics_unittest.cc ('k') | webrtc/base/swap_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698