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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
56 | 56 |
57 MOCK_METHOD2(Method2, std::string(std::string, std::string)); | 57 MOCK_METHOD2(Method2, std::string(std::string, std::string)); |
58 | 58 |
59 protected: | 59 protected: |
60 Fake() {} | 60 Fake() {} |
61 ~Fake() {} | 61 ~Fake() {} |
62 }; | 62 }; |
63 | 63 |
64 // Proxies for the test interface. | 64 // Proxies for the test interface. |
65 BEGIN_PROXY_MAP(Fake) | 65 BEGIN_PROXY_MAP(Fake) |
66 PROXY_SIGNALING_THREAD_DESTRUCTOR() | |
66 PROXY_METHOD0(void, VoidMethod0) | 67 PROXY_METHOD0(void, VoidMethod0) |
67 PROXY_METHOD0(std::string, Method0) | 68 PROXY_METHOD0(std::string, Method0) |
68 PROXY_CONSTMETHOD0(std::string, ConstMethod0) | 69 PROXY_CONSTMETHOD0(std::string, ConstMethod0) |
69 PROXY_WORKER_METHOD1(std::string, Method1, std::string) | 70 PROXY_WORKER_METHOD1(std::string, Method1, std::string) |
70 PROXY_CONSTMETHOD1(std::string, ConstMethod1, std::string) | 71 PROXY_CONSTMETHOD1(std::string, ConstMethod1, std::string) |
71 PROXY_WORKER_METHOD2(std::string, Method2, std::string, std::string) | 72 PROXY_WORKER_METHOD2(std::string, Method2, std::string, std::string) |
72 END_PROXY() | 73 END_PROXY_MAP() |
73 | 74 |
74 // Preprocessor hack to get a proxy class a name different than FakeProxy. | 75 // Preprocessor hack to get a proxy class a name different than FakeProxy. |
75 #define FakeProxy FakeSignalingProxy | 76 #define FakeProxy FakeSignalingProxy |
76 #define FakeProxyWithInternal FakeSignalingProxyWithInternal | 77 #define FakeProxyWithInternal FakeSignalingProxyWithInternal |
77 BEGIN_SIGNALING_PROXY_MAP(Fake) | 78 BEGIN_SIGNALING_PROXY_MAP(Fake) |
79 PROXY_SIGNALING_THREAD_DESTRUCTOR() | |
78 PROXY_METHOD0(void, VoidMethod0) | 80 PROXY_METHOD0(void, VoidMethod0) |
79 PROXY_METHOD0(std::string, Method0) | 81 PROXY_METHOD0(std::string, Method0) |
80 PROXY_CONSTMETHOD0(std::string, ConstMethod0) | 82 PROXY_CONSTMETHOD0(std::string, ConstMethod0) |
81 PROXY_METHOD1(std::string, Method1, std::string) | 83 PROXY_METHOD1(std::string, Method1, std::string) |
82 PROXY_CONSTMETHOD1(std::string, ConstMethod1, std::string) | 84 PROXY_CONSTMETHOD1(std::string, ConstMethod1, std::string) |
83 PROXY_METHOD2(std::string, Method2, std::string, std::string) | 85 PROXY_METHOD2(std::string, Method2, std::string, std::string) |
84 END_SIGNALING_PROXY() | 86 END_PROXY_MAP() |
85 #undef FakeProxy | 87 #undef FakeProxy |
86 | 88 |
87 class SignalingProxyTest : public testing::Test { | 89 class SignalingProxyTest : public testing::Test { |
pthatcher1
2017/01/17 19:44:00
Is there a test of the new functionality you are a
Taylor Brandstetter
2017/01/18 01:17:14
Done. I only added a smoke test for the "owned pro
| |
88 public: | 90 public: |
89 // Checks that the functions are called on the right thread. | 91 // Checks that the functions are called on the right thread. |
90 void CheckSignalingThread() { EXPECT_TRUE(signaling_thread_->IsCurrent()); } | 92 void CheckSignalingThread() { EXPECT_TRUE(signaling_thread_->IsCurrent()); } |
91 | 93 |
92 protected: | 94 protected: |
93 void SetUp() override { | 95 void SetUp() override { |
94 signaling_thread_.reset(new rtc::Thread()); | 96 signaling_thread_.reset(new rtc::Thread()); |
95 ASSERT_TRUE(signaling_thread_->Start()); | 97 ASSERT_TRUE(signaling_thread_->Start()); |
96 fake_ = Fake::Create(); | 98 fake_ = Fake::Create(); |
97 fake_signaling_proxy_ = | 99 fake_signaling_proxy_ = |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 const std::string arg1 = "arg1"; | 232 const std::string arg1 = "arg1"; |
231 const std::string arg2 = "arg2"; | 233 const std::string arg2 = "arg2"; |
232 EXPECT_CALL(*fake_, Method2(arg1, arg2)) | 234 EXPECT_CALL(*fake_, Method2(arg1, arg2)) |
233 .Times(Exactly(1)) | 235 .Times(Exactly(1)) |
234 .WillOnce(DoAll(InvokeWithoutArgs(this, &ProxyTest::CheckWorkerThread), | 236 .WillOnce(DoAll(InvokeWithoutArgs(this, &ProxyTest::CheckWorkerThread), |
235 Return("Method2"))); | 237 Return("Method2"))); |
236 EXPECT_EQ("Method2", fake_proxy_->Method2(arg1, arg2)); | 238 EXPECT_EQ("Method2", fake_proxy_->Method2(arg1, arg2)); |
237 } | 239 } |
238 | 240 |
239 } // namespace webrtc | 241 } // namespace webrtc |
OLD | NEW |