OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 thread->Stop(); | 245 thread->Stop(); |
246 delete thread; | 246 delete thread; |
247 // Really long name | 247 // Really long name |
248 thread = new Thread(); | 248 thread = new Thread(); |
249 EXPECT_TRUE(thread->SetName("Abcdefghijklmnopqrstuvwxyz1234567890", this)); | 249 EXPECT_TRUE(thread->SetName("Abcdefghijklmnopqrstuvwxyz1234567890", this)); |
250 EXPECT_TRUE(thread->Start()); | 250 EXPECT_TRUE(thread->Start()); |
251 thread->Stop(); | 251 thread->Stop(); |
252 delete thread; | 252 delete thread; |
253 } | 253 } |
254 | 254 |
255 // Test that setting thread priorities doesn't cause a malfunction. | |
256 // There's no easy way to verify the priority was set properly at this time. | |
257 TEST(ThreadTest, Priorities) { | |
258 Thread *thread; | |
259 thread = new Thread(); | |
260 EXPECT_TRUE(thread->SetPriority(PRIORITY_HIGH)); | |
261 EXPECT_TRUE(thread->Start()); | |
262 thread->Stop(); | |
263 delete thread; | |
264 thread = new Thread(); | |
265 EXPECT_TRUE(thread->SetPriority(PRIORITY_ABOVE_NORMAL)); | |
266 EXPECT_TRUE(thread->Start()); | |
267 thread->Stop(); | |
268 delete thread; | |
269 | |
270 thread = new Thread(); | |
271 EXPECT_TRUE(thread->Start()); | |
272 #if defined(WEBRTC_WIN) | |
273 EXPECT_TRUE(thread->SetPriority(PRIORITY_ABOVE_NORMAL)); | |
274 #else | |
275 EXPECT_FALSE(thread->SetPriority(PRIORITY_ABOVE_NORMAL)); | |
276 #endif | |
277 thread->Stop(); | |
278 delete thread; | |
279 | |
280 } | |
281 | |
282 TEST(ThreadTest, Wrap) { | 255 TEST(ThreadTest, Wrap) { |
283 Thread* current_thread = Thread::Current(); | 256 Thread* current_thread = Thread::Current(); |
284 current_thread->UnwrapCurrent(); | 257 current_thread->UnwrapCurrent(); |
285 CustomThread* cthread = new CustomThread(); | 258 CustomThread* cthread = new CustomThread(); |
286 EXPECT_TRUE(cthread->WrapCurrent()); | 259 EXPECT_TRUE(cthread->WrapCurrent()); |
287 EXPECT_TRUE(cthread->RunningForTest()); | 260 EXPECT_TRUE(cthread->RunningForTest()); |
288 EXPECT_FALSE(cthread->IsOwned()); | 261 EXPECT_FALSE(cthread->IsOwned()); |
289 cthread->UnwrapCurrent(); | 262 cthread->UnwrapCurrent(); |
290 EXPECT_FALSE(cthread->RunningForTest()); | 263 EXPECT_FALSE(cthread->RunningForTest()); |
291 delete cthread; | 264 delete cthread; |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 }; | 718 }; |
746 | 719 |
747 TEST_F(ComThreadTest, ComInited) { | 720 TEST_F(ComThreadTest, ComInited) { |
748 Thread* thread = new ComThread(); | 721 Thread* thread = new ComThread(); |
749 EXPECT_TRUE(thread->Start()); | 722 EXPECT_TRUE(thread->Start()); |
750 thread->Post(this, 0); | 723 thread->Post(this, 0); |
751 EXPECT_TRUE_WAIT(done_, 1000); | 724 EXPECT_TRUE_WAIT(done_, 1000); |
752 delete thread; | 725 delete thread; |
753 } | 726 } |
754 #endif | 727 #endif |
OLD | NEW |