Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e724745b
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e724745b
编写于
8月 26, 2021
作者:
O
openharmony_ci
提交者:
Gitee
8月 26, 2021
浏览文件
操作
浏览文件
下载
差异文件
!487 添加GetBundleSize接口测试用例
Merge pull request !487 from jiyong/master
上级
3a804021
e7203362
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
169 addition
and
0 deletion
+169
-0
appexecfwk_lite/appexecfwk_posix/src/BundleMgrTest.cpp
appexecfwk_lite/appexecfwk_posix/src/BundleMgrTest.cpp
+169
-0
未找到文件。
appexecfwk_lite/appexecfwk_posix/src/BundleMgrTest.cpp
浏览文件 @
e724745b
...
...
@@ -847,3 +847,172 @@ HWTEST_F(BundleMgrTest, testGetBundleNameForUidWithIllegal, Function | MediumTes
}
printf
(
"------end testGetBundleNameForUidWithIllegal------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_BMS_SIZE_0001
* @tc.name : Test the GetBundleSize of the thirld hap can be obtained normally
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
BundleMgrTest
,
testGetBundleSizeWithLegal_0001
,
Function
|
MediumTest
|
Level1
)
{
printf
(
"------start testGetBundleSizeWithLegal_0001------
\n
"
);
char
*
bundleName
=
(
char
*
)
"com.huawei.testjsdemo"
;
uint32_t
resultCode
=
GetBundleSize
(
bundleName
);
EXPECT_GT
(
resultCode
,
0
);
printf
(
"------end testGetBundleSizeWithLegal_0001------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_BMS_SIZE_0002
* @tc.name : Test the GetBundleSize of the system hap can be obtained normally
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
BundleMgrTest
,
testGetBundleSizeWithLegal_0002
,
Function
|
MediumTest
|
Level1
)
{
printf
(
"------start testGetBundleSizeWithLegal_0002------
\n
"
);
char
*
bundleName
=
(
char
*
)
"com.huawei.launcher"
;
uint32_t
resultCode
=
GetBundleSize
(
bundleName
);
EXPECT_GT
(
resultCode
,
0
);
printf
(
"------end testGetBundleSizeWithLegal_0002------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_BMS_SIZE_0003
* @tc.name : GetBundleSize parameter legal and bundleName length equal to 127 test
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
BundleMgrTest
,
testGetBundleSizeWithLegal_0003
,
Function
|
MediumTest
|
Level1
)
{
printf
(
"------start testGetBundleSizeWithLegal_0003------
\n
"
);
char
*
bundleName
=
(
char
*
)
"com.huawei.testjsdemoBundleNameLengt"
\
"hEqualTo127testjsdemoBundleNameLengthEqualTo127testjsdemoBundleNameLengthEqualTo127testjsde"
;
sem_init
(
&
g_sem
,
0
,
0
);
InstallParam
installParam
=
{.
installLocation
=
1
,.
keepData
=
false
};
string
hapPath
=
g_testPath
+
"testGetBundleNameWithLegal127.hap"
;
Install
(
hapPath
.
c_str
(),
&
installParam
,
TestBundleStateCallback
);
sem_wait
(
&
g_sem
);
uint32_t
resultCode
=
GetBundleSize
(
bundleName
);
EXPECT_EQ
(
strlen
(
bundleName
),
127
);
EXPECT_GT
(
resultCode
,
0
);
//uninstall
sem_init
(
&
g_sem
,
0
,
0
);
Uninstall
(
bundleName
,
&
installParam
,
TestBundleStateCallback
);
sem_wait
(
&
g_sem
);
printf
(
"------end testGetBundleSizeWithLegal_0003------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_BMS_SIZE_0004
* @tc.name : GetBundleSize parameter illegal and bundleName length equal to 128 test
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
BundleMgrTest
,
testGetBundleSizeWithIllegal_0001
,
Function
|
MediumTest
|
Level2
)
{
printf
(
"------start testGetBundleSizeWithIllegal_0001------
\n
"
);
char
*
bundleName
=
(
char
*
)
"com.huawei.testjsdemoBundleNameLength128test"
\
"jsdemoBundleNameLength128testjsdemoBundleNameLength128testjsdemoBundleNameLength128T"
;
EXPECT_EQ
(
strlen
(
bundleName
),
128
);
uint32_t
resultCode
=
GetBundleSize
(
bundleName
);
EXPECT_EQ
(
resultCode
,
0
);
printf
(
"------end testGetBundleSizeWithIllegal_0001------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_BMS_SIZE_0005
* @tc.name : GetBundleSize parameter illegal and bundleName nullptr test
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
BundleMgrTest
,
testGetBundleSizeWithIllegal_0002
,
Function
|
MediumTest
|
Level2
)
{
printf
(
"------start testGetBundleSizeWithIllegal_0002------
\n
"
);
char
*
bundleName
=
nullptr
;
//bundleName nullptr
uint32_t
resultCode
=
GetBundleSize
(
bundleName
);
EXPECT_EQ
(
resultCode
,
0
);
printf
(
"------end testGetBundleSizeWithIllegal_0002------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_BMS_SIZE_0006
* @tc.name : GetBundleSize parameter illegal and bundleName error test
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
BundleMgrTest
,
testGetBundleSizeWithIllegal_0003
,
Function
|
MediumTest
|
Level2
)
{
printf
(
"------start testGetBundleSizeWithIllegal_0003------
\n
"
);
char
*
bundleName
=
(
char
*
)
"com.huawei.nothishap"
;
//error bundleName
uint32_t
resultCode
=
GetBundleSize
(
bundleName
);
EXPECT_EQ
(
resultCode
,
0
);
printf
(
"------end testGetBundleSizeWithIllegal_0003------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_BMS_SIZE_0007
* @tc.name : GetBundleSize parameter illegal and bundleName " " test
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
BundleMgrTest
,
testGetBundleSizeWithIllegal_0004
,
Function
|
MediumTest
|
Level2
)
{
printf
(
"------start testGetBundleSizeWithIllegal_0004------
\n
"
);
char
*
bundleName
=
(
char
*
)
" "
;
//bundleName " "
uint32_t
resultCode
=
GetBundleSize
(
bundleName
);
EXPECT_EQ
(
resultCode
,
0
);
printf
(
"------end testGetBundleSizeWithIllegal_0004------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_BMS_SIZE_0008
* @tc.name : stress test of the same application
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
BundleMgrTest
,
testStressConfig_0001
,
Function
|
MediumTest
|
Level2
)
{
printf
(
"------start testStressConfig_0001------
\n
"
);
char
*
bundleName
=
(
char
*
)
"com.huawei.testjsdemo"
;
for
(
int
i
=
1
;
i
<=
100
;
i
++
){
uint32_t
resultCode
=
GetBundleSize
(
bundleName
);
EXPECT_GT
(
resultCode
,
0
);
}
printf
(
"------end testStressConfig_0001------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_BMS_SIZE_0009
* @tc.name : stress test of the difference application
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
BundleMgrTest
,
testStressConfig_0002
,
Function
|
MediumTest
|
Level2
)
{
printf
(
"------start testStressConfig_0002------
\n
"
);
char
*
bundleName
=
(
char
*
)
"com.huawei.testjsdemo"
;
char
*
bundleName2
=
(
char
*
)
"com.huawei.testjsdemoBtestjsdemoB"
;
sem_init
(
&
g_sem
,
0
,
0
);
InstallParam
installParam
=
{.
installLocation
=
1
,.
keepData
=
false
};
string
hapPath
=
g_testPath
+
"frequentlyStress2.hap"
;
Install
(
hapPath
.
c_str
(),
&
installParam
,
TestBundleStateCallback
);
sem_wait
(
&
g_sem
);
for
(
int
i
=
1
;
i
<=
100
;
i
++
){
uint32_t
resultCode
=
GetBundleSize
(
bundleName
);
EXPECT_GT
(
resultCode
,
0
);
resultCode
=
GetBundleSize
(
bundleName2
);
EXPECT_GT
(
resultCode
,
0
);
}
//uninstall
sem_init
(
&
g_sem
,
0
,
0
);
Uninstall
(
bundleName2
,
&
installParam
,
TestBundleStateCallback
);
sem_wait
(
&
g_sem
);
printf
(
"------end testStressConfig_0002------
\n
"
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录