| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |