henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2013 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 11 | #include "webrtc/api/proxy.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 12 | |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 13 | #include <memory> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 14 | #include <string> |
| 15 | |
Edward Lemur | c20978e | 2017-07-06 19:44:34 +0200 | [diff] [blame] | 16 | #include "webrtc/rtc_base/gunit.h" |
| 17 | #include "webrtc/rtc_base/refcount.h" |
| 18 | #include "webrtc/rtc_base/thread.h" |
kwiberg | ac9f876 | 2016-09-30 22:29:43 -0700 | [diff] [blame] | 19 | #include "webrtc/test/gmock.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 20 | |
| 21 | using ::testing::_; |
| 22 | using ::testing::DoAll; |
| 23 | using ::testing::Exactly; |
| 24 | using ::testing::InvokeWithoutArgs; |
| 25 | using ::testing::Return; |
| 26 | |
| 27 | namespace webrtc { |
| 28 | |
| 29 | // Interface used for testing here. |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 30 | class FakeInterface : public rtc::RefCountInterface { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 31 | public: |
| 32 | virtual void VoidMethod0() = 0; |
| 33 | virtual std::string Method0() = 0; |
| 34 | virtual std::string ConstMethod0() const = 0; |
| 35 | virtual std::string Method1(std::string s) = 0; |
| 36 | virtual std::string ConstMethod1(std::string s) const = 0; |
| 37 | virtual std::string Method2(std::string s1, std::string s2) = 0; |
| 38 | |
| 39 | protected: |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 40 | virtual ~FakeInterface() {} |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 41 | }; |
| 42 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 43 | // Implementation of the test interface. |
| 44 | class Fake : public FakeInterface { |
| 45 | public: |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 46 | static rtc::scoped_refptr<Fake> Create() { |
| 47 | return new rtc::RefCountedObject<Fake>(); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 48 | } |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 49 | // Used to verify destructor is called on the correct thread. |
| 50 | MOCK_METHOD0(Destroy, void()); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 51 | |
| 52 | MOCK_METHOD0(VoidMethod0, void()); |
| 53 | MOCK_METHOD0(Method0, std::string()); |
| 54 | MOCK_CONST_METHOD0(ConstMethod0, std::string()); |
| 55 | |
| 56 | MOCK_METHOD1(Method1, std::string(std::string)); |
| 57 | MOCK_CONST_METHOD1(ConstMethod1, std::string(std::string)); |
| 58 | |
| 59 | MOCK_METHOD2(Method2, std::string(std::string, std::string)); |
| 60 | |
| 61 | protected: |
| 62 | Fake() {} |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 63 | ~Fake() { Destroy(); } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 64 | }; |
| 65 | |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 66 | // Proxies for the test interface. |
| 67 | BEGIN_PROXY_MAP(Fake) |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 68 | PROXY_WORKER_THREAD_DESTRUCTOR() |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 69 | PROXY_METHOD0(void, VoidMethod0) |
| 70 | PROXY_METHOD0(std::string, Method0) |
| 71 | PROXY_CONSTMETHOD0(std::string, ConstMethod0) |
| 72 | PROXY_WORKER_METHOD1(std::string, Method1, std::string) |
| 73 | PROXY_CONSTMETHOD1(std::string, ConstMethod1, std::string) |
| 74 | PROXY_WORKER_METHOD2(std::string, Method2, std::string, std::string) |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 75 | END_PROXY_MAP() |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 76 | |
| 77 | // Preprocessor hack to get a proxy class a name different than FakeProxy. |
| 78 | #define FakeProxy FakeSignalingProxy |
deadbeef | a601f5c | 2016-06-06 14:27:39 -0700 | [diff] [blame] | 79 | #define FakeProxyWithInternal FakeSignalingProxyWithInternal |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 80 | BEGIN_SIGNALING_PROXY_MAP(Fake) |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 81 | PROXY_SIGNALING_THREAD_DESTRUCTOR() |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 82 | PROXY_METHOD0(void, VoidMethod0) |
| 83 | PROXY_METHOD0(std::string, Method0) |
| 84 | PROXY_CONSTMETHOD0(std::string, ConstMethod0) |
| 85 | PROXY_METHOD1(std::string, Method1, std::string) |
| 86 | PROXY_CONSTMETHOD1(std::string, ConstMethod1, std::string) |
| 87 | PROXY_METHOD2(std::string, Method2, std::string, std::string) |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 88 | END_PROXY_MAP() |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 89 | #undef FakeProxy |
| 90 | |
| 91 | class SignalingProxyTest : public testing::Test { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 92 | public: |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 93 | // Checks that the functions are called on the right thread. |
| 94 | void CheckSignalingThread() { EXPECT_TRUE(signaling_thread_->IsCurrent()); } |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 95 | |
| 96 | protected: |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 97 | void SetUp() override { |
charujain | a117b04 | 2017-07-13 07:06:39 -0700 | [diff] [blame^] | 98 | signaling_thread_.reset(new rtc::Thread()); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 99 | ASSERT_TRUE(signaling_thread_->Start()); |
| 100 | fake_ = Fake::Create(); |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 101 | fake_signaling_proxy_ = |
| 102 | FakeSignalingProxy::Create(signaling_thread_.get(), fake_.get()); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | protected: |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 106 | std::unique_ptr<rtc::Thread> signaling_thread_; |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 107 | rtc::scoped_refptr<FakeInterface> fake_signaling_proxy_; |
buildbot@webrtc.org | d4e598d | 2014-07-29 17:36:52 +0000 | [diff] [blame] | 108 | rtc::scoped_refptr<Fake> fake_; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 109 | }; |
| 110 | |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 111 | TEST_F(SignalingProxyTest, SignalingThreadDestructor) { |
| 112 | EXPECT_CALL(*fake_, Destroy()) |
| 113 | .Times(Exactly(1)) |
| 114 | .WillOnce( |
| 115 | InvokeWithoutArgs(this, &SignalingProxyTest::CheckSignalingThread)); |
| 116 | fake_ = nullptr; |
| 117 | fake_signaling_proxy_ = nullptr; |
| 118 | } |
| 119 | |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 120 | TEST_F(SignalingProxyTest, VoidMethod0) { |
| 121 | EXPECT_CALL(*fake_, VoidMethod0()) |
| 122 | .Times(Exactly(1)) |
| 123 | .WillOnce( |
| 124 | InvokeWithoutArgs(this, &SignalingProxyTest::CheckSignalingThread)); |
| 125 | fake_signaling_proxy_->VoidMethod0(); |
| 126 | } |
| 127 | |
| 128 | TEST_F(SignalingProxyTest, Method0) { |
| 129 | EXPECT_CALL(*fake_, Method0()) |
| 130 | .Times(Exactly(1)) |
| 131 | .WillOnce(DoAll( |
| 132 | InvokeWithoutArgs(this, &SignalingProxyTest::CheckSignalingThread), |
| 133 | Return("Method0"))); |
| 134 | EXPECT_EQ("Method0", fake_signaling_proxy_->Method0()); |
| 135 | } |
| 136 | |
| 137 | TEST_F(SignalingProxyTest, ConstMethod0) { |
| 138 | EXPECT_CALL(*fake_, ConstMethod0()) |
| 139 | .Times(Exactly(1)) |
| 140 | .WillOnce(DoAll( |
| 141 | InvokeWithoutArgs(this, &SignalingProxyTest::CheckSignalingThread), |
| 142 | Return("ConstMethod0"))); |
| 143 | EXPECT_EQ("ConstMethod0", fake_signaling_proxy_->ConstMethod0()); |
| 144 | } |
| 145 | |
| 146 | TEST_F(SignalingProxyTest, Method1) { |
| 147 | const std::string arg1 = "arg1"; |
| 148 | EXPECT_CALL(*fake_, Method1(arg1)) |
| 149 | .Times(Exactly(1)) |
| 150 | .WillOnce(DoAll( |
| 151 | InvokeWithoutArgs(this, &SignalingProxyTest::CheckSignalingThread), |
| 152 | Return("Method1"))); |
| 153 | EXPECT_EQ("Method1", fake_signaling_proxy_->Method1(arg1)); |
| 154 | } |
| 155 | |
| 156 | TEST_F(SignalingProxyTest, ConstMethod1) { |
| 157 | const std::string arg1 = "arg1"; |
| 158 | EXPECT_CALL(*fake_, ConstMethod1(arg1)) |
| 159 | .Times(Exactly(1)) |
| 160 | .WillOnce(DoAll( |
| 161 | InvokeWithoutArgs(this, &SignalingProxyTest::CheckSignalingThread), |
| 162 | Return("ConstMethod1"))); |
| 163 | EXPECT_EQ("ConstMethod1", fake_signaling_proxy_->ConstMethod1(arg1)); |
| 164 | } |
| 165 | |
| 166 | TEST_F(SignalingProxyTest, Method2) { |
| 167 | const std::string arg1 = "arg1"; |
| 168 | const std::string arg2 = "arg2"; |
| 169 | EXPECT_CALL(*fake_, Method2(arg1, arg2)) |
| 170 | .Times(Exactly(1)) |
| 171 | .WillOnce(DoAll( |
| 172 | InvokeWithoutArgs(this, &SignalingProxyTest::CheckSignalingThread), |
| 173 | Return("Method2"))); |
| 174 | EXPECT_EQ("Method2", fake_signaling_proxy_->Method2(arg1, arg2)); |
| 175 | } |
| 176 | |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 177 | class ProxyTest : public testing::Test { |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 178 | public: |
| 179 | // Checks that the functions are called on the right thread. |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 180 | void CheckSignalingThread() { EXPECT_TRUE(signaling_thread_->IsCurrent()); } |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 181 | void CheckWorkerThread() { EXPECT_TRUE(worker_thread_->IsCurrent()); } |
| 182 | |
| 183 | protected: |
| 184 | void SetUp() override { |
charujain | a117b04 | 2017-07-13 07:06:39 -0700 | [diff] [blame^] | 185 | signaling_thread_.reset(new rtc::Thread()); |
| 186 | worker_thread_.reset(new rtc::Thread()); |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 187 | ASSERT_TRUE(signaling_thread_->Start()); |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 188 | ASSERT_TRUE(worker_thread_->Start()); |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 189 | fake_ = Fake::Create(); |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 190 | fake_proxy_ = FakeProxy::Create(signaling_thread_.get(), |
| 191 | worker_thread_.get(), fake_.get()); |
| 192 | } |
| 193 | |
| 194 | protected: |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 195 | std::unique_ptr<rtc::Thread> signaling_thread_; |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 196 | std::unique_ptr<rtc::Thread> worker_thread_; |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 197 | rtc::scoped_refptr<FakeInterface> fake_proxy_; |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 198 | rtc::scoped_refptr<Fake> fake_; |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 199 | }; |
| 200 | |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 201 | TEST_F(ProxyTest, WorkerThreadDestructor) { |
| 202 | EXPECT_CALL(*fake_, Destroy()) |
| 203 | .Times(Exactly(1)) |
| 204 | .WillOnce(InvokeWithoutArgs(this, &ProxyTest::CheckWorkerThread)); |
| 205 | fake_ = nullptr; |
| 206 | fake_proxy_ = nullptr; |
| 207 | } |
| 208 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 209 | TEST_F(ProxyTest, VoidMethod0) { |
| 210 | EXPECT_CALL(*fake_, VoidMethod0()) |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 211 | .Times(Exactly(1)) |
| 212 | .WillOnce(InvokeWithoutArgs(this, &ProxyTest::CheckSignalingThread)); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 213 | fake_proxy_->VoidMethod0(); |
| 214 | } |
| 215 | |
| 216 | TEST_F(ProxyTest, Method0) { |
| 217 | EXPECT_CALL(*fake_, Method0()) |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 218 | .Times(Exactly(1)) |
| 219 | .WillOnce( |
| 220 | DoAll(InvokeWithoutArgs(this, &ProxyTest::CheckSignalingThread), |
| 221 | Return("Method0"))); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 222 | EXPECT_EQ("Method0", |
| 223 | fake_proxy_->Method0()); |
| 224 | } |
| 225 | |
| 226 | TEST_F(ProxyTest, ConstMethod0) { |
| 227 | EXPECT_CALL(*fake_, ConstMethod0()) |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 228 | .Times(Exactly(1)) |
| 229 | .WillOnce( |
| 230 | DoAll(InvokeWithoutArgs(this, &ProxyTest::CheckSignalingThread), |
| 231 | Return("ConstMethod0"))); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 232 | EXPECT_EQ("ConstMethod0", |
| 233 | fake_proxy_->ConstMethod0()); |
| 234 | } |
| 235 | |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 236 | TEST_F(ProxyTest, WorkerMethod1) { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 237 | const std::string arg1 = "arg1"; |
| 238 | EXPECT_CALL(*fake_, Method1(arg1)) |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 239 | .Times(Exactly(1)) |
| 240 | .WillOnce(DoAll(InvokeWithoutArgs(this, &ProxyTest::CheckWorkerThread), |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 241 | Return("Method1"))); |
| 242 | EXPECT_EQ("Method1", fake_proxy_->Method1(arg1)); |
| 243 | } |
| 244 | |
| 245 | TEST_F(ProxyTest, ConstMethod1) { |
| 246 | const std::string arg1 = "arg1"; |
| 247 | EXPECT_CALL(*fake_, ConstMethod1(arg1)) |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 248 | .Times(Exactly(1)) |
| 249 | .WillOnce( |
| 250 | DoAll(InvokeWithoutArgs(this, &ProxyTest::CheckSignalingThread), |
| 251 | Return("ConstMethod1"))); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 252 | EXPECT_EQ("ConstMethod1", fake_proxy_->ConstMethod1(arg1)); |
| 253 | } |
| 254 | |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 255 | TEST_F(ProxyTest, WorkerMethod2) { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 256 | const std::string arg1 = "arg1"; |
| 257 | const std::string arg2 = "arg2"; |
| 258 | EXPECT_CALL(*fake_, Method2(arg1, arg2)) |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 259 | .Times(Exactly(1)) |
| 260 | .WillOnce(DoAll(InvokeWithoutArgs(this, &ProxyTest::CheckWorkerThread), |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 261 | Return("Method2"))); |
| 262 | EXPECT_EQ("Method2", fake_proxy_->Method2(arg1, arg2)); |
| 263 | } |
| 264 | |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 265 | // Interface for testing OWNED_PROXY_MAP. |
| 266 | class FooInterface { |
| 267 | public: |
| 268 | virtual ~FooInterface() {} |
| 269 | virtual void Bar() = 0; |
| 270 | }; |
| 271 | |
| 272 | class Foo : public FooInterface { |
| 273 | public: |
| 274 | Foo() {} |
| 275 | MOCK_METHOD0(Bar, void()); |
| 276 | }; |
| 277 | |
| 278 | BEGIN_OWNED_PROXY_MAP(Foo) |
| 279 | PROXY_SIGNALING_THREAD_DESTRUCTOR() |
| 280 | PROXY_METHOD0(void, Bar) |
| 281 | END_PROXY_MAP() |
| 282 | |
| 283 | class OwnedProxyTest : public testing::Test { |
| 284 | public: |
| 285 | OwnedProxyTest() |
charujain | a117b04 | 2017-07-13 07:06:39 -0700 | [diff] [blame^] | 286 | : foo_(new Foo()), |
| 287 | foo_proxy_(FooProxy::Create(&signaling_thread_, |
| 288 | &worker_thread_, |
deadbeef | e814a0d | 2017-02-25 18:15:09 -0800 | [diff] [blame] | 289 | std::unique_ptr<FooInterface>(foo_))) { |
charujain | a117b04 | 2017-07-13 07:06:39 -0700 | [diff] [blame^] | 290 | signaling_thread_.Start(); |
| 291 | worker_thread_.Start(); |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 292 | } |
| 293 | |
charujain | a117b04 | 2017-07-13 07:06:39 -0700 | [diff] [blame^] | 294 | void CheckSignalingThread() { EXPECT_TRUE(signaling_thread_.IsCurrent()); } |
| 295 | void CheckWorkerThread() { EXPECT_TRUE(worker_thread_.IsCurrent()); } |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 296 | |
| 297 | protected: |
charujain | a117b04 | 2017-07-13 07:06:39 -0700 | [diff] [blame^] | 298 | rtc::Thread signaling_thread_; |
| 299 | rtc::Thread worker_thread_; |
deadbeef | d99a200 | 2017-01-18 08:55:23 -0800 | [diff] [blame] | 300 | Foo* foo_; // Owned by foo_proxy_, not this class. |
| 301 | std::unique_ptr<FooInterface> foo_proxy_; |
| 302 | }; |
| 303 | |
| 304 | // Just tests that a method can be invoked using an "owned proxy" (as opposed |
| 305 | // to normal ref-counted version). |
| 306 | TEST_F(OwnedProxyTest, BasicTest) { |
| 307 | EXPECT_CALL(*foo_, Bar()) |
| 308 | .Times(Exactly(1)) |
| 309 | .WillOnce(InvokeWithoutArgs(this, &OwnedProxyTest::CheckSignalingThread)); |
| 310 | foo_proxy_->Bar(); |
| 311 | } |
| 312 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 313 | } // namespace webrtc |