mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-27 00:20:44 +00:00
修复UT
Signed-off-by: 师皓杰 <shihaojie10@huawei.com>
This commit is contained in:
parent
88dd538959
commit
1db0e0c7b2
@ -28,6 +28,8 @@ using namespace testing::ext;
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
const std::string TAG = "DistributedSchedUtilsTest";
|
||||
constexpr const char* PARAM_KEY_OS_TYPE = "OS_TYPE";
|
||||
constexpr const char* PARAM_KEY_OS_VERSION = "OS_VERSION";
|
||||
constexpr int32_t MAX_TEST_PATH_LEN = 1024;
|
||||
const std::string TEST_CONFIG_RELATIVE_PATH = "etc/distributedhardware/distributed_hardware_components_cfg.json";
|
||||
|
||||
@ -173,5 +175,157 @@ HWTEST_F(DistributedSchedUtilsTest, CheckBundleContinueConfig_002, TestSize.Leve
|
||||
std::string bundleName = "test_bundle_1";
|
||||
EXPECT_TRUE(CheckBundleContinueConfig(bundleName));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ParcelToBase64Str_001
|
||||
* @tc.desc: ParcelToBase64Str
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: I5WKCK
|
||||
*/
|
||||
HWTEST_F(DistributedSchedUtilsTest, ParcelToBase64Str_001, TestSize.Level1)
|
||||
{
|
||||
EXPECT_EQ(INVALID_MISSION_ID, GetCurrentMissionId());
|
||||
|
||||
Parcel parcel;
|
||||
std::string rawStr;
|
||||
EXPECT_EQ("", ParcelToBase64Str(parcel));
|
||||
|
||||
EXPECT_EQ(INVALID_PARAMETERS_ERR, Base64StrToParcel(rawStr, parcel));
|
||||
|
||||
unsigned char *toEncode = nullptr;
|
||||
unsigned int len = 0;
|
||||
EXPECT_EQ("", Base64Encode(toEncode, len));
|
||||
|
||||
len = 1;
|
||||
EXPECT_EQ("", Base64Encode(toEncode, len));
|
||||
|
||||
std::string basicString;
|
||||
EXPECT_EQ("", Base64Decode(basicString));
|
||||
|
||||
EXPECT_EQ(true, IsBase64('+'));
|
||||
EXPECT_EQ(true, IsBase64('/'));
|
||||
EXPECT_EQ(true, IsBase64('3'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: Base64Encode_001
|
||||
* @tc.desc: Base64Encode
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: I5WKCK
|
||||
*/
|
||||
HWTEST_F(DistributedSchedUtilsTest, Base64Encode_001, TestSize.Level1)
|
||||
{
|
||||
unsigned char *toEncode = nullptr;
|
||||
unsigned int len = 0;
|
||||
std::string basicString;
|
||||
|
||||
EXPECT_EQ(Base64Encode(toEncode, len), "");
|
||||
len = 1;
|
||||
EXPECT_EQ(Base64Encode(toEncode, len), "");
|
||||
|
||||
EXPECT_EQ(Base64Decode(basicString), "");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsInt32_001
|
||||
* @tc.desc: IsInt32
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: I5WKCK
|
||||
*/
|
||||
HWTEST_F(DistributedSchedUtilsTest, IsInt32_001, TestSize.Level1)
|
||||
{
|
||||
bool ret = IsInt32(nullptr);
|
||||
EXPECT_FALSE(ret);
|
||||
|
||||
cJSON *paramValue = cJSON_CreateObject();
|
||||
if (paramValue == nullptr) {
|
||||
return;
|
||||
}
|
||||
int32_t data = MAX_TEST_PATH_LEN;
|
||||
cJSON_AddNumberToObject(paramValue, "data", data);
|
||||
ret = IsInt32(paramValue);
|
||||
EXPECT_FALSE(ret);
|
||||
cJSON *dataValue = cJSON_GetObjectItem(paramValue, "data");
|
||||
ret = IsInt32(dataValue);
|
||||
EXPECT_TRUE(ret);
|
||||
if (paramValue != nullptr) {
|
||||
cJSON_Delete(paramValue);
|
||||
paramValue = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsString_001
|
||||
* @tc.desc: IsString
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: I5WKCK
|
||||
*/
|
||||
HWTEST_F(DistributedSchedUtilsTest, IsString_001, TestSize.Level1)
|
||||
{
|
||||
bool ret = IsString(nullptr);
|
||||
EXPECT_FALSE(ret);
|
||||
|
||||
cJSON *paramValue = nullptr;
|
||||
std::string str("string");
|
||||
paramValue = cJSON_Parse(str.c_str());
|
||||
if (paramValue == nullptr) {
|
||||
return;
|
||||
}
|
||||
ret = IsString(paramValue);
|
||||
EXPECT_TRUE(ret);
|
||||
if (paramValue != nullptr) {
|
||||
cJSON_Delete(paramValue);
|
||||
paramValue = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: IsString_002
|
||||
* @tc.desc: IsString
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: I5WKCK
|
||||
*/
|
||||
HWTEST_F(DistributedSchedUtilsTest, IsString_002, TestSize.Level1)
|
||||
{
|
||||
cJSON *paramValue = cJSON_CreateObject();
|
||||
if (paramValue == nullptr) {
|
||||
return;
|
||||
}
|
||||
int32_t data = MAX_TEST_PATH_LEN;
|
||||
cJSON_AddNumberToObject(paramValue, "data", data);
|
||||
bool ret = IsString(paramValue);
|
||||
EXPECT_FALSE(ret);
|
||||
if (paramValue != nullptr) {
|
||||
cJSON_Delete(paramValue);
|
||||
paramValue = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: CJsonParamCheck_001
|
||||
* @tc.desc: CJsonParamCheck
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: I5WKCK
|
||||
*/
|
||||
HWTEST_F(DistributedSchedUtilsTest, CJsonParamCheck_001, TestSize.Level1)
|
||||
{
|
||||
bool ret = CJsonParamCheck(nullptr, {PARAM_KEY_OS_TYPE, PARAM_KEY_OS_VERSION});
|
||||
EXPECT_FALSE(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: GetOsInfoFromDM_001
|
||||
* @tc.desc: GetOsInfoFromDM
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: I5WKCK
|
||||
*/
|
||||
HWTEST_F(DistributedSchedUtilsTest, GetOsInfoFromDM_001, TestSize.Level1)
|
||||
{
|
||||
std::string dmInfoEx;
|
||||
int32_t osType;
|
||||
std::string osVersion;
|
||||
bool ret = GetOsInfoFromDM(dmInfoEx, osType, osVersion);
|
||||
EXPECT_FALSE(ret);
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -37,7 +37,8 @@ void DmsSaClientTest::TearDownTestCase()
|
||||
|
||||
void DmsSaClientTest::SetUp()
|
||||
{
|
||||
dmssaClient_ = new DmsSaClient();
|
||||
dmssaClient_ = std::make_shared<DmsSaClient>();
|
||||
dmsSaStatusChange_ = std::make_shared<DmsSystemAbilityStatusChange>();
|
||||
DTEST_LOG << "DmsSaClientTest::SetUp" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,8 @@ public:
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
|
||||
sptr<DmsSaClient> dmssaClient_;
|
||||
sptr<DmsSystemAbilityStatusChange> dmsSaStatusChange_;
|
||||
std::shared_ptr<DmsSaClient> dmssaClient_;
|
||||
std::shared_ptr<DmsSystemAbilityStatusChange> dmsSaStatusChange_;
|
||||
};
|
||||
|
||||
class IDSchedEventListenerTest : public IDSchedEventListener {
|
||||
|
@ -126,6 +126,10 @@ bool DmsBmStorage::UpdatePublicRecords(const std::string &localUdid)
|
||||
Key publicKey(keyOfPublic);
|
||||
PublicRecordsInfo publicRecordsInfo;
|
||||
GetLastBundleNameId(publicRecordsInfo.maxBundleNameId);
|
||||
if (bundleNameIdTables_.empty()) {
|
||||
HILOGE("bundleNameIdTables_ is empty");
|
||||
return false;
|
||||
}
|
||||
publicRecordsInfo.maxBundleNameId =
|
||||
std::max((bundleNameIdTables_.rbegin())->first, publicRecordsInfo.maxBundleNameId);
|
||||
HILOGI("maxBundleNameId = %{public}d", publicRecordsInfo.maxBundleNameId);
|
||||
|
@ -120,11 +120,6 @@ dsched_public_deps = [
|
||||
dtbschedmgr_sources = [ "unittest/distributed_sched_test_util.cpp" ]
|
||||
|
||||
ohos_unittest("distributedschedsvrtest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
|
||||
deps = [
|
||||
@ -378,11 +373,6 @@ ohos_unittest("bundlemanagerinternaltest") {
|
||||
}
|
||||
|
||||
ohos_unittest("softbusadaptertest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
cflags = [ "-Dprivate=public" ]
|
||||
sources = [ "unittest/softbus_adapter/softbus_transport_test.cpp" ]
|
||||
@ -543,30 +533,6 @@ ohos_unittest("dschedswitchstatustest") {
|
||||
subsystem_name = "ability"
|
||||
}
|
||||
|
||||
ohos_unittest("datasharemanagertest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
|
||||
sources = [ "unittest/datashare_manager_test.cpp" ]
|
||||
|
||||
configs = [
|
||||
":test_config",
|
||||
"${dms_path}/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
]
|
||||
configs += dsched_configs
|
||||
deps = []
|
||||
if (is_standard_system) {
|
||||
external_deps = dsched_external_deps
|
||||
public_deps = dsched_public_deps
|
||||
}
|
||||
part_name = "dmsfwk"
|
||||
subsystem_name = "ability"
|
||||
}
|
||||
|
||||
ohos_unittest("dschedcontinuestatetest") {
|
||||
sanitize = {
|
||||
cfi = true
|
||||
@ -581,7 +547,7 @@ ohos_unittest("dschedcontinuestatetest") {
|
||||
"unittest/continue/dsched_continue_test.cpp",
|
||||
"unittest/mock_distributed_sched.cpp",
|
||||
]
|
||||
|
||||
sources += dtbschedmgr_sources
|
||||
configs = [
|
||||
":test_config",
|
||||
"${dms_path}/services/dtbschedmgr/test/resource:coverage_flags",
|
||||
@ -600,7 +566,6 @@ group("unittest") {
|
||||
testonly = true
|
||||
deps = [
|
||||
":bundlemanagerinternaltest",
|
||||
":datasharemanagertest",
|
||||
":distributedcalltest",
|
||||
":distributedschedsvrtest",
|
||||
":distributeduidtest",
|
||||
|
@ -12,4 +12,5 @@
|
||||
# limitations under the License.
|
||||
|
||||
[cfi]
|
||||
type:*testing::UnitTest*
|
||||
type:*testing::UnitTest*
|
||||
src:*third_party/googletest/*
|
@ -18,11 +18,13 @@
|
||||
#include "datetime_ex.h"
|
||||
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
#include "distributed_sched_test_util.h"
|
||||
#include "test_log.h"
|
||||
#include "mock_distributed_sched.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
using namespace OHOS::DistributedHardware;
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
@ -40,6 +42,9 @@ namespace {
|
||||
void DSchedContinueManagerTest::SetUpTestCase()
|
||||
{
|
||||
mkdir(BASEDIR.c_str(), (S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH));
|
||||
const std::string pkgName = "DBinderBus_PermissionTest" + std::to_string(getprocpid());
|
||||
std::shared_ptr<DmInitCallback> initCallback_ = std::make_shared<DeviceInitCallBack>();
|
||||
DeviceManager::GetInstance().InitDeviceManager(pkgName, initCallback_);
|
||||
DTEST_LOG << "DSchedContinueManagerTest::SetUpTestCase" << std::endl;
|
||||
}
|
||||
|
||||
@ -61,6 +66,10 @@ void DSchedContinueManagerTest::SetUp()
|
||||
DTEST_LOG << "DSchedContinueManagerTest::SetUp" << std::endl;
|
||||
}
|
||||
|
||||
void DSchedContinueManagerTest::DeviceInitCallBack::OnRemoteDied()
|
||||
{
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> DSchedContinueManagerTest::GetDSchedService() const
|
||||
{
|
||||
sptr<IRemoteObject> dsched(new MockDistributedSched());
|
||||
@ -139,6 +148,7 @@ HWTEST_F(DSchedContinueManagerTest, ContinueMission_002, TestSize.Level3)
|
||||
HWTEST_F(DSchedContinueManagerTest, ContinueMission_003, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedContinueManagerTest ContinueMission_003 begin" << std::endl;
|
||||
DistributedSchedUtil::MockPermission();
|
||||
OHOS::AAFwk::WantParams wantParams;
|
||||
int32_t ret = DSchedContinueManager::GetInstance().ContinueMission("", "", BUNDLE_NAME,
|
||||
CONTINUETYPE, nullptr, wantParams);
|
||||
@ -231,7 +241,7 @@ HWTEST_F(DSchedContinueManagerTest, CheckContinuationLimit_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedContinueManagerTest CheckContinuationLimit_001 begin" << std::endl;
|
||||
int32_t ret = DSchedContinueManager::GetInstance().CheckContinuationLimit(LOCAL_DEVICEID, REMOTE_DEVICEID);
|
||||
EXPECT_EQ(ret, GET_LOCAL_DEVICE_ERR);
|
||||
EXPECT_EQ(ret, OPERATION_DEVICE_NOT_INITIATOR_OR_TARGET);
|
||||
DTEST_LOG << "DSchedContinueManagerTest CheckContinuationLimit_001 end" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "device_manager.h"
|
||||
#include "dsched_continue_manager.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -31,6 +32,10 @@ public:
|
||||
void TearDown();
|
||||
std::shared_ptr<DSchedContinue> CreateObject();
|
||||
sptr<IRemoteObject> GetDSchedService() const;
|
||||
protected:
|
||||
class DeviceInitCallBack : public OHOS::DistributedHardware::DmInitCallback {
|
||||
void OnRemoteDied() override;
|
||||
};
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "datashare_manager_test.h"
|
||||
|
||||
#include "test_log.h"
|
||||
|
||||
using namespace testing;
|
||||
using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
void DataShareManagerTest::SetUpTestCase()
|
||||
{
|
||||
DTEST_LOG << "DataShareManagerTest::SetUpTestCase" << std::endl;
|
||||
}
|
||||
|
||||
void DataShareManagerTest::TearDownTestCase()
|
||||
{
|
||||
DTEST_LOG << "DataShareManagerTest::TearDownTestCase" << std::endl;
|
||||
}
|
||||
|
||||
void DataShareManagerTest::TearDown()
|
||||
{
|
||||
DTEST_LOG << "DataShareManagerTest::TearDown" << std::endl;
|
||||
}
|
||||
|
||||
void DataShareManagerTest::SetUp()
|
||||
{
|
||||
DTEST_LOG << "DataShareManagerTest::SetUp" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef DATASHARE_MANAGER_TEST_H
|
||||
#define DATASHARE_MANAGER_TEST_H
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#define private public
|
||||
#include "datashare_manager.h"
|
||||
#undef private
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedSchedule {
|
||||
class DataShareManagerTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase();
|
||||
static void TearDownTestCase();
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // DATASHARE_MANAGER_TEST_H
|
@ -68,7 +68,7 @@ void DistributedSchedStubTest::TearDown()
|
||||
void DistributedSchedStubTest::SetUp()
|
||||
{
|
||||
DTEST_LOG << "DistributedSchedStubTest::SetUp" << std::endl;
|
||||
distributedSchedStub_ = new DistributedSchedService();
|
||||
distributedSchedStub_ = std::make_shared<DistributedSchedService>();
|
||||
DistributedSchedUtil::MockProcessAndPermission(FOUNDATION_PROCESS_NAME, PERMS, 1);
|
||||
}
|
||||
|
||||
@ -194,7 +194,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityInner_002, TestSize.Level3)
|
||||
uint32_t accessToken = 0;
|
||||
data.WriteUint32(accessToken);
|
||||
result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
|
||||
EXPECT_EQ(result, DMS_PERMISSION_DENIED);
|
||||
EXPECT_EQ(result, ERR_NONE);
|
||||
DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityInner_002 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ HWTEST_F(DistributedSchedStubTest, StartAbilityFromRemoteInner_001, TestSize.Lev
|
||||
Want want;
|
||||
data.WriteParcelable(&want);
|
||||
result = distributedSchedStub_->StartAbilityFromRemoteInner(data, reply);
|
||||
EXPECT_EQ(result, ERR_NULL_OBJECT);
|
||||
EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
|
||||
|
||||
data.WriteParcelable(&want);
|
||||
AbilityInfo abilityInfo;
|
||||
@ -804,7 +804,7 @@ HWTEST_F(DistributedSchedStubTest, ConnectRemoteAbilityInner_002, TestSize.Level
|
||||
uint32_t accessToken = 0;
|
||||
data.WriteUint32(accessToken);
|
||||
result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
|
||||
EXPECT_EQ(result, DMS_PERMISSION_DENIED);
|
||||
EXPECT_EQ(result, ERR_NONE);
|
||||
DTEST_LOG << "DistributedSchedStubTest ConnectRemoteAbilityInner_002 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -879,7 +879,7 @@ HWTEST_F(DistributedSchedStubTest, DisconnectRemoteAbilityInner_002, TestSize.Le
|
||||
uint32_t accessToken = 0;
|
||||
data.WriteUint32(accessToken);
|
||||
int result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
|
||||
EXPECT_EQ(result, DMS_PERMISSION_DENIED);
|
||||
EXPECT_EQ(result, ERR_NONE);
|
||||
DTEST_LOG << "DistributedSchedStubTest DisconnectRemoteAbilityInner_002 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -927,7 +927,7 @@ HWTEST_F(DistributedSchedStubTest, ConnectAbilityFromRemoteInner_001, TestSize.L
|
||||
Want want;
|
||||
data.WriteParcelable(&want);
|
||||
result = distributedSchedStub_->ConnectAbilityFromRemoteInner(data, reply);
|
||||
EXPECT_EQ(result, ERR_NULL_OBJECT);
|
||||
EXPECT_EQ(result, INVALID_PARAMETERS_ERR);
|
||||
|
||||
data.WriteParcelable(&want);
|
||||
AbilityInfo abilityInfo;
|
||||
@ -1586,7 +1586,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteAbilityByCallInner_002, TestSize.L
|
||||
uint32_t accessToken = 0;
|
||||
data.WriteUint32(accessToken);
|
||||
result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
|
||||
EXPECT_EQ(result, DMS_PERMISSION_DENIED);
|
||||
EXPECT_EQ(result, ERR_NONE);
|
||||
DTEST_LOG << "DistributedSchedStubTest StartRemoteAbilityByCallInner_002 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -1922,7 +1922,7 @@ HWTEST_F(DistributedSchedStubTest, StartRemoteFreeInstallInner_002, TestSize.Lev
|
||||
sptr<IRemoteObject> callback(new DistributedSchedService());
|
||||
data.WriteRemoteObject(callback);
|
||||
result = distributedSchedStub_->OnRemoteRequest(code, data, reply, option);
|
||||
EXPECT_EQ(result, DMS_PERMISSION_DENIED);
|
||||
EXPECT_EQ(result, ERR_NONE);
|
||||
DTEST_LOG << "DistributedSchedStubTest StartRemoteFreeInstallInner_002 end" << std::endl;
|
||||
}
|
||||
|
||||
@ -2135,7 +2135,7 @@ HWTEST_F(DistributedSchedStubTest, StopRemoteExtensionAbilityInner_001, TestSize
|
||||
dataThird.WriteUint32(accessToken);
|
||||
dataThird.WriteInt32(serviceType);
|
||||
result = distributedSchedStub_->StopRemoteExtensionAbilityInner(dataThird, reply);
|
||||
EXPECT_EQ(result, DMS_PERMISSION_DENIED);
|
||||
EXPECT_EQ(result, ERR_NONE);
|
||||
DTEST_LOG << "DistributedSchedStubTest StopRemoteExtensionAbilityInner_001 end" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
bool isTaskDone_;
|
||||
std::mutex taskDoneLock_;
|
||||
std::condition_variable taskDoneCondition_;
|
||||
sptr<DistributedSchedStub> distributedSchedStub_;
|
||||
std::shared_ptr<DistributedSchedStub> distributedSchedStub_;
|
||||
};
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -414,6 +414,9 @@ HWTEST_F(DMSContinueManagerTest, testDealOnBroadcastBusiness001, TestSize.Level3
|
||||
uint16_t bundleNameId = 0;
|
||||
uint8_t continueTypeId = 0;
|
||||
int32_t state = 0;
|
||||
|
||||
DMSContinueRecvMgr::GetInstance().PostOnBroadcastBusiness(senderNetworkId, bundleNameId, continueTypeId, state);
|
||||
|
||||
int32_t ret = DMSContinueRecvMgr::GetInstance().DealOnBroadcastBusiness(senderNetworkId, bundleNameId,
|
||||
continueTypeId, state, DBMS_RETRY_MAX_TIME);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
@ -440,25 +443,6 @@ HWTEST_F(DMSContinueManagerTest, testDealOnBroadcastBusiness001, TestSize.Level3
|
||||
DTEST_LOG << "DMSContinueManagerTest testDealOnBroadcastBusiness001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testPostOnBroadcastBusiness001
|
||||
* @tc.desc: test PostOnBroadcastBusiness
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(DMSContinueManagerTest, testPostOnBroadcastBusiness001, TestSize.Level1)
|
||||
{
|
||||
DTEST_LOG << "DMSContinueManagerTest testPostOnBroadcastBusiness001 start" << std::endl;
|
||||
std::string senderNetworkId = "invalid senderNetworkId";
|
||||
uint16_t bundleNameId = 0;
|
||||
uint8_t continueTypeId = 0;
|
||||
int32_t state = 0;
|
||||
|
||||
DMSContinueRecvMgr::GetInstance().PostOnBroadcastBusiness(senderNetworkId, bundleNameId, continueTypeId, state);
|
||||
EXPECT_NE(DMSContinueRecvMgr::GetInstance().eventHandler_, nullptr);
|
||||
|
||||
DTEST_LOG << "DMSContinueManagerTest testPostOnBroadcastBusiness001 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: testGetBundleName001
|
||||
* @tc.desc: test GetBundleName
|
||||
@ -679,7 +663,7 @@ HWTEST_F(DMSContinueManagerTest, testSendSoftbusEvent001, TestSize.Level1)
|
||||
uint8_t continueType = 1;
|
||||
uint8_t type = 0;
|
||||
bool ret = DMSContinueSendMgr::GetInstance().SendSoftbusEvent(bundleNameId, continueType, type);
|
||||
EXPECT_EQ(ret, ERR_OK);
|
||||
EXPECT_NE(ret, CAN_NOT_FOUND_ABILITY_ERR);
|
||||
DTEST_LOG << "DMSContinueManagerTest testSendSoftbusEvent001 end" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -288,10 +288,10 @@ HWTEST_F(DSchedSoftbusSessionTest, GetPeerDeviceId_001, TestSize.Level3)
|
||||
HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest CheckUnPackBuffer_001 begin" << std::endl;
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
SessionInfo info = {0, MYDEVIDEID, PEERDEVICEID, SESSIONNAME, false};
|
||||
DSchedSoftbusSession::SessionDataHeader headerPara;
|
||||
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>(info);
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
softbusSessionTest_->isWaiting_ = false;
|
||||
int32_t ret = softbusSessionTest_->CheckUnPackBuffer(headerPara);
|
||||
EXPECT_EQ(ret, INVALID_PARAMETERS_ERR);
|
||||
@ -312,10 +312,10 @@ HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_001, TestSize.Level3)
|
||||
HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_002, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest CheckUnPackBuffer_002 begin" << std::endl;
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
SessionInfo info = {0, MYDEVIDEID, PEERDEVICEID, SESSIONNAME, false};
|
||||
DSchedSoftbusSession::SessionDataHeader headerPara = {0, 0, 0, SEQ_1, 0, SEQ_2, TOTALLEN_1};
|
||||
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>(info);
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
softbusSessionTest_->nowSeq_ = SEQ_1;
|
||||
softbusSessionTest_->nowSubSeq_ = SEQ_2;
|
||||
softbusSessionTest_->isWaiting_ = true;
|
||||
@ -339,10 +339,10 @@ HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_002, TestSize.Level3)
|
||||
HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_003, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest CheckUnPackBuffer_003 begin" << std::endl;
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
SessionInfo info = {0, MYDEVIDEID, PEERDEVICEID, SESSIONNAME, false};
|
||||
DSchedSoftbusSession::SessionDataHeader headerPara = {0, 0, 0, SEQ_1, 0, SEQ_2, TOTALLEN_1};
|
||||
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>(info);
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
softbusSessionTest_->nowSeq_ = SEQ_1;
|
||||
softbusSessionTest_->nowSubSeq_ = SEQ_1;
|
||||
softbusSessionTest_->totalLen_ = TOTALLEN_2;
|
||||
@ -362,9 +362,9 @@ HWTEST_F(DSchedSoftbusSessionTest, CheckUnPackBuffer_003, TestSize.Level3)
|
||||
HWTEST_F(DSchedSoftbusSessionTest, UnPackSendData_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest UnPackSendData_001 begin" << std::endl;
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
int32_t dataType = 0;
|
||||
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>();
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
std::shared_ptr<DSchedDataBuffer> buffer = std::make_shared<DSchedDataBuffer>(SIZE_1);
|
||||
int32_t ret = softbusSessionTest_->UnPackSendData(buffer, dataType);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
@ -380,9 +380,9 @@ HWTEST_F(DSchedSoftbusSessionTest, UnPackSendData_001, TestSize.Level3)
|
||||
HWTEST_F(DSchedSoftbusSessionTest, UnPackStartEndData_001, TestSize.Level3)
|
||||
{
|
||||
DTEST_LOG << "DSchedSoftbusSessionTest UnPackStartEndData_001 begin" << std::endl;
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
int32_t dataType = 0;
|
||||
softbusSessionTest_ = std::make_shared<DSchedSoftbusSession>();
|
||||
ASSERT_NE(softbusSessionTest_, nullptr);
|
||||
std::shared_ptr<DSchedDataBuffer> buffer = std::make_shared<DSchedDataBuffer>(SIZE_1);
|
||||
int32_t ret = softbusSessionTest_->UnPackStartEndData(buffer, dataType);
|
||||
EXPECT_NE(ret, ERR_OK);
|
||||
|
Loading…
Reference in New Issue
Block a user