mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-27 00:20:44 +00:00
commit
13cc3a9399
@ -21,7 +21,9 @@
|
||||
#include "distributed_operation_builder.h"
|
||||
#undef private
|
||||
#undef protected
|
||||
#include "test_log.h"
|
||||
|
||||
using namespace OHOS;
|
||||
using namespace testing::ext;
|
||||
using namespace OHOS::DistributedSchedule;
|
||||
using OHOS::Parcel;
|
||||
@ -38,10 +40,15 @@ public:
|
||||
void TearDown();
|
||||
|
||||
std::shared_ptr<DistributedOperationBuilder> operationbuilder_ = nullptr;
|
||||
static sptr<DistributedOperation> distributedOperation_;
|
||||
};
|
||||
|
||||
sptr<DistributedOperation> DistributedOperationBaseTest::distributedOperation_;
|
||||
|
||||
void DistributedOperationBaseTest::SetUpTestCase(void)
|
||||
{}
|
||||
{
|
||||
distributedOperation_ = new DistributedOperation();
|
||||
}
|
||||
|
||||
void DistributedOperationBaseTest::TearDownTestCase(void)
|
||||
{}
|
||||
@ -340,4 +347,233 @@ HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0100
|
||||
operation_ = *(operation.get());
|
||||
|
||||
EXPECT_EQ(true, operation_ == *(operation.get()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_AddEntity_0100
|
||||
* @tc.name: AddEntity
|
||||
* @tc.desc: test AddEntity.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_AddEntity_0100, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_AddEntity_0100 begin" << std::endl;
|
||||
std::string entity = "test";
|
||||
distributedOperation_->entities_.emplace_back(entity);
|
||||
distributedOperation_->AddEntity(entity);
|
||||
distributedOperation_->entities_.clear();
|
||||
EXPECT_TRUE(distributedOperation_->entities_.empty());
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_AddEntity_0100 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_RemoveEntity_0100
|
||||
* @tc.name: RemoveEntity
|
||||
* @tc.desc: test RemoveEntity.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_RemoveEntity_0100, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_RemoveEntity_0100 begin" << std::endl;
|
||||
std::string entity = "test";
|
||||
distributedOperation_->entities_.clear();
|
||||
distributedOperation_->RemoveEntity(entity);
|
||||
distributedOperation_->entities_.clear();
|
||||
EXPECT_TRUE(distributedOperation_->entities_.empty());
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_RemoveEntity_0100 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_RemoveEntity_0200
|
||||
* @tc.name: RemoveEntity
|
||||
* @tc.desc: test RemoveEntity.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_RemoveEntity_0200, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_RemoveEntity_0200 begin" << std::endl;
|
||||
std::string entity = "test";
|
||||
distributedOperation_->entities_.emplace_back(entity);
|
||||
std::string entity1 = "test1";
|
||||
distributedOperation_->RemoveEntity(entity1);
|
||||
distributedOperation_->entities_.clear();
|
||||
EXPECT_TRUE(distributedOperation_->entities_.empty());
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_RemoveEntity_0200 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_Operator_0200
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0200, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0200 begin" << std::endl;
|
||||
DistributedOperation operation1;
|
||||
DistributedOperation operation2;
|
||||
operation1.abilityName_ = "test";
|
||||
EXPECT_FALSE(operation1 == operation2);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0200 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_Operator_0300
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0300, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0300 begin" << std::endl;
|
||||
DistributedOperation operation1;
|
||||
DistributedOperation operation2;
|
||||
operation1.action_ = "test";
|
||||
EXPECT_FALSE(operation1 == operation2);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0300 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_Operator_0400
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0400, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0400 begin" << std::endl;
|
||||
DistributedOperation operation1;
|
||||
DistributedOperation operation2;
|
||||
operation1.bundleName_ = "test";
|
||||
EXPECT_FALSE(operation1 == operation2);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0400 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_Operator_0500
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0500, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0500 begin" << std::endl;
|
||||
DistributedOperation operation1;
|
||||
DistributedOperation operation2;
|
||||
operation1.deviceId_ = "test";
|
||||
EXPECT_FALSE(operation1 == operation2);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0500 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_Operator_0600
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0600, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0600 begin" << std::endl;
|
||||
DistributedOperation operation1;
|
||||
DistributedOperation operation2;
|
||||
operation1.moduleName_ = "test";
|
||||
EXPECT_FALSE(operation1 == operation2);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0600 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_Operator_0700
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0700, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0700 begin" << std::endl;
|
||||
DistributedOperation operation1;
|
||||
DistributedOperation operation2;
|
||||
std::string entity = "test";
|
||||
operation1.entities_.emplace_back(entity);
|
||||
EXPECT_FALSE(operation1 == operation2);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0700 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_Operator_0800
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0800, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0800 begin" << std::endl;
|
||||
DistributedOperation operation1;
|
||||
DistributedOperation operation2;
|
||||
std::string entity = "test";
|
||||
operation1.entities_.emplace_back(entity);
|
||||
std::string entity1 = "test1";
|
||||
operation2.entities_.emplace_back(entity1);
|
||||
EXPECT_FALSE(operation1 == operation2);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0800 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_Operator_0900
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_0900, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0900 begin" << std::endl;
|
||||
DistributedOperation operation1;
|
||||
DistributedOperation operation2;
|
||||
operation1.flags_ = 1;
|
||||
EXPECT_FALSE(operation1 == operation2);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_0900 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_Operator_1000
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Operator_1000, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_1000 begin" << std::endl;
|
||||
DistributedOperation operation1;
|
||||
DistributedOperation operation2;
|
||||
std::string value = "test";
|
||||
OHOS::Uri uri(value);
|
||||
operation1.uri_ = uri;
|
||||
EXPECT_FALSE(operation1 == operation2);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Operator_1000 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DmsFwk_DistributedOperation_Marshalling_0200
|
||||
* @tc.name: Marshalling
|
||||
* @tc.desc: test Marshalling.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedOperationBaseTest, DmsFwk_DistributedOperation_Marshalling_0200, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Marshalling_0200 begin" << std::endl;
|
||||
std::string value = "";
|
||||
OHOS::Uri uri(value);
|
||||
std::vector<std::string> columns;
|
||||
columns.push_back("string1");
|
||||
operationbuilder_->WithUri(uri);
|
||||
operationbuilder_->WithAction(value);
|
||||
operationbuilder_->WithEntities(columns);
|
||||
operationbuilder_->WithDeviceId(value);
|
||||
operationbuilder_->WithBundleName(value);
|
||||
operationbuilder_->WithAbilityName(value);
|
||||
|
||||
std::shared_ptr<DistributedOperation> operation = operationbuilder_->build();
|
||||
Parcel in;
|
||||
bool ret = operation->Marshalling(in);
|
||||
EXPECT_TRUE(ret);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DmsFwk_DistributedOperation_Marshalling_0200 begin" << std::endl;
|
||||
}
|
@ -21,14 +21,15 @@
|
||||
#include "base_object.h"
|
||||
#include "bool_wrapper.h"
|
||||
#include "byte_wrapper.h"
|
||||
#include "distributed_want_params.h"
|
||||
#include "distributed_want_params_wrapper.h"
|
||||
#include "double_wrapper.h"
|
||||
#include "float_wrapper.h"
|
||||
#include "int_wrapper.h"
|
||||
#include "long_wrapper.h"
|
||||
#include "short_wrapper.h"
|
||||
#include "string_wrapper.h"
|
||||
#include "distributed_want_params.h"
|
||||
#include "distributed_want_params_wrapper.h"
|
||||
#include "test_log.h"
|
||||
#include "zchar_wrapper.h"
|
||||
#undef private
|
||||
#undef protected
|
||||
@ -50,10 +51,15 @@ public:
|
||||
void TearDown();
|
||||
std::shared_ptr<DistributedWantParams> wantParamsIn_ = nullptr;
|
||||
std::shared_ptr<DistributedWantParams> wantParamsOut_ = nullptr;
|
||||
static sptr<DistributedWantParams> distributedWantParams_;
|
||||
};
|
||||
|
||||
sptr<DistributedWantParams> DistributedWantParamsBaseTest::distributedWantParams_;
|
||||
|
||||
void DistributedWantParamsBaseTest::SetUpTestCase(void)
|
||||
{}
|
||||
{
|
||||
distributedWantParams_ = new DistributedWantParams();
|
||||
}
|
||||
|
||||
void DistributedWantParamsBaseTest::TearDownTestCase(void)
|
||||
{}
|
||||
@ -1003,4 +1009,169 @@ HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_ReadUnsupportedDat
|
||||
int type1 = 50;
|
||||
bool result2 = wantParams.ReadFromParcelParam(parcel, key, type1);
|
||||
EXPECT_EQ(result2, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DistributedWantParams_Operator_1000
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: Test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Operator_1000, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_Operator_1000 begin" << std::endl;
|
||||
DistributedWantParams wantParams1;
|
||||
DistributedWantParams wantParams2;
|
||||
int32_t typeId = DistributedWantParams::VALUE_TYPE_WANTPARAMS;
|
||||
DistributedWantParams ret = (wantParams1 = wantParams2);
|
||||
EXPECT_EQ(typeId, DistributedWantParams::VALUE_TYPE_WANTPARAMS);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_Operator_1000 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DistributedWantParams_Operator_2000
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: Test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Operator_2000, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_Operator_2000 begin" << std::endl;
|
||||
DistributedWantParams wantParams1;
|
||||
const DistributedWantParams wantParams2;
|
||||
int32_t typeId = DistributedWantParams::VALUE_TYPE_WANTPARAMS;
|
||||
DistributedWantParams ret = (wantParams1 = wantParams2);
|
||||
EXPECT_EQ(typeId, DistributedWantParams::VALUE_TYPE_WANTPARAMS);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_Operator_2000 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DistributedWantParams_Operator_3000
|
||||
* @tc.name: Operator
|
||||
* @tc.desc: Test Operator.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_Operator_3000, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_Operator_3000 begin" << std::endl;
|
||||
DistributedUnsupportedData data1;
|
||||
const DistributedUnsupportedData data2;
|
||||
int32_t typeId = DistributedWantParams::VALUE_TYPE_WANTPARAMS;
|
||||
DistributedUnsupportedData ret = (data1 = data2);
|
||||
EXPECT_EQ(typeId, DistributedWantParams::VALUE_TYPE_WANTPARAMS);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_Operator_3000 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DistributedWantParams_CompareInterface_1200
|
||||
* @tc.name: CompareInterface
|
||||
* @tc.desc: Test CompareInterface.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_CompareInterface_1200, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_CompareInterface_1200 begin" << std::endl;
|
||||
const std::string value = "wantParam";
|
||||
sptr<IInterface> interfaceObj =
|
||||
DistributedWantParams::GetInterfaceByType(DistributedWantParams::VALUE_TYPE_NULL, value);
|
||||
int32_t typeId = DistributedWantParams::VALUE_TYPE_NULL;
|
||||
bool result =
|
||||
DistributedWantParams::CompareInterface(interfaceObj, interfaceObj, DistributedWantParams::VALUE_TYPE_NULL);
|
||||
EXPECT_EQ(typeId, DistributedWantParams::VALUE_TYPE_NULL);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_CompareInterface_1200 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DistributedWantParams_remove_0100
|
||||
* @tc.name: remove
|
||||
* @tc.desc: Test remove.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_remove_0100, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_remove_0100 begin" << std::endl;
|
||||
distributedWantParams_->params_["hello"] = String::Box("World");
|
||||
distributedWantParams_->Remove("hello");
|
||||
distributedWantParams_->params_.clear();
|
||||
EXPECT_TRUE(distributedWantParams_->params_.empty());
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_remove_0100 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DistributedWantParams_IsEmpty_0100
|
||||
* @tc.name: IsEmpty
|
||||
* @tc.desc: Test IsEmpty.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_IsEmpty_0100, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_IsEmpty_0100 begin" << std::endl;
|
||||
distributedWantParams_->params_.clear();
|
||||
EXPECT_TRUE(distributedWantParams_->IsEmpty());
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_IsEmpty_0100 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DistributedWantParams_DoMarshalling_0100
|
||||
* @tc.name: DoMarshalling
|
||||
* @tc.desc: Test DoMarshalling.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_DoMarshalling_0100, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_DoMarshalling_0100 begin" << std::endl;
|
||||
DistributedUnsupportedData data;
|
||||
distributedWantParams_->cachedUnsupportedData_.emplace_back(std::move(data));
|
||||
Parcel tempParcel;
|
||||
bool result = wantParamsIn_->DoMarshalling(tempParcel);
|
||||
distributedWantParams_->cachedUnsupportedData_.clear();
|
||||
EXPECT_TRUE(result);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_DoMarshalling_0100 end" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @tc.number: DistributedWantParams_ReadUnsupportedData_1100
|
||||
* @tc.name: ReadUnsupportedData
|
||||
* @tc.desc: Test ReadUnsupportedData.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_ReadUnsupportedData_1100, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_ReadUnsupportedData_1100 begin" << std::endl;
|
||||
DistributedWantParams wantParams;
|
||||
Parcel parcel;
|
||||
std::string key = "this is key";
|
||||
int type = 1;
|
||||
parcel.WriteInt32(0);
|
||||
bool result = wantParams.ReadUnsupportedData(parcel, key, type);
|
||||
EXPECT_FALSE(result);
|
||||
|
||||
int bufferSize = 1;
|
||||
parcel.WriteInt32(bufferSize);
|
||||
parcel.WriteInt32(0);
|
||||
bool result2 = wantParams.ReadUnsupportedData(parcel, key, type);
|
||||
EXPECT_FALSE(result2);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_ReadUnsupportedData_1100 end" << std::endl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: DistributedWantParams_ReadFromParcelParam_1000
|
||||
* @tc.name: ReadFromParcelParam
|
||||
* @tc.desc: Test ReadFromParcelParam.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantParamsBaseTest, DistributedWantParams_ReadFromParcelParam_1000, Function | MediumTest | Level3)
|
||||
{
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_ReadFromParcelParam_1000 begin" << std::endl;
|
||||
DistributedWantParams wantParams;
|
||||
Parcel parcel;
|
||||
std::string key = "this is key";
|
||||
int type = 51;
|
||||
int bufferSize = 1;
|
||||
parcel.WriteInt32(bufferSize);
|
||||
parcel.WriteInt32(0);
|
||||
bool result = wantParams.ReadFromParcelParam(parcel, key, type);
|
||||
EXPECT_TRUE(result);
|
||||
DTEST_LOG << "DistributedWantParamsBaseTest DistributedWantParams_ReadFromParcelParam_1000 end" << std::endl;
|
||||
}
|
@ -4232,5 +4232,73 @@ HWTEST_F(DistributedWantBaseTest, ParseURI_test_001, TestSize.Level3)
|
||||
|
||||
GTEST_LOG_(INFO) << "ParseURI_test_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: GetLowerCaseScheme_test_001
|
||||
* @tc.name: GetLowerCaseScheme
|
||||
* @tc.desc: Test GetLowerCaseScheme.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantBaseTest, GetLowerCaseScheme_test_001, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "GetLowerCaseScheme_test_001 start";
|
||||
std::string strUri = "";
|
||||
Uri uri(strUri);
|
||||
Want want;
|
||||
want.GetLowerCaseScheme(uri);
|
||||
EXPECT_TRUE(strUri.empty());
|
||||
GTEST_LOG_(INFO) << "GetLowerCaseScheme_test_001 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: GetLowerCaseScheme_test_002
|
||||
* @tc.name: GetLowerCaseScheme
|
||||
* @tc.desc: Test GetLowerCaseScheme.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantBaseTest, GetLowerCaseScheme_test_002, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "GetLowerCaseScheme_test_002 start";
|
||||
std::string strUri = "#Test;action;end";
|
||||
Uri uri(strUri);
|
||||
Want want;
|
||||
want.GetLowerCaseScheme(uri);
|
||||
EXPECT_FALSE(strUri.empty());
|
||||
GTEST_LOG_(INFO) << "GetLowerCaseScheme_test_002 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: GetLowerCaseScheme_test_003
|
||||
* @tc.name: GetLowerCaseScheme
|
||||
* @tc.desc: Test GetLowerCaseScheme.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantBaseTest, GetLowerCaseScheme_test_003, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "GetLowerCaseScheme_test_003 start";
|
||||
std::string strUri = "#Test;action;end";
|
||||
Uri uri(strUri);
|
||||
uri.scheme_ = "NOT VALID";
|
||||
Want want;
|
||||
want.GetLowerCaseScheme(uri);
|
||||
EXPECT_FALSE(strUri.empty());
|
||||
GTEST_LOG_(INFO) << "GetLowerCaseScheme_test_003 end";
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.number: WantParseUri_test_001
|
||||
* @tc.name: WantParseUri
|
||||
* @tc.desc: Test WantParseUri.
|
||||
* @tc.require: I77HFZ
|
||||
*/
|
||||
HWTEST_F(DistributedWantBaseTest, WantParseUri_test_001, TestSize.Level3)
|
||||
{
|
||||
GTEST_LOG_(INFO) << "WantParseUri_test_001 start";
|
||||
char* uri = nullptr;
|
||||
DistributedWant* newWant = nullptr;
|
||||
newWant->WantParseUri(uri);
|
||||
EXPECT_EQ(uri, nullptr);
|
||||
GTEST_LOG_(INFO) << "WantParseUri_test_001 end";
|
||||
}
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
Loading…
Reference in New Issue
Block a user