Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
52e02b84
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
52e02b84
编写于
7月 24, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9423 电话服务新增接口覆盖
Merge pull request !9423 from 高曦/master
上级
6c84d5c7
2e076332
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
313 addition
and
8 deletion
+313
-8
telephony/telephonyjstest/netmanager_base/socket/src/main/js/test/List.test.js
...test/netmanager_base/socket/src/main/js/test/List.test.js
+2
-0
telephony/telephonyjstest/netmanager_base/socket/src/main/js/test/NetManagerTLSSocketServer.test.js
...socket/src/main/js/test/NetManagerTLSSocketServer.test.js
+46
-0
telephony/telephonyjstest/netmanager_base/socket/src/main/js/test/NetworkManagerTCPSocketServer.test.js
...et/src/main/js/test/NetworkManagerTCPSocketServer.test.js
+38
-3
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets
...tmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets
+139
-5
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioSecondJsunit.test.ets
...tistic/entry/src/main/ets/test/RadioSecondJsunit.test.ets
+1
-0
telephony/telephonyjstest/sms_mms/sms_mms_error/src/main/js/test/SmsMmsError.test.js
...ms_mms/sms_mms_error/src/main/js/test/SmsMmsError.test.js
+87
-0
未找到文件。
telephony/telephonyjstest/netmanager_base/socket/src/main/js/test/List.test.js
浏览文件 @
52e02b84
...
...
@@ -14,7 +14,9 @@
*/
import
Telephony_NETSTACK_SocketTest
from
'
./NetStackSocket.test
'
;
import
NetworkManagerTCPSocketServer
from
"
./NetworkManagerTCPSocketServer.test
"
;
import
NetManagerTLSSocketServer
from
'
./NetManagerTLSSocketServer.test
'
;
export
default
function
testsuite
()
{
Telephony_NETSTACK_SocketTest
();
NetworkManagerTCPSocketServer
();
NetManagerTLSSocketServer
();
}
\ No newline at end of file
telephony/telephonyjstest/netmanager_base/socket/src/main/js/test/NetManagerTLSSocketServer.test.js
0 → 100644
浏览文件 @
52e02b84
/**
* Copyright (C) 2023 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
netSocket
from
'
@ohos.net.socket
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
;
export
default
function
NetManagerTlsSocketServerTest
()
{
describe
(
'
NetManagerTLSSocketServerTest
'
,
function
()
{
/**
* @tc.number NetworkManager_TLSSocketServer_on_connect_0100
* @tc.name Test on() interface
* @tc.desc Function test
*/
it
(
'
NetworkManager_TLSSocketServer_on_connect_0100
'
,
0
,
async
function
(
done
)
{
let
caseName
=
'
NetworkManager_TLSSocketServer_on_connect_0100
'
;
let
tlsServer
=
netSocket
.
constructTLSSocketServerInstance
();
try
{
tlsServer
.
on
(
'
connect
'
,
data
=>
{
console
.
info
(
`
${
caseName
}
on connect success
${
JSON
.
stringify
(
data
)}
`
);
expect
(
data
.
clientId
!=
undefined
).
assertTrue
();
done
();
});
tlsServer
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
ExpectFalse
();
done
();
return
;
}
});
});
}
\ No newline at end of file
telephony/telephonyjstest/netmanager_base/socket/src/main/js/test/NetworkManagerTCPSocketServer.test.js
浏览文件 @
52e02b84
...
...
@@ -142,8 +142,10 @@ export default function NetTCPSocketServerTest() {
try
{
server
.
on
(
'
connect
'
,
data
=>
{
console
.
info
(
`
${
caseName
}
on connect success
${
JSON
.
stringify
(
data
)}
`
);
expect
(
data
.
clientId
!=
undefined
).
assertTrue
();
done
();
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -219,6 +221,7 @@ export default function NetTCPSocketServerTest() {
ExpectFalse
();
done
();
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -268,6 +271,7 @@ export default function NetTCPSocketServerTest() {
}
});
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -301,6 +305,7 @@ export default function NetTCPSocketServerTest() {
}
});
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -334,6 +339,7 @@ export default function NetTCPSocketServerTest() {
}
});
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect send error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -365,6 +371,7 @@ export default function NetTCPSocketServerTest() {
return
;
});
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -396,6 +403,7 @@ export default function NetTCPSocketServerTest() {
return
;
});
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -428,6 +436,7 @@ export default function NetTCPSocketServerTest() {
}
});
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -459,6 +468,7 @@ export default function NetTCPSocketServerTest() {
return
;
});
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -491,6 +501,7 @@ export default function NetTCPSocketServerTest() {
}
});
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -522,6 +533,7 @@ export default function NetTCPSocketServerTest() {
return
;
});
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -754,7 +766,9 @@ export default function NetTCPSocketServerTest() {
done
();
return
;
}
data
.
off
(
'
message
'
);
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -788,6 +802,7 @@ export default function NetTCPSocketServerTest() {
return
;
}
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -824,6 +839,7 @@ export default function NetTCPSocketServerTest() {
return
;
}
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -859,7 +875,9 @@ export default function NetTCPSocketServerTest() {
done
();
return
;
}
data
.
off
(
'
message
'
);
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -887,6 +905,7 @@ export default function NetTCPSocketServerTest() {
expect
(
true
).
assertTrue
();
done
();
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -919,7 +938,9 @@ export default function NetTCPSocketServerTest() {
done
();
return
;
}
data
.
off
(
'
close
'
);
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -953,6 +974,7 @@ export default function NetTCPSocketServerTest() {
return
;
}
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -989,6 +1011,7 @@ export default function NetTCPSocketServerTest() {
return
;
}
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -1024,7 +1047,9 @@ export default function NetTCPSocketServerTest() {
done
();
return
;
}
data
.
off
(
'
close
'
);
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -1052,6 +1077,7 @@ export default function NetTCPSocketServerTest() {
expect
(
true
).
assertTrue
();
done
();
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -1076,7 +1102,9 @@ export default function NetTCPSocketServerTest() {
console
.
info
(
`
${
caseName
}
on err failed, err:
${
JSON
.
stringify
(
err
)}
`
);
done
();
});
data
.
off
(
"
error
"
);
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -1110,6 +1138,7 @@ export default function NetTCPSocketServerTest() {
return
;
}
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -1138,6 +1167,7 @@ export default function NetTCPSocketServerTest() {
done
();
});
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -1172,7 +1202,9 @@ export default function NetTCPSocketServerTest() {
done
();
return
;
}
data
.
off
(
"
error
"
);
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -1198,6 +1230,7 @@ export default function NetTCPSocketServerTest() {
});
data
.
off
(
"
error
"
);
});
server
.
off
(
'
connect
'
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -1219,6 +1252,7 @@ export default function NetTCPSocketServerTest() {
server
.
on
(
"
error
"
,
err
=>
{
console
.
info
(
`
${
caseName
}
on err failed, err:
${
JSON
.
stringify
(
err
)}
`
);
});
server
.
off
(
"
error
"
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -1267,6 +1301,7 @@ export default function NetTCPSocketServerTest() {
server
.
off
(
null
,
err
=>
{
console
.
info
(
`
${
caseName
}
off err failed, err:
${
JSON
.
stringify
(
err
)}
`
);
});
server
.
off
(
"
error
"
);
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch err, expect err: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -1288,7 +1323,7 @@ export default function NetTCPSocketServerTest() {
server
.
on
(
"
error
"
,
err
=>
{
console
.
info
(
`
${
caseName
}
on err failed, err:
${
JSON
.
stringify
(
err
)}
`
);
});
server
.
off
(
"
error
"
)
server
.
off
(
"
error
"
)
;
done
();
}
catch
(
error
)
{
console
.
info
(
`
${
caseName
}
catch error, expect error: [
${
error
.
code
}
,
${
error
.
message
}
]`
);
...
...
@@ -1313,7 +1348,7 @@ export default function NetTCPSocketServerTest() {
done
();
}
else
{
console
.
info
(
caseName
+
'
getSocketFd data
'
+
JSON
.
stringify
(
data
));
expect
(
data
==
0
).
assertTrue
();
expect
(
data
!=
-
1
).
assertTrue
();
done
();
}
});
...
...
@@ -1329,7 +1364,7 @@ export default function NetTCPSocketServerTest() {
let
tcp
=
socket
.
constructTCPSocketInstance
();
tcp
.
getSocketFd
().
then
((
data
)
=>
{
console
.
info
(
caseName
+
'
getSocketFd data
'
+
JSON
.
stringify
(
data
));
expect
(
data
==
0
).
assertTrue
();
expect
(
data
!=
-
1
).
assertTrue
();
done
();
}).
catch
((
err
)
=>
{
console
.
info
(
caseName
+
'
getSocketFd err
'
+
JSON
.
stringify
(
err
));
...
...
telephony/telephonyjstest/netmanager_http/entry/src/main/ets/test/HttpJsunit.test.ets
浏览文件 @
52e02b84
/*
* Copyright (C) 2021-202
2
Huawei Device Co., Ltd.
* Copyright (C) 2021-202
3
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
...
...
@@ -15,9 +15,12 @@
import {describe, it, expect} from '@ohos/hypium';
import http from '@ohos.net.http';
import connection from "@ohos.net.connection";
import socket from '@ohos.net.socket';
import ethernet from '@ohos.net.ethernet';
export default function httpJsunit() {
describe("httpJsunitTest", function () {
/**
* @tc.number Telephony_Http_Http_createHttp_0100
* @tc.name createHttp
...
...
@@ -31,6 +34,7 @@ export default function httpJsunit() {
httpRequest.destroy();
done();
});
/**
* @tc.number Telephony_NetworkManager_getDefaultNetSync
* @tc.name Test getDefaultNetSync() to check return value
...
...
@@ -69,7 +73,7 @@ export default function httpJsunit() {
expect(data).assertEqual(true);
done();
}
})
})
;
});
/**
...
...
@@ -87,7 +91,137 @@ export default function httpJsunit() {
console.log(JSON.stringify(error));
expect().assertFail();
done();
})
});
});
/**
* @tc.number Telephony_NetworkManager_getDefaultHttpProxy_Async_0100
* @tc.name Test getDefaultHttpProxy() to check return value
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getDefaultHttpProxy_Async_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getDefaultHttpProxy_Async_0100';
connection.getDefaultHttpProxy((error, data) => {
if (error) {
console.log(`${caseName} getDefaultHttpProxy error`);
expect().assertFail();
done();
} else {
console.log(`${caseName} getDefaultHttpProxy success`);
expect(error).assertEqual(undefined);
done();
}
});
});
/**
* @tc.number Telephony_NetworkManager_getDefaultHttpProxy_Promise_0100
* @tc.name Test getDefaultHttpProxy() to check return value
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getDefaultHttpProxy_Promise_0100', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getDefaultHttpProxy_Promise_0100';
connection.getDefaultHttpProxy().then((data) => {
console.log(`${caseName} getDefaultHttpProxy success`);
done();
}).catch((error) => {
console.log(JSON.stringify(error));
expect().assertFail();
done();
});
});
})
};
\ No newline at end of file
/**
* @tc.number Telephony_NetworkManager_getDefaultHttpProxy_Async_0200
* @tc.name Test getDefaultHttpProxy() to check return value
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getDefaultHttpProxy_Async_0200', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getDefaultHttpProxy_Async_0200';
connection.getDefaultNet().then(function (netHandle) {
console.log("netHandle is " +JSON.stringify(netHandle));
connection.setAppNet(netHandle).then(() => {
console.log("setAppNet success");
connection.getDefaultHttpProxy((error, data) => {
if (error) {
console.log(`${caseName} getDefaultHttpProxy error`);
expect().assertFail();
done();
} else {
console.log(`${caseName} getDefaultHttpProxy success`);
done();
}
});
}).catch(error => {
console.log("setAppNet err " + JSON.stringify(error));
expect().assertFail();
done();
});
}).catch(error => {
console.log("getDefaultNet err " + JSON.stringify(error));
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_NetworkManager_getDefaultHttpProxy_Promise_0200
* @tc.name Test getDefaultHttpProxy() to check return value
* @tc.desc Function test
*/
it('Telephony_NetworkManager_getDefaultHttpProxy_Promise_0200', 0, async function (done) {
let caseName = 'Telephony_NetworkManager_getDefaultHttpProxy_Promise_0200';
connection.getDefaultNet().then(function (netHandle) {
console.log("netHandle is " +JSON.stringify(netHandle));
connection.setAppNet(netHandle).then(() => {
console.log("setAppNet success");
connection.getDefaultHttpProxy().then((data) => {
console.log(`${caseName} getDefaultHttpProxy success`);
done();
}).catch((error) => {
console.log(JSON.stringify(error));
expect().assertFail();
done();
});
}).catch(error => {
console.log("setAppNet err " + JSON.stringify(error));
expect().assertFail();
done();
});
}).catch(error => {
console.log("getDefaultNet err " + JSON.stringify(error));
expect().assertFail();
done();
});
});
/**
* @tc.number Telephony_Connection_Request_Socket_0100
* @tc.name Test type
* @tc.desc Function test
*/
it('Telephony_Connection_Request_Socket_0100', 0, async function (done) {
try{
let caseName = 'Telephony_Connection_Request_Socket_0100';
type HttpRequest = http.HttpRequest;
type HttpProxy = connection.HttpProxy;
type TCPSocket = socket.TCPSocket;
type UDPSocket = socket.UDPSocket;
Test(http.createHttp(),socket.constructTCPSocketInstance(),socket.constructUDPSocketInstance());
function Test(httpRequest :HttpRequest,tcpSocket:TCPSocket,udpSocket:UDPSocket){
expect(httpRequest != null).assertTrue();
expect(tcpSocket != null).assertTrue();
expect(udpSocket != null).assertTrue();
httpRequest.destroy();
tcpSocket.close();
udpSocket.close();
done();
}
} catch (error) {
console.info("Telephony_Connection_Request_Socket_0100 catch " + error);
done();
}
});
});
}
\ No newline at end of file
telephony/telephonyjstest/radiostatistic/entry/src/main/ets/test/RadioSecondJsunit.test.ets
浏览文件 @
52e02b84
...
...
@@ -316,6 +316,7 @@ export default function radioSecondJsunit() {
expect(NETWORK_TYPES).assertContain(data[i].signalInformation.signalType);
expect(NETWORK_SIGNAL).assertContain(data[i].signalInformation.signalLevel);
expect(NETWORK_SIGNAL).assertContain(data[i].signalInformation.dBm);
expect(data[i].data != undefined && data[i].data != '' && data[i].data != null).assertTrue();
if (data[i].networkType === radio.NetworkType.NETWORK_TYPE_LTE) {
console.log("radio.NetworkType.NETWORK_TYPE_LTE:" + radio.NetworkType.NETWORK_TYPE_LTE);
...
...
telephony/telephonyjstest/sms_mms/sms_mms_error/src/main/js/test/SmsMmsError.test.js
浏览文件 @
52e02b84
...
...
@@ -153,5 +153,92 @@ describe('SmsMmsErrorTest', function () {
done
();
}
});
/**
* @tc.number Telephony_SmsMms_sendShortMessage_Promise_0100
* @tc.name Telephony_SmsMms_sendShortMessage_Promise_0100
* @tc.desc Function test
*/
it
(
'
Telephony_SmsMms_sendShortMessage_Promise_0100
'
,
0
,
async
function
(
done
)
{
try
{
let
sendCallback
=
function
(
err
,
data
)
{
expect
(
data
.
isLastPart
).
assertEqual
(
false
);
console
.
log
(
`sendCallback: err->
${
JSON
.
stringify
(
err
)}
, data->
${
JSON
.
stringify
(
data
)}
`
);
}
let
deliveryCallback
=
function
(
err
,
data
)
{
console
.
log
(
`deliveryCallback: err->
${
JSON
.
stringify
(
err
)}
, data->
${
JSON
.
stringify
(
data
)}
`
);
}
let
slotId
=
0
;
let
content
=
'
短信内容
'
;
let
destinationHost
=
'
10086
'
;
let
serviceCenter
=
''
;
let
destinationPort
=
1000
;
let
options
=
{
slotId
,
content
,
destinationHost
,
serviceCenter
,
destinationPort
,
sendCallback
,
deliveryCallback
};
sms
.
sendShortMessage
(
options
).
then
((
data
)
=>
{
console
.
info
(
'
Telephony_SmsMms_sendShortMessage_Promise_0100
'
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}).
catch
((
error
)
=>
{
console
.
info
(
'
Telephony_SmsMms_sendShortMessage_Promise_0100
'
+
JSON
.
stringify
(
error
));
done
();
});
}
catch
(
error
)
{
console
.
info
(
'
Telephony_SmsMms_sendShortMessage_Promise_0100 catch
'
+
JSON
.
stringify
(
error
));
done
();
}
});
/**
* @tc.number Telephony_SmsMms_sendShortMessage_Async_0100
* @tc.name Telephony_SmsMms_sendShortMessage_Async_0100
* @tc.desc Function test
*/
it
(
'
Telephony_SmsMms_sendShortMessage_Async_0100
'
,
0
,
async
function
(
done
)
{
try
{
let
sendCallback
=
function
(
err
,
data
)
{
expect
(
data
.
isLastPart
).
assertEqual
(
false
);
console
.
log
(
`sendCallback: err->
${
JSON
.
stringify
(
err
)}
, data->
${
JSON
.
stringify
(
data
)}
`
);
}
let
deliveryCallback
=
function
(
err
,
data
)
{
console
.
log
(
`deliveryCallback: err->
${
JSON
.
stringify
(
err
)}
, data->
${
JSON
.
stringify
(
data
)}
`
);
}
let
slotId
=
0
;
let
content
=
'
短信内容
'
;
let
destinationHost
=
'
10086
'
;
let
serviceCenter
=
''
;
let
destinationPort
=
1000
;
let
options
=
{
slotId
,
content
,
destinationHost
,
serviceCenter
,
destinationPort
,
sendCallback
,
deliveryCallback
};
sms
.
sendShortMessage
(
options
,(
err
,
data
)
=>
{
if
(
err
){
console
.
info
(
'
Telephony_SmsMms_sendShortMessage_Async_0100
'
+
JSON
.
stringify
(
err
));
done
();
}
else
{
console
.
info
(
'
Telephony_SmsMms_sendShortMessage_Async_0100
'
+
JSON
.
stringify
(
data
));
expect
().
assertFail
();
done
();
}
});
done
();
}
catch
(
error
)
{
console
.
info
(
'
Telephony_SmsMms_sendShortMessage_Async_0100 catch
'
+
JSON
.
stringify
(
error
));
done
();
}
});
});
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录