Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
954db676
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看板
未验证
提交
954db676
编写于
2月 24, 2022
作者:
O
openharmony_ci
提交者:
Gitee
2月 24, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1989 设备包管理和元能力的xts修改
Merge pull request !1989 from 闻飞/master
上级
70adb131
901fb702
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
224 addition
and
160 deletion
+224
-160
OAT.xml
OAT.xml
+1
-0
aafwk_lite/ability_hal/src/ability_mgr_test.c
aafwk_lite/ability_hal/src/ability_mgr_test.c
+115
-56
appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
+108
-104
未找到文件。
OAT.xml
浏览文件 @
954db676
...
@@ -64,6 +64,7 @@ Note:If the text contains special characters, please escape them according to th
...
@@ -64,6 +64,7 @@ Note:If the text contains special characters, please escape them according to th
<filteritem
type=
"filename"
name=
"*.jpg"
desc=
"all jpg file have check "
/>
<filteritem
type=
"filename"
name=
"*.jpg"
desc=
"all jpg file have check "
/>
<filteritem
type=
"filename"
name=
"*.gif"
desc=
"all gif file have check "
/>
<filteritem
type=
"filename"
name=
"*.gif"
desc=
"all gif file have check "
/>
<filteritem
type=
"filename"
name=
"*.png"
desc=
"all png file have check "
/>
<filteritem
type=
"filename"
name=
"*.png"
desc=
"all png file have check "
/>
<filteritem
type=
"filename"
name=
"*.bin"
desc=
"all bin file have check"
/>
</filefilter>
</filefilter>
</filefilterlist>
</filefilterlist>
</oatconfig>
</oatconfig>
...
...
aafwk_lite/ability_hal/src/ability_mgr_test.c
浏览文件 @
954db676
...
@@ -15,14 +15,18 @@
...
@@ -15,14 +15,18 @@
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "hctest.h"
#include "hctest.h"
#include "ohos_types.h"
#include "ohos_types.h"
#include "ability_manager.h"
#include "ability_manager.h"
#include "ability_errors.h"
#include "want.h"
#include "want.h"
static
int32_t
g_errorCode
=
-
1
;
#define DATA_EXTERN (2 * 3)
/**
/**
* @brief register a test suit named AbilityMgrTestSuite
* @brief register a test suit named AbilityMgrTestSuite
...
@@ -46,50 +50,66 @@ static BOOL AbilityMgrTestSuiteTearDown(void)
...
@@ -46,50 +50,66 @@ static BOOL AbilityMgrTestSuiteTearDown(void)
/**
/**
* @tc.number : SUB_AAFWK_ABILITY_0001
* @tc.number : SUB_AAFWK_ABILITY_0001
* @tc.name : testClearElement
parameter legal test
* @tc.name : testClearElement
Legal
* @tc.desc :
[C- SOFTWARE -0200]
* @tc.desc :
testClearElement parameter legal test
*/
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testClearElement
,
Function
|
MediumTest
|
Level0
)
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testClearElement
Legal
,
Function
|
MediumTest
|
Level0
)
{
{
printf
(
"------start testClearElement------
\n
"
);
printf
(
"------start testClearElement
Legal
------
\n
"
);
ElementName
element
=
{
0
};
ElementName
element
=
{
0
};
SetElementDeviceID
(
&
element
,
"0001000"
);
SetElementBundleName
(
&
element
,
"com.openharmony.testnative"
);
bool
ret
=
SetElementAbilityName
(
&
element
,
"SecondAbility"
);
bool
ret
=
SetElementAbilityName
(
&
element
,
"SecondAbility"
);
if
(
ret
)
{
if
(
ret
)
{
char
aName
[]
=
"SecondAbility"
;
char
aName
[]
=
"SecondAbility"
;
char
bName
[]
=
"com.openharmony.testnative"
;
char
dID
[]
=
"0001000"
;
TEST_ASSERT_EQUAL_STRING
(
element
.
abilityName
,
aName
);
TEST_ASSERT_EQUAL_STRING
(
element
.
abilityName
,
aName
);
TEST_ASSERT_EQUAL_STRING
(
element
.
bundleName
,
bName
);
TEST_ASSERT_EQUAL_STRING
(
element
.
deviceId
,
dID
);
ClearElement
(
&
element
);
ClearElement
(
&
element
);
TEST_ASSERT_EQUAL_STRING
(
element
.
abilityName
,
NULL
);
TEST_ASSERT_EQUAL_STRING
(
element
.
abilityName
,
NULL
);
TEST_ASSERT_EQUAL_STRING
(
element
.
bundleName
,
NULL
);
TEST_ASSERT_EQUAL_STRING
(
element
.
deviceId
,
NULL
);
}
}
printf
(
"------end testClearElement------
\n
"
);
printf
(
"------end testClearElement
Legal
------
\n
"
);
}
}
/**
/**
* @tc.number : SUB_AAFWK_ABILITY_0002
* @tc.number : SUB_AAFWK_ABILITY_0002
* @tc.name : testClearElement
parameter illegal test
* @tc.name : testClearElement
Illegal
* @tc.desc :
[C- SOFTWARE -0200]
* @tc.desc :
testClearElement parameter illegal test
*/
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testClearElementIllegal
,
Function
|
MediumTest
|
Level0
)
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testClearElementIllegal
,
Function
|
MediumTest
|
Level0
)
{
{
printf
(
"------start testClearElementIllegal------
\n
"
);
printf
(
"------start testClearElementIllegal------
\n
"
);
ElementName
element
=
{
0
};
ElementName
element
=
{
0
};
SetElementDeviceID
(
&
element
,
"0001000"
);
SetElementBundleName
(
&
element
,
"com.openharmony.testnative"
);
bool
ret
=
SetElementAbilityName
(
&
element
,
"SecondAbility"
);
bool
ret
=
SetElementAbilityName
(
&
element
,
"SecondAbility"
);
if
(
ret
)
{
if
(
ret
)
{
char
aName
[]
=
"SecondAbility"
;
char
aName
[]
=
"SecondAbility"
;
char
bName
[]
=
"com.openharmony.testnative"
;
char
dID
[]
=
"0001000"
;
TEST_ASSERT_EQUAL_STRING
(
element
.
abilityName
,
aName
);
TEST_ASSERT_EQUAL_STRING
(
element
.
abilityName
,
aName
);
TEST_ASSERT_EQUAL_STRING
(
element
.
bundleName
,
bName
);
TEST_ASSERT_EQUAL_STRING
(
element
.
deviceId
,
dID
);
ClearElement
(
NULL
);
ClearElement
(
NULL
);
TEST_ASSERT_EQUAL_STRING
(
element
.
abilityName
,
aName
);
TEST_ASSERT_EQUAL_STRING
(
element
.
abilityName
,
aName
);
TEST_ASSERT_EQUAL_STRING
(
element
.
bundleName
,
bName
);
TEST_ASSERT_EQUAL_STRING
(
element
.
deviceId
,
dID
);
}
}
printf
(
"------end testClearElementIllegal------
\n
"
);
printf
(
"------end testClearElementIllegal------
\n
"
);
}
}
/**
/**
* @tc.number : SUB_AAFWK_ABILITY_0003
* @tc.number : SUB_AAFWK_ABILITY_0003
* @tc.name : testSetWantElement
parameter legal test
* @tc.name : testSetWantElement
Legal
* @tc.desc :
[C- SOFTWARE -0200]
* @tc.desc :
testSetWantElement parameter legal test
*/
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetWantElement
,
Function
|
MediumTest
|
Level0
)
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetWantElement
Legal
,
Function
|
MediumTest
|
Level0
)
{
{
printf
(
"------start testSetWantElement------
\n
"
);
printf
(
"------start testSetWantElement
Legal
------
\n
"
);
Want
want
=
{
0
};
Want
want
=
{
0
};
ElementName
element
=
{
0
};
ElementName
element
=
{
0
};
SetElementDeviceID
(
&
element
,
"0001000"
);
SetElementDeviceID
(
&
element
,
"0001000"
);
...
@@ -105,18 +125,19 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantElement, Function | MediumTest |
...
@@ -105,18 +125,19 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantElement, Function | MediumTest |
}
}
ClearElement
(
&
element
);
ClearElement
(
&
element
);
ClearWant
(
&
want
);
ClearWant
(
&
want
);
printf
(
"------end testSetWantElement------
\n
"
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
,
NULL
);
printf
(
"------end testSetWantElementLegal------
\n
"
);
}
}
/**
/**
* @tc.number : SUB_AAFWK_ABILITY_0004
* @tc.number : SUB_AAFWK_ABILITY_0004
* @tc.name : testSetWantElement
parameter illegal test
* @tc.name : testSetWantElement
Illegal
* @tc.desc :
[C- SOFTWARE -0200]
* @tc.desc :
testSetWantElement parameter illegal test
*/
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetWantElementIllegal
,
Function
|
MediumTest
|
Level2
)
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetWantElementIllegal
,
Function
|
MediumTest
|
Level2
)
{
{
printf
(
"------start testSetWantElementIllegal------
\n
"
);
printf
(
"------start testSetWantElementIllegal------
\n
"
);
Want
want
=
{
0
};
Want
want
=
{
0
};
ElementName
element
=
{
0
};
ElementName
element
=
{
0
};
bool
ret
=
SetWantElement
(
&
want
,
element
);
bool
ret
=
SetWantElement
(
&
want
,
element
);
if
(
ret
)
{
if
(
ret
)
{
...
@@ -133,22 +154,27 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantElementIllegal, Function | Medium
...
@@ -133,22 +154,27 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantElementIllegal, Function | Medium
/**
/**
* @tc.number : SUB_AAFWK_ABILITY_0005
* @tc.number : SUB_AAFWK_ABILITY_0005
* @tc.name : testClearWant
parameter illegal test
* @tc.name : testClearWant
Illegal
* @tc.desc :
[C- SOFTWARE -0200]
* @tc.desc :
testClearWant parameter illegal test
*/
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testClearWantIllegal
,
Function
|
MediumTest
|
Level2
)
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testClearWantIllegal
,
Function
|
MediumTest
|
Level2
)
{
{
printf
(
"------start testClearWantIllegal------
\n
"
);
printf
(
"------start testClearWantIllegal------
\n
"
);
Want
want
=
{
0
};
Want
want
=
{
0
};
ElementName
element
=
{
0
};
ElementName
element
=
{
0
};
SetElementDeviceID
(
&
element
,
"0001000"
);
SetElementBundleName
(
&
element
,
"com.openharmony.testnative"
);
bool
ret
=
SetElementAbilityName
(
&
element
,
"SecondAbility"
);
bool
ret
=
SetElementAbilityName
(
&
element
,
"SecondAbility"
);
if
(
ret
)
{
if
(
ret
)
{
ret
=
SetWantElement
(
&
want
,
element
);
ret
=
SetWantElement
(
&
want
,
element
);
if
(
ret
)
{
if
(
ret
)
{
char
aName
[]
=
"SecondAbility"
;
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
deviceId
,
"0001000"
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
abilityName
,
aName
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
abilityName
,
"SecondAbility"
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
bundleName
,
"com.openharmony.testnative"
);
ClearWant
(
NULL
);
ClearWant
(
NULL
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
abilityName
,
aName
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
deviceId
,
"0001000"
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
abilityName
,
"SecondAbility"
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
bundleName
,
"com.openharmony.testnative"
);
}
}
}
}
ClearElement
(
&
element
);
ClearElement
(
&
element
);
...
@@ -158,26 +184,29 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testClearWantIllegal, Function | MediumTest
...
@@ -158,26 +184,29 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testClearWantIllegal, Function | MediumTest
/**
/**
* @tc.number : SUB_AAFWK_ABILITY_0006
* @tc.number : SUB_AAFWK_ABILITY_0006
* @tc.name : testSetWantDate
parameter legal test
* @tc.name : testSetWantDate
Legal
* @tc.desc :
[C- SOFTWARE -0200]
* @tc.desc :
testSetWantDate parameter legal test
*/
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetWantDate
,
Function
|
MediumTest
|
Level0
)
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetWantDate
Legal
,
Function
|
MediumTest
|
Level0
)
{
{
printf
(
"------start testSetWantDate------
\n
"
);
printf
(
"------start testSetWantDate
Legal
------
\n
"
);
Want
want
=
{
0
};
Want
want
=
{
0
};
SetWantData
(
&
want
,
"test"
,
5
);
char
*
data
=
"test"
;
SetWantData
(
&
want
,
(
void
*
)
data
,
strlen
(
data
)
+
1
);
if
(
want
.
data
!=
NULL
)
{
if
(
want
.
data
!=
NULL
)
{
TEST_ASSERT_EQUAL_STRING
((
char
*
)(
want
.
data
),
"test"
);
TEST_ASSERT_EQUAL_STRING
((
char
*
)(
want
.
data
),
data
);
TEST_ASSERT_TRUE
(
want
.
dataLength
==
5
);
TEST_ASSERT_TRUE
(
want
.
dataLength
==
strlen
(
data
)
+
1
);
}
}
ClearWant
(
&
want
);
ClearWant
(
&
want
);
printf
(
"------end testSetWantDate------
\n
"
);
TEST_ASSERT_EQUAL_STRING
(
want
.
data
,
NULL
);
TEST_ASSERT_TRUE
(
want
.
dataLength
==
strlen
(
data
)
+
1
);
printf
(
"------end testSetWantDateLegal------
\n
"
);
}
}
/**
/**
* @tc.number : SUB_AAFWK_ABILITY_0007
* @tc.number : SUB_AAFWK_ABILITY_0007
* @tc.name : testSetWantDate
parameter illegal test
* @tc.name : testSetWantDate
Illegal
* @tc.desc :
[C- SOFTWARE -0200]
* @tc.desc :
testSetWantDate parameter illegal test
*/
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetWantDateIllegal
,
Function
|
MediumTest
|
Level2
)
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetWantDateIllegal
,
Function
|
MediumTest
|
Level2
)
{
{
...
@@ -194,47 +223,77 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantDateIllegal, Function | MediumTes
...
@@ -194,47 +223,77 @@ LITE_TEST_CASE(AbilityMgrTestSuite, testSetWantDateIllegal, Function | MediumTes
/**
/**
* @tc.number : SUB_AAFWK_ABILITY_0008
* @tc.number : SUB_AAFWK_ABILITY_0008
* @tc.name : testStartAbility
parameter illegal test
* @tc.name : testStartAbility
Illegal
* @tc.desc :
[C- SOFTWARE -0200]
* @tc.desc :
testStartAbility parameter illegal test
*/
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testStartAbilityIllegal
,
Function
|
MediumTest
|
Level
2
)
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testStartAbilityIllegal
,
Function
|
MediumTest
|
Level
0
)
{
{
printf
(
"------start testStartAbilityIllegal------
\n
"
);
printf
(
"------start testStartAbilityIllegal------
\n
"
);
int
result
=
StartAbility
(
NULL
);
int
ret
=
StartAbility
(
NULL
);
printf
(
"ret is %d
\n
"
,
result
);
TEST_ASSERT_TRUE
(
ret
==
PARAM_CHECK_ERROR
);
int
expect
=
8
;
TEST_ASSERT_TRUE
(
result
==
expect
);
printf
(
"------end testStartAbilityIllegal------
\n
"
);
printf
(
"------end testStartAbilityIllegal------
\n
"
);
}
}
/**
/**
* @tc.number : SUB_AAFWK_ABILITY_00
08
* @tc.number : SUB_AAFWK_ABILITY_00
10
* @tc.name : testSetIntParam
parameter illegal test
* @tc.name : testSetIntParam
Illegal
* @tc.desc :
[C- SOFTWARE -0200]
* @tc.desc :
testSetIntParam parameter illegal test
*/
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetIntParamIllegal
,
Function
|
MediumTest
|
Level
2
)
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetIntParamIllegal
,
Function
|
MediumTest
|
Level
0
)
{
{
printf
(
"------start testSetIntParamIllegal------
\n
"
);
printf
(
"------start testSetIntParamIllegal------
\n
"
);
int
result
=
SetIntParam
(
NULL
,
NULL
,
0
,
0
);
bool
ret
=
SetIntParam
(
NULL
,
NULL
,
0
,
0
);
printf
(
"ret is %d
\n
"
,
result
);
TEST_ASSERT_FALSE
(
ret
);
int
expect
=
0
;
TEST_ASSERT_TRUE
(
result
==
expect
);
printf
(
"------end testSetIntParamIllegal------
\n
"
);
printf
(
"------end testSetIntParamIllegal------
\n
"
);
}
}
/**
/**
* @tc.number : SUB_AAFWK_ABILITY_0009
* @tc.number : SUB_AAFWK_ABILITY_0011
* @tc.name : testSetStrParam parameter illegal test
* @tc.name : testSetIntParamLegal
* @tc.desc : [C- SOFTWARE -0200]
* @tc.desc : testSetIntParam parameter legal test
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetIntParamLegal
,
Function
|
MediumTest
|
Level0
)
{
printf
(
"------start testSetIntParamLegal------
\n
"
);
Want
want
=
{
0
};
int32_t
value
=
1
;
char
*
key
=
"key"
;
bool
ret
=
SetIntParam
(
&
want
,
key
,
strlen
(
key
),
value
);
TEST_ASSERT_TRUE
(
ret
);
TEST_ASSERT_TRUE
(
want
.
dataLength
==
(
strlen
(
key
)
+
sizeof
(
int
)
+
DATA_EXTERN
));
TEST_ASSERT_TRUE
(
want
.
data
!=
NULL
);
printf
(
"------end testSetIntParamLegal------
\n
"
);
}
/**
* @tc.number : SUB_AAFWK_ABILITY_0012
* @tc.name : testSetStrParamIllegal
* @tc.desc : testSetStrParam parameter illegal test
*/
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetStrParamIllegal
,
Function
|
MediumTest
|
Level
2
)
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetStrParamIllegal
,
Function
|
MediumTest
|
Level
0
)
{
{
printf
(
"------start testSetStrParamIllegal------
\n
"
);
printf
(
"------start testSetStrParamIllegal------
\n
"
);
int
result
=
SetStrParam
(
NULL
,
NULL
,
0
,
NULL
,
0
);
bool
ret
=
SetStrParam
(
NULL
,
NULL
,
0
,
NULL
,
0
);
printf
(
"ret is %d
\n
"
,
result
);
TEST_ASSERT_FALSE
(
ret
);
int
expect
=
0
;
TEST_ASSERT_TRUE
(
result
==
expect
);
printf
(
"------end testSetStrParamIllegal------
\n
"
);
printf
(
"------end testSetStrParamIllegal------
\n
"
);
}
}
RUN_TEST_SUITE
(
AbilityMgrTestSuite
);
/**
* @tc.number : SUB_AAFWK_ABILITY_0013
* @tc.name : testSetStrParamLegal
* @tc.desc : testSetStrParam parameter legal test
*/
LITE_TEST_CASE
(
AbilityMgrTestSuite
,
testSetStrParamLegal
,
Function
|
MediumTest
|
Level2
)
{
printf
(
"------start testSetStrParamLegal------
\n
"
);
Want
want
=
{
0
};
char
*
key
=
"key"
;
char
*
value
=
"value"
;
bool
ret
=
SetStrParam
(
&
want
,
key
,
strlen
(
key
),
value
,
strlen
(
value
));
TEST_ASSERT_TRUE
(
ret
);
TEST_ASSERT_TRUE
(
want
.
dataLength
==
(
strlen
(
value
)
+
strlen
(
key
)
+
DATA_EXTERN
));
TEST_ASSERT_TRUE
(
want
.
data
!=
NULL
);
printf
(
"------end testSetStrParamLegal------
\n
"
);
}
RUN_TEST_SUITE
(
AbilityMgrTestSuite
);
\ No newline at end of file
appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
浏览文件 @
954db676
...
@@ -44,8 +44,25 @@ static BOOL BundleMgrTestSuiteTearDown(void)
...
@@ -44,8 +44,25 @@ static BOOL BundleMgrTestSuiteTearDown(void)
/**
/**
* @tc.number : SUB_APPEXECFWK_0001
* @tc.number : SUB_APPEXECFWK_0001
* @tc.name : testClearAbilityInfo parameter illegal test
* @tc.name : testClearAbilityInfoLegal
* @tc.desc : [C- SOFTWARE -0200]
* @tc.desc : testClearAbilityInfo parameter legal test with bundle name
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testClearAbilityInfoLegal
,
Function
|
MediumTest
|
Level2
)
{
printf
(
"------start testClearAbilityInfo------
\n
"
);
AbilityInfo
abilityInfo
;
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
abilityInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
ClearAbilityInfo
(
&
abilityInfo
);
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
NULL
);
printf
(
"------end testClearAbilityInfo------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_0002
* @tc.name : testClearAbilityInfoIllegal
* @tc.desc : testClearAbilityInfo parameter illegal test
*/
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testClearAbilityInfoIllegal
,
Function
|
MediumTest
|
Level2
)
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testClearAbilityInfoIllegal
,
Function
|
MediumTest
|
Level2
)
{
{
...
@@ -59,14 +76,31 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoIllegal, Function | Mediu
...
@@ -59,14 +76,31 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoIllegal, Function | Mediu
}
}
/**
/**
* @tc.number : SUB_APPEXECFWK_0002
* @tc.number : SUB_APPEXECFWK_0003
* @tc.name : testClearBundleInfo parameter legal test with bundle name
* @tc.name : testClearBundleInfoLegal
* @tc.desc : [C- SOFTWARE -0200]
* @tc.desc : testClearBundleInfo parameter legal test with bundle name
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testClearBundleInfoLegal
,
Function
|
MediumTest
|
Level2
)
{
printf
(
"------start testClearBundleInfo------
\n
"
);
BundleInfo
bundleInfo
=
{
0
};
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
bundleInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
ClearBundleInfo
(
&
bundleInfo
);
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
NULL
);
printf
(
"------end testClearBundleInfo------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_0004
* @tc.name : testClearBundleInfoIllegal
* @tc.desc : testClearBundleInfo parameter illegal test
*/
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testClearBundleInfoIllegal
,
Function
|
MediumTest
|
Level2
)
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testClearBundleInfoIllegal
,
Function
|
MediumTest
|
Level2
)
{
{
printf
(
"------start testClearBundleInfoIllegal------
\n
"
);
printf
(
"------start testClearBundleInfoIllegal------
\n
"
);
BundleInfo
bundleInfo
=
{
0
}
;
BundleInfo
bundleInfo
;
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
bundleInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
bundleInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
ClearBundleInfo
(
NULL
);
ClearBundleInfo
(
NULL
);
...
@@ -75,11 +109,44 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoIllegal, Function | Medium
...
@@ -75,11 +109,44 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoIllegal, Function | Medium
}
}
/**
/**
* @tc.number : SUB_APPEXECFWK_000
3
* @tc.number : SUB_APPEXECFWK_000
5
* @tc.name : test
SetElementAbilityName parameter legal test
* @tc.name : test
ClearModuleInfoLegal
* @tc.desc :
[C- SOFTWARE -0100]
* @tc.desc :
ClearAbilityInfo parameter legal test with module info
*/
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementAbilityName
,
Function
|
MediumTest
|
Level0
)
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testClearModuleInfoLegal
,
Function
|
MediumTest
|
Level1
)
{
printf
(
"------start testClearModuleInfo------
\n
"
);
ModuleInfo
moduleInfo
=
{
0
};
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
moduleInfo
.
moduleName
=
"test"
;
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
"test"
);
ClearModuleInfo
(
&
moduleInfo
);
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
NULL
);
printf
(
"------end testClearModuleInfo------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_0006
* @tc.name : testClearModuleInfoIllegal
* @tc.desc : ClearAbilityInfo parameter illegal test
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testClearModuleInfoIllegal
,
Function
|
MediumTest
|
Level1
)
{
printf
(
"------start testClearModuleInfoIllegal------
\n
"
);
ModuleInfo
moduleInfo
=
{
0
};
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
moduleInfo
.
moduleName
=
"test"
;
ClearModuleInfo
(
NULL
);
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
"test"
);
printf
(
"------end testClearModuleInfoIllegal------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_0007
* @tc.name : testSetElementAbilityNameLegal
* @tc.desc : testSetElementAbilityName parameter legal test
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementAbilityNameLegal
,
Function
|
MediumTest
|
Level0
)
{
{
printf
(
"------start testSetElementAbilityName------
\n
"
);
printf
(
"------start testSetElementAbilityName------
\n
"
);
Want
want
=
{
0
};
Want
want
=
{
0
};
...
@@ -94,9 +161,9 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementAbilityName, Function | MediumT
...
@@ -94,9 +161,9 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementAbilityName, Function | MediumT
}
}
/**
/**
* @tc.number : SUB_APPEXECFWK_000
4
* @tc.number : SUB_APPEXECFWK_000
8
* @tc.name : testSetElementAbilityName
parameter illegal test
* @tc.name : testSetElementAbilityName
Illegal
* @tc.desc :
[C- SOFTWARE -0100]
* @tc.desc :
testSetElementAbilityName parameter illegal test
*/
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementAbilityNameIllegal
,
Function
|
MediumTest
|
Level2
)
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementAbilityNameIllegal
,
Function
|
MediumTest
|
Level2
)
{
{
...
@@ -110,17 +177,19 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementAbilityNameIllegal, Function |
...
@@ -110,17 +177,19 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementAbilityNameIllegal, Function |
SetElementAbilityName
(
&
element
,
NULL
);
SetElementAbilityName
(
&
element
,
NULL
);
SetWantElement
(
&
want
,
element
);
SetWantElement
(
&
want
,
element
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
abilityName
,
NULL
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
abilityName
,
NULL
);
int
ret
=
SetElementAbilityName
(
NULL
,
aName
);
TEST_ASSERT_FALSE
(
ret
);
ClearElement
(
&
element
);
ClearElement
(
&
element
);
ClearWant
(
&
want
);
ClearWant
(
&
want
);
printf
(
"------end testSetElementAbilityNameIllegal------
\n
"
);
printf
(
"------end testSetElementAbilityNameIllegal------
\n
"
);
}
}
/**
/**
* @tc.number : SUB_APPEXECFWK_000
5
* @tc.number : SUB_APPEXECFWK_000
9
* @tc.name : testSetElementBundleName
parameter legal test
* @tc.name : testSetElementBundleName
Legal
* @tc.desc :
[C- SOFTWARE -0100]
* @tc.desc :
testSetElementBundleName parameter legal test
*/
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementBundleName
,
Function
|
MediumTest
|
Level0
)
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementBundleName
Legal
,
Function
|
MediumTest
|
Level0
)
{
{
printf
(
"------start testSetElementBundleName------
\n
"
);
printf
(
"------start testSetElementBundleName------
\n
"
);
Want
want
=
{
0
};
Want
want
=
{
0
};
...
@@ -135,9 +204,9 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementBundleName, Function | MediumTe
...
@@ -135,9 +204,9 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementBundleName, Function | MediumTe
}
}
/**
/**
* @tc.number : SUB_APPEXECFWK_00
06
* @tc.number : SUB_APPEXECFWK_00
10
* @tc.name : testSetElementBundleName
parameter illegal test
* @tc.name : testSetElementBundleName
Illegal
* @tc.desc :
[C- SOFTWARE -0100]
* @tc.desc :
testSetElementBundleName parameter illegal test
*/
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementBundleNameIllegal
,
Function
|
MediumTest
|
Level2
)
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementBundleNameIllegal
,
Function
|
MediumTest
|
Level2
)
{
{
...
@@ -151,16 +220,18 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementBundleNameIllegal, Function | M
...
@@ -151,16 +220,18 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementBundleNameIllegal, Function | M
SetElementBundleName
(
&
element
,
NULL
);
SetElementBundleName
(
&
element
,
NULL
);
SetWantElement
(
&
want
,
element
);
SetWantElement
(
&
want
,
element
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
bundleName
,
NULL
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
bundleName
,
NULL
);
bool
ret
=
SetElementBundleName
(
NULL
,
bName
);
TEST_ASSERT_FALSE
(
ret
);
ClearElement
(
&
element
);
ClearElement
(
&
element
);
ClearWant
(
&
want
);
ClearWant
(
&
want
);
printf
(
"------end testSetElementBundleNameIllegal------
\n
"
);
printf
(
"------end testSetElementBundleNameIllegal------
\n
"
);
}
}
/**
/**
* @tc.number : SUB_APPEXECFWK_00
07
* @tc.number : SUB_APPEXECFWK_00
11
* @tc.name : testSetElementDeviceID
parameter legal test
* @tc.name : testSetElementDeviceID
Legal
* @tc.desc :
[C- SOFTWARE -0100]
* @tc.desc :
testSetElementDeviceID parameter legal test
*/
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementDeviceID
,
Function
|
MediumTest
|
Level0
)
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementDeviceID
Legal
,
Function
|
MediumTest
|
Level0
)
{
{
printf
(
"------start testSetElementDeviceID------
\n
"
);
printf
(
"------start testSetElementDeviceID------
\n
"
);
Want
want
=
{
0
};
Want
want
=
{
0
};
...
@@ -175,9 +246,9 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementDeviceID, Function | MediumTest
...
@@ -175,9 +246,9 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementDeviceID, Function | MediumTest
}
}
/**
/**
* @tc.number : SUB_APPEXECFWK_00
08
* @tc.number : SUB_APPEXECFWK_00
12
* @tc.name : testSetElementDeviceID
parameter illegal test
* @tc.name : testSetElementDeviceID
Illegal
* @tc.desc :
[C- SOFTWARE -0100]
* @tc.desc :
testSetElementDeviceID parameter illegal test
*/
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementDeviceIDIllegal
,
Function
|
MediumTest
|
Level2
)
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testSetElementDeviceIDIllegal
,
Function
|
MediumTest
|
Level2
)
{
{
...
@@ -191,60 +262,17 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementDeviceIDIllegal, Function | Med
...
@@ -191,60 +262,17 @@ LITE_TEST_CASE(BundleMgrTestSuite, testSetElementDeviceIDIllegal, Function | Med
SetElementDeviceID
(
&
element
,
NULL
);
SetElementDeviceID
(
&
element
,
NULL
);
SetWantElement
(
&
want
,
element
);
SetWantElement
(
&
want
,
element
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
deviceId
,
NULL
);
TEST_ASSERT_EQUAL_STRING
(
want
.
element
->
deviceId
,
NULL
);
int
ret
=
SetElementDeviceID
(
NULL
,
"0001000"
);
TEST_ASSERT_FALSE
(
ret
);
ClearElement
(
&
element
);
ClearElement
(
&
element
);
ClearWant
(
&
want
);
ClearWant
(
&
want
);
printf
(
"------end testSetElementDeviceIDIllegal------
\n
"
);
printf
(
"------end testSetElementDeviceIDIllegal------
\n
"
);
}
}
/**
/**
* @tc.number : SUB_APPEXECFWK_0009
* @tc.number : SUB_APPEXECFWK_0013
* @tc.name : ClearAbilityInfo parameter legal test with module info
* @tc.name : testGetBundleInfoIllegal
* @tc.desc : [C- SOFTWARE -0200]
* @tc.desc : GetBundleInfo parameter illegal test
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testClearModuleInfoIllegal
,
Function
|
MediumTest
|
Level1
)
{
printf
(
"------start testClearModuleInfoIllegal------
\n
"
);
ModuleInfo
moduleInfo
=
{
0
};
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
moduleInfo
.
moduleName
=
"test"
;
ClearModuleInfo
(
NULL
);
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
"test"
);
printf
(
"------end testClearModuleInfoIllegal------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_0010
* @tc.name : GetBundleInfo parameter legal test.
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testGetBundleInfoRight
,
Function
|
MediumTest
|
Level1
)
{
printf
(
"------start testGetBundleInfoRight------
\n
"
);
BundleInfo
bundleInfo
;
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
const
char
*
bundleName
=
"com.openharmony.testjsdemo"
;
int32_t
flags
=
0
;
printf
(
"bundleName is %s
\n
"
,
bundleName
);
sleep
(
2
);
uint8_t
ret
=
GetBundleInfo
(
bundleName
,
flags
,
&
bundleInfo
);
printf
(
"getBundleInfo ret is %d
\n
"
,
ret
);
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
NULL
);
TEST_ASSERT_TRUE
(
ret
==
2
);
flags
=
1
;
printf
(
"bundleName is %s
\n
"
,
bundleName
);
ret
=
GetBundleInfo
(
bundleName
,
flags
,
&
bundleInfo
);
sleep
(
2
);
printf
(
"getBundleInfo ret is %d
\n
"
,
ret
);
TEST_ASSERT_TRUE
(
ret
==
2
);
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
NULL
);
ClearBundleInfo
(
&
bundleInfo
);
printf
(
"------end testGetBundleInfoRight------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_0011
* @tc.name : GetBundleInfo parameter illegal test.
* @tc.desc : [C- SOFTWARE -0200]
*/
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testGetBundleInfoIllegal
,
Function
|
MediumTest
|
Level2
)
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testGetBundleInfoIllegal
,
Function
|
MediumTest
|
Level2
)
{
{
...
@@ -262,38 +290,14 @@ LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfoIllegal, Function | MediumTe
...
@@ -262,38 +290,14 @@ LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfoIllegal, Function | MediumTe
TEST_ASSERT_TRUE
(
ret
==
2
);
TEST_ASSERT_TRUE
(
ret
==
2
);
ret
=
GetBundleInfo
(
"com.openharmony.testjsdemo"
,
2
,
&
bundleInfo
);
ret
=
GetBundleInfo
(
"com.openharmony.testjsdemo"
,
2
,
&
bundleInfo
);
sleep
(
2
);
sleep
(
2
);
TEST_ASSERT_TRUE
(
ret
!=
1
);
printf
(
"------end testGetBundleInfoIllegal------
\n
"
);
}
/**
* @tc.number : SUB_APPEXECFWK_0012
* @tc.name : GetBundleInfos parameter legal test
* @tc.desc : [C- SOFTWARE -0200]
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testGetBundleInfosRight
,
Function
|
MediumTest
|
Level1
)
{
printf
(
"------start testGetBundleInfosRight------
\n
"
);
BundleInfo
*
bundleInfos
=
NULL
;
int32_t
flags
=
0
;
int32_t
length
=
0
;
uint8_t
ret
=
GetBundleInfos
(
flags
,
&
bundleInfos
,
&
length
);
sleep
(
2
);
printf
(
"getBundleInfo ret is %d
\n
"
,
ret
);
TEST_ASSERT_TRUE
(
ret
==
2
);
flags
=
1
;
ret
=
GetBundleInfos
(
flags
,
&
bundleInfos
,
&
length
);
printf
(
"getBundleInfo ret is %d
\n
"
,
ret
);
sleep
(
2
);
TEST_ASSERT_TRUE
(
ret
==
2
);
TEST_ASSERT_TRUE
(
ret
==
2
);
free
(
bundleInfos
);
printf
(
"------end testGetBundleInfoIllegal------
\n
"
);
printf
(
"------end testGetBundleInfosRight------
\n
"
);
}
}
/**
/**
* @tc.number : SUB_APPEXECFWK_001
3
* @tc.number : SUB_APPEXECFWK_001
4
* @tc.name :
GetBundleInfos parameter illegal test
* @tc.name :
testGetBundleInfosIllegal
* @tc.desc :
[C- SOFTWARE -0200]
* @tc.desc :
GetBundleInfos parameter illegal test
*/
*/
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testGetBundleInfosIllegal
,
Function
|
MediumTest
|
Level2
)
LITE_TEST_CASE
(
BundleMgrTestSuite
,
testGetBundleInfosIllegal
,
Function
|
MediumTest
|
Level2
)
{
{
...
@@ -302,7 +306,7 @@ LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfosIllegal, Function | MediumT
...
@@ -302,7 +306,7 @@ LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfosIllegal, Function | MediumT
int32_t
*
length
=
NULL
;
int32_t
*
length
=
NULL
;
int32_t
flags
=
0
;
int32_t
flags
=
0
;
uint8_t
ret
=
GetBundleInfos
(
flags
,
NULL
,
length
);
uint8_t
ret
=
GetBundleInfos
(
flags
,
NULL
,
length
);
TEST_ASSERT_TRUE
(
ret
!=
2
);
TEST_ASSERT_TRUE
(
ret
==
1
);
ret
=
GetBundleInfos
(
flags
,
&
bundleInfos
,
NULL
);
ret
=
GetBundleInfos
(
flags
,
&
bundleInfos
,
NULL
);
printf
(
"ret is %d
\n
"
,
ret
);
printf
(
"ret is %d
\n
"
,
ret
);
TEST_ASSERT_TRUE
(
ret
==
2
);
TEST_ASSERT_TRUE
(
ret
==
2
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录