| 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 #if defined(OS_WIN) | |
| 12 #include <windows.h> | |
| 13 #endif | |
| 14 | |
| 15 namespace base { | 11 namespace base { |
| 16 | 12 |
| 17 // Trivial tests that thread runs and doesn't crash on create and join --------- | 13 // Trivial tests that thread runs and doesn't crash on create and join --------- |
| 18 | 14 |
| 19 class TrivialThread : public PlatformThread::Delegate { | 15 class TrivialThread : public PlatformThread::Delegate { |
| 20 public: | 16 public: |
| 21 TrivialThread() : did_run_(false) {} | 17 TrivialThread() : did_run_(false) {} |
| 22 | 18 |
| 23 void ThreadMain() override { did_run_ = true; } | 19 void ThreadMain() override { did_run_ = true; } |
| 24 | 20 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 262 } |
| 267 | 263 |
| 268 // Restore current thread priority for follow-up tests. | 264 // Restore current thread priority for follow-up tests. |
| 269 PlatformThread::SetThreadPriority(current_handle, ThreadPriority::NORMAL); | 265 PlatformThread::SetThreadPriority(current_handle, ThreadPriority::NORMAL); |
| 270 | 266 |
| 271 thread.MarkForTermination(); | 267 thread.MarkForTermination(); |
| 272 PlatformThread::Join(handle); | 268 PlatformThread::Join(handle); |
| 273 } | 269 } |
| 274 | 270 |
| 275 } // namespace base | 271 } // namespace base |
| OLD | NEW |