Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a2f8723c
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看板
提交
a2f8723c
编写于
4月 15, 2021
作者:
Z
zhouhouxin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
for component
上级
cb3e98cc
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
2 addition
and
303 deletion
+2
-303
distributed_schedule_lite/dtbschedmgr_posix/BUILD.gn
distributed_schedule_lite/dtbschedmgr_posix/BUILD.gn
+2
-3
distributed_schedule_lite/dtbschedmgr_posix/src/StartAbilityFromRemoteFuncTest.cpp
.../dtbschedmgr_posix/src/StartAbilityFromRemoteFuncTest.cpp
+0
-300
未找到文件。
distributed_schedule_lite/dtbschedmgr_posix/BUILD.gn
浏览文件 @
a2f8723c
...
...
@@ -18,7 +18,6 @@ hcpptest_suite("ActsDMSTest") {
sources = [
"src/MsgParserFuncTest.cpp",
"src/MsgParserLenFuncTest.cpp",
"src/StartAbilityFromRemoteFuncTest.cpp",
"src/utils/DMSTestBase.cpp",
"src/utils/dms_packet.cpp",
]
...
...
@@ -31,7 +30,7 @@ hcpptest_suite("ActsDMSTest") {
"//foundation/communication/ipc_lite/interfaces/kits",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/
services/dtbschedmgr
_lite/include",
"//foundation/distributedschedule/
dmsfwk
_lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/innerkits",
"${aafwk_lite_path}/interfaces/innerkits/abilitymgr_lite",
...
...
@@ -46,7 +45,7 @@ hcpptest_suite("ActsDMSTest") {
"${appexecfwk_lite_path}/frameworks/bundle_lite:bundle",
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//foundation/distributedschedule/
services/dtbschedmgr
_lite:dtbschedmgr",
"//foundation/distributedschedule/
dmsfwk
_lite:dtbschedmgr",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-Wno-error" ]
...
...
distributed_schedule_lite/dtbschedmgr_posix/src/StartAbilityFromRemoteFuncTest.cpp
已删除
100755 → 0
浏览文件 @
cb3e98cc
/*
* Copyright (c) 2021 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 "gtest/gtest.h"
#include "utils/DMSTestBase.h"
#include "utils/dms_packet.h"
#include "distributed_service_interface.h"
using
namespace
testing
::
ext
;
static
int8_t
RunTest
(
const
uint8_t
*
buffer
,
uint16_t
bufferLen
,
const
TlvParseCallback
onTlvParseDone
,
const
StartAbilityCallback
onStartAbilityDone
)
{
IDmsFeatureCallback
dmsFeatureCallback
=
{
.
onTlvParseDone
=
onTlvParseDone
,
.
onStartAbilityDone
=
onStartAbilityDone
};
CommuInterInfo
interInfo
;
interInfo
.
payloadLength
=
bufferLen
;
interInfo
.
payload
=
buffer
;
return
DmsLiteProcessCommuMsg
(
&
interInfo
,
&
dmsFeatureCallback
);
}
class
StartAbilityFromRemoteFuncTest
:
public
testing
::
Test
{
protected:
// SetUpTestCase: Testsuit setup, run before 1st testcase
static
void
SetUpTestCase
(
void
)
{
SystemInitProxy
();
}
// TearDownTestCase: Testsuit teardown, run after last testcase
static
void
TearDownTestCase
(
void
)
{
UninstallHap
();
}
// Testcase setup
virtual
void
SetUp
()
{
}
// Testcase teardown
virtual
void
TearDown
()
{
}
};
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0010
* @tc.name : User can start ability from remote
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
StartAbilityFromRemoteFuncTest
,
testStartAbilityFromRemoteFunc0010
,
Function
|
MediumTest
|
Level2
)
{
std
::
string
bundleName
=
"com.huawei.helloworld"
;
std
::
string
abilityName
=
"AceAbility"
;
std
::
string
signature
=
"BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8="
;
char
buffer
[
PACKET_DATA_SIZE
]
=
{
0
};
uint16_t
dataSize
=
0
;
DmsPacket
dmsPacket
{
buffer
,
PACKET_DATA_SIZE
};
DmsMsgInfo
dmsMsgInfo
=
{
DMSLITE_COMMAND
::
START_ABILITY_FROM_REMOTE
,
bundleName
,
abilityName
,
signature
};
if
(
!
dmsPacket
.
BuildDmsPacket
(
dmsMsgInfo
,
dataSize
))
{
printf
(
"[hcpptest]E BuildDmsPacket failed"
);
}
auto
onStartAbilityDone
=
[]
(
int8_t
errCode
)
{
printf
(
"[hcpptest]onStartAbilityDone call and errCode:%d
\n
"
,
errCode
);
};
int8_t
resultCode
=
RunTest
((
uint8_t
*
)
buffer
,
dataSize
,
nullptr
,
onStartAbilityDone
);
ASSERT_EQ
(
resultCode
,
DMS_EC_START_ABILITY_SYNC_SUCCESS
);
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0020
* @tc.name : When start ability from remote with unknown comand id user get error code
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
StartAbilityFromRemoteFuncTest
,
testStartAbilityFromRemoteFunc0020
,
Function
|
MediumTest
|
Level2
)
{
std
::
string
bundleName
=
"com.huawei.helloworld"
;
std
::
string
abilityName
=
"AceAbility"
;
std
::
string
signature
=
"BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8="
;
char
buffer
[
PACKET_DATA_SIZE
]
=
{
0
};
uint16_t
dataSize
=
0
;
DmsPacket
dmsPacket
{
buffer
,
PACKET_DATA_SIZE
};
DmsMsgInfo
dmsMsgInfo
=
{
DMSLITE_COMMAND
::
START_ABILITY_FROM_REMOTE
,
bundleName
,
abilityName
,
signature
};
dmsMsgInfo
.
commandId
=
9
;
if
(
!
dmsPacket
.
BuildDmsPacket
(
dmsMsgInfo
,
dataSize
))
{
printf
(
"[hcpptest]E BuildDmsPacket failed"
);
}
auto
onStartAbilityDone
=
[]
(
int8_t
errCode
)
{
printf
(
"[hcpptest]onStartAbilityDone call and errCode:%d
\n
"
,
errCode
);
};
int8_t
resultCode
=
RunTest
((
uint8_t
*
)
buffer
,
dataSize
,
nullptr
,
onStartAbilityDone
);
ASSERT_EQ
(
resultCode
,
DMS_EC_UNKNOWN_COMMAND_ID
);
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0030
* @tc.name : When start ability from remote with unknown bundle name user get error code
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
StartAbilityFromRemoteFuncTest
,
testStartAbilityFromRemoteFunc0030
,
Function
|
MediumTest
|
Level2
)
{
std
::
string
bundleName
=
"com.huawei.unknownPackage"
;
std
::
string
abilityName
=
"AceAbility"
;
std
::
string
signature
=
"BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8="
;
char
buffer
[
PACKET_DATA_SIZE
]
=
{
0
};
uint16_t
dataSize
=
0
;
DmsPacket
dmsPacket
{
buffer
,
PACKET_DATA_SIZE
};
DmsMsgInfo
dmsMsgInfo
=
{
DMSLITE_COMMAND
::
START_ABILITY_FROM_REMOTE
,
bundleName
,
abilityName
,
signature
};
if
(
!
dmsPacket
.
BuildDmsPacket
(
dmsMsgInfo
,
dataSize
))
{
printf
(
"[hcpptest]E BuildDmsPacket failed"
);
}
auto
onStartAbilityDone
=
[]
(
int8_t
errCode
)
{
printf
(
"[hcpptest]onStartAbilityDone call and errCode:%d
\n
"
,
errCode
);
};
int8_t
resultCode
=
RunTest
((
uint8_t
*
)
buffer
,
dataSize
,
nullptr
,
onStartAbilityDone
);
ASSERT_EQ
(
resultCode
,
DMS_EC_GET_BUNDLEINFO_FAILURE
);
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0040
* @tc.name : When start ability from remote with unknown ability name user can not get error code
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
StartAbilityFromRemoteFuncTest
,
testStartAbilityFromRemoteFunc0040
,
Function
|
MediumTest
|
Level2
)
{
std
::
string
bundleName
=
"com.huawei.helloworld"
;
std
::
string
abilityName
=
"unknownAbility"
;
std
::
string
signature
=
"BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8="
;
char
buffer
[
PACKET_DATA_SIZE
]
=
{
0
};
uint16_t
dataSize
=
0
;
DmsPacket
dmsPacket
{
buffer
,
PACKET_DATA_SIZE
};
DmsMsgInfo
dmsMsgInfo
=
{
DMSLITE_COMMAND
::
START_ABILITY_FROM_REMOTE
,
bundleName
,
abilityName
,
signature
};
if
(
!
dmsPacket
.
BuildDmsPacket
(
dmsMsgInfo
,
dataSize
))
{
printf
(
"[hcpptest]E BuildDmsPacket failed"
);
}
auto
onStartAbilityDone
=
[]
(
int8_t
errCode
)
{
printf
(
"[hcpptest]onStartAbilityDone call and errCode:%d
\n
"
,
errCode
);
};
int8_t
resultCode
=
RunTest
((
uint8_t
*
)
buffer
,
dataSize
,
nullptr
,
onStartAbilityDone
);
ASSERT_EQ
(
resultCode
,
DMS_EC_START_ABILITY_SYNC_SUCCESS
);
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0050
* @tc.name : When start ability from remote with wrong signature user get error code
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
StartAbilityFromRemoteFuncTest
,
testStartAbilityFromRemoteFunc0050
,
Function
|
MediumTest
|
Level2
)
{
std
::
string
bundleName
=
"com.huawei.helloworld"
;
std
::
string
abilityName
=
"AceAbility"
;
std
::
string
signature
=
"wrongPublicKey"
;
char
buffer
[
PACKET_DATA_SIZE
]
=
{
0
};
uint16_t
dataSize
=
0
;
DmsPacket
dmsPacket
{
buffer
,
PACKET_DATA_SIZE
};
DmsMsgInfo
dmsMsgInfo
=
{
DMSLITE_COMMAND
::
START_ABILITY_FROM_REMOTE
,
bundleName
,
abilityName
,
signature
};
if
(
!
dmsPacket
.
BuildDmsPacket
(
dmsMsgInfo
,
dataSize
))
{
printf
(
"[hcpptest]E BuildDmsPacket failed"
);
}
auto
onStartAbilityDone
=
[]
(
int8_t
errCode
)
{
printf
(
"[hcpptest]onStartAbilityDone call and errCode:%d
\n
"
,
errCode
);
};
int8_t
resultCode
=
RunTest
((
uint8_t
*
)
buffer
,
dataSize
,
nullptr
,
onStartAbilityDone
);
ASSERT_EQ
(
resultCode
,
DMS_EC_CHECK_PERMISSION_FAILURE
);
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0060
* @tc.name : User can start ability repeatedly and no memory leak
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
StartAbilityFromRemoteFuncTest
,
testStartAbilityFromRemoteFunc0060
,
Function
|
MediumTest
|
Level2
)
{
std
::
string
bundleName
=
"com.huawei.helloworld"
;
std
::
string
abilityName
=
"AceAbility"
;
std
::
string
signature
=
"BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8="
;
char
buffer
[
PACKET_DATA_SIZE
]
=
{
0
};
uint16_t
dataSize
=
0
;
DmsPacket
dmsPacket
{
buffer
,
PACKET_DATA_SIZE
};
DmsMsgInfo
dmsMsgInfo
=
{
DMSLITE_COMMAND
::
START_ABILITY_FROM_REMOTE
,
bundleName
,
abilityName
,
signature
};
if
(
!
dmsPacket
.
BuildDmsPacket
(
dmsMsgInfo
,
dataSize
))
{
printf
(
"[hcpptest]E BuildDmsPacket failed"
);
}
auto
onStartAbilityDone
=
[]
(
int8_t
errCode
)
{
printf
(
"[hcpptest]onStartAbilityDone call and errCode:%d
\n
"
,
errCode
);
};
for
(
int
i
=
0
;
i
<
PRESSURE_LEVEL0
;
i
++
)
{
usleep
(
OPER_INTERVAL
*
MS2US
);
int8_t
resultCode
=
RunTest
((
uint8_t
*
)
buffer
,
dataSize
,
nullptr
,
onStartAbilityDone
);
ASSERT_EQ
(
resultCode
,
DMS_EC_START_ABILITY_SYNC_SUCCESS
);
printf
(
"[hcpptest]occurs: %d, resultCode:%d
\n
"
,
i
,
resultCode
);
}
}
/**
* @tc.number : DMSLite_DMS_StartAbilityFromRemoteFunc_0070
* @tc.name : When start ability from remote DMS cost time less than 50ms
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
StartAbilityFromRemoteFuncTest
,
testStartAbilityFromRemoteFunc0070
,
Function
|
MediumTest
|
Level2
)
{
std
::
string
bundleName
=
"com.huawei.helloworld"
;
std
::
string
abilityName
=
"AceAbility"
;
std
::
string
signature
=
"BERxL4Em2dAox98GRbsB31dRcsHDto7hjc5ztnc0cNMsHX33a0B2xgfJIJiGMBiAEcTlW3mbxzm6KIMyrKJj1z8="
;
char
buffer
[
PACKET_DATA_SIZE
]
=
{
0
};
uint16_t
dataSize
=
0
;
DmsPacket
dmsPacket
{
buffer
,
PACKET_DATA_SIZE
};
DmsMsgInfo
dmsMsgInfo
=
{
DMSLITE_COMMAND
::
START_ABILITY_FROM_REMOTE
,
bundleName
,
abilityName
,
signature
};
if
(
!
dmsPacket
.
BuildDmsPacket
(
dmsMsgInfo
,
dataSize
))
{
printf
(
"[hcpptest]E BuildDmsPacket failed"
);
}
auto
onStartAbilityDone
=
[]
(
int8_t
errCode
)
{
printf
(
"[hcpptest]onStartAbilityDone call and errCode:%d
\n
"
,
errCode
);
};
long
long
totalTime
=
0
;
for
(
int
i
=
0
;
i
<
PRESSURE_LEVEL0
;
i
++
)
{
usleep
(
OPER_INTERVAL
*
MS2US
);
long
long
startTime
=
GetSystemTime
();
RunTest
((
uint8_t
*
)
buffer
,
dataSize
,
nullptr
,
onStartAbilityDone
);
long
long
endTime
=
GetSystemTime
();
totalTime
=
totalTime
+
(
endTime
-
startTime
);
}
printf
(
"[hcpptest]totalTime:%lld, averageTime:%lld
\n
"
,
totalTime
,
totalTime
/
PRESSURE_LEVEL0
);
// usually it costs about 19ms, if bigger than 50ms need to analyse
ASSERT_EQ
((
totalTime
/
PRESSURE_LEVEL0
)
<
50
,
TRUE
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录