From 29f02424b9684283c2c57d14ca8e6fbcae4657d4 Mon Sep 17 00:00:00 2001 From: lihao Date: Wed, 19 Oct 2022 15:52:26 +0800 Subject: [PATCH] =?UTF-8?q?fixed=2045e2190=20from=20https://gitee.com/deng?= =?UTF-8?q?xianjun007/xts=5Facts/pulls/5968=20=E6=96=B0=E5=A2=9E=E7=94=B5?= =?UTF-8?q?=E8=AF=9D=E6=8E=A5=E5=8F=A3xts=E7=94=A8=E4=BE=8B=E8=A6=86?= =?UTF-8?q?=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lihao --- .../main/js/test/NetworkManagerDNS.test.js | 2 +- .../jshttp/src/main/js/test/Http2Test.js | 115 ++++++ .../jshttp/src/main/js/test/HttpCacheTest.js | 148 +++++++ .../jshttp/src/main/js/test/List.test.js | 4 + .../entry/src/main/ets/test/List.test.ets | 2 + .../ets/test/NetworkManagerSocket.test.ets | 367 ++++++++++++++++++ telephony/telephonyjstest/sms_mms/BUILD.gn | 2 +- .../sms_mms/sms_mms_error/BUILD.gn | 4 +- 8 files changed, 640 insertions(+), 4 deletions(-) create mode 100644 telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/Http2Test.js create mode 100644 telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpCacheTest.js create mode 100644 telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/NetworkManagerSocket.test.ets diff --git a/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/NetworkManagerDNS.test.js b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/NetworkManagerDNS.test.js index 145bb5071..dfd3fc2d3 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/NetworkManagerDNS.test.js +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/NetworkManagerDNS.test.js @@ -161,7 +161,7 @@ export default function Telephony_NETMANAGER_TestDNSTest() { it('Telephony_NETMANAGER_TestDNS_Test0900', 0, function(done){ let netHandle = netConnection.getDefaultNetSync(); console.info("Telephony_NETMANAGER_TestDNS_Test0900 " + JSON.stringify(netHandle)); - expect(netHandle.netId).assertEqual(100); + expect(netHandle.netId >= 100).assertTrue(); done(); }); }); diff --git a/telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/Http2Test.js b/telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/Http2Test.js new file mode 100644 index 000000000..25166c2fe --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/Http2Test.js @@ -0,0 +1,115 @@ +/** + * Copyright (C) 2022 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 net_Http from '@ohos.net.http'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function Http2Test() { + describe('Http2Test', function () { + + /** + * @tc.number Telephony_NETSTACK_Http2TestBasicGet_0100 + * @tc.name set usingCache to true + * @tc.desc usingCache test + */ + it('Telephony_NETSTACK_Http2TestBasicGet_0100', 0, async function (done) { + let http = net_Http.createHttp() + http.request("https://www.zhihu.com", { + usingProtocol: net_Http.HttpProtocol.HTTP1_1 + }).then(function (data) { + console.info("Telephony_NETSTACK_Http2TestBasicGet_0100" + JSON.stringify(data)); + expect(data.responseCode === net_Http.ResponseCode.OK).assertTrue(); + done(); + }) + }); + + /** + * @tc.number Telephony_NETSTACK_Http2TestBasicGet_0200 + * @tc.name set usingCache to true + * @tc.desc usingCache test + */ + it('Telephony_NETSTACK_Http2TestBasicGet_0200', 0, async function (done) { + let http = net_Http.createHttp() + http.request("https://www.zhihu.com", { + usingProtocol: net_Http.HttpProtocol.HTTP2 + }).then(function (data) { + console.info("Telephony_NETSTACK_Http2TestBasicGet_0200" + JSON.stringify(data)); + expect(data.responseCode === net_Http.ResponseCode.OK).assertTrue(); + done(); + }) + }); + + /** + * @tc.number Telephony_NETSTACK_Http2TestBasicGet_0300 + * @tc.name set usingCache to true + * @tc.desc usingCache test + */ + it('Telephony_NETSTACK_Http2TestBasicGet_0300', 0, async function (done) { + let http = net_Http.createHttp() + http.request("https://www.zhihu.com").then(function (data) { + console.info("Telephony_NETSTACK_Http2TestBasicGet_0300" + JSON.stringify(data)); + expect(data.responseCode === net_Http.ResponseCode.OK).assertTrue(); + done(); + }) + }); + + /** + * @tc.number Telephony_NETSTACK_Http2TestBasicGet_0400 + * @tc.name set usingCache to true + * @tc.desc usingCache test + */ + it('Telephony_NETSTACK_Http2TestBasicGet_0400', 0, async function (done) { + expect(net_Http.HttpProtocol.HTTP1_1).assertEqual(0); + expect(net_Http.HttpProtocol.HTTP2).assertEqual(1); + done(); + }); + + /** + * @tc.number Telephony_NETSTACK_Http2TestBasicGet_0500 + * @tc.name set usingCache to true + * @tc.desc usingCache test + */ + it('Telephony_NETSTACK_Http2TestBasicGet_0500', 0, async function (done) { + expect(net_Http.HttpDataType.STRING).assertEqual(0); + expect(net_Http.HttpDataType.OBJECT).assertEqual(1); + expect(net_Http.HttpDataType.ARRAY_BUFFER).assertEqual(2); + done(); + }); + + it('Telephony_http_HttpTestPriority_0100', 0, async function(done){ + let CaseName = 'Telephony_http_HttpTestPriority_0100'; + try { + let httpRequestOptions ={ + method: net_http.RequestMethod.GET, + extraData: null, + header: "content-type': 'application/json", + readTimeout: 6000, + connectTimeout: 6000, + priority: 100 + } + var httpRequest = net_http.createHttp(); + httpRequest.request("https://httpbin/anything", httpRequestOptions, (err,data) => { + console.info(CaseName + Json.stringify(err)+ "data"+ Json.stringify(data)); + expect(data.responseCode === net_http.ResponseCode.Ok).assertTrue(); + done(); + }); + } catch(err){ + console.info(CaseName+ "err=" + err) + done(); + return; + } + }) + }); +} \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpCacheTest.js b/telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpCacheTest.js new file mode 100644 index 000000000..30fce434e --- /dev/null +++ b/telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpCacheTest.js @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2022 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 net_http from '@ohos.net.http'; +import { describe, expect, it } from '@ohos/hypium' + +export default function HttpCacheTest() { + describe('HttpCacheTest', function () { + + /** + * @tc.number Telephony_NetStack_HttpTestBasicGet_0100 + * @tc.name set usingCache to true + * @tc.desc usingCache test + */ + + it('Telephony_NetStack_HttpTestBasicGet_0100', 0, async function(done){ + let CaseName = 'Telephony_NetStack_HttpTestBasicGet_0100'; + let http = net_http.createHttp(); + http.request('https://httpbin.org/anything', { + usingCache : true + }).then(function(data){ + console.info(CaseName + JSON.stringify(data)); + expect(data.responseCode === net_http.ResponseCode.OK).assertTrue(); + done(); + return; + }); + }); + + /** + * @tc.number Telephony_NetStack_HttpTestBasicGet_0200 + * @tc.name set usingCache to false + * @tc.desc usingCache test + */ + + it('Telephony_NetStack_HttpTestBasicGet_0200', 0, async function(done){ + let CaseName = 'Telephony_NetStack_HttpTestBasicGet_0200'; + let http = net_http.createHttp(); + http.request('https://httpbin.org/anything', { + usingCache : false + }).then(function(data){ + console.info(CaseName + JSON.stringify(data)); + expect(data.responseCode === net_http.ResponseCode.OK).assertTrue(); + done(); + return; + }); + }); + + /** + * @tc.number Telephony_NetStack_HttpTestCacheFlush_0100 + * @tc.name use callback form test cache.flush + * @tc.desc cache flush test + */ + + it('Telephony_NetStack_HttpTestCacheFlush_0100', 0, async function(done){ + let CaseName = 'Telephony_NetStack_HttpTestCacheFlush_0100'; + let http = net_http.createHttp(); + let cache = net_http.createHttpResponseCache(10*1024*1024); + http.request('https://httpbin.org/anything',{ + usingCache : true + }).then(function (){ + cache.flush().then(function (data){ + console.info(CaseName + JSON.stringify(data)); + expect(data === undefined).assertTrue(); + done(); + return; + }) + }); + }); + + /** + * @tc.number Telephony_NetStack_HttpTestCacheFlush_0200 + * @tc.name use promise form test cache.flush + * @tc.desc cache flush test + */ + + it('Telephony_NetStack_HttpTestCacheFlush_0200', 0, async function(done){ + let CaseName = 'Telephony_NetStack_HttpTestCacheFlush_0200'; + let http = net_http.createHttp(); + let cache = net_http.createHttpResponseCache(10*1024*1024); + http.request('https://httpbin.org/anything',{ + usingCache : true + }).then(function (){ + cache.flush(function (data){ + console.info(CaseName + JSON.stringify(data)); + expect(data === undefined).assertTrue(); + done(); + return; + }) + }); + }); + + /** + * @tc.number Telephony_NetStack_HttpTestCacheDelete_0100 + * @tc.name use callback form test cache.delete + * @tc.desc cache flush test + */ + + it('Telephony_NetStack_HttpTestCacheDelete_0100', 0, async function(done){ + let CaseName = 'Telephony_NetStack_HttpTestCacheDelete_0100'; + let http = net_http.createHttp(); + let cache = net_http.createHttpResponseCache(10*1024*1024); + http.request('https://httpbin.org/anything',{ + usingCache : true + }).then(function (){ + cache.delete().then(function (data){ + console.info(CaseName + JSON.stringify(data)); + expect(data === undefined).assertTrue(); + done(); + return; + }) + }); + }); + + /** + * @tc.number Telephony_NetStack_HttpTestCacheDelete_0200 + * @tc.name use callback form test cache.delete + * @tc.desc cache flush test + */ + + it('Telephony_NetStack_HttpTestCacheDelete_0200', 0, async function(done){ + let CaseName = 'Telephony_NetStack_HttpTestCacheDelete_0200'; + let http = net_http.createHttp(); + let cache = net_http.createHttpResponseCache(10*1024*1024); + http.request('https://httpbin.org/anything',{ + usingCache : true + }).then(function (){ + cache.delete(function (data){ + console.info(CaseName + JSON.stringify(data)); + expect(data === undefined).assertTrue(); + done(); + return; + }) + }); + }); + }); +}; \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/List.test.js b/telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/List.test.js index e99428332..d06dbcc2e 100644 --- a/telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/List.test.js +++ b/telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/List.test.js @@ -13,7 +13,11 @@ * limitations under the License. */ import Telephony_NETSTACK_HTTPTest from './NetworkManagerHttp.test.js' + import Http2Test from './Http2Test.js' + import HttpCacheTest from './HttpCacheTest.js' export default function testsuite() { Telephony_NETSTACK_HTTPTest() + Http2Test() + HttpCacheTest() } diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/List.test.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/List.test.ets index aea124115..3947062cd 100644 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/List.test.ets +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/List.test.ets @@ -18,6 +18,7 @@ import connectionJsunit from './ConnectionJsunit.test.ets'; import socketJsunit from './SocketJsunit.test.ets'; import webSocketJsunit from './WebSocketJsunit.test.ets'; import connectionSecondJsUnit from './ConnectionSecondJsUnit.test.ets'; +import networkManagerSocketTest from './NetworkManagerSocket.test' export default function testsuite() { //other @@ -25,4 +26,5 @@ export default function testsuite() { webSocketJsunit(); connectionJsunit(); connectionSecondJsUnit(); + networkManagerSocketTest(); } \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/NetworkManagerSocket.test.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/NetworkManagerSocket.test.ets new file mode 100644 index 000000000..465e04a54 --- /dev/null +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/NetworkManagerSocket.test.ets @@ -0,0 +1,367 @@ +// @ts-nocheck +/* + * Copyright (C) 2022 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 { describe, it, expect, beforeAll, afterAll, afterEach, beforeEach } from 'hypium/index'; +import socket from "@ohos.net.socket"; + +let sendData = "hello!"; +let instance = undefined; + +let options = { + ALPNProtocols: ["spdy/1", "http/1.1"], + address: { + address: "192.168.31.96", + port: 5555, + family: 1 + }, + secureOptions: { + key: "key", + cert: "cert", + ca: ["ca"], + passwd: "123456", + protocols: [socket.Protocol.TLSv12, socket.Protocol.TLSv13], + useRemoteCipherPrefer: true, + signatureAlgorithms: "rsa_pss_rsae_sha256:ECDSA+SHA256", + cipherSuites: "AES256-SHA256" + }, +} + +export default function networkManagerSocketTest() { + + describe("Telephony_NetworkManager_SocketTest", function () { + + beforeAll(async function () { + console.log('Telephony_NetworkManager_ActsNetworkManagerSocketTest beforeAll start') + console.log('Telephony_NetworkManager_ActsNetworkManagerSocketTest beforeAll end') + }) + + afterAll(async function () { + console.log('Telephony_NetworkManager_ActsNetworkManagerSocketTest afterAll start') + console.log('Telephony_NetworkManager_ActsNetworkManagerSocketTest afterAll end') + }) + + /** + * @tc.number Telephony_NetworkManager_constructTLSSocketInstance_0100 + * @tc.name Test create TLSSocket object + * @tc.desc Function test + */ + it('Telephony_NetworkManager_constructTLSSocketInstance_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + if (instance != "") { + expect(instance).assertInstanceOf('Object'); + done(); + } else { + expect().assertFail(); + done(); + } + }) + + /** + * @tc.number Telephony_NetworkManager_connect_Async_0100 + * @tc.name Test connect() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_connect_Async_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.connect(options, (err) => { + expect(options.ALPNProtocols != undefined).assertEqual(true); + expect(options.address != undefined).assertEqual(true); + expect(options.secureOptions != undefined).assertEqual(true); + expect(options.secureOptions.key != undefined).assertEqual(true); + expect(options.secureOptions.cert != undefined).assertEqual(true); + expect(options.secureOptions.ca != undefined).assertEqual(true); + expect(options.secureOptions.passwd != undefined).assertEqual(true); + expect(options.secureOptions.protocols != undefined).assertEqual(true); + expect(options.secureOptions.protocols[0] == "TLSv1.2").assertEqual(true); + expect(options.secureOptions.protocols[1] == "TLSv1.3").assertEqual(true); + expect(options.secureOptions.useRemoteCipherPrefer != undefined).assertEqual(true); + expect(options.secureOptions.signatureAlgorithms != undefined).assertEqual(true); + expect(options.secureOptions.cipherSuites != undefined).assertEqual(true); + expect(socket.X509CertRawData == undefined).assertEqual(true); + if (err == undefined) { + expect().assertFail(); + done(); + } else { + expect(err != undefined).assertEqual(true); + done(); + } + }) + }) + + /** + * @tc.number Telephony_NetworkManager_connect_Promise_0100 + * @tc.name Test connect() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_connect_Promise_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.connect(options).then(() => { + expect().assertFail(); + done(); + }).catch((err) => { + expect(err != undefined).assertEqual(true); + done(); + }) + }) + + /** + * @tc.number Telephony_NetworkManager_close_Async_0100 + * @tc.name Test close() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_close_Async_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.close((err) => { + if (err == undefined) { + expect().assertFail(); + done(); + } else { + expect(err != undefined).assertEqual(true); + done(); + } + }) + }) + + /** + * @tc.number Telephony_NetworkManager_close_Promise_0100 + * @tc.name Test close() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_close_Promise_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.close().then(() => { + expect().assertFail(); + done(); + }).catch((err) => { + expect(err != undefined).assertEqual(true); + done(); + }) + }) + + /** + * @tc.number Telephony_NetworkManager_getCertificate_Async_0100 + * @tc.name Test getCertificate() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_getCertificate_Async_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.getCertificate((err, data) => { + if (err == undefined) { + expect().assertFail(); + done(); + } else { + expect(data).assertEqual(undefined); + expect(err != undefined).assertEqual(true); + done(); + } + }) + }) + + /** + * @tc.number Telephony_NetworkManager_getCertificate_Promise_0100 + * @tc.name Test getCertificate() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_getCertificate_Promise_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.getCertificate().then((data) => { + expect(data).assertEqual(undefined); + expect().assertFail(); + done(); + }).catch((err) => { + expect(err != undefined).assertEqual(true); + done(); + }) + }) + + /** + * @tc.number Telephony_NetworkManager_getRemoteCertificate_Async_0100 + * @tc.name Test getRemoteCertificate() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_getRemoteCertificate_Async_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.getRemoteCertificate((err, data) => { + if (err == undefined) { + expect().assertFail(); + done(); + } else { + expect(data).assertEqual(undefined); + expect(err != undefined).assertEqual(true); + done(); + } + }) + }) + + /** + * @tc.number Telephony_NetworkManager_getRemoteCertificate_Promise_0100 + * @tc.name Test getRemoteCertificate() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_getRemoteCertificate_Promise_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.getRemoteCertificate().then((data) => { + expect(data).assertEqual(undefined); + expect().assertFail(); + done(); + }).catch((err) => { + expect(err != undefined).assertEqual(true); + done(); + }) + }) + + /** + * @tc.number Telephony_NetworkManager_getProtocol_Async_0100 + * @tc.name Test getProtocol() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_getProtocol_Async_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.getProtocol((err, data) => { + if (err == undefined) { + expect().assertFail(); + done(); + } else { + expect(data).assertEqual(undefined); + expect(err != undefined).assertEqual(true); + done(); + } + }) + }) + + /** + * @tc.number Telephony_NetworkManager_getProtocol_Promise_0100 + * @tc.name Test getProtocol() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_getProtocol_Promise_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.getProtocol().then((data) => { + expect(data).assertEqual(undefined); + expect().assertFail(); + done(); + }).catch((err) => { + expect(err != undefined).assertEqual(true); + done(); + }) + }) + + /** + * @tc.number Telephony_NetworkManager_getCipherSuites_Async_0100 + * @tc.name Test getCipherSuite() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_getCipherSuites_Async_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.getCipherSuite((err, data) => { + if (err == undefined) { + expect().assertFail(); + done(); + } else { + expect(data).assertEqual(undefined); + expect(err != undefined).assertEqual(true); + done(); + } + }) + }) + + /** + * @tc.number Telephony_NetworkManager_getCipherSuites_Promise_0100 + * @tc.name Test getCipherSuite() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_getCipherSuites_Promise_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.getCipherSuite().then((data) => { + expect(data).assertEqual(undefined); + expect().assertFail(); + done(); + }).catch((err) => { + expect(err != undefined).assertEqual(true); + done(); + }) + }) + + /** + * @tc.number Telephony_NetworkManager_getSignatureAlgorithms_Async_0100 + * @tc.name Test getSignatureAlgorithms() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_getSignatureAlgorithms_Async_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.getSignatureAlgorithms((err, data) => { + if (err == undefined) { + expect().assertFail(); + done(); + } else { + expect(data).assertEqual(undefined); + expect(err != undefined).assertEqual(true); + done(); + } + }) + }) + + /** + * @tc.number Telephony_NetworkManager_getSignatureAlgorithms_Promise_0100 + * @tc.name Test getSignatureAlgorithms() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_getSignatureAlgorithms_Promise_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.getSignatureAlgorithms().then((data) => { + expect(data).assertEqual(undefined); + expect().assertFail(); + done(); + }).catch((err) => { + expect(err != undefined).assertEqual(true); + done(); + }) + }) + + /** + * @tc.number Telephony_NetworkManager_send_Async_0100 + * @tc.name Test send() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_send_Async_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.send(sendData, (err) => { + if (err == undefined) { + expect().assertFail(); + done(); + } else { + expect(err != undefined).assertEqual(true); + done(); + } + }) + }) + + /** + * @tc.number Telephony_NetworkManager_send_Promise_0100 + * @tc.name Test send() interface + * @tc.desc Function test + */ + it('Telephony_NetworkManager_send_Promise_0100', 0, async function (done) { + instance = socket.constructTLSSocketInstance() + instance.send(sendData).then(() => { + expect().assertFail(); + done(); + }).catch((err) => { + expect(err != undefined).assertEqual(true); + done(); + }) + }) + }) +} \ No newline at end of file diff --git a/telephony/telephonyjstest/sms_mms/BUILD.gn b/telephony/telephonyjstest/sms_mms/BUILD.gn index 7ab63f542..b633ffb2c 100644 --- a/telephony/telephonyjstest/sms_mms/BUILD.gn +++ b/telephony/telephonyjstest/sms_mms/BUILD.gn @@ -15,6 +15,6 @@ import("//test/xts/tools/build/suite.gni") group("sms_mms") { testonly = true if (is_standard_system) { - deps = [ "sms_mms_error:ActSmsMmsErrorTest" ] + deps = [ "sms_mms_error:ActsSmsMmsErrorTest" ] } } diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_error/BUILD.gn b/telephony/telephonyjstest/sms_mms/sms_mms_error/BUILD.gn index 424715f5a..b3bb1fc79 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_error/BUILD.gn +++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/BUILD.gn @@ -13,14 +13,14 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("ActSmsMmsErrorTest") { +ohos_js_hap_suite("ActsSmsMmsErrorTest") { hap_profile = "./src/main/config.json" deps = [ ":hjs_demo_js_assets", ":hjs_demo_resources", ] certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActSmsMmsErrorTest" + hap_name = "ActsSmsMmsErrorTest" part_name = "sms_mms" subsystem_name = "telephony" } -- GitLab