Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuhammedrafi committed Dec 3, 2024
1 parent 5a24b0e commit f35f6ba
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions Tests/unit_test/test_Legacy_WifiManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include <gtest/gtest.h>
#include <fstream>
#include "WifiManager.h"

#include "ServiceMock.h"
#include "IarmBusMock.h"
#include "WrapsMock.h"
#include "FactoriesImplementation.h"
#include "WifiManagerDefines.h"

using namespace WPEFramework;

using ::testing::NiceMock;

class WifiManagerTest : public ::testing::Test {
protected:
Core::ProxyType<Plugin::WifiManager> plugin;
Core::JSONRPC::Handler& handler;
Core::JSONRPC::Connection connection;
Core::JSONRPC::Message message;
ServiceMock services;

WifiManagerTest()
: plugin(Core::ProxyType<Plugin::WifiManager>::Create())
, handler(*(plugin))
, connection(1, 0){}
virtual ~WifiManagerTest() override{}
};

TEST_F(WifiManagerTest, TestedAPIsShouldExist)
{
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("startScan")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("stopScan")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("setEnabled")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("connect")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("disconnect")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("cancelWPSPairing")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("saveSSID")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("clearSSID")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("setSignalThresholdChangeEnabled")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("getPairedSSID")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("getPairedSSIDInfo")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("isPaired")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("getCurrentState")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("getConnectedSSID")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("getQuirks")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("isSignalThresholdChangeEnabled")));
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("getSupportedSecurityModes")));
}
1 change: 1 addition & 0 deletions Tests/unit_test/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ target_include_directories(${UNIT_TEST} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
install(TARGETS ${UNIT_TEST} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)

add_executable(${GMOCK_UNIT_TEST}
Tests/unit_test/test_Legacy_WifiManager.cpp
Tests/mocks/Iarm.cpp
Tests/mocks/thunder/Module.cpp
Tests/mocks/Wraps.cpp
Expand Down

0 comments on commit f35f6ba

Please sign in to comment.