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

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

Issue 1660273004: base: Set initial thread priority in ThreadFunc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 #else 255 #else
256 #define MAYBE_ThreadPriorityCurrentThread ThreadPriorityCurrentThread 256 #define MAYBE_ThreadPriorityCurrentThread ThreadPriorityCurrentThread
257 #endif 257 #endif
258 258
259 // Test changing a created thread's priority (which has different semantics on 259 // Test changing a created thread's priority (which has different semantics on
260 // some platforms). 260 // some platforms).
261 TEST(PlatformThreadTest, MAYBE_ThreadPriorityCurrentThread) { 261 TEST(PlatformThreadTest, MAYBE_ThreadPriorityCurrentThread) {
262 ThreadPriorityTestThread thread; 262 ThreadPriorityTestThread thread;
263 PlatformThreadHandle handle; 263 PlatformThreadHandle handle;
264 264
265 if (IsBumpingPriorityAllowed()) {
266 // Bump the priority in order to verify that new threads are started with
267 // normal priority.
268 PlatformThread::SetCurrentThreadPriority(ThreadPriority::DISPLAY);
269 }
270
265 ASSERT_FALSE(thread.IsRunning()); 271 ASSERT_FALSE(thread.IsRunning());
266 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle)); 272 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle));
267 thread.WaitForTerminationReady(); 273 thread.WaitForTerminationReady();
268 ASSERT_TRUE(thread.IsRunning()); 274 ASSERT_TRUE(thread.IsRunning());
269 275
270 thread.MarkForTermination(); 276 thread.MarkForTermination();
271 PlatformThread::Join(handle); 277 PlatformThread::Join(handle);
272 ASSERT_FALSE(thread.IsRunning()); 278 ASSERT_FALSE(thread.IsRunning());
273 } 279 }
274 280
275 } // namespace base 281 } // namespace base
OLDNEW
« base/threading/platform_thread_android.cc ('K') | « base/threading/platform_thread_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698