Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 24 additions & 79 deletions source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityDmlTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,67 +21,12 @@
typedef void* ANSC_HANDLE;
ANSC_HANDLE bus_handle = NULL;


class CcspAdvSecurityDmlTestFixture : public ::testing::Test {
protected:
void SetUp() override {
g_syscfgMock = new SyscfgMock();
g_securewrapperMock = new SecureWrapperMock();
g_msgpackMock = new msgpackMock();
g_usertimeMock = new UserTimeMock();
g_safecLibMock = new SafecLibMock();
g_anscMemoryMock = new AnscMemoryMock();
g_baseapiMock = new BaseAPIMock();
g_traceMock = new TraceMock();
g_base64Mock = new base64Mock();
g_rbusMock = new rbusMock();
g_cmHALMock = new CmHalMock();
g_platformHALMock = new PlatformHalMock();
g_cjsonMock = new cjsonMock();
g_syseventMock = new SyseventMock();
g_webconfigFwMock = new webconfigFwMock();
g_anscWrapperApiMock = new AnscWrapperApiMock();
}

void TearDown() override {
delete g_syscfgMock;
delete g_securewrapperMock;
delete g_msgpackMock;
delete g_usertimeMock;
delete g_safecLibMock;
delete g_anscMemoryMock;
delete g_baseapiMock;
delete g_traceMock;
delete g_base64Mock;
delete g_rbusMock;
delete g_cmHALMock;
delete g_platformHALMock;
delete g_cjsonMock;
delete g_syseventMock;
delete g_webconfigFwMock;
delete g_anscWrapperApiMock;
g_syscfgMock = nullptr;
g_securewrapperMock = nullptr;
g_msgpackMock = nullptr;
g_usertimeMock = nullptr;
g_safecLibMock = nullptr;
g_anscMemoryMock = nullptr;
g_baseapiMock = nullptr;
g_traceMock = nullptr;
g_base64Mock = nullptr;
g_rbusMock = nullptr;
g_cmHALMock = nullptr;
g_platformHALMock = nullptr;
g_cjsonMock = nullptr;
g_syseventMock = nullptr;
g_webconfigFwMock = nullptr;
g_anscWrapperApiMock = nullptr;
}
class CcspAdvSecurityDmlTestFixture : public CcspAdvSecurityTestBase {
};

TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_GetParamBoolValue_Enable) {
TEST_F(CcspAdvSecurityDmlTestFixture, DeviceFingerPrint_GetParamBoolValue_Enable) {
BOOL resultBool;
PCOSA_DATAMODEL_AGENT pMyObject = new COSA_DATAMODEL_AGENT;
PCOSA_DATAMODEL_AGENT pMyObject = (PCOSA_DATAMODEL_AGENT)calloc(1, sizeof(COSA_DATAMODEL_AGENT));
pMyObject->bEnable = TRUE;
g_pAdvSecAgent = pMyObject;
Comment on lines 28 to 31

Expand All @@ -97,12 +42,12 @@ TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_GetParamBoolValue_E
EXPECT_TRUE(result);
EXPECT_TRUE(resultBool);

delete pMyObject;
free(pMyObject);
}

TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_GetParamBoolValue_Disable) {
TEST_F(CcspAdvSecurityDmlTestFixture, DeviceFingerPrint_GetParamBoolValue_Disable) {
BOOL resultBool;
PCOSA_DATAMODEL_AGENT pMyObject = new COSA_DATAMODEL_AGENT;
PCOSA_DATAMODEL_AGENT pMyObject = (PCOSA_DATAMODEL_AGENT)calloc(1, sizeof(COSA_DATAMODEL_AGENT));
pMyObject->bEnable = FALSE;
g_pAdvSecAgent = pMyObject;
Comment on lines +48 to 52

Expand All @@ -118,12 +63,12 @@ TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_GetParamBoolValue_D
EXPECT_TRUE(result);
EXPECT_FALSE(resultBool);

delete pMyObject;
free(pMyObject);
}

TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_GetParamBoolValue_UnsupportedParam) {
TEST_F(CcspAdvSecurityDmlTestFixture, DeviceFingerPrint_GetParamBoolValue_UnsupportedParam) {
BOOL resultBool;
PCOSA_DATAMODEL_AGENT pMyObject = new COSA_DATAMODEL_AGENT;
PCOSA_DATAMODEL_AGENT pMyObject = (PCOSA_DATAMODEL_AGENT)calloc(1, sizeof(COSA_DATAMODEL_AGENT));
g_pAdvSecAgent = pMyObject;

Comment on lines +69 to 73
const char* ParamName = "UnsupportedParam";
Expand All @@ -137,13 +82,13 @@ TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_GetParamBoolValue_U

EXPECT_FALSE(result);

delete pMyObject;
free(pMyObject);
}

TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_SetParamBoolValue_Enable) {
TEST_F(CcspAdvSecurityDmlTestFixture, DeviceFingerPrint_SetParamBoolValue_Enable) {

const char *DeviceFingerPrintEnabled = "Advsecurity_DeviceFingerPrint";
PCOSA_DATAMODEL_AGENT pMyObject = new COSA_DATAMODEL_AGENT;
PCOSA_DATAMODEL_AGENT pMyObject = (PCOSA_DATAMODEL_AGENT)calloc(1, sizeof(COSA_DATAMODEL_AGENT));
pMyObject->bEnable = FALSE;
g_pAdvSecAgent = pMyObject;
Comment on lines +88 to 93

Expand Down Expand Up @@ -175,12 +120,12 @@ TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_SetParamBoolValue_E
EXPECT_TRUE(result);
EXPECT_TRUE(pMyObject->bEnable);

delete pMyObject;
free(pMyObject);
}

TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_SetParamBoolValue_Disable) {
TEST_F(CcspAdvSecurityDmlTestFixture, DeviceFingerPrint_SetParamBoolValue_Disable) {
const char *DeviceFingerPrintEnabled = "Advsecurity_DeviceFingerPrint";
PCOSA_DATAMODEL_AGENT pMyObject = new COSA_DATAMODEL_AGENT;
PCOSA_DATAMODEL_AGENT pMyObject = (PCOSA_DATAMODEL_AGENT)calloc(1, sizeof(COSA_DATAMODEL_AGENT));
pMyObject->bEnable = TRUE;
g_pAdvSecAgent = pMyObject;
Comment on lines +126 to 130

Expand Down Expand Up @@ -212,12 +157,12 @@ TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_SetParamBoolValue_D
EXPECT_TRUE(result);
EXPECT_FALSE(pMyObject->bEnable);

delete pMyObject;
free(pMyObject);
}

TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_GetParamUlongValue_LoggingPeriod) {
TEST_F(CcspAdvSecurityDmlTestFixture, DeviceFingerPrint_GetParamUlongValue_LoggingPeriod) {
ULONG resultUlong;
PCOSA_DATAMODEL_AGENT pMyObject = new COSA_DATAMODEL_AGENT;
PCOSA_DATAMODEL_AGENT pMyObject = (PCOSA_DATAMODEL_AGENT)calloc(1, sizeof(COSA_DATAMODEL_AGENT));
pMyObject->ulLoggingPeriod = 100;
g_pAdvSecAgent = pMyObject;
Comment on lines +163 to 167

Expand All @@ -233,11 +178,11 @@ TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_GetParamUlongValue_
EXPECT_TRUE(result);
EXPECT_EQ(100, resultUlong);

delete pMyObject;
free(pMyObject);
}

TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_SetParamUlongValue_LoggingPeriod) {
PCOSA_DATAMODEL_AGENT pMyObject = new COSA_DATAMODEL_AGENT;
TEST_F(CcspAdvSecurityDmlTestFixture, DeviceFingerPrint_SetParamUlongValue_LoggingPeriod) {
PCOSA_DATAMODEL_AGENT pMyObject = (PCOSA_DATAMODEL_AGENT)calloc(1, sizeof(COSA_DATAMODEL_AGENT));
pMyObject->ulLoggingPeriod = 100;
g_pAdvSecAgent = pMyObject;
const char *DeviceFingerPrintLogginPeriod = "Advsecurity_LoggingPeriod";
Comment on lines +184 to 188
Expand Down Expand Up @@ -267,10 +212,10 @@ TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_SetParamUlongValue_
EXPECT_TRUE(result);
EXPECT_EQ(200, pMyObject->ulLoggingPeriod);

delete pMyObject;
free(pMyObject);
}

TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_GetParamStringValue_EndpointURL) {
TEST_F(CcspAdvSecurityDmlTestFixture, DeviceFingerPrint_GetParamStringValue_EndpointURL) {
char pValue[256] = {0};
ULONG pUlSize = 256;
ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS;
Expand Down Expand Up @@ -305,7 +250,7 @@ TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_GetParamStringValue
EXPECT_EQ(ANSC_STATUS_SUCCESS, returnStatus);
}

TEST_F(CcspAdvSecurityDmlTestFixture, CheckDeviceFingerPrint_SetParamStringValue_EndpointURL) {
TEST_F(CcspAdvSecurityDmlTestFixture, DeviceFingerPrint_SetParamStringValue_EndpointURL) {
char pString[256] = "\0";
const char *AdvSecCustomEndpointURL = "Advsecurity_CustomEndpointURL";
ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS;
Expand Down
Loading
Loading