Skip to content

Commit

Permalink
tried for class invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
parvathika committed Dec 5, 2024
1 parent 3babc9e commit 7f368ba
Showing 1 changed file with 22 additions and 28 deletions.
50 changes: 22 additions & 28 deletions Tests/unittest/test_LegacyPlugin_WiFiManagerAPIs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,38 @@ using namespace std;
using namespace WPEFramework;

using ::testing::NiceMock;
//using namespace WPEFramework::PluginHost;
using namespace WPEFramework::Plugin;

//class WiFiManager : public PluginHost::IPlugin, public PluginHost::JSONRPC

class WiFiManagerTest : public ::testing::Test {
protected:
Core::ProxyType<Plugin::WiFiManager> plugin;
Core::JSONRPC::Handler& handler;
//Core::JSONRPC::Connection connection;
Core::JSONRPC::Connection connection;
string response;
Core::JSONRPC::Message message;
//WrapsImplMock *p_wrapsImplMock = nullptr ;
//NiceMock<IarmBusImplMock> iarmBusImplMock;
//IarmBusImplMock *p_iarmBusImplMock = nullptr ;
//ServiceMock services;
};

class WifiInitializedEventTest : public WiFiManagerTest {
protected:
FactoriesImplementation factoriesImplementation;
PluginHost::IDispatcher* dispatcher;


WifiInitializedEventTest()
: WiFiManagerTest()
{
PluginHost::IFactories::Assign(&factoriesImplementation);

dispatcher = static_cast<PluginHost::IDispatcher*>(
plugin->QueryInterface(PluginHost::IDispatcher::ID));
dispatcher->Activate(&services);

NiceMock<PluginHost::IShell> mockShell;
NiceMock<PluginHost::IDispatcher> mockDispatcher;


WiFiManagerTest()
: plugin(Core::ProxyType<WiFiManager>::Create())
, handler(*(plugin))
, connection(1, 0) {
}

virtual ~WifiInitializedEventTest() override
{
dispatcher->Deactivate();
dispatcher->Release();
PluginHost::IFactories::Assign(nullptr);

virtual ~WiFiManagerTest() override {
// Cleanup if needed
}

// Helper function to simulate sending a JSON-RPC request
void sendJsonRpcRequest(const string& methodName, const JsonObject& parameters) {
message.Method(methodName);
message.Parameters(parameters);
handler.Process(connection, message);
}
};


0 comments on commit 7f368ba

Please sign in to comment.