|
18 | 18 | **/
|
19 | 19 |
|
20 | 20 | #include <gtest/gtest.h>
|
| 21 | +#include "COMLinkMock.h" |
| 22 | +#include <gmock/gmock.h> |
21 | 23 |
|
22 | 24 | #include "AVInput.h"
|
23 | 25 |
|
|
29 | 31 | #include "ServiceMock.h"
|
30 | 32 | #include "ThunderPortability.h"
|
31 | 33 |
|
| 34 | +#include "AVInputImplementation.h" |
| 35 | + |
32 | 36 | using namespace WPEFramework;
|
33 | 37 |
|
34 | 38 | using ::testing::NiceMock;
|
35 | 39 |
|
36 | 40 | class AVInputTest : public ::testing::Test {
|
37 | 41 | protected:
|
38 | 42 | Core::ProxyType<Plugin::AVInput> plugin;
|
| 43 | + Core::ProxyType<Plugin::AVInputImplementation> AVInputImpl; |
| 44 | + |
| 45 | + NiceMock<COMLinkMock> comLinkMock; |
| 46 | + |
39 | 47 | Core::JSONRPC::Handler& handler;
|
40 | 48 | DECL_CORE_JSONRPC_CONX connection;
|
41 | 49 | string response;
|
42 | 50 |
|
| 51 | + AVInputMock* p_avInputMock = nullptr; |
| 52 | + |
43 | 53 | AVInputTest()
|
44 | 54 | : plugin(Core::ProxyType<Plugin::AVInput>::Create())
|
45 | 55 | , handler(*(plugin))
|
46 | 56 | , INIT_CONX(1, 0)
|
47 | 57 | {
|
| 58 | + p_avInputMock = new NiceMock<AVInputMock>; |
| 59 | + |
| 60 | + #ifdef USE_THUNDER_R4 |
| 61 | + ON_CALL(comLinkMock, Instantiate(::testing::_, ::testing::_, ::testing::_)) |
| 62 | + .WillByDefault(::testing::Invoke( |
| 63 | + [&](const RPC::Object& object, const uint32_t waitTime, uint32_t& connectionId) { |
| 64 | + AVInputImpl = Core::ProxyType<Plugin::AVInputImplementation>::Create(); |
| 65 | + return &AVInputImpl; |
| 66 | + })); |
| 67 | + #else |
| 68 | + ON_CALL(comLinkMock, Instantiate(::testing::_, ::testing::_, ::testing::_, ::testing::_, ::testing::_)) |
| 69 | + .WillByDefault(::testing::Return(AVInputImpl)); |
| 70 | + #endif |
| 71 | + |
| 72 | + plugin->Initialize(&service); |
| 73 | + |
| 74 | + } |
| 75 | + virtual ~AVInputTest() |
| 76 | + { |
| 77 | + plugin->Deinitialize(&service); |
48 | 78 | }
|
49 |
| - virtual ~AVInputTest() = default; |
50 | 79 | };
|
51 | 80 |
|
52 | 81 | TEST_F(AVInputTest, RegisteredMethods)
|
|
0 commit comments