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

Side by Side Diff: base/threading/platform_thread_unittest.cc

Issue 2032603002: Migrate WaitableEvent to enum-based constructor in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: undo incorrect template change Created 4 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 // Tests of basic thread functions --------------------------------------------- 68 // Tests of basic thread functions ---------------------------------------------
69 69
70 namespace { 70 namespace {
71 71
72 class FunctionTestThread : public PlatformThread::Delegate { 72 class FunctionTestThread : public PlatformThread::Delegate {
73 public: 73 public:
74 FunctionTestThread() 74 FunctionTestThread()
75 : thread_id_(kInvalidThreadId), 75 : thread_id_(kInvalidThreadId),
76 termination_ready_(true, false), 76 termination_ready_(WaitableEvent::ResetPolicy::MANUAL,
77 terminate_thread_(true, false), 77 WaitableEvent::InitialState::NOT_SIGNALED),
78 terminate_thread_(WaitableEvent::ResetPolicy::MANUAL,
79 WaitableEvent::InitialState::NOT_SIGNALED),
78 done_(false) {} 80 done_(false) {}
79 ~FunctionTestThread() override { 81 ~FunctionTestThread() override {
80 EXPECT_TRUE(terminate_thread_.IsSignaled()) 82 EXPECT_TRUE(terminate_thread_.IsSignaled())
81 << "Need to mark thread for termination and join the underlying thread " 83 << "Need to mark thread for termination and join the underlying thread "
82 << "before destroying a FunctionTestThread as it owns the " 84 << "before destroying a FunctionTestThread as it owns the "
83 << "WaitableEvent blocking the underlying thread's main."; 85 << "WaitableEvent blocking the underlying thread's main.";
84 } 86 }
85 87
86 // Grabs |thread_id_|, runs an optional test on that thread, signals 88 // Grabs |thread_id_|, runs an optional test on that thread, signals
87 // |termination_ready_|, and then waits for |terminate_thread_| to be 89 // |termination_ready_|, and then waits for |terminate_thread_| to be
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 EXPECT_EQ(ThreadPriority::DISPLAY, 328 EXPECT_EQ(ThreadPriority::DISPLAY,
327 NiceValueToThreadPriority(kRealtimeAudioNiceValue + 1)); 329 NiceValueToThreadPriority(kRealtimeAudioNiceValue + 1));
328 EXPECT_EQ(ThreadPriority::REALTIME_AUDIO, 330 EXPECT_EQ(ThreadPriority::REALTIME_AUDIO,
329 NiceValueToThreadPriority(kRealtimeAudioNiceValue)); 331 NiceValueToThreadPriority(kRealtimeAudioNiceValue));
330 EXPECT_EQ(ThreadPriority::REALTIME_AUDIO, 332 EXPECT_EQ(ThreadPriority::REALTIME_AUDIO,
331 NiceValueToThreadPriority(kLowestNiceValue)); 333 NiceValueToThreadPriority(kLowestNiceValue));
332 } 334 }
333 #endif 335 #endif
334 336
335 } // namespace base 337 } // namespace base
OLDNEW
« no previous file with comments | « base/test/trace_event_analyzer_unittest.cc ('k') | base/threading/sequenced_task_runner_handle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698