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

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

Issue 1620673003: base: Implement GetCurrentThreadPriority. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 EXPECT_EQ(kThreadPriorityTestValues[i], 242 EXPECT_EQ(kThreadPriorityTestValues[i],
243 PlatformThread::GetCurrentThreadPriority()); 243 PlatformThread::GetCurrentThreadPriority());
244 } 244 }
245 } 245 }
246 246
247 DISALLOW_COPY_AND_ASSIGN(ThreadPriorityTestThread); 247 DISALLOW_COPY_AND_ASSIGN(ThreadPriorityTestThread);
248 }; 248 };
249 249
250 } // namespace 250 } // namespace
251 251
252 #if defined(OS_MACOSX)
253 // PlatformThread::GetCurrentThreadPriority() is not implemented on OS X.
254 #define MAYBE_ThreadPriorityCurrentThread DISABLED_ThreadPriorityCurrentThread
255 #else
256 #define MAYBE_ThreadPriorityCurrentThread ThreadPriorityCurrentThread
257 #endif
258
259 // Test changing a created thread's priority (which has different semantics on 252 // Test changing a created thread's priority (which has different semantics on
260 // some platforms). 253 // some platforms).
261 TEST(PlatformThreadTest, MAYBE_ThreadPriorityCurrentThread) { 254 TEST(PlatformThreadTest, ThreadPriorityCurrentThread) {
262 ThreadPriorityTestThread thread; 255 ThreadPriorityTestThread thread;
263 PlatformThreadHandle handle; 256 PlatformThreadHandle handle;
264 257
265 ASSERT_FALSE(thread.IsRunning()); 258 ASSERT_FALSE(thread.IsRunning());
266 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle)); 259 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle));
267 thread.WaitForTerminationReady(); 260 thread.WaitForTerminationReady();
268 ASSERT_TRUE(thread.IsRunning()); 261 ASSERT_TRUE(thread.IsRunning());
269 262
270 thread.MarkForTermination(); 263 thread.MarkForTermination();
271 PlatformThread::Join(handle); 264 PlatformThread::Join(handle);
272 ASSERT_FALSE(thread.IsRunning()); 265 ASSERT_FALSE(thread.IsRunning());
273 } 266 }
274 267
275 } // namespace base 268 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698