OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 277 |
278 BEGIN_OWNED_PROXY_MAP(Foo) | 278 BEGIN_OWNED_PROXY_MAP(Foo) |
279 PROXY_SIGNALING_THREAD_DESTRUCTOR() | 279 PROXY_SIGNALING_THREAD_DESTRUCTOR() |
280 PROXY_METHOD0(void, Bar) | 280 PROXY_METHOD0(void, Bar) |
281 END_PROXY_MAP() | 281 END_PROXY_MAP() |
282 | 282 |
283 class OwnedProxyTest : public testing::Test { | 283 class OwnedProxyTest : public testing::Test { |
284 public: | 284 public: |
285 OwnedProxyTest() | 285 OwnedProxyTest() |
286 : foo_(new Foo()), | 286 : foo_(new Foo()), |
287 foo_proxy_( | 287 foo_proxy_(FooProxy::Create(&signaling_thread_, |
288 FooProxy::Create(&signaling_thread_, &worker_thread_, foo_)) { | 288 &worker_thread_, |
| 289 std::unique_ptr<FooInterface>(foo_))) { |
289 signaling_thread_.Start(); | 290 signaling_thread_.Start(); |
290 worker_thread_.Start(); | 291 worker_thread_.Start(); |
291 } | 292 } |
292 | 293 |
293 void CheckSignalingThread() { EXPECT_TRUE(signaling_thread_.IsCurrent()); } | 294 void CheckSignalingThread() { EXPECT_TRUE(signaling_thread_.IsCurrent()); } |
294 void CheckWorkerThread() { EXPECT_TRUE(worker_thread_.IsCurrent()); } | 295 void CheckWorkerThread() { EXPECT_TRUE(worker_thread_.IsCurrent()); } |
295 | 296 |
296 protected: | 297 protected: |
297 rtc::Thread signaling_thread_; | 298 rtc::Thread signaling_thread_; |
298 rtc::Thread worker_thread_; | 299 rtc::Thread worker_thread_; |
299 Foo* foo_; // Owned by foo_proxy_, not this class. | 300 Foo* foo_; // Owned by foo_proxy_, not this class. |
300 std::unique_ptr<FooInterface> foo_proxy_; | 301 std::unique_ptr<FooInterface> foo_proxy_; |
301 }; | 302 }; |
302 | 303 |
303 // Just tests that a method can be invoked using an "owned proxy" (as opposed | 304 // Just tests that a method can be invoked using an "owned proxy" (as opposed |
304 // to normal ref-counted version). | 305 // to normal ref-counted version). |
305 TEST_F(OwnedProxyTest, BasicTest) { | 306 TEST_F(OwnedProxyTest, BasicTest) { |
306 EXPECT_CALL(*foo_, Bar()) | 307 EXPECT_CALL(*foo_, Bar()) |
307 .Times(Exactly(1)) | 308 .Times(Exactly(1)) |
308 .WillOnce(InvokeWithoutArgs(this, &OwnedProxyTest::CheckSignalingThread)); | 309 .WillOnce(InvokeWithoutArgs(this, &OwnedProxyTest::CheckSignalingThread)); |
309 foo_proxy_->Bar(); | 310 foo_proxy_->Bar(); |
310 } | 311 } |
311 | 312 |
312 } // namespace webrtc | 313 } // namespace webrtc |
OLD | NEW |