| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |