Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
7d9ad525
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看板
未验证
提交
7d9ad525
编写于
3月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2642 api补齐,增加memset_s校验
Merge pull request !2642 from ry/master
上级
7bb301fe
a28e4221
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
434 addition
and
1761 deletion
+434
-1761
appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js
...emanagertest/entry/src/main/js/test/ExampleJsunit.test.js
+10
-9
appexecfwk/zlib/actszipfileandunzipfiletest/entry/src/main/js/test/actszipfileandunzipfiletest.test.js
...ntry/src/main/js/test/actszipfileandunzipfiletest.test.js
+385
-1731
appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
+17
-10
appexecfwk_lite/appexecfwk_posix/src/BundleMgrTest.cpp
appexecfwk_lite/appexecfwk_posix/src/BundleMgrTest.cpp
+22
-11
未找到文件。
appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js
浏览文件 @
7d9ad525
...
@@ -2126,14 +2126,13 @@ describe('ActsBundleManagerTest', function () {
...
@@ -2126,14 +2126,13 @@ describe('ActsBundleManagerTest', function () {
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
err
.
code
).
assertEqual
(
0
);
expect
(
data
.
status
).
assertEqual
(
demo
.
InstallErrorCode
.
SUCCESS
);
expect
(
data
.
status
).
assertEqual
(
demo
.
InstallErrorCode
.
SUCCESS
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
getInfo
();
await
demo
.
queryAbilityByWant
(
});
async
function
getInfo
()
{
demo
.
queryAbilityByWant
(
{
{
"
bundleName
"
:
"
com.example.myapplication1
"
,
"
bundleName
"
:
"
com.example.myapplication1
"
,
"
abilityName
"
:
"
com.example.myapplication1.MainAbility
"
,
"
abilityName
"
:
"
com.example.myapplication1.MainAbility
"
,
},
demo
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
demo
.
BundleFlag
.
GET_ABILITY_INFO_WITH_PERMISSION
,
},
demo
.
BundleFlag
.
GET_ABILITY_INFO_WITH_APPLICATION
|
demo
.
BundleFlag
.
GET_ABILITY_INFO_WITH_PERMISSION
|
demo
.
BundleFlag
.
GET_ABILITY_INFO_WITH_METADATA
,
100
).
then
(
data
=>
{
100
).
then
(
data
=>
{
expect
(
data
.
length
).
assertLarger
(
0
);
expect
(
data
.
length
).
assertLarger
(
0
);
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
...
@@ -2144,9 +2143,9 @@ describe('ActsBundleManagerTest', function () {
...
@@ -2144,9 +2143,9 @@ describe('ActsBundleManagerTest', function () {
expect
(
datainfo
.
icon
).
assertEqual
(
"
$media:icon
"
)
expect
(
datainfo
.
icon
).
assertEqual
(
"
$media:icon
"
)
expect
(
datainfo
.
moduleName
).
assertEqual
(
"
entry
"
)
expect
(
datainfo
.
moduleName
).
assertEqual
(
"
entry
"
)
expect
(
datainfo
.
bundleName
).
assertEqual
(
NAME1
)
expect
(
datainfo
.
bundleName
).
assertEqual
(
NAME1
)
expect
(
datainfo
.
type
).
assertEqual
(
1
)
expect
(
datainfo
.
type
).
assertEqual
(
demo
.
AbilityType
.
PAGE
)
expect
(
datainfo
.
subType
).
assertEqual
(
demo
.
AbilitySubType
.
UNSPECIFIED
)
expect
(
datainfo
.
subType
).
assertEqual
(
demo
.
AbilitySubType
.
UNSPECIFIED
)
expect
(
datainfo
.
orientation
).
assertEqual
(
0
)
expect
(
datainfo
.
orientation
).
assertEqual
(
demo
.
DisplayOrientation
.
UNSPECIFIED
)
expect
(
datainfo
.
launchMode
).
assertEqual
(
demo
.
LaunchMode
.
STANDARD
)
expect
(
datainfo
.
launchMode
).
assertEqual
(
demo
.
LaunchMode
.
STANDARD
)
expect
(
datainfo
.
permissions
[
0
]).
assertEqual
(
"
com.permission.BMS_PERMISSION_CAMERA
"
)
expect
(
datainfo
.
permissions
[
0
]).
assertEqual
(
"
com.permission.BMS_PERMISSION_CAMERA
"
)
expect
(
datainfo
.
applicationInfo
.
name
).
assertEqual
(
NAME1
)
expect
(
datainfo
.
applicationInfo
.
name
).
assertEqual
(
NAME1
)
...
@@ -2159,12 +2158,14 @@ describe('ActsBundleManagerTest', function () {
...
@@ -2159,12 +2158,14 @@ describe('ActsBundleManagerTest', function () {
expect
(
datainfo
.
applicationInfo
.
systemApp
).
assertEqual
(
true
)
expect
(
datainfo
.
applicationInfo
.
systemApp
).
assertEqual
(
true
)
expect
(
datainfo
.
applicationInfo
.
supportedModes
).
assertEqual
(
0
)
expect
(
datainfo
.
applicationInfo
.
supportedModes
).
assertEqual
(
0
)
expect
(
datainfo
.
applicationInfo
.
enabled
).
assertEqual
(
true
)
expect
(
datainfo
.
applicationInfo
.
enabled
).
assertEqual
(
true
)
expect
(
datainfo
.
metaData
.
customizeDatas
.
length
).
assertLarger
(
0
)
expect
(
datainfo
.
metaData
.
length
).
assertLarger
(
0
)
for
(
var
j
=
0
;
j
<
datainfo
.
applicationInfo
.
moduleInfos
;
j
++
)
{
for
(
var
j
=
0
;
j
<
datainfo
.
applicationInfo
.
moduleInfos
;
j
++
)
{
expect
(
datainfo
.
applicationInfo
.
moduleInfos
[
j
].
moduleName
).
assertEqual
(
"
entry
"
)
expect
(
datainfo
.
applicationInfo
.
moduleInfos
[
j
].
moduleName
).
assertEqual
(
"
entry
"
)
expect
(
datainfo
.
applicationInfo
.
moduleInfos
[
j
].
moduleSourceDir
).
assertEqual
(
DIR1
)
expect
(
datainfo
.
applicationInfo
.
moduleInfos
[
j
].
moduleSourceDir
).
assertEqual
(
DIR1
)
}
}
}
}
}).
catch
(
err
=>
{
expect
(
err
).
assertFail
();
})
})
installData
.
uninstall
(
NAME1
,
{
installData
.
uninstall
(
NAME1
,
{
userId
:
100
,
userId
:
100
,
...
@@ -2176,7 +2177,7 @@ describe('ActsBundleManagerTest', function () {
...
@@ -2176,7 +2177,7 @@ describe('ActsBundleManagerTest', function () {
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
expect
(
data
.
statusMessage
).
assertEqual
(
'
SUCCESS
'
);
done
();
done
();
});
});
}
}
);
})
})
/**
/**
...
...
appexecfwk/zlib/actszipfileandunzipfiletest/entry/src/main/js/test/actszipfileandunzipfiletest.test.js
浏览文件 @
7d9ad525
此差异已折叠。
点击以展开。
appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c
浏览文件 @
7d9ad525
...
@@ -51,7 +51,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoLegal, Function | MediumT
...
@@ -51,7 +51,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoLegal, Function | MediumT
{
{
printf
(
"------start testClearAbilityInfo------
\n
"
);
printf
(
"------start testClearAbilityInfo------
\n
"
);
AbilityInfo
abilityInfo
;
AbilityInfo
abilityInfo
;
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
int
result
=
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
abilityInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
abilityInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
ClearAbilityInfo
(
&
abilityInfo
);
ClearAbilityInfo
(
&
abilityInfo
);
...
@@ -68,7 +69,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoIllegal, Function | Mediu
...
@@ -68,7 +69,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoIllegal, Function | Mediu
{
{
printf
(
"------start testClearAbilityInfoIllegal------
\n
"
);
printf
(
"------start testClearAbilityInfoIllegal------
\n
"
);
AbilityInfo
abilityInfo
=
{
0
};
AbilityInfo
abilityInfo
=
{
0
};
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
int
result
=
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
abilityInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
abilityInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
ClearAbilityInfo
(
NULL
);
ClearAbilityInfo
(
NULL
);
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
TEST_ASSERT_EQUAL_STRING
(
abilityInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
...
@@ -84,7 +86,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoLegal, Function | MediumTe
...
@@ -84,7 +86,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoLegal, Function | MediumTe
{
{
printf
(
"------start testClearBundleInfo------
\n
"
);
printf
(
"------start testClearBundleInfo------
\n
"
);
BundleInfo
bundleInfo
=
{
0
};
BundleInfo
bundleInfo
=
{
0
};
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
int
result
=
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
bundleInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
bundleInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
ClearBundleInfo
(
&
bundleInfo
);
ClearBundleInfo
(
&
bundleInfo
);
...
@@ -101,7 +104,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoIllegal, Function | Medium
...
@@ -101,7 +104,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoIllegal, Function | Medium
{
{
printf
(
"------start testClearBundleInfoIllegal------
\n
"
);
printf
(
"------start testClearBundleInfoIllegal------
\n
"
);
BundleInfo
bundleInfo
;
BundleInfo
bundleInfo
;
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
int
result
=
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
bundleInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
bundleInfo
.
bundleName
=
"com.openharmony.testjsdemo"
;
ClearBundleInfo
(
NULL
);
ClearBundleInfo
(
NULL
);
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
TEST_ASSERT_EQUAL_STRING
(
bundleInfo
.
bundleName
,
"com.openharmony.testjsdemo"
);
...
@@ -117,7 +121,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoLegal, Function | MediumTe
...
@@ -117,7 +121,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoLegal, Function | MediumTe
{
{
printf
(
"------start testClearModuleInfo------
\n
"
);
printf
(
"------start testClearModuleInfo------
\n
"
);
ModuleInfo
moduleInfo
=
{
0
};
ModuleInfo
moduleInfo
=
{
0
};
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
int
result
=
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
moduleInfo
.
moduleName
=
"test"
;
moduleInfo
.
moduleName
=
"test"
;
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
"test"
);
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
"test"
);
ClearModuleInfo
(
&
moduleInfo
);
ClearModuleInfo
(
&
moduleInfo
);
...
@@ -134,7 +139,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoIllegal, Function | Medium
...
@@ -134,7 +139,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoIllegal, Function | Medium
{
{
printf
(
"------start testClearModuleInfoIllegal------
\n
"
);
printf
(
"------start testClearModuleInfoIllegal------
\n
"
);
ModuleInfo
moduleInfo
=
{
0
};
ModuleInfo
moduleInfo
=
{
0
};
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
int
result
=
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
moduleInfo
.
moduleName
=
"test"
;
moduleInfo
.
moduleName
=
"test"
;
ClearModuleInfo
(
NULL
);
ClearModuleInfo
(
NULL
);
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
"test"
);
TEST_ASSERT_EQUAL_STRING
(
moduleInfo
.
moduleName
,
"test"
);
...
@@ -278,9 +284,10 @@ LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfoIllegal, Function | MediumTe
...
@@ -278,9 +284,10 @@ LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfoIllegal, Function | MediumTe
{
{
printf
(
"------start testGetBundleInfoIllegal------
\n
"
);
printf
(
"------start testGetBundleInfoIllegal------
\n
"
);
BundleInfo
bundleInfo
;
BundleInfo
bundleInfo
;
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
int
result
=
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
TEST_ASSERT_TRUE
(
result
==
0
);
const
char
*
bundleName
=
"com.openharmony.nothishap"
;
const
char
*
bundleName
=
"com.openharmony.nothishap"
;
int
32_t
flags
=
0
;
int
flags
=
0
;
uint8_t
ret
=
GetBundleInfo
(
bundleName
,
flags
,
&
bundleInfo
);
uint8_t
ret
=
GetBundleInfo
(
bundleName
,
flags
,
&
bundleInfo
);
TEST_ASSERT_TRUE
(
ret
==
2
);
TEST_ASSERT_TRUE
(
ret
==
2
);
ret
=
GetBundleInfo
(
NULL
,
flags
,
&
bundleInfo
);
ret
=
GetBundleInfo
(
NULL
,
flags
,
&
bundleInfo
);
...
@@ -303,8 +310,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfosIllegal, Function | MediumT
...
@@ -303,8 +310,8 @@ LITE_TEST_CASE(BundleMgrTestSuite, testGetBundleInfosIllegal, Function | MediumT
{
{
printf
(
"------start testGetBundleInfosIllegal------
\n
"
);
printf
(
"------start testGetBundleInfosIllegal------
\n
"
);
BundleInfo
*
bundleInfos
=
{
NULL
};
BundleInfo
*
bundleInfos
=
{
NULL
};
int
32_t
*
length
=
NULL
;
int
*
length
=
NULL
;
int
32_t
flags
=
0
;
int
flags
=
0
;
uint8_t
ret
=
GetBundleInfos
(
flags
,
NULL
,
length
);
uint8_t
ret
=
GetBundleInfos
(
flags
,
NULL
,
length
);
TEST_ASSERT_TRUE
(
ret
==
1
);
TEST_ASSERT_TRUE
(
ret
==
1
);
ret
=
GetBundleInfos
(
flags
,
&
bundleInfos
,
NULL
);
ret
=
GetBundleInfos
(
flags
,
&
bundleInfos
,
NULL
);
...
...
appexecfwk_lite/appexecfwk_posix/src/BundleMgrTest.cpp
浏览文件 @
7d9ad525
...
@@ -102,7 +102,8 @@ HWTEST_F(BundleMgrTest, testClearAbilityInfoIllegal, Function | MediumTest | Lev
...
@@ -102,7 +102,8 @@ HWTEST_F(BundleMgrTest, testClearAbilityInfoIllegal, Function | MediumTest | Lev
printf
(
"------start testClearAbilityInfoIllegal------
\n
"
);
printf
(
"------start testClearAbilityInfoIllegal------
\n
"
);
// abilityInfo is nullptr
// abilityInfo is nullptr
AbilityInfo
abilityInfo
;
AbilityInfo
abilityInfo
;
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
int32_t
result
=
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
EXPECT_EQ
(
result
,
0
);
abilityInfo
.
bundleName
=
(
char
*
)
"com.openharmony.testjsdemo"
;
abilityInfo
.
bundleName
=
(
char
*
)
"com.openharmony.testjsdemo"
;
printf
(
"abilityInfo.bundleName is %s
\n
"
,
abilityInfo
.
bundleName
);
printf
(
"abilityInfo.bundleName is %s
\n
"
,
abilityInfo
.
bundleName
);
ClearAbilityInfo
(
nullptr
);
ClearAbilityInfo
(
nullptr
);
...
@@ -119,7 +120,8 @@ HWTEST_F(BundleMgrTest, testClearBundleInfoIllegal, Function | MediumTest | Leve
...
@@ -119,7 +120,8 @@ HWTEST_F(BundleMgrTest, testClearBundleInfoIllegal, Function | MediumTest | Leve
{
{
printf
(
"------start testClearBundleInfoIllegal------
\n
"
);
printf
(
"------start testClearBundleInfoIllegal------
\n
"
);
BundleInfo
bundleInfo
;
BundleInfo
bundleInfo
;
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
int32_t
result
=
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
EXPECT_EQ
(
result
,
0
);
bundleInfo
.
bundleName
=
(
char
*
)
"com.openharmony.testjsdemo"
;
bundleInfo
.
bundleName
=
(
char
*
)
"com.openharmony.testjsdemo"
;
printf
(
"abilityInfo.bundleName is %s
\n
"
,
bundleInfo
.
bundleName
);
printf
(
"abilityInfo.bundleName is %s
\n
"
,
bundleInfo
.
bundleName
);
ClearBundleInfo
(
nullptr
);
ClearBundleInfo
(
nullptr
);
...
@@ -137,7 +139,8 @@ HWTEST_F(BundleMgrTest, testClearModuleInfoIllegal, Function | MediumTest | Leve
...
@@ -137,7 +139,8 @@ HWTEST_F(BundleMgrTest, testClearModuleInfoIllegal, Function | MediumTest | Leve
{
{
printf
(
"------start testClearModuleInfoIllegal------
\n
"
);
printf
(
"------start testClearModuleInfoIllegal------
\n
"
);
ModuleInfo
moduleInfo
;
ModuleInfo
moduleInfo
;
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
int32_t
result
=
memset_s
(
&
moduleInfo
,
sizeof
(
moduleInfo
),
0
,
sizeof
(
moduleInfo
));
EXPECT_EQ
(
result
,
0
);
moduleInfo
.
description
=
(
char
*
)
"test app"
;
moduleInfo
.
description
=
(
char
*
)
"test app"
;
moduleInfo
.
moduleType
=
(
char
*
)
"entry"
;
moduleInfo
.
moduleType
=
(
char
*
)
"entry"
;
ClearModuleInfo
(
nullptr
);
ClearModuleInfo
(
nullptr
);
...
@@ -556,15 +559,18 @@ HWTEST_F(BundleMgrTest, testQueryAbilityInfoRight, Function | MediumTest | Level
...
@@ -556,15 +559,18 @@ HWTEST_F(BundleMgrTest, testQueryAbilityInfoRight, Function | MediumTest | Level
{
{
printf
(
"------start testQueryAbilityInfoRight------
\n
"
);
printf
(
"------start testQueryAbilityInfoRight------
\n
"
);
Want
want
;
Want
want
;
memset_s
(
&
want
,
sizeof
(
Want
),
0
,
sizeof
(
Want
));
int32_t
resultWant
=
memset_s
(
&
want
,
sizeof
(
Want
),
0
,
sizeof
(
Want
));
EXPECT_EQ
(
resultWant
,
0
);
ElementName
element
;
ElementName
element
;
memset_s
(
&
element
,
sizeof
(
ElementName
),
0
,
sizeof
(
ElementName
));
int32_t
resultElementName
=
memset_s
(
&
element
,
sizeof
(
ElementName
),
0
,
sizeof
(
ElementName
));
EXPECT_EQ
(
resultElementName
,
0
);
SetElementAbilityName
(
&
element
,
"MainAbility"
);
SetElementAbilityName
(
&
element
,
"MainAbility"
);
SetElementBundleName
(
&
element
,
"com.openharmony.testjsdemo"
);
SetElementBundleName
(
&
element
,
"com.openharmony.testjsdemo"
);
SetWantElement
(
&
want
,
element
);
SetWantElement
(
&
want
,
element
);
SetWantData
(
&
want
,
"test"
,
4
);
SetWantData
(
&
want
,
"test"
,
4
);
AbilityInfo
abilityInfo
;
AbilityInfo
abilityInfo
;
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
int32_t
result
=
memset_s
(
&
abilityInfo
,
sizeof
(
abilityInfo
),
0
,
sizeof
(
abilityInfo
));
EXPECT_EQ
(
result
,
0
);
printf
(
"element.elementname is %s
\n
"
,
want
.
element
->
bundleName
);
printf
(
"element.elementname is %s
\n
"
,
want
.
element
->
bundleName
);
printf
(
"AbilityName2 is %s
\n
"
,
want
.
element
->
abilityName
);
printf
(
"AbilityName2 is %s
\n
"
,
want
.
element
->
abilityName
);
g_errorCode
=
QueryAbilityInfo
(
&
want
,
&
abilityInfo
);
g_errorCode
=
QueryAbilityInfo
(
&
want
,
&
abilityInfo
);
...
@@ -584,16 +590,19 @@ HWTEST_F(BundleMgrTest, testQueryAbilityInfoIllegal, Function | MediumTest | Lev
...
@@ -584,16 +590,19 @@ HWTEST_F(BundleMgrTest, testQueryAbilityInfoIllegal, Function | MediumTest | Lev
{
{
printf
(
"------start testQueryAbilityInfoIllegal------
\n
"
);
printf
(
"------start testQueryAbilityInfoIllegal------
\n
"
);
AbilityInfo
abilityInfo
;
AbilityInfo
abilityInfo
;
memset_s
(
&
abilityInfo
,
sizeof
(
AbilityInfo
),
0
,
sizeof
(
AbilityInfo
));
int32_t
result
=
memset_s
(
&
abilityInfo
,
sizeof
(
AbilityInfo
),
0
,
sizeof
(
AbilityInfo
));
EXPECT_EQ
(
result
,
0
);
// want is nullptr
// want is nullptr
g_errorCode
=
QueryAbilityInfo
(
nullptr
,
&
abilityInfo
);
g_errorCode
=
QueryAbilityInfo
(
nullptr
,
&
abilityInfo
);
printf
(
"ret is %d
\n
"
,
g_errorCode
);
printf
(
"ret is %d
\n
"
,
g_errorCode
);
EXPECT_TRUE
(
g_errorCode
==
4
);
EXPECT_TRUE
(
g_errorCode
==
4
);
// abilityInfo is nullptr
// abilityInfo is nullptr
Want
want
;
Want
want
;
memset_s
(
&
want
,
sizeof
(
Want
),
0
,
sizeof
(
Want
));
int32_t
resultWant
=
memset_s
(
&
want
,
sizeof
(
Want
),
0
,
sizeof
(
Want
));
EXPECT_EQ
(
resultWant
,
0
);
ElementName
element
;
ElementName
element
;
memset_s
(
&
element
,
sizeof
(
ElementName
),
0
,
sizeof
(
ElementName
));
int32_t
resultElementName
=
memset_s
(
&
element
,
sizeof
(
ElementName
),
0
,
sizeof
(
ElementName
));
EXPECT_EQ
(
resultElementName
,
0
);
SetElementAbilityName
(
&
element
,
"MainAbility"
);
SetElementAbilityName
(
&
element
,
"MainAbility"
);
SetElementBundleName
(
&
element
,
"com.openharmony.testjsdemo"
);
SetElementBundleName
(
&
element
,
"com.openharmony.testjsdemo"
);
SetWantElement
(
&
want
,
element
);
SetWantElement
(
&
want
,
element
);
...
@@ -624,7 +633,8 @@ HWTEST_F(BundleMgrTest, testGetBundleInfoRight, Function | MediumTest | Level1)
...
@@ -624,7 +633,8 @@ HWTEST_F(BundleMgrTest, testGetBundleInfoRight, Function | MediumTest | Level1)
{
{
printf
(
"------start testGetBundleInfoRight------
\n
"
);
printf
(
"------start testGetBundleInfoRight------
\n
"
);
BundleInfo
bundleInfo
;
BundleInfo
bundleInfo
;
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
int32_t
result
=
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
EXPECT_EQ
(
result
,
0
);
const
char
*
bundleName
=
(
char
*
)
"com.openharmony.testjsdemo"
;
const
char
*
bundleName
=
(
char
*
)
"com.openharmony.testjsdemo"
;
int32_t
flags
=
0
;
int32_t
flags
=
0
;
printf
(
"bundleName is %s
\n
"
,
bundleName
);
printf
(
"bundleName is %s
\n
"
,
bundleName
);
...
@@ -655,7 +665,8 @@ HWTEST_F(BundleMgrTest, testGetBundleInfoIllegal, Function | MediumTest | Level2
...
@@ -655,7 +665,8 @@ HWTEST_F(BundleMgrTest, testGetBundleInfoIllegal, Function | MediumTest | Level2
{
{
printf
(
"------start testGetBundleInfoIllegal------
\n
"
);
printf
(
"------start testGetBundleInfoIllegal------
\n
"
);
BundleInfo
bundleInfo
;
BundleInfo
bundleInfo
;
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
int32_t
result
=
memset_s
(
&
bundleInfo
,
sizeof
(
bundleInfo
),
0
,
sizeof
(
bundleInfo
));
EXPECT_EQ
(
result
,
0
);
const
char
*
bundleName
=
(
char
*
)
"com.openharmony.nothishap"
;
const
char
*
bundleName
=
(
char
*
)
"com.openharmony.nothishap"
;
int32_t
flags
=
0
;
int32_t
flags
=
0
;
// error bundleName
// error bundleName
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录