mirror of
https://github.com/openharmony/device_manager.git
synced 2026-07-20 02:23:30 -04:00
@@ -16,6 +16,9 @@
|
||||
#ifndef OHOS_DM_ABILITY_MANAGER_H
|
||||
#define OHOS_DM_ABILITY_MANAGER_H
|
||||
|
||||
#include <semaphore.h>
|
||||
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "event_manager_adapt.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include "dm_constants.h"
|
||||
|
||||
using namespace OHOS::EventFwk;
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
#include "softbus_connector.h"
|
||||
|
||||
#include <securec.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
|
||||
#include "dm_anonymous.h"
|
||||
#include "dm_constants.h"
|
||||
|
||||
@@ -34,7 +34,6 @@ void AuthRequestStateTest::TearDownTestCase()
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
std::string AUTHENTICATE_TIMEOUT_TASK = "authenticateTimeoutTask";
|
||||
std::string NEGOTIATE_TIMEOUT_TASK = "negotiateTimeoutTask";
|
||||
std::string CONFIRM_TIMEOUT_TASK = "confirmTimeoutTask";
|
||||
|
||||
@@ -36,7 +36,6 @@ void AuthResponseStateTest::TearDownTestCase()
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
/**
|
||||
* @tc.name: AuthResponseInitState::SetAuthManager_001
|
||||
* @tc.desc: 1 set authManager not null
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
|
||||
IMPLEMENT_SINGLE_INSTANCE(DeviceManagerService);
|
||||
|
||||
void DeviceManagerServiceTest::SetUp()
|
||||
@@ -39,8 +38,8 @@ void DeviceManagerServiceTest::SetUpTestCase()
|
||||
void DeviceManagerServiceTest::TearDownTestCase()
|
||||
{
|
||||
}
|
||||
namespace {
|
||||
|
||||
namespace {
|
||||
std::string INPUT_TIMEOUT_TASK = "inputTimeoutTask";
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
|
||||
class DeviceManagerServiceTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
@@ -42,6 +41,4 @@ public:
|
||||
};
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#undef private
|
||||
#undef protected
|
||||
#endif
|
||||
@@ -40,8 +40,8 @@ void DeviceManagerServiceListenerTest::SetUpTestCase()
|
||||
void DeviceManagerServiceListenerTest::TearDownTestCase()
|
||||
{
|
||||
}
|
||||
namespace {
|
||||
|
||||
namespace {
|
||||
/**
|
||||
* @tc.name: OnDeviceStateChange_001
|
||||
* @tc.desc: OnDeviceStateChange, construct a dummy listener, pass in pkgName, use the constructed listener to get
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
|
||||
class DeviceManagerServiceListenerTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
|
||||
@@ -36,8 +36,7 @@ void AuthMessageProcessorTest::TearDownTestCase()
|
||||
{
|
||||
}
|
||||
|
||||
namespace{
|
||||
|
||||
namespace {
|
||||
/**
|
||||
* @tc.name: AuthMessageProcessor::CreateNegotiateMessage_001
|
||||
* @tc.desc: 1 set cryptoAdapter_ to null
|
||||
@@ -177,7 +176,7 @@ HWTEST_F(AuthMessageProcessorTest, ParseResponseFinishMessage_001, testing::ext:
|
||||
jsonObj[TAG_REPLY] = authMessageProcessor->authResponseContext_->reply;
|
||||
authMessageProcessor->SetResponseContext(authResponseContext);
|
||||
authMessageProcessor->ParseResponseFinishMessage(jsonObj);
|
||||
ASSERT_EQ(authMessageProcessor->authResponseContext_,authResponseContext);
|
||||
ASSERT_EQ(authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -247,7 +246,7 @@ HWTEST_F(AuthMessageProcessorTest, ParseAuthRequestMessage_001, testing::ext::Te
|
||||
jsonThumbnail[TAG_REQUEST_ID] = authResponseContext->requestId;
|
||||
authMessageProcessor->authSplitJsonList_.push_back(jsonThumbnail);
|
||||
int32_t ret = authMessageProcessor->ParseAuthRequestMessage();
|
||||
ASSERT_EQ(ret,DM_FAILED);
|
||||
ASSERT_EQ(ret, DM_FAILED);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -283,7 +282,7 @@ HWTEST_F(AuthMessageProcessorTest, ParseAuthRequestMessage_002, testing::ext::Te
|
||||
jsonThumbnail[TAG_REQUEST_ID] = authResponseContext->requestId;
|
||||
authMessageProcessor->authSplitJsonList_.push_back(jsonThumbnail);
|
||||
int32_t ret = authMessageProcessor->ParseAuthRequestMessage();
|
||||
ASSERT_EQ(ret,DM_OK);
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -306,7 +305,7 @@ HWTEST_F(AuthMessageProcessorTest, ParseNegotiateMessage_001, testing::ext::Test
|
||||
jsonObj[TAG_CRYPTO_SUPPORT] = authMessageProcessor->authResponseContext_->cryptoSupport;
|
||||
authMessageProcessor->SetResponseContext(authResponseContext);
|
||||
authMessageProcessor->ParseNegotiateMessage(jsonObj);
|
||||
ASSERT_EQ( authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
ASSERT_EQ(authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -329,7 +328,7 @@ HWTEST_F(AuthMessageProcessorTest, ParseNegotiateMessage_002, testing::ext::Test
|
||||
jsonObj[TAG_CRYPTO_NAME] = authResponseContext->cryptoSupport;
|
||||
authMessageProcessor->SetResponseContext(authResponseContext);
|
||||
authMessageProcessor->ParseNegotiateMessage(jsonObj);
|
||||
ASSERT_EQ( authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
ASSERT_EQ(authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -352,7 +351,7 @@ HWTEST_F(AuthMessageProcessorTest, ParseNegotiateMessage_003, testing::ext::Test
|
||||
jsonObj[TAG_CRYPTO_VERSION] = authResponseContext->cryptoSupport;
|
||||
authMessageProcessor->SetResponseContext(authResponseContext);
|
||||
authMessageProcessor->ParseNegotiateMessage(jsonObj);
|
||||
ASSERT_EQ( authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
ASSERT_EQ(authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -375,7 +374,7 @@ HWTEST_F(AuthMessageProcessorTest, ParseNegotiateMessage_004, testing::ext::Test
|
||||
jsonObj[TAG_DEVICE_ID] = authResponseContext->deviceId;
|
||||
authMessageProcessor->SetResponseContext(authResponseContext);
|
||||
authMessageProcessor->ParseNegotiateMessage(jsonObj);
|
||||
ASSERT_EQ( authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
ASSERT_EQ(authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -398,7 +397,7 @@ HWTEST_F(AuthMessageProcessorTest, ParseNegotiateMessage_005, testing::ext::Test
|
||||
jsonObj[TAG_LOCAL_DEVICE_ID] = authResponseContext->localDeviceId;
|
||||
authMessageProcessor->SetResponseContext(authResponseContext);
|
||||
authMessageProcessor->ParseNegotiateMessage(jsonObj);
|
||||
ASSERT_EQ( authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
ASSERT_EQ(authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -416,7 +415,7 @@ HWTEST_F(AuthMessageProcessorTest, SetRequestContext_001, testing::ext::TestSize
|
||||
std::shared_ptr<AuthMessageProcessor> authMessageProcessor = std::make_shared<AuthMessageProcessor>(data);
|
||||
std::shared_ptr<DmAuthRequestContext> authRequestContext = std::make_shared<DmAuthRequestContext>();
|
||||
authMessageProcessor->SetRequestContext(authRequestContext);
|
||||
ASSERT_EQ(authMessageProcessor->authRequestContext_,authRequestContext);
|
||||
ASSERT_EQ(authMessageProcessor->authRequestContext_, authRequestContext);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -434,7 +433,7 @@ HWTEST_F(AuthMessageProcessorTest, SetRequestContext_002, testing::ext::TestSize
|
||||
std::shared_ptr<AuthMessageProcessor> authMessageProcessor = std::make_shared<AuthMessageProcessor>(data);
|
||||
std::shared_ptr<DmAuthRequestContext> authRequestContext = std::make_shared<DmAuthRequestContext>();
|
||||
authMessageProcessor->SetRequestContext(nullptr);
|
||||
ASSERT_EQ(authMessageProcessor->authRequestContext_,nullptr);
|
||||
ASSERT_EQ(authMessageProcessor->authRequestContext_, nullptr);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -452,7 +451,7 @@ HWTEST_F(AuthMessageProcessorTest, SetResponseContext_001, testing::ext::TestSiz
|
||||
std::shared_ptr<AuthMessageProcessor> authMessageProcessor = std::make_shared<AuthMessageProcessor>(data);
|
||||
std::shared_ptr<DmAuthResponseContext> authResponseContext = std::make_shared<DmAuthResponseContext>();
|
||||
authMessageProcessor->SetResponseContext(authResponseContext);
|
||||
ASSERT_EQ(authMessageProcessor->authResponseContext_,authResponseContext);
|
||||
ASSERT_EQ(authMessageProcessor->authResponseContext_, authResponseContext);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -470,7 +469,7 @@ HWTEST_F(AuthMessageProcessorTest, SetResponseContext_002, testing::ext::TestSiz
|
||||
std::shared_ptr<AuthMessageProcessor> authMessageProcessor = std::make_shared<AuthMessageProcessor>(data);
|
||||
std::shared_ptr<DmAuthResponseContext> authResponseContext = std::make_shared<DmAuthResponseContext>();
|
||||
authMessageProcessor->SetResponseContext(nullptr);
|
||||
ASSERT_EQ(authMessageProcessor->authResponseContext_,nullptr);
|
||||
ASSERT_EQ(authMessageProcessor->authResponseContext_, nullptr);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -506,7 +505,7 @@ HWTEST_F(AuthMessageProcessorTest, GetResponseContext_002, testing::ext::TestSiz
|
||||
std::shared_ptr<AuthMessageProcessor> authMessageProcessor = std::make_shared<AuthMessageProcessor>(data);
|
||||
authMessageProcessor->authResponseContext_ = std::make_shared<DmAuthResponseContext>();
|
||||
std::shared_ptr<DmAuthResponseContext> authResponseContext = authMessageProcessor->GetResponseContext();
|
||||
ASSERT_NE(authResponseContext,nullptr);
|
||||
ASSERT_NE(authResponseContext, nullptr);
|
||||
sleep(15);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@ void DmAuthManagerTest::TearDownTestCase()
|
||||
{
|
||||
}
|
||||
|
||||
namespace{
|
||||
|
||||
namespace {
|
||||
std::string AUTHENTICATE_TIMEOUT_TASK = "authenticateTimeoutTask";
|
||||
std::string NEGOTIATE_TIMEOUT_TASK = "negotiateTimeoutTask";
|
||||
std::string CONFIRM_TIMEOUT_TASK = "confirmTimeoutTask";
|
||||
@@ -64,8 +63,8 @@ HWTEST_F(DmAuthManagerTest, AuthenticateDevice_001, testing::ext::TestSize.Level
|
||||
std::string extra = "333";
|
||||
authRequestState->SetAuthContext(context);
|
||||
authManager->SetAuthRequestState(authRequestState);
|
||||
int32_t ret =authManager->AuthenticateDevice(pkgName,authType,deviceId,extra);
|
||||
ASSERT_EQ(ret,DM_AUTH_BUSINESS_BUSY);
|
||||
int32_t ret = authManager->AuthenticateDevice(pkgName, authType, deviceId, extra);
|
||||
ASSERT_EQ(ret, DM_AUTH_BUSINESS_BUSY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,8 +86,8 @@ HWTEST_F(DmAuthManagerTest, AuthenticateDevice_002, testing::ext::TestSize.Level
|
||||
const std::string extra = "333";
|
||||
authResponseState->SetAuthContext(context);
|
||||
authManager->SetAuthResponseState(authResponseState);
|
||||
int32_t ret =authManager->AuthenticateDevice(pkgName,authType,deviceId,extra);
|
||||
ASSERT_EQ(ret,DM_AUTH_BUSINESS_BUSY);
|
||||
int32_t ret = authManager->AuthenticateDevice(pkgName, authType, deviceId, extra);
|
||||
ASSERT_EQ(ret, DM_AUTH_BUSINESS_BUSY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +107,7 @@ HWTEST_F(DmAuthManagerTest, AuthenticateDevice_003, testing::ext::TestSize.Level
|
||||
int32_t authType = 1;
|
||||
std::string deviceId = "222";
|
||||
std::string extra = "";
|
||||
int32_t ret =authManager->AuthenticateDevice(pkgName,authType,deviceId,extra);
|
||||
int32_t ret = authManager->AuthenticateDevice(pkgName, authType, deviceId, extra);
|
||||
ASSERT_EQ(ret, DM_INPUT_PARA_EMPTY);
|
||||
}
|
||||
|
||||
@@ -131,7 +130,7 @@ HWTEST_F(DmAuthManagerTest, AuthenticateDevice_004, testing::ext::TestSize.Level
|
||||
const std::string deviceId = "222";
|
||||
const std::string extra = "targetPkgName";
|
||||
authRequestContext->targetPkgName = "targetPkgName";
|
||||
int32_t ret =authManager->AuthenticateDevice(pkgName,authType,deviceId,extra);
|
||||
int32_t ret = authManager->AuthenticateDevice(pkgName, authType, deviceId, extra);
|
||||
ASSERT_EQ(ret, DM_INPUT_PARA_EMPTY);
|
||||
}
|
||||
|
||||
@@ -155,7 +154,7 @@ HWTEST_F(DmAuthManagerTest, AuthenticateDevice_005, testing::ext::TestSize.Level
|
||||
const std::string extra = "targetPkgName";
|
||||
authRequestContext->targetPkgName = "targetPkgName";
|
||||
json[TARGET_PKG_NAME_KEY] = authRequestContext->targetPkgName;
|
||||
int32_t ret =authManager->AuthenticateDevice(pkgName,authType,deviceId,extra);
|
||||
int32_t ret = authManager->AuthenticateDevice(pkgName, authType, deviceId, extra);
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
@@ -179,7 +178,7 @@ HWTEST_F(DmAuthManagerTest, AuthenticateDevice_006, testing::ext::TestSize.Level
|
||||
const std::string extra = "appName";
|
||||
authRequestContext->targetPkgName = "appName";
|
||||
json[APP_NAME_KEY] = authRequestContext->targetPkgName;
|
||||
int32_t ret =authManager->AuthenticateDevice(pkgName,authType,deviceId,extra);
|
||||
int32_t ret = authManager->AuthenticateDevice(pkgName, authType, deviceId, extra);
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
@@ -203,7 +202,7 @@ HWTEST_F(DmAuthManagerTest, AuthenticateDevice_007, testing::ext::TestSize.Level
|
||||
const std::string extra = "appDescription";
|
||||
authRequestContext->targetPkgName = "appDescription";
|
||||
json[APP_DESCRIPTION_KEY] = authRequestContext->targetPkgName;
|
||||
int32_t ret =authManager->AuthenticateDevice(pkgName,authType,deviceId,extra);
|
||||
int32_t ret = authManager->AuthenticateDevice(pkgName, authType, deviceId, extra);
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
@@ -227,7 +226,7 @@ HWTEST_F(DmAuthManagerTest, AuthenticateDevice_008, testing::ext::TestSize.Level
|
||||
const std::string extra = "appThumbnail";
|
||||
authRequestContext->targetPkgName = "appThumbnail";
|
||||
json[APP_THUMBNAIL] = authRequestContext->targetPkgName;
|
||||
int32_t ret =authManager->AuthenticateDevice(pkgName,authType,deviceId,extra);
|
||||
int32_t ret = authManager->AuthenticateDevice(pkgName, authType, deviceId, extra);
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
@@ -251,7 +250,7 @@ HWTEST_F(DmAuthManagerTest, AuthenticateDevice_009, testing::ext::TestSize.Level
|
||||
const std::string extra = "appIcon";
|
||||
authRequestContext->targetPkgName = "appIcon";
|
||||
json[APP_ICON_KEY] = authRequestContext->targetPkgName;
|
||||
int32_t ret = authManager->AuthenticateDevice(pkgName,authType,deviceId,extra);
|
||||
int32_t ret = authManager->AuthenticateDevice(pkgName, authType, deviceId, extra);
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
@@ -270,8 +269,8 @@ HWTEST_F(DmAuthManagerTest, UnAuthenticateDevice_001, testing::ext::TestSize.Lev
|
||||
std::shared_ptr<DmAuthRequestContext> authRequestContext = std::make_shared<DmAuthRequestContext>();
|
||||
std::string pkgName = "";
|
||||
std::string deviceId = "222";
|
||||
int32_t ret =authManager->UnAuthenticateDevice(pkgName,deviceId);
|
||||
ASSERT_EQ(ret,DM_FAILED);
|
||||
int32_t ret = authManager->UnAuthenticateDevice(pkgName, deviceId);
|
||||
ASSERT_EQ(ret, DM_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -293,13 +292,10 @@ HWTEST_F(DmAuthManagerTest, VerifyAuthentication_001, testing::ext::TestSize.Lev
|
||||
authManager->authRequestState_ = std::make_shared<AuthRequestNetworkState>();
|
||||
authManager->authResponseContext_=nullptr;
|
||||
authManager->SetAuthRequestState(authRequestState);
|
||||
int32_t ret =authManager->HandleAuthenticateTimeout();
|
||||
ASSERT_EQ(ret,DM_FAILED);
|
||||
int32_t ret = authManager->HandleAuthenticateTimeout();
|
||||
ASSERT_EQ(ret, DM_FAILED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @tc.name: DmAuthManager::HandleAuthenticateTimeout_001
|
||||
* @tc.desc: authResponseContext_= nullptr; Call handleauthenticatemeout to check whether the return value is DM_FAILED
|
||||
@@ -317,8 +313,8 @@ HWTEST_F(DmAuthManagerTest, HandleAuthenticateTimeout_001, testing::ext::TestSiz
|
||||
authManager->authRequestState_ = std::make_shared<AuthRequestNetworkState>();
|
||||
authManager->authResponseContext_=nullptr;
|
||||
authManager->SetAuthRequestState(authRequestState);
|
||||
int32_t ret =authManager->HandleAuthenticateTimeout();
|
||||
ASSERT_EQ(ret,DM_FAILED);
|
||||
int32_t ret = authManager->HandleAuthenticateTimeout();
|
||||
ASSERT_EQ(ret, DM_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,8 +333,8 @@ HWTEST_F(DmAuthManagerTest, HandleAuthenticateTimeout_002, testing::ext::TestSiz
|
||||
authManager->authRequestContext_ = std::make_shared<DmAuthRequestContext>();
|
||||
authManager->authRequestState_ = std::make_shared<AuthRequestFinishState>();
|
||||
authManager->SetAuthRequestState(authRequestState);
|
||||
int32_t ret =authManager->HandleAuthenticateTimeout();
|
||||
ASSERT_EQ(ret,DM_OK);
|
||||
int32_t ret = authManager->HandleAuthenticateTimeout();
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -358,7 +354,7 @@ HWTEST_F(DmAuthManagerTest, EstablishAuthChannel_001, testing::ext::TestSize.Lev
|
||||
authManager->authRequestContext_ = std::make_shared<DmAuthRequestContext>();
|
||||
authManager->authRequestState_ = std::make_shared<AuthRequestFinishState>();
|
||||
std::string deviceId1;
|
||||
int32_t ret =authManager->EstablishAuthChannel(deviceId1);
|
||||
int32_t ret = authManager->EstablishAuthChannel(deviceId1);
|
||||
ASSERT_EQ(ret, DM_FAILED);
|
||||
}
|
||||
|
||||
@@ -382,7 +378,7 @@ HWTEST_F(DmAuthManagerTest, SendAuthRequest_001, testing::ext::TestSize.Level0)
|
||||
authManager->authResponseContext_->cryptoSupport = true;
|
||||
authManager->SetAuthRequestState(authRequestState);
|
||||
int32_t sessionId=1;
|
||||
int32_t ret =authManager->SendAuthRequest(sessionId);
|
||||
int32_t ret = authManager->SendAuthRequest(sessionId);
|
||||
ASSERT_EQ(ret, DM_FAILED);
|
||||
}
|
||||
|
||||
@@ -403,8 +399,8 @@ HWTEST_F(DmAuthManagerTest, StartAuthProcess_001, testing::ext::TestSize.Level0)
|
||||
authManager->authResponseState_ = std::make_shared<AuthResponseConfirmState>();
|
||||
authManager->SetAuthResponseState(authResponseState);
|
||||
int32_t action = 0;
|
||||
int32_t ret =authManager->StartAuthProcess(action);
|
||||
ASSERT_EQ(ret,DM_FAILED);
|
||||
int32_t ret = authManager->StartAuthProcess(action);
|
||||
ASSERT_EQ(ret, DM_FAILED);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,8 +422,8 @@ HWTEST_F(DmAuthManagerTest, StartAuthProcess_002, testing::ext::TestSize.Level0)
|
||||
authManager->SetAuthResponseState(authResponseState);
|
||||
authManager->authResponseContext_->sessionId=111;
|
||||
int32_t action = 1;
|
||||
int32_t ret =authManager->StartAuthProcess(action);
|
||||
ASSERT_EQ(ret,DM_OK);
|
||||
int32_t ret = authManager->StartAuthProcess(action);
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -451,8 +447,8 @@ HWTEST_F(DmAuthManagerTest, CreateGroup_001, testing::ext::TestSize.Level0)
|
||||
authManager->authResponseContext_->requestId=111;
|
||||
authManager->authResponseContext_->groupName="111";
|
||||
int32_t action = 1;
|
||||
int32_t ret =authManager->StartAuthProcess(action);
|
||||
ASSERT_EQ(ret,DM_OK);
|
||||
int32_t ret = authManager->StartAuthProcess(action);
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -486,8 +482,8 @@ HWTEST_F(DmAuthManagerTest, AddMember_001, testing::ext::TestSize.Level0)
|
||||
jsonObject[TAG_DEVICE_ID] = authManager->authResponseContext_->deviceId;
|
||||
std::string deviceId = "44444";
|
||||
authManager->SetAuthResponseState(authResponseState);
|
||||
int32_t ret =authManager->AddMember(deviceId);
|
||||
ASSERT_EQ(ret,DM_OK);
|
||||
int32_t ret = authManager->AddMember(deviceId);
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
sleep(15);
|
||||
}
|
||||
|
||||
@@ -510,7 +506,7 @@ HWTEST_F(DmAuthManagerTest, JoinNetwork_001, testing::ext::TestSize.Level0)
|
||||
authManager->authRequestContext_ = std::make_shared<DmAuthRequestContext>();
|
||||
authManager->authRequestState_ = std::make_shared<AuthRequestFinishState>();
|
||||
authManager->SetAuthRequestState(authRequestState);
|
||||
int32_t ret =authManager->JoinNetwork();
|
||||
int32_t ret = authManager->JoinNetwork();
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
@@ -527,8 +523,8 @@ HWTEST_F(DmAuthManagerTest, GetIsCryptoSupport_001, testing::ext::TestSize.Level
|
||||
std::shared_ptr<DmAuthManager> authManager = std::make_shared<DmAuthManager>(softbusConnector, listener);
|
||||
authManager->authResponseState_ = std::make_shared<AuthResponseFinishState>();
|
||||
bool isCryptoSupport = false;
|
||||
int32_t ret =authManager->GetIsCryptoSupport(isCryptoSupport);
|
||||
ASSERT_EQ(ret,DM_OK);
|
||||
int32_t ret = authManager->GetIsCryptoSupport(isCryptoSupport);
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -545,7 +541,7 @@ HWTEST_F(DmAuthManagerTest, SetAuthResponseState_001, testing::ext::TestSize.Lev
|
||||
std::shared_ptr<AuthResponseState> authResponseState = std::make_shared<AuthResponseFinishState>();
|
||||
authManager->authResponseState_ = std::make_shared<AuthResponseFinishState>();
|
||||
authManager->SetAuthResponseState(authResponseState);
|
||||
int32_t ret =authManager->SetAuthResponseState(authResponseState);
|
||||
int32_t ret = authManager->SetAuthResponseState(authResponseState);
|
||||
ASSERT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
@@ -561,8 +557,8 @@ HWTEST_F(DmAuthManagerTest, GetPinCode_001, testing::ext::TestSize.Level0)
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener = std::make_shared<DeviceManagerServiceListener>();
|
||||
std::shared_ptr<DmAuthManager> authManager = std::make_shared<DmAuthManager>(softbusConnector, listener);
|
||||
authManager->authResponseContext_ = std::make_shared<DmAuthResponseContext>();;
|
||||
int32_t ret =authManager->GetPinCode();
|
||||
ASSERT_EQ(ret,authManager->authResponseContext_->code);
|
||||
int32_t ret = authManager->GetPinCode();
|
||||
ASSERT_EQ(ret, authManager->authResponseContext_->code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,6 @@ public:
|
||||
virtual void SetUp() override;
|
||||
virtual void TearDown() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,6 @@ void DeviceManagerImplTest::TearDownTestCase()
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
std::shared_ptr<SoftbusConnector> softbusConnector = std::make_shared<SoftbusConnector>();
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener_ = std::make_shared<DeviceManagerServiceListener>();
|
||||
std::shared_ptr<DmDeviceInfoManager> dmDeviceStateManager = std::make_shared<DmDeviceInfoManager>(softbusConnector);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
|
||||
class DeviceManagerImplTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
@@ -40,6 +39,4 @@ public:
|
||||
};
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#undef private
|
||||
#undef protected
|
||||
#endif
|
||||
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
#include<iostream>
|
||||
|
||||
#include "UTTest_dm_device_state_manager.h"
|
||||
#include "dm_log.h"
|
||||
#include "dm_constants.h"
|
||||
#include "dm_adapter_manager.h"
|
||||
@@ -24,10 +23,10 @@
|
||||
#include "dm_device_state_manager.h"
|
||||
#include "ipc_notify_device_found_req.h"
|
||||
#include "ipc_notify_discover_result_req.h"
|
||||
#include "UTTest_dm_device_state_manager.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
|
||||
void DmDeviceStateManagerTest::SetUp()
|
||||
{
|
||||
}
|
||||
@@ -44,7 +43,6 @@ void DmDeviceStateManagerTest::TearDownTestCase()
|
||||
{
|
||||
}
|
||||
namespace {
|
||||
|
||||
std::shared_ptr<SoftbusConnector> softbusConnector = std::make_shared<SoftbusConnector>();
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener_ = std::make_shared<DeviceManagerServiceListener>();
|
||||
std::shared_ptr<DmDeviceStateManager> dmDeviceStateManager = std::make_shared<DmDeviceStateManager>(softbusConnector, listener_);
|
||||
@@ -59,7 +57,6 @@ HWTEST_F(DmDeviceStateManagerTest, DmDeviceStateManager_001, testing::ext::TestS
|
||||
{
|
||||
std::shared_ptr<DmDeviceStateManager> p = std::make_shared<DmDeviceStateManager>(softbusConnector, listener_);
|
||||
ASSERT_NE(p, nullptr);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +74,7 @@ HWTEST_F(DmDeviceStateManagerTest, DmDeviceStateManager_002, testing::ext::TestS
|
||||
|
||||
/**
|
||||
* @tc.name: OnDeviceOnline_001
|
||||
* @tc.desc: set info.deviceId to some para,and return it
|
||||
* @tc.desc: set info.deviceId to some para, and return it
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000GHSJK
|
||||
*/
|
||||
@@ -89,13 +86,13 @@ HWTEST_F(DmDeviceStateManagerTest, OnDeviceOnline_001, testing::ext::TestSize.Le
|
||||
dmDeviceStateManager->OnDeviceOnline(pkgName, info);
|
||||
std::shared_ptr<IpcNotifyDeviceStateReq> pReq = std::static_pointer_cast<IpcNotifyDeviceStateReq > (listener_->ipcServerListener_.req_);
|
||||
DmDeviceInfo ret = pReq->GetDeviceInfo();
|
||||
int result = strcmp(info.deviceId,ret.deviceId);
|
||||
EXPECT_EQ (result ,0);
|
||||
int result = strcmp(info.deviceId, ret.deviceId);
|
||||
EXPECT_EQ(result, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnDeviceOffline_001
|
||||
* @tc.desc: set info.deviceId to some para,and return it
|
||||
* @tc.desc: set info.deviceId to some para, and return it
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000GHSJK
|
||||
*/
|
||||
@@ -103,17 +100,17 @@ HWTEST_F(DmDeviceStateManagerTest, OnDeviceOffline_001, testing::ext::TestSize.L
|
||||
{
|
||||
std::string pkgName;
|
||||
DmDeviceInfo info;
|
||||
strncpy (info.deviceId, "123", sizeof(info.deviceId));
|
||||
strncpy(info.deviceId, "123", sizeof(info.deviceId));
|
||||
dmDeviceStateManager->OnDeviceOffline(pkgName, info);
|
||||
std::shared_ptr<IpcNotifyDeviceStateReq > pReq = std::static_pointer_cast<IpcNotifyDeviceStateReq >(listener_->ipcServerListener_.req_);
|
||||
DmDeviceInfo ret = pReq->GetDeviceInfo();
|
||||
int result = strcmp(info.deviceId,ret.deviceId);
|
||||
EXPECT_EQ (result ,0);
|
||||
int result = strcmp(info.deviceId, ret.deviceId);
|
||||
EXPECT_EQ(result, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnDeviceChanged_001
|
||||
* @tc.desc: set info.deviceId to some para,and return it
|
||||
* @tc.desc: set info.deviceId to some para, and return it
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000GHSJK
|
||||
*/
|
||||
@@ -125,13 +122,13 @@ HWTEST_F(DmDeviceStateManagerTest, OnDeviceChanged_001, testing::ext::TestSize.L
|
||||
dmDeviceStateManager->OnDeviceChanged(pkgName, info);
|
||||
std::shared_ptr<IpcNotifyDeviceStateReq> pReq = std::static_pointer_cast<IpcNotifyDeviceStateReq >(listener_->ipcServerListener_.req_);
|
||||
DmDeviceInfo ret = pReq->GetDeviceInfo();
|
||||
int result = strcmp(info.deviceId,ret.deviceId);
|
||||
EXPECT_EQ (result ,0);
|
||||
int result = strcmp(info.deviceId, ret.deviceId);
|
||||
EXPECT_EQ(result, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: OnDeviceReady_001
|
||||
* @tc.desc: set info.deviceId to some para,and return it
|
||||
* @tc.desc: set info.deviceId to some para, and return it
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000GHSJK
|
||||
*/
|
||||
@@ -144,8 +141,8 @@ HWTEST_F(DmDeviceStateManagerTest, OnProfileReady_001, testing::ext::TestSize.Le
|
||||
dmDeviceStateManager->OnProfileReady(pkgName, deviceId);
|
||||
std::shared_ptr<IpcNotifyDeviceStateReq> pReq = std::static_pointer_cast<IpcNotifyDeviceStateReq >(listener_->ipcServerListener_.req_);
|
||||
DmDeviceInfo ret = pReq->GetDeviceInfo();
|
||||
int result = strcmp(info.deviceId,ret.deviceId);
|
||||
ASSERT_GE(result,0);
|
||||
int result = strcmp(info.deviceId, ret.deviceId);
|
||||
ASSERT_GE(result, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -159,11 +156,11 @@ HWTEST_F(DmDeviceStateManagerTest, OnDeviceReady_001, testing::ext::TestSize.Lev
|
||||
std::string pkgName;
|
||||
DmDeviceInfo info ;
|
||||
strncpy (info.deviceId, "123", sizeof(info.deviceId));
|
||||
dmDeviceStateManager->OnDeviceReady(pkgName,info);
|
||||
dmDeviceStateManager->OnDeviceReady(pkgName, info);
|
||||
std::shared_ptr<IpcNotifyDeviceStateReq> pReq = std::static_pointer_cast<IpcNotifyDeviceStateReq >(listener_->ipcServerListener_.req_);
|
||||
DmDeviceInfo ret = pReq->GetDeviceInfo();
|
||||
int result = strcmp(info.deviceId,ret.deviceId);
|
||||
ASSERT_GE(result,0);
|
||||
int result = strcmp(info.deviceId, ret.deviceId);
|
||||
ASSERT_GE(result, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -176,12 +173,12 @@ HWTEST_F(DmDeviceStateManagerTest, OnDeviceChanged_002, testing::ext::TestSize.L
|
||||
{
|
||||
std::string pkgName;
|
||||
DmDeviceInfo info ;
|
||||
strncpy (info.deviceId, "123", sizeof(info.deviceId));
|
||||
strncpy(info.deviceId, "123", sizeof(info.deviceId));
|
||||
dmDeviceStateManager->OnDeviceChanged(pkgName, info);
|
||||
std::shared_ptr<IpcNotifyDeviceStateReq> pReq = std::static_pointer_cast<IpcNotifyDeviceStateReq >(listener_->ipcServerListener_.req_);
|
||||
DmDeviceInfo ret = pReq->GetDeviceInfo();
|
||||
int result = strcmp(info.deviceId,ret.deviceId);
|
||||
ASSERT_GE(result,0);
|
||||
int result = strcmp(info.deviceId, ret.deviceId);
|
||||
ASSERT_GE(result, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -193,7 +190,7 @@ HWTEST_F(DmDeviceStateManagerTest, OnDeviceChanged_002, testing::ext::TestSize.L
|
||||
HWTEST_F(DmDeviceStateManagerTest, RegisterSoftbusStateCallback_001, testing::ext::TestSize.Level0)
|
||||
{
|
||||
int ret = dmDeviceStateManager->RegisterSoftbusStateCallback();
|
||||
EXPECT_EQ (ret,DM_OK);
|
||||
EXPECT_EQ(ret, DM_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,13 +24,9 @@
|
||||
#include "softbus_session_callback.h"
|
||||
#include "dm_discovery_manager.h"
|
||||
|
||||
namespace OHOS
|
||||
{
|
||||
namespace DistributedHardware
|
||||
{
|
||||
|
||||
class DmDeviceStateManagerTest : public testing::Test
|
||||
{
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
class DmDeviceStateManagerTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
@@ -39,6 +35,4 @@ public:
|
||||
};
|
||||
}
|
||||
}
|
||||
#undef private
|
||||
#undef protected
|
||||
#endif
|
||||
@@ -22,12 +22,11 @@
|
||||
#include "dm_anonymous.h"
|
||||
#include "ipc_server_listener.h"
|
||||
#include "device_manager_service_listener.h"
|
||||
#include "UTTest_dm_discovery_manager.h"
|
||||
#include "discovery_service.h"
|
||||
#include "UTTest_dm_discovery_manager.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
|
||||
void DmDiscoveryManagerTest::SetUp() {
|
||||
}
|
||||
|
||||
@@ -40,8 +39,7 @@ void DmDiscoveryManagerTest::SetUpTestCase() {
|
||||
void DmDiscoveryManagerTest::TearDownTestCase() {
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
namespace {
|
||||
std::shared_ptr<SoftbusConnector> softbusConnector_ = std::make_shared<SoftbusConnector>();
|
||||
std::shared_ptr<DeviceManagerServiceListener> listener_ = std::make_shared<DeviceManagerServiceListener>();
|
||||
std::shared_ptr<DmDiscoveryManager> discoveryMgr_ = std::make_shared<DmDiscoveryManager>(softbusConnector_, listener_);
|
||||
@@ -72,7 +70,8 @@ HWTEST_F(DmDiscoveryManagerTest, DmDiscoveryManager_002, testing::ext::TestSize.
|
||||
|
||||
/**
|
||||
* @tc.name:StartDeviceDiscovery_001
|
||||
* @tc.desc: keeping pkgame unchanged, call StartDeviceDiscovery twice so that its discoveryQueue is not empty and return DM_DISCOVERY_REPEATED
|
||||
* @tc.desc: keeping pkgame unchanged, call StartDeviceDiscovery twice
|
||||
* so that its discoveryQueue is not empty and return DM_DISCOVERY_REPEATED
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000GHSJK
|
||||
*/
|
||||
@@ -88,7 +87,8 @@ HWTEST_F(DmDiscoveryManagerTest, StartDeviceDiscovery_001, testing::ext::TestSiz
|
||||
|
||||
/**
|
||||
* @tc.name:StartDeviceDiscovery_002
|
||||
* @tc.desc: pkgame changed, call StartDeviceDiscovery twice so that its discoveryQueue is not empty and return DM_DISCOVERY_REPEATED
|
||||
* @tc.desc: pkgame changed, call StartDeviceDiscovery twice
|
||||
* so that its discoveryQueue is not empty and return DM_DISCOVERY_REPEATED
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000GHSJK
|
||||
*/
|
||||
@@ -109,7 +109,7 @@ HWTEST_F(DmDiscoveryManagerTest, StartDeviceDiscovery_002, testing::ext::TestSiz
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: AR000GHSJK
|
||||
*/
|
||||
//doing
|
||||
// doing
|
||||
HWTEST_F(DmDiscoveryManagerTest, StopDeviceDiscovery_001, testing::ext::TestSize.Level0)
|
||||
{
|
||||
std::string pkgName = "com.ohos.helloworld";
|
||||
@@ -131,18 +131,18 @@ HWTEST_F(DmDiscoveryManagerTest, OnDeviceFound_001, testing::ext::TestSize.Level
|
||||
{
|
||||
std::string pkgName = "com.ohos.helloworld";
|
||||
uint16_t aaa = 11;
|
||||
DmDiscoveryContext context{pkgName, "121110", aaa};
|
||||
DmDiscoveryContext context{ pkgName, "121110", aaa };
|
||||
discoveryMgr_->discoveryContextMap_[pkgName] = context;
|
||||
sleep(1);
|
||||
DmDeviceInfo info;
|
||||
info.deviceId[0] = '\0';
|
||||
info.deviceName[0] = '\0';
|
||||
info.deviceName[0] = '\0';
|
||||
discoveryMgr_->OnDeviceFound(pkgName, info);
|
||||
std::shared_ptr<IpcNotifyDeviceFoundReq> pReq = std::static_pointer_cast<IpcNotifyDeviceFoundReq>(listener_->ipcServerListener_.req_);
|
||||
int ret1 = discoveryMgr_->discoveryContextMap_.count(pkgName);
|
||||
EXPECT_EQ (ret1, 1);
|
||||
EXPECT_EQ(ret1, 1);
|
||||
std ::string ret = pReq->GetPkgName();
|
||||
EXPECT_EQ (ret,pkgName);
|
||||
EXPECT_EQ(ret, pkgName);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -248,5 +248,3 @@ HWTEST_F(DmDiscoveryManagerTest, HandleDiscoveryTimeout_001, testing::ext::TestS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
#ifndef OHOS_UTTEST_DM_DISCOVERY_MANAGER_H
|
||||
#define OHOS_UTTEST_DM_DISCOVERY_MANAGER_H
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <refbase.h>
|
||||
#include <queue>
|
||||
@@ -26,10 +27,8 @@
|
||||
#include "ipc_notify_discover_result_req.h"
|
||||
|
||||
#define private public
|
||||
namespace OHOS
|
||||
{
|
||||
namespace DistributedHardware
|
||||
{
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
class DmDiscoveryManagerTest : public testing::Test
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -23,13 +23,11 @@
|
||||
#include "dm_log.h"
|
||||
#include "dm_constants.h"
|
||||
#include "dm_random.h"
|
||||
#include "UTTest_hichain_connector.h"
|
||||
#include "hichain_connector.h"
|
||||
#include "UTTest_hichain_connector.h"
|
||||
|
||||
namespace OHOS
|
||||
{
|
||||
namespace DistributedHardware
|
||||
{
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
void HichainConnectorTest::SetUp()
|
||||
{
|
||||
}
|
||||
@@ -264,7 +262,7 @@ HWTEST_F(HichainConnectorTest, RegisterHiChainCallback_001, testing::ext::TestSi
|
||||
std::shared_ptr<DmAuthManager> discoveryMgr_ = std::make_shared<DmAuthManager>(softbusConnector, listener_);
|
||||
std::shared_ptr<HiChainConnector> hichainConnector = std::make_shared<HiChainConnector>();
|
||||
int ret = hichainConnector->RegisterHiChainCallback(pkgName, std::shared_ptr<IHiChainConnectorCallback>(discoveryMgr_));
|
||||
int ret1 = HiChainConnector:: hiChainConnectorCallbackMap_.count(pkgName);
|
||||
int ret1 = HiChainConnector::hiChainConnectorCallbackMap_.count(pkgName);
|
||||
EXPECT_EQ(ret1, 1);
|
||||
EXPECT_EQ(ret, DM_OK);
|
||||
}
|
||||
@@ -283,7 +281,7 @@ HWTEST_F(HichainConnectorTest, IsGroupCreated_001, testing::ext::TestSize.Level0
|
||||
std::vector<GroupInfo> groupList ;
|
||||
GroupInfo groupInfo;
|
||||
std::shared_ptr<HiChainConnector> hichainConnector = std::make_shared<HiChainConnector>();
|
||||
bool ret = hichainConnector->IsGroupCreated( groupName, groupInfo);
|
||||
bool ret = hichainConnector->IsGroupCreated(groupName, groupInfo);
|
||||
EXPECT_EQ(ret, false);
|
||||
}
|
||||
|
||||
@@ -386,7 +384,7 @@ HWTEST_F(HichainConnectorTest, GetConnectPara_002, testing::ext::TestSize.Level0
|
||||
std::shared_ptr<HiChainConnector> hichainConnector = std::make_shared<HiChainConnector>();
|
||||
hichainConnector->RegisterHiChainCallback(pkgName, std::shared_ptr<IHiChainConnectorCallback>(discoveryMgr_));
|
||||
std::string ret = hichainConnector->GetConnectPara(deviceId, reqDeviceId);
|
||||
EXPECT_EQ(ret,"");
|
||||
EXPECT_EQ(ret, "");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -400,7 +398,7 @@ HWTEST_F(HichainConnectorTest, DeleteGroup_001, testing::ext::TestSize.Level0)
|
||||
std::string groupId = "34567";
|
||||
std::shared_ptr<HiChainConnector> hichainConnector = std::make_shared<HiChainConnector>();
|
||||
int ret = hichainConnector->DeleteGroup(groupId);
|
||||
EXPECT_EQ(ret,DM_OK);
|
||||
EXPECT_EQ(ret, DM_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,14 +30,11 @@
|
||||
#include "device_manager_service_listener.h"
|
||||
#include "dm_auth_manager.h"
|
||||
#include "dm_device_state_manager.h"
|
||||
#include "hichain_connector.h"
|
||||
#include "hichain_connector.h"
|
||||
|
||||
namespace OHOS
|
||||
{
|
||||
namespace DistributedHardware
|
||||
{
|
||||
class HichainConnectorTest : public testing::Test
|
||||
{
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
class HichainConnectorTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
@@ -46,6 +43,6 @@ public:
|
||||
};
|
||||
}
|
||||
}
|
||||
#undef private
|
||||
#undef protected
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_HICHAIN_CONNECTOR_H
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
#ifndef OHOS_UTTest_DM_SOFTBUS_CONNECTOR_H
|
||||
#define OHOS_UTTest_DM_SOFTBUS_CONNECTOR_H
|
||||
|
||||
#define private public // hack complier
|
||||
#define protected public
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <refbase.h>
|
||||
|
||||
@@ -38,9 +35,9 @@
|
||||
#include "softbus_discovery_callback.h"
|
||||
#include "softbus_session.h"
|
||||
#include "softbus_state_callback.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
|
||||
class SoftbusConnectorTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
@@ -50,6 +47,4 @@ public:
|
||||
};
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#undef private
|
||||
#undef protected
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,6 @@ void SoftbusSessionTest::TearDownTestCase()
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
std::shared_ptr<SoftbusSession> softbusSession = std::make_shared<SoftbusSession>();
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
|
||||
class SoftbusSessionTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
@@ -44,6 +43,4 @@ public:
|
||||
};
|
||||
} // namespace DistributedHardware
|
||||
} // namespace OHOS
|
||||
#undef private
|
||||
#undef protected
|
||||
#endif
|
||||
Reference in New Issue
Block a user