Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ff2aad89
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看板
提交
ff2aad89
编写于
5月 30, 2023
作者:
Z
zhangfuzhi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加用例兼容性
Signed-off-by:
N
zhangfuzhi
<
zhangfuzhi1@huawei.com
>
上级
fadcc00e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
360 addition
and
100 deletion
+360
-100
telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/CallManageAll.test.js
..._manager_ims2_call/src/main/js/test/CallManageAll.test.js
+4
-0
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/Http2Test.test.js
...netmanager_base/jshttp/src/main/js/test/Http2Test.test.js
+0
-0
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpCacheTest.test.js
...anager_base/jshttp/src/main/js/test/HttpCacheTest.test.js
+189
-0
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpRequest2JsunitTest.test.js
...se/jshttp/src/main/js/test/HttpRequest2JsunitTest.test.js
+0
-0
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/List.test.js
...test/netmanager_base/jshttp/src/main/js/test/List.test.js
+3
-3
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/NetworkManagerHttp.test.js
...r_base/jshttp/src/main/js/test/NetworkManagerHttp.test.js
+35
-23
telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/test/Http.fetch.test.js
...ger_base/system_fetch/src/main/js/test/Http.fetch.test.js
+94
-74
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
+35
-0
未找到文件。
telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/CallManageAll.test.js
浏览文件 @
ff2aad89
...
@@ -107,6 +107,10 @@ export default function CallManageImsCall() {
...
@@ -107,6 +107,10 @@ export default function CallManageImsCall() {
done
();
done
();
return
;
return
;
}
}
expect
(
call
.
CallState
.
CALL_STATE_UNKNOWN
).
assertEqual
(
-
1
);
expect
(
call
.
CallState
.
CALL_STATE_IDLE
).
assertEqual
(
0
);
expect
(
call
.
CallState
.
CALL_STATE_RINGING
).
assertEqual
(
1
);
expect
(
call
.
CallState
.
CALL_STATE_OFFHOOK
).
assertEqual
(
2
);
console
.
log
(
"
Telephony_CallManager_getCallState_Async_0100 : data =
"
+
JSON
.
stringify
(
data
));
console
.
log
(
"
Telephony_CallManager_getCallState_Async_0100 : data =
"
+
JSON
.
stringify
(
data
));
done
();
done
();
});
});
...
...
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/Http2Test.js
→
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/Http2Test.
test.
js
浏览文件 @
ff2aad89
文件已移动
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpCacheTest.js
→
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpCacheTest.
test.
js
浏览文件 @
ff2aad89
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
*/
*/
import
net_http
from
'
@ohos.net.http
'
;
import
net_http
from
'
@ohos.net.http
'
;
import
connection
from
'
@ohos.net.connection
'
import
{
describe
,
expect
,
it
}
from
'
@ohos/hypium
'
import
{
describe
,
expect
,
it
}
from
'
@ohos/hypium
'
export
default
function
HttpCacheTest
()
{
export
default
function
HttpCacheTest
()
{
...
@@ -26,15 +27,21 @@ export default function HttpCacheTest() {
...
@@ -26,15 +27,21 @@ export default function HttpCacheTest() {
*/
*/
it
(
'
Telephony_NetStack_HttpTestBasicGet_0100
'
,
0
,
async
function
(
done
){
it
(
'
Telephony_NetStack_HttpTestBasicGet_0100
'
,
0
,
async
function
(
done
){
let
http
=
net_http
.
createHttp
();
connection
.
hasDefaultNet
(
function
(
error
,
data
)
{
http
.
request
(
'
https://httpbin.org/anything
'
,
{
console
.
log
(
JSON
.
stringify
(
error
))
usingCache
:
true
console
.
log
(
'
data:
'
+
data
)
}).
then
(
function
(
data
){
if
(
data
)
{
http
.
destroy
();
let
http
=
net_http
.
createHttp
();
expect
(
data
.
responseCode
===
net_http
.
ResponseCode
.
OK
).
assertTrue
();
http
.
request
(
'
https://httpbin.org/anything
'
,
{
done
();
usingCache
:
true
return
;
}).
then
(
function
(
data
)
{
});
http
.
destroy
();
expect
(
data
.
responseCode
===
net_http
.
ResponseCode
.
OK
||
data
.
responseCode
>
500
).
assertTrue
();
done
();
return
;
});
}
})
});
});
/**
/**
...
@@ -45,16 +52,22 @@ export default function HttpCacheTest() {
...
@@ -45,16 +52,22 @@ export default function HttpCacheTest() {
it
(
'
Telephony_NetStack_HttpTestBasicGet_0200
'
,
0
,
async
function
(
done
){
it
(
'
Telephony_NetStack_HttpTestBasicGet_0200
'
,
0
,
async
function
(
done
){
let
CaseName
=
'
Telephony_NetStack_HttpTestBasicGet_0200
'
;
let
CaseName
=
'
Telephony_NetStack_HttpTestBasicGet_0200
'
;
let
http
=
net_http
.
createHttp
();
connection
.
hasDefaultNet
(
function
(
error
,
data
)
{
http
.
request
(
'
https://httpbin.org/anything
'
,
{
console
.
log
(
JSON
.
stringify
(
error
))
usingCache
:
false
console
.
log
(
'
data:
'
+
data
)
}).
then
(
function
(
data
){
if
(
data
)
{
http
.
destroy
();
let
http
=
net_http
.
createHttp
();
console
.
info
(
CaseName
+
JSON
.
stringify
(
data
));
http
.
request
(
'
https://httpbin.org/anything
'
,
{
expect
(
data
.
responseCode
===
net_http
.
ResponseCode
.
OK
).
assertTrue
();
usingCache
:
false
done
();
}).
then
(
function
(
data
)
{
return
;
http
.
destroy
();
});
console
.
info
(
CaseName
+
JSON
.
stringify
(
data
));
expect
(
data
.
responseCode
===
net_http
.
ResponseCode
.
OK
||
data
.
responseCode
>
500
).
assertTrue
();
done
();
return
;
});
}
})
});
});
/**
/**
...
@@ -65,19 +78,25 @@ export default function HttpCacheTest() {
...
@@ -65,19 +78,25 @@ export default function HttpCacheTest() {
it
(
'
Telephony_NetStack_HttpTestCacheFlush_0100
'
,
0
,
async
function
(
done
){
it
(
'
Telephony_NetStack_HttpTestCacheFlush_0100
'
,
0
,
async
function
(
done
){
let
CaseName
=
'
Telephony_NetStack_HttpTestCacheFlush_0100
'
;
let
CaseName
=
'
Telephony_NetStack_HttpTestCacheFlush_0100
'
;
let
http
=
net_http
.
createHttp
();
connection
.
hasDefaultNet
(
function
(
error
,
data
)
{
let
cache
=
net_http
.
createHttpResponseCache
(
10
*
1024
*
1024
);
console
.
log
(
JSON
.
stringify
(
error
))
http
.
request
(
'
https://httpbin.org/anything
'
,{
console
.
log
(
'
data:
'
+
data
)
usingCache
:
true
if
(
data
)
{
}).
then
(
function
(){
let
http
=
net_http
.
createHttp
();
cache
.
flush
().
then
(
function
(
data
){
let
cache
=
net_http
.
createHttpResponseCache
(
10
*
1024
*
1024
);
http
.
destroy
();
http
.
request
(
'
https://httpbin.org/anything
'
,
{
console
.
info
(
CaseName
+
JSON
.
stringify
(
data
));
usingCache
:
true
expect
(
data
===
undefined
).
assertTrue
();
}).
then
(
function
()
{
done
();
cache
.
flush
().
then
(
function
(
data
)
{
return
;
http
.
destroy
();
});
console
.
info
(
CaseName
+
JSON
.
stringify
(
data
));
});
expect
(
data
===
undefined
).
assertTrue
();
done
();
return
;
});
});
}
})
});
});
/**
/**
...
@@ -88,19 +107,25 @@ export default function HttpCacheTest() {
...
@@ -88,19 +107,25 @@ export default function HttpCacheTest() {
it
(
'
Telephony_NetStack_HttpTestCacheFlush_0200
'
,
0
,
async
function
(
done
){
it
(
'
Telephony_NetStack_HttpTestCacheFlush_0200
'
,
0
,
async
function
(
done
){
let
CaseName
=
'
Telephony_NetStack_HttpTestCacheFlush_0200
'
;
let
CaseName
=
'
Telephony_NetStack_HttpTestCacheFlush_0200
'
;
let
http
=
net_http
.
createHttp
();
connection
.
hasDefaultNet
(
function
(
error
,
data
)
{
let
cache
=
net_http
.
createHttpResponseCache
(
10
*
1024
*
1024
);
console
.
log
(
JSON
.
stringify
(
error
))
http
.
request
(
'
https://httpbin.org/anything
'
,{
console
.
log
(
'
data:
'
+
data
)
usingCache
:
true
if
(
data
)
{
}).
then
(
function
(){
let
http
=
net_http
.
createHttp
();
cache
.
flush
(
function
(
data
){
let
cache
=
net_http
.
createHttpResponseCache
(
10
*
1024
*
1024
);
http
.
destroy
();
http
.
request
(
'
https://httpbin.org/anything
'
,
{
console
.
info
(
CaseName
+
JSON
.
stringify
(
data
));
usingCache
:
true
expect
(
data
===
undefined
).
assertTrue
();
}).
then
(
function
()
{
done
();
cache
.
flush
(
function
(
data
)
{
return
;
http
.
destroy
();
});
console
.
info
(
CaseName
+
JSON
.
stringify
(
data
));
});
expect
(
data
===
undefined
).
assertTrue
();
done
();
return
;
});
});
}
})
});
});
/**
/**
...
@@ -111,19 +136,25 @@ export default function HttpCacheTest() {
...
@@ -111,19 +136,25 @@ export default function HttpCacheTest() {
it
(
'
Telephony_NetStack_HttpTestCacheDelete_0100
'
,
0
,
async
function
(
done
){
it
(
'
Telephony_NetStack_HttpTestCacheDelete_0100
'
,
0
,
async
function
(
done
){
let
CaseName
=
'
Telephony_NetStack_HttpTestCacheDelete_0100
'
;
let
CaseName
=
'
Telephony_NetStack_HttpTestCacheDelete_0100
'
;
let
http
=
net_http
.
createHttp
();
connection
.
hasDefaultNet
(
function
(
error
,
data
)
{
let
cache
=
net_http
.
createHttpResponseCache
(
10
*
1024
*
1024
);
console
.
log
(
JSON
.
stringify
(
error
))
http
.
request
(
'
https://httpbin.org/anything
'
,{
console
.
log
(
'
data:
'
+
data
)
usingCache
:
true
if
(
data
)
{
}).
then
(
function
(){
let
http
=
net_http
.
createHttp
();
cache
.
delete
().
then
(
function
(
data
){
let
cache
=
net_http
.
createHttpResponseCache
(
10
*
1024
*
1024
);
http
.
destroy
();
http
.
request
(
'
https://httpbin.org/anything
'
,
{
console
.
info
(
CaseName
+
JSON
.
stringify
(
data
));
usingCache
:
true
expect
(
data
===
undefined
).
assertTrue
();
}).
then
(
function
()
{
done
();
cache
.
delete
().
then
(
function
(
data
)
{
return
;
http
.
destroy
();
});
console
.
info
(
CaseName
+
JSON
.
stringify
(
data
));
});
expect
(
data
===
undefined
).
assertTrue
();
done
();
return
;
});
});
}
})
});
});
/**
/**
...
@@ -134,19 +165,25 @@ export default function HttpCacheTest() {
...
@@ -134,19 +165,25 @@ export default function HttpCacheTest() {
it
(
'
Telephony_NetStack_HttpTestCacheDelete_0200
'
,
0
,
async
function
(
done
){
it
(
'
Telephony_NetStack_HttpTestCacheDelete_0200
'
,
0
,
async
function
(
done
){
let
CaseName
=
'
Telephony_NetStack_HttpTestCacheDelete_0200
'
;
let
CaseName
=
'
Telephony_NetStack_HttpTestCacheDelete_0200
'
;
let
http
=
net_http
.
createHttp
();
connection
.
hasDefaultNet
(
function
(
error
,
data
)
{
let
cache
=
net_http
.
createHttpResponseCache
(
10
*
1024
*
1024
);
console
.
log
(
JSON
.
stringify
(
error
))
http
.
request
(
'
https://httpbin.org/anything
'
,{
console
.
log
(
'
data:
'
+
data
)
usingCache
:
true
if
(
data
)
{
}).
then
(
function
(){
let
http
=
net_http
.
createHttp
();
cache
.
delete
(
function
(
data
){
let
cache
=
net_http
.
createHttpResponseCache
(
10
*
1024
*
1024
);
http
.
destroy
();
http
.
request
(
'
https://httpbin.org/anything
'
,
{
console
.
info
(
CaseName
+
JSON
.
stringify
(
data
));
usingCache
:
true
expect
(
data
===
undefined
).
assertTrue
();
}).
then
(
function
()
{
done
();
cache
.
delete
(
function
(
data
)
{
return
;
http
.
destroy
();
});
console
.
info
(
CaseName
+
JSON
.
stringify
(
data
));
});
expect
(
data
===
undefined
).
assertTrue
();
done
();
return
;
});
});
}
})
});
});
});
});
};
};
\ No newline at end of file
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpRequest2JsunitTest.js
→
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/HttpRequest2JsunitTest.
test.
js
浏览文件 @
ff2aad89
文件已移动
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/List.test.js
浏览文件 @
ff2aad89
...
@@ -13,9 +13,9 @@
...
@@ -13,9 +13,9 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
Telephony_NETSTACK_HTTPTest
from
'
./NetworkManagerHttp.test.js
'
;
import
Telephony_NETSTACK_HTTPTest
from
'
./NetworkManagerHttp.test.js
'
;
import
Http2Test
from
'
./Http2Test.js
'
;
import
Http2Test
from
'
./Http2Test.
test.
js
'
;
import
HttpCacheTest
from
'
./HttpCacheTest.js
'
;
import
HttpCacheTest
from
'
./HttpCacheTest.
test.
js
'
;
import
HttpRequest2JsunitTest
from
'
./HttpRequest2JsunitTest.js
'
;
import
HttpRequest2JsunitTest
from
'
./HttpRequest2JsunitTest.
test.
js
'
;
export
default
function
testsuite
()
{
export
default
function
testsuite
()
{
HttpCacheTest
();
HttpCacheTest
();
...
...
telephony/telephonyjstest/netmanager_base/jshttp/src/main/js/test/NetworkManagerHttp.test.js
浏览文件 @
ff2aad89
...
@@ -30,7 +30,7 @@ export default function Telephony_NETSTACK_HTTPTest() {
...
@@ -30,7 +30,7 @@ export default function Telephony_NETSTACK_HTTPTest() {
let
http
=
netHttp
.
createHttp
();
let
http
=
netHttp
.
createHttp
();
http
.
request
(
"
https://httpbin.org/anything
"
).
then
(
function
(
data
)
{
http
.
request
(
"
https://httpbin.org/anything
"
).
then
(
function
(
data
)
{
http
.
destroy
();
http
.
destroy
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
).
assertTrue
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
||
data
.
responseCode
>
500
).
assertTrue
();
done
();
done
();
});
});
});
});
...
@@ -45,10 +45,12 @@ export default function Telephony_NETSTACK_HTTPTest() {
...
@@ -45,10 +45,12 @@ export default function Telephony_NETSTACK_HTTPTest() {
let
http
=
netHttp
.
createHttp
();
let
http
=
netHttp
.
createHttp
();
http
.
request
(
"
https://httpbin.org/user-agent
"
).
then
(
function
(
data
)
{
http
.
request
(
"
https://httpbin.org/user-agent
"
).
then
(
function
(
data
)
{
http
.
destroy
();
http
.
destroy
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
).
assertTrue
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
||
data
.
responseCode
>
500
).
assertTrue
();
console
.
info
(
JSON
.
stringify
(
data
));
if
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
)
{
expect
(
data
.
result
.
toString
().
search
(
"
user-agent
"
)
!=
-
1
).
assertTrue
();
console
.
info
(
JSON
.
stringify
(
data
));
expect
(
data
.
result
.
toString
().
search
(
"
libcurl-agent/1.0
"
)
!=
-
1
).
assertTrue
();
expect
(
data
.
result
.
toString
().
search
(
"
user-agent
"
)
!=
-
1
).
assertTrue
();
expect
(
data
.
result
.
toString
().
search
(
"
libcurl-agent/1.0
"
)
!=
-
1
).
assertTrue
();
}
done
();
done
();
});
});
});
});
...
@@ -63,10 +65,12 @@ export default function Telephony_NETSTACK_HTTPTest() {
...
@@ -63,10 +65,12 @@ export default function Telephony_NETSTACK_HTTPTest() {
let
http
=
netHttp
.
createHttp
();
let
http
=
netHttp
.
createHttp
();
http
.
request
(
"
https://httpbin.org/headers
"
).
then
(
function
(
data
)
{
http
.
request
(
"
https://httpbin.org/headers
"
).
then
(
function
(
data
)
{
http
.
destroy
();
http
.
destroy
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
).
assertTrue
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
||
data
.
responseCode
>
500
).
assertTrue
();
console
.
info
(
"
NETSTACK ####
"
+
JSON
.
stringify
(
data
.
result
));
console
.
info
(
"
NETSTACK ####
"
+
JSON
.
stringify
(
data
.
result
));
expect
(
data
.
result
.
toString
().
search
(
"
Content-Type
"
)
!=
-
1
).
assertTrue
();
if
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
)
{
expect
(
data
.
result
.
toString
().
search
(
"
application/json
"
)
!=
-
1
).
assertTrue
();
expect
(
data
.
result
.
toString
().
search
(
"
Content-Type
"
)
!=
-
1
).
assertTrue
();
expect
(
data
.
result
.
toString
().
search
(
"
application/json
"
)
!=
-
1
).
assertTrue
();
}
done
()
done
()
});
});
});
});
...
@@ -84,8 +88,10 @@ export default function Telephony_NETSTACK_HTTPTest() {
...
@@ -84,8 +88,10 @@ export default function Telephony_NETSTACK_HTTPTest() {
extraData
:
"
MineMine
"
extraData
:
"
MineMine
"
}).
then
(
function
(
data
)
{
}).
then
(
function
(
data
)
{
http
.
destroy
();
http
.
destroy
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
).
assertTrue
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
||
data
.
responseCode
>
500
).
assertTrue
();
expect
(
data
.
result
.
toString
().
search
(
"
MineMine
"
)
!=
-
1
).
assertTrue
()
if
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
)
{
expect
(
data
.
result
.
toString
().
search
(
"
MineMine
"
)
!=
-
1
).
assertTrue
()
}
done
();
done
();
});
});
});
});
...
@@ -103,8 +109,10 @@ export default function Telephony_NETSTACK_HTTPTest() {
...
@@ -103,8 +109,10 @@ export default function Telephony_NETSTACK_HTTPTest() {
extraData
:
"
MineMine
"
extraData
:
"
MineMine
"
}).
then
(
function
(
data
)
{
}).
then
(
function
(
data
)
{
http
.
destroy
();
http
.
destroy
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
).
assertTrue
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
||
data
.
responseCode
>
500
).
assertTrue
();
expect
(
data
.
result
.
toString
().
search
(
"
MineMine
"
)
!=
-
1
).
assertTrue
()
if
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
)
{
expect
(
data
.
result
.
toString
().
search
(
"
MineMine
"
)
!=
-
1
).
assertTrue
()
}
done
();
done
();
});
});
});
});
...
@@ -119,8 +127,10 @@ export default function Telephony_NETSTACK_HTTPTest() {
...
@@ -119,8 +127,10 @@ export default function Telephony_NETSTACK_HTTPTest() {
let
http
=
netHttp
.
createHttp
();
let
http
=
netHttp
.
createHttp
();
http
.
request
(
"
https://httpbin.org/cookies/set/name/value
"
).
then
(
function
(
data
)
{
http
.
request
(
"
https://httpbin.org/cookies/set/name/value
"
).
then
(
function
(
data
)
{
http
.
destroy
();
http
.
destroy
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
).
assertTrue
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
||
data
.
responseCode
>
500
).
assertTrue
();
expect
(
data
.
cookies
!==
""
).
assertTrue
();
if
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
)
{
expect
(
data
.
cookies
!==
""
).
assertTrue
();
}
done
();
done
();
});
});
});
});
...
@@ -140,15 +150,17 @@ export default function Telephony_NETSTACK_HTTPTest() {
...
@@ -140,15 +150,17 @@ export default function Telephony_NETSTACK_HTTPTest() {
}
}
}).
then
(
function
(
data
)
{
}).
then
(
function
(
data
)
{
http
.
destroy
();
http
.
destroy
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
).
assertTrue
();
expect
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
||
data
.
responseCode
>
500
).
assertTrue
();
expect
(
data
.
result
.
toString
().
search
(
"
key1
"
)
!=
-
1
).
assertTrue
()
if
(
data
.
responseCode
===
netHttp
.
ResponseCode
.
OK
)
{
expect
(
data
.
result
.
toString
().
search
(
"
val1
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
key1
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
key2
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
val1
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
val2
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
key2
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
name1
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
val2
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
mine1
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
name1
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
name2
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
mine1
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
mine2
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
name2
"
)
!=
-
1
).
assertTrue
()
expect
(
data
.
result
.
toString
().
search
(
"
mine2
"
)
!=
-
1
).
assertTrue
()
}
done
();
done
();
});
});
});
});
...
...
telephony/telephonyjstest/netmanager_base/system_fetch/src/main/js/test/Http.fetch.test.js
浏览文件 @
ff2aad89
...
@@ -29,17 +29,17 @@ export default function Telephony_NetStack_HttpFetchTest() {
...
@@ -29,17 +29,17 @@ export default function Telephony_NetStack_HttpFetchTest() {
fetch
.
fetch
({
fetch
.
fetch
({
url
:
"
https://httpbin.org/anything
"
,
url
:
"
https://httpbin.org/anything
"
,
success
:
function
(
data
){
success
:
function
(
data
){
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
))
;
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
done
();
done
();
},
},
fail
:
function
(){
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
expect
().
assertFail
()
;
done
()
done
()
;
},
},
complete
:
function
(){
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
}
})
})
});
});
...
@@ -53,18 +53,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
...
@@ -53,18 +53,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
fetch
.
fetch
({
fetch
.
fetch
({
url
:
"
https://httpbin.org/user-agent
"
,
url
:
"
https://httpbin.org/user-agent
"
,
success
:
function
(
data
){
success
:
function
(
data
){
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
user-agent
"
]
==
"
libcurl-agent/1.0
"
).
assertTrue
();
if
(
data
.
code
===
200
)
{
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
user-agent
"
]
==
"
libcurl-agent/1.0
"
).
assertTrue
();
}
done
();
done
();
},
},
fail
:
function
(){
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
expect
().
assertFail
()
;
done
();
done
();
},
},
complete
:
function
(){
complete
:
function
(){
console
.
info
(
"
NetStack fetch complete
"
)
console
.
info
(
"
NetStack fetch complete
"
)
;
}
}
})
})
});
});
...
@@ -79,18 +81,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
...
@@ -79,18 +81,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
url
:
"
https://httpbin.org/user-agent
"
,
url
:
"
https://httpbin.org/user-agent
"
,
responseType
:
"
json
"
,
responseType
:
"
json
"
,
success
:
function
(
data
){
success
:
function
(
data
){
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
NetStack fetch success
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
expect
(
data
.
data
[
"
user-agent
"
]
==
"
libcurl-agent/1.0
"
).
assertTrue
();
if
(
data
.
code
===
200
)
{
expect
(
data
.
data
[
"
user-agent
"
]
==
"
libcurl-agent/1.0
"
).
assertTrue
();
}
done
();
done
();
},
},
fail
:
function
(){
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
expect
().
assertFail
()
;
done
();
done
();
},
},
complete
:
function
(){
complete
:
function
(){
console
.
info
(
"
NetStack fetch complete
"
)
console
.
info
(
"
NetStack fetch complete
"
)
;
}
}
})
})
});
});
...
@@ -104,18 +108,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
...
@@ -104,18 +108,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
fetch
.
fetch
({
fetch
.
fetch
({
url
:
"
https://httpbin.org/headers
"
,
url
:
"
https://httpbin.org/headers
"
,
success
:
function
(
data
){
success
:
function
(
data
){
console
.
info
(
"
NetStack Fetch Success
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
NetStack Fetch Success
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
headers
"
][
"
Content-Type
"
]
===
"
application/json
"
).
assertTrue
()
if
(
data
.
code
===
200
)
{
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
headers
"
][
"
Content-Type
"
]
===
"
application/json
"
).
assertTrue
();
}
done
();
done
();
},
},
fail
:
function
(){
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
expect
().
assertFail
()
;
done
();
done
();
},
},
complete
:
function
(){
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
}
})
})
});
});
...
@@ -130,18 +136,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
...
@@ -130,18 +136,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
url
:
"
https://httpbin.org/headers
"
,
url
:
"
https://httpbin.org/headers
"
,
responseType
:
"
json
"
,
responseType
:
"
json
"
,
success
:
function
(
data
){
success
:
function
(
data
){
console
.
info
(
"
NetStack Fetch Success
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
NetStack Fetch Success
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
expect
(
data
.
data
[
"
headers
"
][
"
Content-Type
"
]
===
"
application/json
"
).
assertTrue
()
if
(
data
.
code
===
200
)
{
expect
(
data
.
data
[
"
headers
"
][
"
Content-Type
"
]
===
"
application/json
"
).
assertTrue
();
}
done
();
done
();
},
},
fail
:
function
(){
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
expect
().
assertFail
()
;
done
();
done
();
},
},
complete
:
function
(){
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
}
})
})
});
});
...
@@ -157,18 +165,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
...
@@ -157,18 +165,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
method
:
"
POST
"
,
method
:
"
POST
"
,
data
:
"
MineMine
"
,
data
:
"
MineMine
"
,
success
:
function
(
data
){
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
data
"
]
===
"
MineMine
"
).
assertTrue
()
if
(
data
.
code
===
200
)
{
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
data
"
]
===
"
MineMine
"
).
assertTrue
();
}
done
();
done
();
},
},
fail
:
function
(){
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
expect
().
assertFail
()
;
done
()
done
()
},
},
complete
:
function
(){
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
}
})
})
});
});
...
@@ -185,18 +195,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
...
@@ -185,18 +195,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
data
:
"
MineMine
"
,
data
:
"
MineMine
"
,
responseType
:
"
json
"
,
responseType
:
"
json
"
,
success
:
function
(
data
){
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
expect
(
data
.
data
[
"
data
"
]
===
"
MineMine
"
).
assertTrue
()
if
(
data
.
code
===
200
)
{
expect
(
data
.
data
[
"
data
"
]
===
"
MineMine
"
).
assertTrue
();
}
done
();
done
();
},
},
fail
:
function
(){
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
expect
().
assertFail
()
;
done
();
done
();
},
},
complete
:
function
(){
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
}
})
})
});
});
...
@@ -212,18 +224,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
...
@@ -212,18 +224,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
method
:
"
PUT
"
,
method
:
"
PUT
"
,
data
:
"
MineMine
"
,
data
:
"
MineMine
"
,
success
:
function
(
data
){
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
data
"
]
===
"
MineMine
"
).
assertTrue
()
if
(
data
.
code
===
200
)
{
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
data
"
]
===
"
MineMine
"
).
assertTrue
();
}
done
();
done
();
},
},
fail
:
function
(){
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
expect
().
assertFail
()
;
done
();
done
();
},
},
complete
:
function
(){
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
}
})
})
});
});
...
@@ -240,18 +254,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
...
@@ -240,18 +254,20 @@ export default function Telephony_NetStack_HttpFetchTest() {
data
:
"
MineMine
"
,
data
:
"
MineMine
"
,
responseType
:
"
json
"
,
responseType
:
"
json
"
,
success
:
function
(
data
){
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
).
assertTrue
()
if
(
data
.
code
===
200
)
{
expect
(
data
.
data
[
"
data
"
]
===
"
MineMine
"
).
assertTrue
()
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
expect
(
data
.
data
[
"
data
"
]
===
"
MineMine
"
).
assertTrue
();
}
done
();
done
();
},
},
fail
:
function
(){
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
expect
().
assertFail
()
;
done
();
done
();
},
},
complete
:
function
(){
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
}
})
})
});
});
...
@@ -269,21 +285,23 @@ export default function Telephony_NetStack_HttpFetchTest() {
...
@@ -269,21 +285,23 @@ export default function Telephony_NetStack_HttpFetchTest() {
"
name2
"
:
"
mine2
"
,
"
name2
"
:
"
mine2
"
,
},
},
success
:
function
(
data
){
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
key1
"
]
===
"
val1
"
).
assertTrue
()
if
(
data
.
code
===
200
)
{
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
key2
"
]
===
"
val2
"
).
assertTrue
()
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
key1
"
]
===
"
val1
"
).
assertTrue
();
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
name1
"
]
===
"
mine1
"
).
assertTrue
()
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
key2
"
]
===
"
val2
"
).
assertTrue
();
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
name2
"
]
===
"
mine2
"
).
assertTrue
()
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
name1
"
]
===
"
mine1
"
).
assertTrue
();
expect
(
JSON
.
parse
(
data
.
data
.
toString
())[
"
name2
"
]
===
"
mine2
"
).
assertTrue
();
}
done
();
done
();
},
},
fail
:
function
(){
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
expect
().
assertFail
()
;
done
()
done
()
;
},
},
complete
:
function
(){
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
}
})
})
});
});
...
@@ -302,21 +320,23 @@ export default function Telephony_NetStack_HttpFetchTest() {
...
@@ -302,21 +320,23 @@ export default function Telephony_NetStack_HttpFetchTest() {
},
},
responseType
:
"
json
"
,
responseType
:
"
json
"
,
success
:
function
(
data
){
success
:
function
(
data
){
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
NetStack
"
+
JSON
.
stringify
(
data
));
expect
(
data
.
code
===
200
).
assertTrue
()
expect
(
data
.
code
===
200
||
data
.
code
>
500
).
assertTrue
();
expect
(
data
.
data
[
"
key1
"
]
===
"
val1
"
).
assertTrue
()
if
(
data
.
code
===
200
)
{
expect
(
data
.
data
[
"
key2
"
]
===
"
val2
"
).
assertTrue
()
expect
(
data
.
data
[
"
key1
"
]
===
"
val1
"
).
assertTrue
();
expect
(
data
.
data
[
"
name1
"
]
===
"
mine1
"
).
assertTrue
()
expect
(
data
.
data
[
"
key2
"
]
===
"
val2
"
).
assertTrue
();
expect
(
data
.
data
[
"
name2
"
]
===
"
mine2
"
).
assertTrue
()
expect
(
data
.
data
[
"
name1
"
]
===
"
mine1
"
).
assertTrue
();
expect
(
data
.
data
[
"
name2
"
]
===
"
mine2
"
).
assertTrue
();
}
done
();
done
();
},
},
fail
:
function
(){
fail
:
function
(){
console
.
info
(
"
NetStack Fetch Failed
"
)
console
.
info
(
"
NetStack Fetch Failed
"
)
;
expect
().
assertFail
()
expect
().
assertFail
()
;
done
()
done
()
;
},
},
complete
:
function
(){
complete
:
function
(){
console
.
info
(
"
NetStack Fetch Complete
"
)
console
.
info
(
"
NetStack Fetch Complete
"
)
;
}
}
})
})
});
});
...
...
telephony/telephonyjstest/sms_mms/sms_mms_error/src/main/js/test/SmsMmsError.test.js
浏览文件 @
ff2aad89
...
@@ -118,5 +118,40 @@ describe('SmsMmsErrorTest', function () {
...
@@ -118,5 +118,40 @@ describe('SmsMmsErrorTest', function () {
}
}
});
});
/**
* @tc.number Telephony_SmsMms_sendMessage_Promise_0100
* @tc.name Telephony_SmsMms_sendMessage_Promise_0100
* @tc.desc Function test
*/
it
(
'
Telephony_SmsMms_sendMessage_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
.
sendMessage
(
options
);
done
();
}
catch
(
err
)
{
expect
(
true
).
assertFalse
();
done
();
}
});
});
});
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录