diff --git a/telephony/telephonyjstest/netmanager_base/dns/Test.json b/telephony/telephonyjstest/netmanager_base/dns/Test.json index e0d8ef8a0d800fc4424af33024108fb8c29d134f..3ad5aa31cfdf9ef66c312400efff3bd1c5f7ddae 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/Test.json +++ b/telephony/telephonyjstest/netmanager_base/dns/Test.json @@ -2,7 +2,7 @@ "description": "Function test of sim manager interface", "driver": { "type": "JSUnitTest", - "test-timeout": "1800000", + "test-timeout": "900000", "package": "com.ohos.dns", "shell-timeout": "60000" }, diff --git a/telephony/telephonyjstest/netmanager_base/jshttp/Test.json b/telephony/telephonyjstest/netmanager_base/jshttp/Test.json index c09c93e8521456fd8678f2a3d90bf070c5bf2b50..05f25c764ae46670f4a5c3dc2cafd6713c044e0a 100644 --- a/telephony/telephonyjstest/netmanager_base/jshttp/Test.json +++ b/telephony/telephonyjstest/netmanager_base/jshttp/Test.json @@ -2,7 +2,7 @@ "description": "Function test of sim manager interface", "driver": { "type": "JSUnitTest", - "test-timeout": "1800000", + "test-timeout": "900000", "package": "com.ohos.jshttp", "shell-timeout": "60000" }, diff --git a/telephony/telephonyjstest/netmanager_base/jshttp/entry/src/main/js/test/NetworkManagerHttp.test.js b/telephony/telephonyjstest/netmanager_base/jshttp/entry/src/main/js/test/NetworkManagerHttp.test.js index 51a68b3f48e6e0b7c77f0447db0521bd3cb53eba..0c3d0ca9aab42c1529621ed6d8aca5c05ea62d30 100644 --- a/telephony/telephonyjstest/netmanager_base/jshttp/entry/src/main/js/test/NetworkManagerHttp.test.js +++ b/telephony/telephonyjstest/netmanager_base/jshttp/entry/src/main/js/test/NetworkManagerHttp.test.js @@ -42,7 +42,9 @@ describe('Telephony_NETSTACK_HTTPTest',function(){ let http = netHttp.createHttp() http.request("https://httpbin.org/user-agent").then(function(data){ expect(data.responseCode === netHttp.ResponseCode.OK).assertTrue(); - expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue(); + console.info(JSON.stringify(data)); + expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0" + || JSON.parse(data.result)["user-agent"].indexOf("Dalvik/2.1.0")).assertTrue(); done(); }) }); diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json index d7233dc4ef835a9676ac2a8fedcd2104216ce0a0..79882ec7b93e4c975671840862463134c9e1aec4 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/Test.json @@ -2,7 +2,7 @@ "description": "Function test of sim manager interface", "driver": { "type": "JSUnitTest", - "test-timeout": "1800000", + "test-timeout": "900000", "package": "com.ohos.network_nopermission", "shell-timeout": "60000" }, diff --git a/telephony/telephonyjstest/netmanager_base/network_wifi/Test.json b/telephony/telephonyjstest/netmanager_base/network_wifi/Test.json index 61ebec364ea70f6f580ab07d6235e817ddbfc1ab..b0b262dd1125811932f5ca640048193a07576e9a 100644 --- a/telephony/telephonyjstest/netmanager_base/network_wifi/Test.json +++ b/telephony/telephonyjstest/netmanager_base/network_wifi/Test.json @@ -2,7 +2,7 @@ "description": "Function test of sim manager interface", "driver": { "type": "JSUnitTest", - "test-timeout": "1800000", + "test-timeout": "900000", "package": "com.ohos.network_wifi", "shell-timeout": "60000" }, diff --git a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/test/NetworkManagerRegister.test.js b/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/test/NetworkManagerRegister.test.js index 1e4f84680c4841794adad0c345d1d9bb4c23085e..5a7b7af1b646ae7ae292bd88592be3d98f70fd7e 100644 --- a/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/test/NetworkManagerRegister.test.js +++ b/telephony/telephonyjstest/netmanager_base/register/entry/src/main/js/test/NetworkManagerRegister.test.js @@ -40,6 +40,9 @@ function sleepOther(timeout) { for (var t = Date.now(); Date.now() - t <= timeout;) ; } + function sleep(time) { + return new Promise((resolve)=>setTimeout(resolve,time)); + } /** *@tc.number Telephony_NetworkManager_register_Async_0100 @@ -229,13 +232,13 @@ console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); } }); - netConn.on('netBlockStatusChange', (error, value) => { + netConn.on('netCapabilitiesChange', (error, value) => { if (error) { console.info(`${caseName} register fail: ${error}`); expect().assertFail(); done(); } else { - console.info(`${caseName} netBlockStatusChange handle = :` + value.handle.netId); + console.info(`${caseName} netCapabilitiesChange handle = :` + value.handle.netId); } }); netConn.on('netConnectionPropertiesChange', (error, value) => { @@ -2497,7 +2500,7 @@ expect().assertFail(); done(); } - + await sleep(1000); done(); }); done(); diff --git a/telephony/telephonyjstest/netmanager_base/socket/entry/src/main/js/test/NetStackSocket.test.js b/telephony/telephonyjstest/netmanager_base/socket/entry/src/main/js/test/NetStackSocket.test.js index f92d99872e3bca1705eb0e5d5dabcebd14346c28..ecddf4d11d9ea2977e42e845e85259eaad964ebb 100644 --- a/telephony/telephonyjstest/netmanager_base/socket/entry/src/main/js/test/NetStackSocket.test.js +++ b/telephony/telephonyjstest/netmanager_base/socket/entry/src/main/js/test/NetStackSocket.test.js @@ -227,6 +227,14 @@ describe('Telephony_NETSTACK_SocketTest', function () { it('Telephony_NetStack_UDPTest1200', 0, function (done) { let udp = netSocket.constructUDPSocketInstance() + udp.on('message', function () { + }) + udp.on('listening', function () { + }) + udp.on('close', function () { + }) + udp.on('error', function () { + }) udp.off('message', function () { expect().assertFail() done() @@ -246,9 +254,6 @@ describe('Telephony_NETSTACK_SocketTest', function () { done() }); - - - /** * @tc.number Telephony_NetStack_TCPTest0100 * @tc.name TCP bind,callback方式,预计无异常,错误码为undefined @@ -423,7 +428,7 @@ describe('Telephony_NETSTACK_SocketTest', function () { expect().assertFail() done() }) - tcp.on('listening', function () { + tcp.on('connect', function () { expect().assertFail() done() }) @@ -446,11 +451,19 @@ describe('Telephony_NETSTACK_SocketTest', function () { it('Telephony_NetStack_TCPTest1200', 0, function (done) { let tcp = netSocket.constructTCPSocketInstance() + tcp.on('message', function () { + }) + tcp.on('connect', function () { + }) + tcp.on('close', function () { + }) + tcp.on('error', function () { + }) tcp.off('message', function () { expect().assertFail() done() }) - tcp.off('listening', function () { + tcp.off('connect', function () { expect().assertFail() done() }) diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json b/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json index 08058699b9ec9664911c956b61d707c3d3a45305..3ccd069b60940bd4dc345d6bc05edf61c2e8ed79 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/Test.json @@ -2,7 +2,7 @@ "description": "Function test of sim manager interface", "driver": { "type": "JSUnitTest", - "test-timeout": "1800000", + "test-timeout": "900000", "package": "com.ohos.system_fetch", "shell-timeout": "60000" }, diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/Http.fetch.test.js b/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/Http.fetch.test.js index 127dd2339aa0c969e09a1ab9e104633e066ba58e..3b46ef232926b4f4b9da8803a2717faf53a53589 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/Http.fetch.test.js +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/entry/src/main/js/test/Http.fetch.test.js @@ -18,7 +18,7 @@ import NetHttp from '@ohos.net.http'; import fetch from '@system.fetch'; import {describe, afterAll, it, expect, beforeAll, afterEach} from 'deccjsunit/index'; -describe("Telephony_NetStack_HttpTest", function () { +describe("Telephony_NetStack_HttpFetchTest", function () { /** * @tc.number Telephony_NetStack_HttpTestBasicGet_0100 @@ -44,7 +44,8 @@ describe("Telephony_NetStack_HttpTest", function () { http.request("https://httpbin.org/user-agent").then(function(data){ console.info("NetStack "+ JSON.stringify(data)); expect(data.responseCode === NetHttp.ResponseCode.OK).assertTrue() - expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0").assertTrue() + expect(JSON.parse(data.result)["user-agent"] === "libcurl-agent/1.0" + || JSON.parse(data.result)["user-agent"].indexOf("Dalvik/2.1.0")).assertTrue(); done(); }) }); @@ -174,7 +175,8 @@ describe("Telephony_NetStack_HttpTest", function () { success : function(data){ console.info("NetStack fetch success "+ JSON.stringify(data)) expect(data.code === 200).assertTrue() - expect(JSON.parse(data.data)["user-agent"] === "libcurl-agent/1.0").assertTrue() + expect(JSON.parse(data.data)["user-agent"] === "libcurl-agent/1.0" + || JSON.parse(data.data)["user-agent"].indexOf("Dalvik/2.1.0")).assertTrue(); done(); }, fail : function(){ @@ -200,7 +202,7 @@ describe("Telephony_NetStack_HttpTest", function () { success : function(data){ console.info("NetStack fetch success "+ JSON.stringify(data)) expect(data.code === 200).assertTrue() - expect(data.data["user-agent"] === "libcurl-agent/1.0").assertTrue() + expect(data.data["user-agent"]).assertContain("libcurl-agent/1.0"||"Dalvik/2.1.0"); done(); }, fail : function(){ diff --git a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js index 8023e4028ec332c3f7abd14f86bf44c192ab3a1c..35cbf44c9ccb3a53ca37f075f9ac446755412681 100644 --- a/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js +++ b/telephony/telephonyjstest/network_search/network_search_errors/entry/src/main/js/test/NetworkSearchErrors.test.js @@ -172,7 +172,7 @@ describe('ActsNetworkSearchTest', function () { radio.getISOCountryCodeForNetwork(SLOT_2, (err, data) => { if (err) { console.info(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 fail err: ${err}`); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); done(); return; } @@ -196,7 +196,7 @@ describe('ActsNetworkSearchTest', function () { expect(data.length === 0).assertTrue(); } catch (err) { console.info(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 fail err: ${err}`); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); done(); return; } diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js index 63e03e8b5a4ec83f2d0621e56d9afd50701f019d..ea2afa90f6474ad0dc226ecab67eb0fd8d15b686 100644 --- a/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js +++ b/telephony/telephonyjstest/sim/sim_manager_function_test/entry/src/main/js/test/SimManager.test.js @@ -268,7 +268,7 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_isSimActive_Async_0700'; sim.isSimActive(env.SLOTID2, (err, data) => { console.info("isSimActive async err info :" + JSON.stringify(err) + "data:" + JSON.stringify(data)); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); done(); }); }); @@ -288,7 +288,7 @@ describe('SimManagerTest', function () { done(); }).catch(err => { console.info("isSimActive promise err info :" + JSON.stringify(err)); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); done(); }); }); @@ -303,7 +303,7 @@ describe('SimManagerTest', function () { const CASE_NAME = 'Telephony_Sim_hasSimCard_Async_0600'; sim.hasSimCard(env.SLOTID2, (err, data) => { if (err) { - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); console.info(`${CASE_NAME} fail, err: ${err.message}`); done(); return; @@ -323,7 +323,7 @@ describe('SimManagerTest', function () { try { let data = await sim.hasSimCard(env.SLOTID2); } catch (err) { - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); console.info(`${CASE_NAME} fail, err: ${err.message}`); done(); return; @@ -355,7 +355,7 @@ describe('SimManagerTest', function () { sim.getCardType(env.SLOTID2, (err, cardType) => { if (err) { console.info(`${CASE_NAME} GetCardType error: ${err.message}`); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); done(); return; } @@ -376,7 +376,7 @@ describe('SimManagerTest', function () { console.info(`${CASE_NAME} test finish.`); } catch (err) { console.info(`${CASE_NAME} GetCardType error: ${err.message}`); - expect(err.code).assertEqual("-1"); + expect(err.code).assertEqual("202"); } done(); });