| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 Thread::Current()->socketserver()->Wait(500, false); | 152 Thread::Current()->socketserver()->Wait(500, false); |
| 153 } | 153 } |
| 154 | 154 |
| 155 #define EXPECT_STATE(started, done, completed, stopped, deleted) \ | 155 #define EXPECT_STATE(started, done, completed, stopped, deleted) \ |
| 156 EXPECT_EQ(started, thread_started_); \ | 156 EXPECT_EQ(started, thread_started_); \ |
| 157 EXPECT_EQ(done, thread_done_); \ | 157 EXPECT_EQ(done, thread_done_); \ |
| 158 EXPECT_EQ(completed, thread_completed_); \ | 158 EXPECT_EQ(completed, thread_completed_); \ |
| 159 EXPECT_EQ(stopped, thread_stopped_); \ | 159 EXPECT_EQ(stopped, thread_stopped_); \ |
| 160 EXPECT_EQ(deleted, thread_deleted_); | 160 EXPECT_EQ(deleted, thread_deleted_); |
| 161 | 161 |
| 162 TEST_F(SignalThreadTest, ThreadFinishes) { | 162 #if defined(WEBRTC_LINUX) |
| 163 #define MAYBE_ThreadFinishes DISABLED_ThreadFinishes |
| 164 #else |
| 165 #define MAYBE_ThreadFinishes ThreadFinishes |
| 166 #endif |
| 167 TEST_F(SignalThreadTest, MAYBE_ThreadFinishes) { |
| 163 thread_->Start(); | 168 thread_->Start(); |
| 164 EXPECT_STATE(1, 0, 0, 0, 0); | 169 EXPECT_STATE(1, 0, 0, 0, 0); |
| 165 Thread::SleepMs(500); | 170 Thread::SleepMs(500); |
| 166 EXPECT_STATE(1, 0, 0, 0, 0); | 171 EXPECT_STATE(1, 0, 0, 0, 0); |
| 167 Thread::Current()->ProcessMessages(0); | 172 Thread::Current()->ProcessMessages(0); |
| 168 EXPECT_STATE(1, 1, 1, 0, 1); | 173 EXPECT_STATE(1, 1, 1, 0, 1); |
| 169 } | 174 } |
| 170 | 175 |
| 171 TEST_F(SignalThreadTest, ReleasedThreadFinishes) { | 176 #if defined(WEBRTC_LINUX) |
| 177 #define MAYBE_ReleasedThreadFinishes DISABLED_ReleasedThreadFinishes |
| 178 #else |
| 179 #define MAYBE_ReleasedThreadFinishes ReleasedThreadFinishes |
| 180 #endif |
| 181 TEST_F(SignalThreadTest, MAYBE_ReleasedThreadFinishes) { |
| 172 thread_->Start(); | 182 thread_->Start(); |
| 173 EXPECT_STATE(1, 0, 0, 0, 0); | 183 EXPECT_STATE(1, 0, 0, 0, 0); |
| 174 thread_->Release(); | 184 thread_->Release(); |
| 175 called_release_ = true; | 185 called_release_ = true; |
| 176 EXPECT_STATE(1, 0, 0, 0, 0); | 186 EXPECT_STATE(1, 0, 0, 0, 0); |
| 177 Thread::SleepMs(500); | 187 Thread::SleepMs(500); |
| 178 EXPECT_STATE(1, 0, 0, 0, 0); | 188 EXPECT_STATE(1, 0, 0, 0, 0); |
| 179 Thread::Current()->ProcessMessages(0); | 189 Thread::Current()->ProcessMessages(0); |
| 180 EXPECT_STATE(1, 1, 1, 0, 1); | 190 EXPECT_STATE(1, 1, 1, 0, 1); |
| 181 } | 191 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 192 TEST_F(SignalThreadTest, DeferredDestroyedThreadCleansUp) { | 202 TEST_F(SignalThreadTest, DeferredDestroyedThreadCleansUp) { |
| 193 thread_->Start(); | 203 thread_->Start(); |
| 194 EXPECT_STATE(1, 0, 0, 0, 0); | 204 EXPECT_STATE(1, 0, 0, 0, 0); |
| 195 thread_->Destroy(false); | 205 thread_->Destroy(false); |
| 196 EXPECT_STATE(1, 0, 0, 1, 0); | 206 EXPECT_STATE(1, 0, 0, 1, 0); |
| 197 Thread::SleepMs(500); | 207 Thread::SleepMs(500); |
| 198 EXPECT_STATE(1, 0, 0, 1, 0); | 208 EXPECT_STATE(1, 0, 0, 1, 0); |
| 199 Thread::Current()->ProcessMessages(0); | 209 Thread::Current()->ProcessMessages(0); |
| 200 EXPECT_STATE(1, 1, 0, 1, 1); | 210 EXPECT_STATE(1, 1, 0, 1, 1); |
| 201 } | 211 } |
| OLD | NEW |