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 23 matching lines...) Expand all Loading... | |
34 virtual std::string ConstMethod0() const = 0; | 34 virtual std::string ConstMethod0() const = 0; |
35 virtual std::string Method1(std::string s) = 0; | 35 virtual std::string Method1(std::string s) = 0; |
36 virtual std::string ConstMethod1(std::string s) const = 0; | 36 virtual std::string ConstMethod1(std::string s) const = 0; |
37 virtual std::string Method2(std::string s1, std::string s2) = 0; | 37 virtual std::string Method2(std::string s1, std::string s2) = 0; |
38 | 38 |
39 protected: | 39 protected: |
40 ~FakeInterface() {} | 40 ~FakeInterface() {} |
41 }; | 41 }; |
42 | 42 |
43 // Proxy for the test interface. | 43 // Proxy for the test interface. |
44 BEGIN_PROXY_MAP(Fake) | 44 BEGIN_SIGNALLING_PROXY_MAP(Fake) |
45 PROXY_METHOD0(void, VoidMethod0) | 45 PROXY_METHOD0(void, VoidMethod0) |
46 PROXY_METHOD0(std::string, Method0) | 46 PROXY_METHOD0(std::string, Method0) |
47 PROXY_CONSTMETHOD0(std::string, ConstMethod0) | 47 PROXY_CONSTMETHOD0(std::string, ConstMethod0) |
48 PROXY_METHOD1(std::string, Method1, std::string) | 48 PROXY_METHOD1(std::string, Method1, std::string) |
49 PROXY_CONSTMETHOD1(std::string, ConstMethod1, std::string) | 49 PROXY_CONSTMETHOD1(std::string, ConstMethod1, std::string) |
50 PROXY_METHOD2(std::string, Method2, std::string, std::string) | 50 PROXY_METHOD2(std::string, Method2, std::string, std::string) |
51 END_PROXY() | 51 END_SIGNALLING_PROXY() |
52 | 52 |
53 // Implementation of the test interface. | 53 // Implementation of the test interface. |
54 class Fake : public FakeInterface { | 54 class Fake : public FakeInterface { |
55 public: | 55 public: |
56 static rtc::scoped_refptr<Fake> Create() { | 56 static rtc::scoped_refptr<Fake> Create() { |
57 return new rtc::RefCountedObject<Fake>(); | 57 return new rtc::RefCountedObject<Fake>(); |
58 } | 58 } |
59 | 59 |
60 MOCK_METHOD0(VoidMethod0, void()); | 60 MOCK_METHOD0(VoidMethod0, void()); |
61 MOCK_METHOD0(Method0, std::string()); | 61 MOCK_METHOD0(Method0, std::string()); |
62 MOCK_CONST_METHOD0(ConstMethod0, std::string()); | 62 MOCK_CONST_METHOD0(ConstMethod0, std::string()); |
63 | 63 |
64 MOCK_METHOD1(Method1, std::string(std::string)); | 64 MOCK_METHOD1(Method1, std::string(std::string)); |
65 MOCK_CONST_METHOD1(ConstMethod1, std::string(std::string)); | 65 MOCK_CONST_METHOD1(ConstMethod1, std::string(std::string)); |
66 | 66 |
67 MOCK_METHOD2(Method2, std::string(std::string, std::string)); | 67 MOCK_METHOD2(Method2, std::string(std::string, std::string)); |
68 | 68 |
69 protected: | 69 protected: |
70 Fake() {} | 70 Fake() {} |
71 ~Fake() {} | 71 ~Fake() {} |
72 }; | 72 }; |
73 | 73 |
74 class ProxyTest: public testing::Test { | 74 class ProxyTest: public testing::Test { |
perkj_webrtc
2016/04/11 10:41:55
Add test for the worker thread and the new worker
| |
75 public: | 75 public: |
76 // Checks that the functions is called on the |signaling_thread_|. | 76 // Checks that the functions is called on the |signaling_thread_|. |
77 void CheckThread() { | 77 void CheckThread() { |
78 EXPECT_EQ(rtc::Thread::Current(), signaling_thread_.get()); | 78 EXPECT_EQ(rtc::Thread::Current(), signaling_thread_.get()); |
79 } | 79 } |
80 | 80 |
81 protected: | 81 protected: |
82 virtual void SetUp() { | 82 virtual void SetUp() { |
83 signaling_thread_.reset(new rtc::Thread()); | 83 signaling_thread_.reset(new rtc::Thread()); |
84 ASSERT_TRUE(signaling_thread_->Start()); | 84 ASSERT_TRUE(signaling_thread_->Start()); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 const std::string arg2 = "arg2"; | 144 const std::string arg2 = "arg2"; |
145 EXPECT_CALL(*fake_, Method2(arg1, arg2)) | 145 EXPECT_CALL(*fake_, Method2(arg1, arg2)) |
146 .Times(Exactly(1)) | 146 .Times(Exactly(1)) |
147 .WillOnce( | 147 .WillOnce( |
148 DoAll(InvokeWithoutArgs(this, &ProxyTest::CheckThread), | 148 DoAll(InvokeWithoutArgs(this, &ProxyTest::CheckThread), |
149 Return("Method2"))); | 149 Return("Method2"))); |
150 EXPECT_EQ("Method2", fake_proxy_->Method2(arg1, arg2)); | 150 EXPECT_EQ("Method2", fake_proxy_->Method2(arg1, arg2)); |
151 } | 151 } |
152 | 152 |
153 } // namespace webrtc | 153 } // namespace webrtc |
OLD | NEW |