xref: /aosp_15_r20/external/cronet/base/test/test_waitable_event.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1*6777b538SAndroid Build Coastguard Worker // Copyright 2020 The Chromium Authors
2*6777b538SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*6777b538SAndroid Build Coastguard Worker // found in the LICENSE file.
4*6777b538SAndroid Build Coastguard Worker 
5*6777b538SAndroid Build Coastguard Worker #include "base/test/test_waitable_event.h"
6*6777b538SAndroid Build Coastguard Worker 
7*6777b538SAndroid Build Coastguard Worker #include <utility>
8*6777b538SAndroid Build Coastguard Worker 
9*6777b538SAndroid Build Coastguard Worker #include "build/build_config.h"
10*6777b538SAndroid Build Coastguard Worker 
11*6777b538SAndroid Build Coastguard Worker namespace base {
12*6777b538SAndroid Build Coastguard Worker 
TestWaitableEvent(ResetPolicy reset_policy,InitialState initial_state)13*6777b538SAndroid Build Coastguard Worker TestWaitableEvent::TestWaitableEvent(ResetPolicy reset_policy,
14*6777b538SAndroid Build Coastguard Worker                                      InitialState initial_state)
15*6777b538SAndroid Build Coastguard Worker     : WaitableEvent(reset_policy, initial_state) {
16*6777b538SAndroid Build Coastguard Worker   // Pretending this is only used while idle ensures this WaitableEvent is not
17*6777b538SAndroid Build Coastguard Worker   // instantiating a ScopedBlockingCallWithBaseSyncPrimitives in Wait(). In
18*6777b538SAndroid Build Coastguard Worker   // other words, test logic is considered "idle" work (not part of the tested
19*6777b538SAndroid Build Coastguard Worker   // logic).
20*6777b538SAndroid Build Coastguard Worker   declare_only_used_while_idle();
21*6777b538SAndroid Build Coastguard Worker }
22*6777b538SAndroid Build Coastguard Worker 
23*6777b538SAndroid Build Coastguard Worker #if BUILDFLAG(IS_WIN)
TestWaitableEvent(win::ScopedHandle event_handle)24*6777b538SAndroid Build Coastguard Worker TestWaitableEvent::TestWaitableEvent(win::ScopedHandle event_handle)
25*6777b538SAndroid Build Coastguard Worker     : WaitableEvent(std::move(event_handle)) {
26*6777b538SAndroid Build Coastguard Worker   declare_only_used_while_idle();
27*6777b538SAndroid Build Coastguard Worker }
28*6777b538SAndroid Build Coastguard Worker #endif
29*6777b538SAndroid Build Coastguard Worker 
30*6777b538SAndroid Build Coastguard Worker }  // namespace base
31