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

Side by Side Diff: base/synchronization/waitable_event_unittest.cc

Issue 2433773005: Move OS_WIN specific logic in MessagePumpDefault::Run into waitable_event_win.cc (Closed)
Patch Set: Fixed test issue 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
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 "base/synchronization/waitable_event.h" 5 #include "base/synchronization/waitable_event.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 TimeTicks start = TimeTicks::Now(); 153 TimeTicks start = TimeTicks::Now();
154 PlatformThread::Create(0, &signaler, &thread); 154 PlatformThread::Create(0, &signaler, &thread);
155 155
156 ev->TimedWait(TimeDelta::Max()); 156 ev->TimedWait(TimeDelta::Max());
157 EXPECT_GE(TimeTicks::Now() - start, thread_delay); 157 EXPECT_GE(TimeTicks::Now() - start, thread_delay);
158 delete ev; 158 delete ev;
159 159
160 PlatformThread::Join(thread); 160 PlatformThread::Join(thread);
161 } 161 }
162 162
163 // Tests that a sub-ms TimedWait doesn't time out promptly.
164 TEST(WaitableEventTest, SubMsTimedWait) {
165 WaitableEvent ev(WaitableEvent::ResetPolicy::AUTOMATIC,
166 WaitableEvent::InitialState::NOT_SIGNALED);
167
168 TimeDelta delay = TimeDelta::FromMicroseconds(900);
169 TimeTicks start = TimeTicks::Now();
170 ev.TimedWait(delay);
171 EXPECT_GE(TimeTicks::Now() - start, delay);
172 }
173
163 } // namespace base 174 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698