Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
02526510
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看板
提交
02526510
编写于
7月 15, 2023
作者:
H
hu0475
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完成telephony子系统Connection模块的跨平台测试套 完成telephony子系统WebSocket模块的跨平台测试套
Signed-off-by:
N
hu0475
<
huyanqiang5@huawei.com
>
上级
1d7a6a1d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
107 addition
and
69 deletion
+107
-69
telephony/BUILD.gn
telephony/BUILD.gn
+1
-1
telephony/crossplatform/telephonyConnectionetstest/BUILD.gn
telephony/crossplatform/telephonyConnectionetstest/BUILD.gn
+5
-1
telephony/crossplatform/telephonyConnectionetstest/src/main/ets/test/Connection.test.ets
...nyConnectionetstest/src/main/ets/test/Connection.test.ets
+8
-64
telephony/crossplatform/telephonyWebSocketetstest/BUILD.gn
telephony/crossplatform/telephonyWebSocketetstest/BUILD.gn
+5
-1
telephony/crossplatform/telephonyWebSocketetstest/src/main/ets/test/WebSocket.test.ets
...honyWebSocketetstest/src/main/ets/test/WebSocket.test.ets
+88
-2
未找到文件。
telephony/BUILD.gn
浏览文件 @
02526510
...
...
@@ -14,8 +14,8 @@
group("telephony") {
testonly = true
deps = [
"crossplatform/telephony_http_test:ActsCrossplatformTelephonyHttpEtsTest",
"crossplatform:crossplatform",
"crossplatform/telephony_http_test:ActsCrossplatformTelephonyHttpEtsTest",
"telephonyjstest:telephonyjstest",
]
}
telephony/crossplatform/telephonyConnectionetstest/BUILD.gn
浏览文件 @
02526510
...
...
@@ -20,6 +20,7 @@ ohos_js_hap_suite("ActsCrossplatformConnectionTest") {
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
# hap_name: HAP的名字,可选,默认为目标名
hap_name = "ActsCrossplatformConnectionTest"
subsystem_name = "communication"
...
...
@@ -28,6 +29,7 @@ ohos_js_hap_suite("ActsCrossplatformConnectionTest") {
ohos_app_scope("windowStage_app_profile") {
# app_profile: HAP的AppScope中的app.json,只在Stage模型下使用
app_profile = "AppScope/app.json"
# sources: 资源文件路径
sources = [ "AppScope/resources" ]
}
...
...
@@ -38,8 +40,10 @@ ohos_js_assets("windowStage_js_assets") {
ohos_resources("windowStage_resources") {
# sources: 资源文件路径
sources = [ "src/main/resources" ]
# deps: 当前目标的依赖
deps = [ ":windowStage_app_profile" ]
# hap_profile: HAP的config.json,Stage模型对应module.json
hap_profile = "src/main/module.json"
}
\ No newline at end of file
}
telephony/crossplatform/telephonyConnectionetstest/src/main/ets/test/Connection.test.ets
浏览文件 @
02526510
...
...
@@ -52,24 +52,24 @@ export default function connectionTest() {
* @tc.level : Level 2
*/
it('testHasDefaultNet001', 0, function (done) {
console.log('testHasDefaultNet001 1')
console.log('testHasDefaultNet001 1')
;
connection.hasDefaultNet((error, value) => {
console.log('testHasDefaultNet001 2')
console.log('testHasDefaultNet001 2')
;
if (!error) {
console.log('testHasDefaultNet001 3')
console.log('testHasDefaultNet001 3')
;
console.log(`testHasDefaultNet001 case success,data:` + value);
console.log('testHasDefaultNet001 4')
console.log('testHasDefaultNet001 4')
;
expect(value).assertTrue();
done();
} else {
console.log('testHasDefaultNet001 6')
console.log('testHasDefaultNet001 6')
;
console.log(`testHasDefaultNet001 error, case failed,errCode:` + error.code);
console.log('testHasDefaultNet001 7')
console.log('testHasDefaultNet001 7')
;
expect().assertFail();
done();
}
});
console.log('testHasDefaultNet001 9')
console.log('testHasDefaultNet001 9')
;
});
/*
...
...
@@ -176,34 +176,6 @@ export default function connectionTest() {
}
});
/**
* @tc.number: TEST_ON_NET_BLOCK_STATUS_CHANGE_001
* @tc.name : testOn_NetBlockStatusChange001
* @tc.desc : Subscribe to network blocking status events, using the callback method as an asynchronous method.
* @tc.size : MediumTest
* @tc.type : Method
* @tc.level : Level 2
*/
it('testOn_NetBlockStatusChange001', 0, function (done) {
let netConn = connection.createNetConnection();
netConn.register((error) => {
if (!error) {
netConn.on('netBlockStatusChange',(data) => {
console.log("success11:" + data);
});
netConn.unregister((error) => {
console.log("result11:" + error);
});
expect(true).assertTrue();
done();
} else {
console.log(`register failed,errCode:` + error.code);
expect().assertFail();
done();
}
});
});
/**
* @tc.number: TEST_ON_NET_CAPABILITIES_CHANGE_001
* @tc.name : testOn_NetCapabilitiesChange001
...
...
@@ -218,34 +190,7 @@ export default function connectionTest() {
if (!error) {
netConn.on('netCapabilitiesChange',(data) => {
console.log("success11:" + data);
});
netConn.unregister((error) => {
console.log("result11:" + error);
});
expect(true).assertTrue();
done();
} else {
console.log(`register failed,errCode:` + error.code);
expect().assertFail();
done();
}
});
});
/**
* @tc.number: TEST_ON_NET_CONNECTION_PROPERTIES_CHANGE_001
* @tc.name : testOn_NetConnectionPropertiesChange001
* @tc.desc : Subscribe to network connection information change events.
* @tc.size : MediumTest
* @tc.type : Method
* @tc.level : Level 2
*/
it('testOn_NetConnectionPropertiesChange001', 0, function (done) {
let netConn = connection.createNetConnection();
netConn.register((error) => {
if (!error) {
netConn.on('netConnectionPropertiesChange',(data) => {
console.log("success11:" + data);
expect(data.netCap.bearerTypes.length >= 0).assertTrue();
});
netConn.unregister((error) => {
console.log("result11:" + error);
...
...
@@ -358,6 +303,5 @@ export default function connectionTest() {
done();
});
})
}
telephony/crossplatform/telephonyWebSocketetstest/BUILD.gn
浏览文件 @
02526510
...
...
@@ -20,6 +20,7 @@ ohos_js_hap_suite("ActsCrossplatformWebSocketTest") {
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
# hap_name: HAP的名字,可选,默认为目标名
hap_name = "ActsCrossplatformWebSocketTest"
subsystem_name = "communication"
...
...
@@ -28,6 +29,7 @@ ohos_js_hap_suite("ActsCrossplatformWebSocketTest") {
ohos_app_scope("windowStage_app_profile") {
# app_profile: HAP的AppScope中的app.json,只在Stage模型下使用
app_profile = "AppScope/app.json"
# sources: 资源文件路径
sources = [ "AppScope/resources" ]
}
...
...
@@ -38,8 +40,10 @@ ohos_js_assets("windowStage_js_assets") {
ohos_resources("windowStage_resources") {
# sources: 资源文件路径
sources = [ "src/main/resources" ]
# deps: 当前目标的依赖
deps = [ ":windowStage_app_profile" ]
# hap_profile: HAP的config.json,Stage模型对应module.json
hap_profile = "src/main/module.json"
}
\ No newline at end of file
}
telephony/crossplatform/telephonyWebSocketetstest/src/main/ets/test/WebSocket.test.ets
浏览文件 @
02526510
...
...
@@ -19,8 +19,6 @@ export default function webSocketTest() {
describe('webSocketTest', function () {
console.log("************* webSocket Test start*************");
let serverIpAddress: string = "ws://192.168.1.100:8081/string";
/*
* @tc.number: TEST_CREATE_WEB_SOCKET_001
* @tc.name : testCreateWebSocket001
...
...
@@ -32,6 +30,17 @@ export default function webSocketTest() {
it('testCreateWebSocket001', 0, async function (done) {
var mWebSocket = webSocket.createWebSocket();
expect(mWebSocket != null).assertTrue();
mWebSocket.close((error, value) => {
if (!error) {
console.log(`case success:` + value);
expect(value).assertTrue();
done();
} else {
console.log(`error, case failed,errCode:` + error.code);
expect(error.code).assertEqual(2302999);
done();
}
});
done();
});
...
...
@@ -161,6 +170,54 @@ export default function webSocketTest() {
});
});
/*
* @tc.number: TEST_CONNECT_004
* @tc.name : testConnect004
* @tc.desc : Initiates a WebSocket request to establish a WebSocket connection to a given URL.
* @tc.size : MediumTest
* @tc.type : Method
* @tc.level : Level 2
*/
it('testConnect004', 0, async function (done) {
let mWebSocket = webSocket.createWebSocket();
mWebSocket.connect(null).then(value => {
console.log(`case success11:` + value);
expect(value).assertTrue();
done();
}).catch((error) => {
console.log(`error, case failed,errCode:` + error.code);
expect(error.code).assertEqual(401);
done();
});
});
/*
* @tc.number: TEST_CONNECT_005
* @tc.name : testConnect005
* @tc.desc : Initiates a WebSocket request to establish a WebSocket connection to a given URL.
* @tc.size : MediumTest
* @tc.type : Method
* @tc.level : Level 2
*/
it('testConnect005', 0, async function (done) {
let mWebSocket = webSocket.createWebSocket();
let webSocketRequestOptions: webSocket.WebSocketRequestOptions = {
header: {
key: "value",
key2: "value2"
}
}
mWebSocket.connect("ws://19211.16811.1.100:8081/string", webSocketRequestOptions).then(value => {
console.log(`case success11:` + value);
expect(value).assertTrue();
done();
}).catch((error) => {
console.log(`error, case failed,errCode:` + error.code);
expect(error.code).assertEqual(-1);
done();
});
});
/*
* @tc.number: TEST_SEND_001
* @tc.name : testSend001
...
...
@@ -234,6 +291,35 @@ export default function webSocketTest() {
});
});
/*
* @tc.number: TEST_SEND_004
* @tc.name : testSend004
* @tc.desc : Sends data through a WebSocket connection.
* @tc.size : MediumTest
* @tc.type : Method
* @tc.level : Level 2
*/
it('testSend004', 0, async function (done) {
let mWebSocket = webSocket.createWebSocket();
var str = "Hello, server!(arrayBuffer promise mode)";
var buf = new ArrayBuffer(str.length);
var message = new Uint8Array(buf);
for (var i = 0, strLen = str.length; i < strLen; i++) {
message[i] = str.charCodeAt(i);
}
mWebSocket.send(message.buffer, (error, value) => {
if (!error) {
console.log(`case success:` + value);
expect(value).assertTrue();
done();
} else {
console.log(`error, case failed,errCode:` + error.code);
expect(error.code).assertEqual(2302999);
done();
}
});
});
/*
* @tc.number: TEST_CLOSE_001
* @tc.name : testClose001
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录