Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
dbd9cec5
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看板
提交
dbd9cec5
编写于
9月 15, 2021
作者:
D
defeng2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
delete softbus
Signed-off-by:
N
defeng2020
<
wudefeng@huawei.com
>
上级
65ae4546
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
0 addition
and
1620 deletion
+0
-1620
build_lite/BUILD.gn
build_lite/BUILD.gn
+0
-2
communication_lite/softbus_hal/BUILD.gn
communication_lite/softbus_hal/BUILD.gn
+0
-32
communication_lite/softbus_hal/Test.tmpl
communication_lite/softbus_hal/Test.tmpl
+0
-19
communication_lite/softbus_hal/src/softbus_func_test.c
communication_lite/softbus_hal/src/softbus_func_test.c
+0
-1092
communication_lite/softbus_posix/BUILD.gn
communication_lite/softbus_posix/BUILD.gn
+0
-46
communication_lite/softbus_posix/Test.json
communication_lite/softbus_posix/Test.json
+0
-25
communication_lite/softbus_posix/src/ActsSoftBusTest.cpp
communication_lite/softbus_posix/src/ActsSoftBusTest.cpp
+0
-404
未找到文件。
build_lite/BUILD.gn
浏览文件 @
dbd9cec5
...
...
@@ -32,7 +32,6 @@ lite_component("acts_component") {
if (ohos_kernel_type == "liteos_m") {
all_features += [
"//test/xts/acts/communication_lite/lwip_hal:ActsLwipTest",
"//test/xts/acts/communication_lite/softbus_hal:ActsSoftBusTest",
"//test/xts/acts/communication_lite/wifiservice_hal:ActsWifiServiceTest",
"//test/xts/acts/utils_lite/file_hal:ActsUtilsFileTest",
"//test/xts/acts/startup_lite/syspara_hal:ActsParameterTest",
...
...
@@ -68,7 +67,6 @@ lite_component("acts_component") {
"//test/xts/acts/graphic_lite/ui:uikit_test3",
"//test/xts/acts/appexecfwk_lite/bundle_mgr_posix:ActsBundleMgrTest",
"//test/xts/acts/aafwk_lite/ability_posix:ActsAbilityMgrTest",
"//test/xts/acts/communication_lite/softbus_posix:ActsSoftBusTest",
"//test/xts/acts/communication_lite/lwip_posix:ActsLwipTest",
"//test/xts/acts/ai_lite/ai_engine_posix/base:ActsAiEngineTest",
...
...
communication_lite/softbus_hal/BUILD.gn
已删除
100755 → 0
浏览文件 @
65ae4546
# Copyright (c) 2020-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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hctest_suite("ActsSoftBusTest") {
suite_name = "acts"
sources = [ "src/softbus_func_test.c" ]
include_dirs = [
"//third_party/bounds_checking_function/include",
"//kernel/liteos_m/kal",
"//foundation/communication/wifi_lite/interfaces/wifiservice",
"//foundation/communication/softbus_lite/discovery/discovery_service/include",
"//foundation/communication/softbus_lite/discovery/include",
"//foundation/communication/softbus_lite/interfaces/kits/discovery",
"//foundation/communication/softbus_lite/interfaces/kits/transport",
]
deps = [ "//foundation/communication/softbus_lite:softbus" ]
cflags = [ "-Wno-error" ]
}
communication_lite/softbus_hal/Test.tmpl
已删除
100755 → 0
浏览文件 @
65ae4546
{
"description": "Config for $module test cases",
"environment": [
{
"type": "device",
"label": "wifiiot"
}
],
"kits": [
{
"type": "DeployKit",
"timeout": "20000",
"burn_file": "$subsystem/$module.bin"
}
],
"driver": {
"type": "CTestLite"
}
}
\ No newline at end of file
communication_lite/softbus_hal/src/softbus_func_test.c
已删除
100755 → 0
浏览文件 @
65ae4546
此差异已折叠。
点击以展开。
communication_lite/softbus_posix/BUILD.gn
已删除
100755 → 0
浏览文件 @
65ae4546
# Copyright (c) 2020-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.
import("//test/xts/tools/lite/build/suite_lite.gni")
hcpptest_suite("ActsSoftBusTest") {
suite_name = "acts"
sources = [ "src/ActsSoftBusTest.cpp" ]
include_dirs = [
"//foundation/communication/softbus_lite/discovery/coap/include",
"//foundation/communication/softbus_lite/os_adapter/include",
"//foundation/communication/softbus_lite/interfaces/kits/discovery",
"//foundation/communication/softbus_lite/interfaces/kits/transport",
"//foundation/communication/softbus_lite/discovery/discovery_service/include",
"//foundation/communication/softbus_lite/authmanager/include",
"//foundation/communication/softbus_lite/trans_service/include/libdistbus",
"//foundation/communication/softbus_lite/trans_service/include/utils",
"//foundation/communication/softbus_lite/trans_service/source/libdistbus",
"//foundation/communication/softbus_lite/trans_service/source/utils",
"//third_party/cJSON",
"//third_party/mbedtls/include",
"//third_party/bounds_checking_function/include",
"//base/startup/syspara_lite/interfaces/kits/include",
"//base/security/deviceauth/interfaces/innerkits/deviceauth_lite",
]
defines = [ "_GNU_SOURCE" ]
deps = [
"//foundation/communication/softbus_lite:softbus_lite",
"//third_party/bounds_checking_function:libsec_shared",
]
cflags = [ "-Wno-error" ]
}
\ No newline at end of file
communication_lite/softbus_posix/Test.json
已删除
100644 → 0
浏览文件 @
65ae4546
{
"description"
:
"Config for hcpptest demo test cases"
,
"environment"
:
[
{
"type"
:
"device"
,
"label"
:
"ipcamera"
}
],
"kits"
:
[
{
"type"
:
"MountKit"
,
"server"
:
"NfsServer"
,
"mount"
:
[
{
"source"
:
"testcases/communication"
,
"target"
:
"/test_root/communication"
}
]
}
],
"driver"
:
{
"type"
:
"CppTestLite"
,
"execute"
:
"/test_root/communication/ActsSoftBusTest.bin"
}
}
\ No newline at end of file
communication_lite/softbus_posix/src/ActsSoftBusTest.cpp
已删除
100755 → 0
浏览文件 @
65ae4546
/**
* Copyright (c) 2020-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 "discovery_service.h"
#include "session.h"
#include "securec.h"
#include <unistd.h>
#include <stdlib.h>
#include <climits>
using
namespace
std
;
using
namespace
testing
::
ext
;
static
const
int
PUB_SUCCESS
=
1
;
static
const
int
PUB_FAIL
=
-
1
;
static
const
int
TESTCASE_COUNT
=
18
;
static
const
int
ERROR_SESSION_ID
=
-
1
;
static
const
int
SESSION_NAME_LEN
=
64
;
static
const
int
DEVID_MAX_LEN
=
96
;
static
const
int
SOFTBUS_TEST_SUCCESS
=
0
;
static
const
int
SOFTBUS_TEST_FAIL
=
-
1
;
static
const
int
ONE_SECOND
=
1
;
static
const
int
DEF_TIMEOUT
=
6
;
static
const
int
DEF_PUB_ID
=
33113322
;
static
const
int
DEF_PUB_CAPABILITY_DATA_LEN
=
2
;
static
int
g_pubFlag
=
0
;
static
const
char
*
g_devId
=
"sb_test_default_devid"
;
static
const
char
*
g_pubModuleName
=
"sb_pub_module_name"
;
static
const
char
*
g_pubCapability
=
"ddmpCapability"
;
static
unsigned
char
*
g_pubCapabilityData
=
(
unsigned
char
*
)
"Hi"
;
static
IPublishCallback
g_pubCallback
=
{
0
};
static
struct
ISessionListener
*
g_sessionListenerCallback
=
nullptr
;
static
void
ResetPubFlag
(
void
)
{
g_pubFlag
=
0
;
}
static
void
WaitPublishResult
(
void
)
{
int
timeout
=
DEF_TIMEOUT
;
while
(
timeout
>
0
)
{
sleep
(
ONE_SECOND
);
timeout
--
;
if
(
g_pubFlag
==
PUB_SUCCESS
||
g_pubFlag
==
PUB_FAIL
)
{
printf
(
"checkPublish:wait[%d].
\n
"
,
DEF_TIMEOUT
-
timeout
);
break
;
}
}
if
(
timeout
<=
0
)
{
printf
(
"checkPublish:timeout!
\n
"
);
}
}
/**
* callback of publish success
*/
void
SbPublishSuccess
(
int
pubId
)
{
printf
(
"[PubSuccess]publish success id[%d].
\n
"
,
pubId
);
g_pubFlag
=
PUB_SUCCESS
;
}
/**
* callback of publish fail
*/
void
SbPublishFail
(
int
pubId
,
PublishFailReason
reason
)
{
printf
(
"[PubFail]publish fail id[%d],reason[%d].
\n
"
,
pubId
,
reason
);
g_pubFlag
=
PUB_FAIL
;
}
/**
* callback of session opened
*/
int
SbSessionOpened
(
int
sessionId
)
{
(
void
)
sessionId
;
printf
(
"[Session] opened.
\n
"
);
return
SOFTBUS_TEST_SUCCESS
;
}
/**
* callback of session closed
*/
void
SbSessionClosed
(
int
sessionId
)
{
(
void
)
sessionId
;
printf
(
"[Session] closed.
\n
"
);
}
/**
* callback of received data
*/
void
SbOnBytesReceived
(
int
sessionId
,
const
void
*
data
,
unsigned
int
len
)
{
(
void
)
sessionId
;
printf
(
"[Session] receive bytes, data len[%u].
\n
"
,
len
);
}
/**
* init service during first publish
*/
static
void
DefaultPublishToInitService
(
void
)
{
PublishInfo
*
pubInfo
=
NULL
;
pubInfo
=
(
PublishInfo
*
)
malloc
(
sizeof
(
PublishInfo
));
if
(
pubInfo
==
NULL
)
{
printf
(
"[DefaultPublishToInitService]malloc fail!
\n
"
);
return
;
}
(
void
)
memset_s
(
pubInfo
,
sizeof
(
PublishInfo
),
0
,
sizeof
(
PublishInfo
));
pubInfo
->
publishId
=
DEF_PUB_ID
;
pubInfo
->
mode
=
DISCOVER_MODE_PASSIVE
;
pubInfo
->
medium
=
COAP
;
pubInfo
->
freq
=
MID
;
pubInfo
->
capability
=
g_pubCapability
;
pubInfo
->
capabilityData
=
g_pubCapabilityData
;
pubInfo
->
dataLen
=
DEF_PUB_CAPABILITY_DATA_LEN
;
ResetPubFlag
();
int
ret
=
PublishService
(
g_pubModuleName
,
pubInfo
,
&
g_pubCallback
);
if
(
ret
!=
SOFTBUS_TEST_SUCCESS
)
{
printf
(
"[DefaultPublishToInitService]call PublishService fail!
\n
"
);
}
else
{
WaitPublishResult
();
if
(
g_pubFlag
!=
PUB_SUCCESS
)
{
printf
(
"[DefaultPublishToInitService]call PublishService fail!
\n
"
);
ret
=
SOFTBUS_TEST_FAIL
;
}
}
free
(
pubInfo
);
}
/**
* undo the first publish
*/
static
void
UnDefaultPublish
(
void
)
{
int
ret
=
UnPublishService
(
g_pubModuleName
,
DEF_PUB_ID
);
if
(
ret
!=
SOFTBUS_TEST_SUCCESS
)
{
printf
(
"[UnDefaultPublish]unpublish fail!
\n
"
);
}
}
class
ActsSoftBusTest
:
public
testing
::
Test
{
protected:
// SetUpTestCase: Testsuit setup, run before 1st testcase
static
void
SetUpTestCase
(
void
)
{
g_pubCallback
.
onPublishSuccess
=
SbPublishSuccess
;
g_pubCallback
.
onPublishFail
=
SbPublishFail
;
g_sessionListenerCallback
=
(
struct
ISessionListener
*
)
malloc
(
sizeof
(
struct
ISessionListener
));
ASSERT_EQ
(
true
,
g_sessionListenerCallback
!=
nullptr
);
g_sessionListenerCallback
->
onSessionOpened
=
SbSessionOpened
;
g_sessionListenerCallback
->
onSessionClosed
=
SbSessionClosed
;
g_sessionListenerCallback
->
onBytesReceived
=
SbOnBytesReceived
;
DefaultPublishToInitService
();
UnDefaultPublish
();
}
// TearDownTestCase: Testsuit teardown, run after last testcase
static
void
TearDownTestCase
(
void
)
{
if
(
g_sessionListenerCallback
!=
nullptr
)
{
free
(
g_sessionListenerCallback
);
g_sessionListenerCallback
=
nullptr
;
}
}
// Testcase setup
virtual
void
SetUp
()
{}
// Testcase teardown
virtual
void
TearDown
()
{}
};
/**
* @tc.number : SUB_COMMUNICATION_SOFTBUS_SDK_0100
* @tc.name : abnormal parameter test
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsSoftBusTest
,
testSetNumGreaterThanMax
,
Function
|
MediumTest
|
Level3
)
{
CommonDeviceInfo
*
devInfo
=
NULL
;
devInfo
=
(
CommonDeviceInfo
*
)
malloc
(
sizeof
(
CommonDeviceInfo
));
ASSERT_EQ
(
true
,
devInfo
!=
NULL
);
(
void
)
memset_s
(
devInfo
,
sizeof
(
CommonDeviceInfo
),
0
,
sizeof
(
CommonDeviceInfo
));
devInfo
->
key
=
COMM_DEVICE_KEY_DEVID
;
devInfo
->
value
=
g_devId
;
int
ret
=
SetCommonDeviceInfo
(
devInfo
,
COMM_DEVICE_KEY_MAX
+
1
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
ret
=
SetCommonDeviceInfo
(
devInfo
,
0
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
ret
=
SetCommonDeviceInfo
(
NULL
,
1
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
free
(
devInfo
);
}
/**
* @tc.number : SUB_COMMUNICATION_SOFTBUS_SDK_0300
* @tc.name : set ID value equal and greater maximum value
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsSoftBusTest
,
testSetDevIdEqualMax
,
Function
|
MediumTest
|
Level3
)
{
const
char
*
info1
=
"abcdef123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
;
const
char
*
info2
=
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890abcdefg"
;
CommonDeviceInfo
*
devInfo
=
NULL
;
devInfo
=
(
CommonDeviceInfo
*
)
malloc
(
sizeof
(
CommonDeviceInfo
));
ASSERT_EQ
(
true
,
devInfo
!=
NULL
);
(
void
)
memset_s
(
devInfo
,
sizeof
(
CommonDeviceInfo
),
0
,
sizeof
(
CommonDeviceInfo
));
devInfo
->
key
=
COMM_DEVICE_KEY_DEVID
;
devInfo
->
value
=
info1
;
int
ret
=
SetCommonDeviceInfo
(
devInfo
,
1
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
devInfo
->
value
=
info2
;
ret
=
SetCommonDeviceInfo
(
devInfo
,
1
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
free
(
devInfo
);
}
/**
* @tc.number : SUB_COMMUNICATION_SOFTBUS_SDK_0600
* @tc.name : set name value equal and greater maximum value
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsSoftBusTest
,
testSetDevNameEqualMax
,
Function
|
MediumTest
|
Level3
)
{
const
char
*
info1
=
"abcd123456789012345678901234567890123456789012345678901234567890"
;
const
char
*
info2
=
"123456789012345678901234567890123456789012345678901234567890abcde"
;
CommonDeviceInfo
*
devInfo
=
NULL
;
devInfo
=
(
CommonDeviceInfo
*
)
malloc
(
sizeof
(
CommonDeviceInfo
));
ASSERT_EQ
(
true
,
devInfo
!=
NULL
);
(
void
)
memset_s
(
devInfo
,
sizeof
(
CommonDeviceInfo
),
0
,
sizeof
(
CommonDeviceInfo
));
devInfo
->
key
=
COMM_DEVICE_KEY_DEVNAME
;
devInfo
->
value
=
info1
;
int
ret
=
SetCommonDeviceInfo
(
devInfo
,
1
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
devInfo
->
value
=
info2
;
ret
=
SetCommonDeviceInfo
(
devInfo
,
1
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
free
(
devInfo
);
}
/**
* @tc.number : SUB_COMMUNICATION_SOFTBUS_SDK_0800
* @tc.name : set type value not in enum
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsSoftBusTest
,
testSetDevTypeError
,
Function
|
MediumTest
|
Level3
)
{
const
char
*
info
=
"error"
;
CommonDeviceInfo
*
devInfo
=
NULL
;
devInfo
=
(
CommonDeviceInfo
*
)
malloc
(
sizeof
(
CommonDeviceInfo
));
ASSERT_EQ
(
true
,
devInfo
!=
NULL
);
(
void
)
memset_s
(
devInfo
,
sizeof
(
CommonDeviceInfo
),
0
,
sizeof
(
CommonDeviceInfo
));
devInfo
->
key
=
COMM_DEVICE_KEY_DEVTYPE
;
devInfo
->
value
=
info
;
int
ret
=
SetCommonDeviceInfo
(
devInfo
,
1
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
free
(
devInfo
);
}
/**
* @tc.number : SUB_COMMUNICATION_SOFTBUS_SDK_1000
* @tc.name : set key is error
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsSoftBusTest
,
testSetDevKeyIsError
,
Function
|
MediumTest
|
Level2
)
{
CommonDeviceInfo
*
devInfo
=
NULL
;
devInfo
=
(
CommonDeviceInfo
*
)
malloc
(
sizeof
(
CommonDeviceInfo
));
ASSERT_EQ
(
true
,
devInfo
!=
NULL
);
(
void
)
memset_s
(
devInfo
,
sizeof
(
CommonDeviceInfo
),
0
,
sizeof
(
CommonDeviceInfo
));
devInfo
->
key
=
COMM_DEVICE_KEY_MAX
;
devInfo
->
value
=
g_devId
;
unsigned
int
num
=
1
;
int
ret
=
SetCommonDeviceInfo
(
devInfo
,
num
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
free
(
devInfo
);
}
/**
* @tc.number : SUB_COMMUNICATION_SOFTBUS_SDK_1300
* @tc.name : Test publish with invalid parameter
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsSoftBusTest
,
testPublishParameterIsNull
,
Function
|
MediumTest
|
Level2
)
{
PublishInfo
*
pubInfo
=
NULL
;
pubInfo
=
(
PublishInfo
*
)
malloc
(
sizeof
(
PublishInfo
));
ASSERT_EQ
(
true
,
pubInfo
!=
NULL
);
(
void
)
memset_s
(
pubInfo
,
sizeof
(
PublishInfo
),
0
,
sizeof
(
PublishInfo
));
pubInfo
->
publishId
=
DEF_PUB_ID
;
pubInfo
->
mode
=
DISCOVER_MODE_PASSIVE
;
pubInfo
->
medium
=
COAP
;
pubInfo
->
freq
=
MID
;
pubInfo
->
capability
=
g_pubCapability
;
pubInfo
->
capabilityData
=
g_pubCapabilityData
;
pubInfo
->
dataLen
=
DEF_PUB_CAPABILITY_DATA_LEN
;
ResetPubFlag
();
int
ret
=
PublishService
(
NULL
,
pubInfo
,
&
g_pubCallback
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
WaitPublishResult
();
EXPECT_EQ
(
PUB_FAIL
,
g_pubFlag
);
ret
=
PublishService
(
g_pubModuleName
,
NULL
,
&
g_pubCallback
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
ret
=
PublishService
(
g_pubModuleName
,
pubInfo
,
NULL
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
ret
=
PublishService
(
NULL
,
NULL
,
NULL
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
free
(
pubInfo
);
}
/**
* @tc.number : SUB_COMMUNICATION_SOFTBUS_SDK_1500
* @tc.name : set package name value equal and greater than maximum value
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsSoftBusTest
,
testPublishPkgNameAbnormal
,
Function
|
MediumTest
|
Level2
)
{
PublishInfo
*
pubInfo
=
NULL
;
pubInfo
=
(
PublishInfo
*
)
malloc
(
sizeof
(
PublishInfo
));
ASSERT_EQ
(
true
,
pubInfo
!=
NULL
);
(
void
)
memset_s
(
pubInfo
,
sizeof
(
PublishInfo
),
0
,
sizeof
(
PublishInfo
));
pubInfo
->
publishId
=
DEF_PUB_ID
;
pubInfo
->
mode
=
DISCOVER_MODE_PASSIVE
;
pubInfo
->
medium
=
COAP
;
pubInfo
->
freq
=
MID
;
pubInfo
->
capability
=
g_pubCapability
;
pubInfo
->
capabilityData
=
g_pubCapabilityData
;
pubInfo
->
dataLen
=
DEF_PUB_CAPABILITY_DATA_LEN
;
ResetPubFlag
();
int
ret
=
PublishService
(
NULL
,
pubInfo
,
&
g_pubCallback
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
WaitPublishResult
();
EXPECT_EQ
(
PUB_FAIL
,
g_pubFlag
);
ResetPubFlag
();
const
char
*
pkgNameMax
=
"123456789012345678901234567890123456789012345678901234567890abcd"
;
ret
=
PublishService
(
pkgNameMax
,
pubInfo
,
&
g_pubCallback
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
WaitPublishResult
();
EXPECT_EQ
(
PUB_FAIL
,
g_pubFlag
);
ResetPubFlag
();
const
char
*
pkgNameMoreMax
=
"abcde123456789012345678901234567890123456789012345678901234567890"
;
ret
=
PublishService
(
pkgNameMoreMax
,
pubInfo
,
&
g_pubCallback
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
WaitPublishResult
();
EXPECT_EQ
(
PUB_FAIL
,
g_pubFlag
);
ret
=
UnPublishService
(
pkgNameMax
,
DEF_PUB_ID
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
ret
=
UnPublishService
(
pkgNameMoreMax
,
DEF_PUB_ID
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
free
(
pubInfo
);
}
/**
* @tc.number : SUB_COMMUNICATION_SOFTBUS_SDK_1700
* @tc.name : set capability value not in list
* @tc.desc : [C- SOFTWARE -0200]
*/
HWTEST_F
(
ActsSoftBusTest
,
testPublishCapabilityError
,
Function
|
MediumTest
|
Level3
)
{
PublishInfo
*
pubInfo
=
NULL
;
pubInfo
=
(
PublishInfo
*
)
malloc
(
sizeof
(
PublishInfo
));
EXPECT_EQ
(
true
,
pubInfo
!=
NULL
);
(
void
)
memset_s
(
pubInfo
,
sizeof
(
PublishInfo
),
0
,
sizeof
(
PublishInfo
));
pubInfo
->
publishId
=
DEF_PUB_ID
;
pubInfo
->
mode
=
DISCOVER_MODE_PASSIVE
;
pubInfo
->
medium
=
COAP
;
pubInfo
->
freq
=
MID
;
pubInfo
->
capability
=
(
char
*
)
"error capability"
;
pubInfo
->
capabilityData
=
g_pubCapabilityData
;
pubInfo
->
dataLen
=
DEF_PUB_CAPABILITY_DATA_LEN
;
ResetPubFlag
();
int
ret
=
PublishService
(
g_pubModuleName
,
pubInfo
,
&
g_pubCallback
);
EXPECT_NE
(
SOFTBUS_TEST_SUCCESS
,
ret
);
WaitPublishResult
();
EXPECT_EQ
(
PUB_FAIL
,
g_pubFlag
);
free
(
pubInfo
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录