Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
c7dd5985
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看板
提交
c7dd5985
编写于
11月 10, 2022
作者:
L
liuxueqi
提交者:
Gitee
11月 10, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of gitee.com:openharmony/xts_acts into master
上级
77cd4679
6508cfef
变更
25
展开全部
隐藏空白更改
内联
并排
Showing
25 changed file
with
2558 addition
and
791 deletion
+2558
-791
arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets
..._ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets
+226
-226
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
...dard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
+2
-2
multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js
...angeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js
+1
-0
multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/test/AudioRendererChangeInfo.test.js
...angeInfo/src/main/js/test/AudioRendererChangeInfo.test.js
+1
-0
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioManagerApi9.test.js
...rd/audioManager/src/main/js/test/AudioManagerApi9.test.js
+98
-98
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js
...io_js_standard/audioManager/src/main/js/test/List.test.js
+0
-1
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSession.test.js
...ndard/avsessionManager/src/main/js/test/AVSession.test.js
+180
-67
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionController.test.js
...ssionManager/src/main/js/test/AVSessionController.test.js
+54
-0
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionErrorCode.test.js
...essionManager/src/main/js/test/AVSessionErrorCode.test.js
+249
-0
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionManager.test.js
...vsessionManager/src/main/js/test/AVSessionManager.test.js
+137
-0
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/List.test.js
...s_standard/avsessionManager/src/main/js/test/List.test.js
+2
-0
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/Camera.test.ets
...js_standard/src/main/ets/MainAbility/test/Camera.test.ets
+2
-0
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraEnumTest.test.ets
...ard/src/main/ets/MainAbility/test/CameraEnumTest.test.ets
+416
-0
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
...st_Stage/entry/src/main/ets/test/requestDownload.test.ets
+88
-1
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
...Test_Stage/entry/src/main/ets/test/requestUpload.test.ets
+61
-0
telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/ObjectInterface_test.js
...anager_ims2_call/src/main/js/test/ObjectInterface_test.js
+8
-6
telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/Http.nopermission.test.js
...k_nopermission/src/main/js/test/Http.nopermission.test.js
+4
-12
telephony/telephonyjstest/netmanager_base/register/Test.json
telephony/telephonyjstest/netmanager_base/register/Test.json
+8
-0
telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js
.../register/src/main/js/test/NetworkManagerRegister.test.js
+16
-0
telephony/telephonyjstest/netmanager_base/socket/src/main/js/test/NetStackSocket.test.js
...nager_base/socket/src/main/js/test/NetStackSocket.test.js
+141
-1
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionJsunit.test.ets
..._socket/entry/src/main/ets/test/ConnectionJsunit.test.ets
+241
-0
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionSecondJsUnit.test.ets
...t/entry/src/main/ets/test/ConnectionSecondJsUnit.test.ets
+67
-0
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/SocketJsunit.test.ets
...ager_socket/entry/src/main/ets/test/SocketJsunit.test.ets
+417
-16
theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets
...ock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets
+23
-93
theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
...screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
+116
-268
未找到文件。
arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets
浏览文件 @
c7dd5985
此差异已折叠。
点击以展开。
multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js
浏览文件 @
c7dd5985
...
...
@@ -357,7 +357,7 @@ describe('audioCapturer', function () {
steps
.
shift
();
let
markReachParam
=
steps
[
0
];
steps
.
shift
();
try
{
try
{
audioCap
.
on
(
'
markReach
'
,
markReachParam
,
(
position
)
=>
{
console
.
log
(
`
${
Tag
}
position:
${
JSON
.
stringify
(
position
)}
`
);
console
.
log
(
`
${
Tag
}
markReachParam:
${
JSON
.
stringify
(
markReachParam
)}
`
);
...
...
@@ -391,7 +391,7 @@ describe('audioCapturer', function () {
steps
.
shift
();
let
periodReachParam
=
steps
[
0
];
steps
.
shift
();
try
{
try
{
audioCap
.
on
(
'
periodReach
'
,
periodReachParam
,
(
position
)
=>
{
console
.
log
(
`
${
Tag
}
position:
${
JSON
.
stringify
(
position
)}
`
);
console
.
log
(
`
${
Tag
}
periodReachParam:
${
JSON
.
stringify
(
periodReachParam
)}
`
);
...
...
multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js
浏览文件 @
c7dd5985
...
...
@@ -34,6 +34,7 @@ describe('audioCapturerChange', function () {
await
sleep
(
100
);
console
.
info
(
`AudioFrameworkTest: beforeAll: END`
);
await
sleep
(
100
);
audioStreamManager
=
audioManager
.
getStreamManager
();
audioStreamManagerCB
=
audioManager
.
getStreamManager
();
await
sleep
(
1000
);
...
...
multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/test/AudioRendererChangeInfo.test.js
浏览文件 @
c7dd5985
...
...
@@ -25,6 +25,7 @@ describe('audioRendererChange', function () {
console
.
info
(
`
${
Tag
}
: Create AudioManger Object JS Framework`
);
beforeAll
(
async
function
()
{
audioStreamManager
=
AUDIOMANAGER
.
getStreamManager
();
audioStreamManagerCB
=
AUDIOMANAGER
.
getStreamManager
();
await
sleep
(
1000
);
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioManagerApi9.test.js
浏览文件 @
c7dd5985
此差异已折叠。
点击以展开。
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js
浏览文件 @
c7dd5985
...
...
@@ -16,4 +16,3 @@
require
(
'
./AudioFramework.test.js
'
)
require
(
'
./AudioManagerApi9.test.js
'
)
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSession.test.js
100644 → 100755
浏览文件 @
c7dd5985
此差异已折叠。
点击以展开。
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionController.test.js
100644 → 100755
浏览文件 @
c7dd5985
...
...
@@ -1680,5 +1680,59 @@ export default function Controller() {
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_CALLBACK_0100
* @tc.name : GETOUTPUTDEVICE_CALLBACK_0100
* @tc.desc : Testing get output device
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
controller
.
on
(
'
outputDeviceChange
'
,
(
callback
)
=>
{
if
(
!
callback
.
isRemote
)
{
console
.
info
(
'
outputDeviceChange callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
outputDeviceChange callback registration fail
'
);
expect
(
false
).
assertTrue
();
}
});
controller
.
off
(
'
outputDeviceChange
'
);
controller
.
getOutputDevice
((
err
,
value
)
=>
{
if
(
err
)
{
console
.
info
(
`Get device information BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
}
else
if
(
!
value
.
isRemote
)
{
console
.
info
(
'
Get device information successfully
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Get device information failed
'
);
expect
(
false
).
assertTrue
();
}
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_PROMISE_0100
* @tc.name : GETOUTPUTDEVICE_PROMISE_0100
* @tc.desc : Testing get output device
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_GETOUTPUTDEVICE_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
controller
.
getOutputDevice
().
then
((
value
)
=>
{
console
.
info
(
'
Get device information successfully
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
console
.
info
(
`Get device BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
})
done
();
})
})
}
\ No newline at end of file
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionErrorCode.test.js
0 → 100755
浏览文件 @
c7dd5985
/*
* 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
avSession
from
'
@ohos.multimedia.avsession
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
export
default
function
AVSessionErrorCode
()
{
describe
(
'
AVSessionErrorCode
'
,
function
()
{
let
tag
=
'
ApplicationA
'
;
let
type
=
'
audio
'
;
let
session
;
let
pid
=
100
;
let
uid
=
200
;
let
audioDevices
;
let
sessionToken
;
let
controller
;
let
id
=
'
9527
'
;
let
sessionId
;
let
keyItem
=
{
code
:
10
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:[
keyItem
]};
let
context
=
featureAbility
.
getContext
();
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
beforeAll
(
function
()
{
console
.
info
(
'
TestLog: Start Testing avSession Interfaces
'
);
})
beforeEach
(
async
function
()
{
console
.
info
(
'
TestLog: Init Session And Controller
'
);
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
}).
catch
((
err
)
=>
{
expect
(
err
.
code
==
6600101
).
assertTrue
();
console
.
info
(
avSession
.
AVSessionErrorCode
.
ERR_CODE_SERVICE_EXCEPTION
);
console
.
info
(
`TestLog: Session create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session activate
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session activate error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
avSession
.
createController
(
session
.
sessionId
).
then
((
data
)
=>
{
controller
=
data
;
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Controller create error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
})
afterEach
(
async
function
(
done
)
{
console
.
info
(
'
TestLog: Destroy Session And Controller
'
);
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session destroy success
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
controller
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Controller destroy success
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Controller destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
afterAll
(
function
()
{
console
.
info
(
'
TestLog: End Testing avSession Interfaces
'
);
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_SET_METADATA_PROMISE_0100
* @tc.name : SETMETADATA_0100
* @tc.desc : Testing set metadata - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_SET_METADATA_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
let
metadata1
=
{
assetId
:
'
121278
'
,
};
await
sleep
(
500
);
await
session
.
setAVMetadata
(
metadata1
).
then
(()
=>
{
console
.
info
(
'
TestLog: Set metadata successfully
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
expect
(
err
.
code
==
6600102
).
assertTrue
();
console
.
info
(
avSession
.
AVSessionErrorCode
.
ERR_CODE_SESSION_NOT_EXIST
);
console
.
info
(
`TestLog: Set metadata error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_DESTROYCONTROLLER_PROMISE_0100
* @tc.name : DESTROYCONTROLLER_0100
* @tc.desc : Testing destroy the controller - promise
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level1
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_DESTROYCONTROLLER_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
controller
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Controller destroy successfully
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
expect
(
err
.
code
==
6600103
).
assertTrue
();
console
.
info
(
avSession
.
AVSessionErrorCode
.
ERR_CODE_CONTROLLER_NOT_EXIST
);
console
.
info
(
`TestLog: Controller destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0100
* @tc.name : OFFPLAY_0100
* @tc.desc : Testing offPlay callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_OFFPLAY_0100
'
,
0
,
async
function
(
done
)
{
function
callback1
()
{
console
.
info
(
'
TestLog: Play command registration1 success
'
);
expect
(
true
).
assertTrue
();
}
session
.
on
(
'
play
'
,
callback1
);
await
controller
.
sendControlCommand
({
command
:
'
play
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Controller send command successfully
'
);
expect
(
true
).
assertTrue
();
}).
catch
((
err
)
=>
{
expect
(
err
.
code
==
6600105
).
assertTrue
();
console
.
info
(
avSession
.
AVSessionErrorCode
.
ERR_CODE_COMMAND_INVALID
);
console
.
info
(
`TestLog: Controller send command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_PROMISE_0100
* @tc.name : CAST_AUDIO_0100
* @tc.desc : Testing cast audio
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
sessionId
=
session
.
sessionId
;
sessionToken
=
{
sessionId
,
pid
,
uid
};
try
{
await
avSession
.
castAudio
(
sessionToken
,
audioDevices
).
then
(()
=>
{
console
.
info
(
'
Cast audio to remote
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
avSession
.
AVSessionErrorCode
.
ERR_CODE_REMOTE_CONNECTION_ERR
);
console
.
info
(
`Cast audio to remote BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
}
catch
(
err
)
{
console
.
info
(
`Testing has failed BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONHANDLEKEYEVENT_0100
* @tc.name : ONHANDLEKEYEVENT_0100
* @tc.desc : Testing Handle KeyEvent callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONHANDLEKEYEVENT_0100
'
,
0
,
async
function
(
done
)
{
session
.
on
(
'
handleKeyEvent
'
,
(
callback
)
=>
{
if
(
callback
.
action
===
2
)
{
console
.
info
(
'
TestLog: Handle keyEvent callback registration successful
'
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
TestLog: Handle keyEvent callback registration error
'
);
expect
(
false
).
assertTrue
();
}
});
await
controller
.
sendAVKeyEvent
(
event
).
then
(()
=>
{
console
.
info
(
'
TestLog: Controller send AVKeyEvent successfully
'
);
}).
catch
((
err
)
=>
{
expect
(
err
.
code
==
6600106
).
assertTrue
();
console
.
info
(
avSession
.
AVSessionErrorCode
.
ERR_CODE_SESSION_INACTIVE
);
console
.
info
(
`TestLog: Controller send AVKeyEvent error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_ONPLAY_0100
* @tc.name : ONPLAY_0100
* @tc.desc : Testing onPlay callback
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_ONPLAY_0100
'
,
0
,
async
function
(
done
)
{
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
TestLog: Play command callback registration successful
'
);
expect
(
true
).
assertTrue
();
});
await
controller
.
sendControlCommand
({
command
:
'
play
'
}).
then
(()
=>
{
console
.
info
(
'
TestLog: Controller send command successfully
'
);
}).
catch
((
err
)
=>
{
expect
(
err
.
code
==
6600107
).
assertTrue
();
console
.
info
(
avSession
.
AVSessionErrorCode
.
ERR_CODE_MESSAGE_OVERLOAD
);
console
.
info
(
`TestLog: Controller send command error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
false
).
assertTrue
();
});
await
sleep
(
500
);
done
();
})
})
}
\ No newline at end of file
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/AVSessionManager.test.js
100644 → 100755
浏览文件 @
c7dd5985
...
...
@@ -24,6 +24,11 @@ export default function AVSessionManager() {
let
session
;
let
controller
;
let
id
=
'
9527
'
;
let
sessionId
;
let
pid
=
100
;
let
uid
=
200
;
let
audioDevices
;
let
sessionToken
;
let
keyItem
=
{
code
:
10
,
pressedTime
:
123456789
,
deviceId
:
0
};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:[
keyItem
]};
let
context
=
featureAbility
.
getContext
();
...
...
@@ -1140,5 +1145,137 @@ export default function AVSessionManager() {
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_PROMISE_0100
* @tc.name : CAST_AUDIO_PROMISE_0100
* @tc.desc : Testing cast audio
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_PROMISE_0100
'
,
0
,
async
function
(
done
)
{
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
sessionId
=
session
.
sessionId
;
sessionToken
=
{
sessionId
,
pid
,
uid
};
}).
catch
((
err
)
=>
{
console
.
info
(
`Session create BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
await
avSession
.
castAudio
(
sessionToken
,
audioDevices
).
then
(()
=>
{
console
.
info
(
'
Cast audio to remote
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`Cast audio to remote BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
});
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_PROMISE_0200
* @tc.name : CAST_AUDIO_PROMISE_0200
* @tc.desc : Testing cast audio with all session
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_PROMISE_0200
'
,
0
,
async
function
(
done
)
{
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
sessionId
=
session
.
sessionId
;
sessionToken
=
{
sessionId
,
pid
,
uid
};
}).
catch
((
err
)
=>
{
console
.
info
(
`Session create BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
await
avSession
.
castAudio
(
'
all
'
,
audioDevices
).
then
(()
=>
{
console
.
info
(
'
Cast audio to remote
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`Cast audio to remote BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
});
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_CALLBACK_0100
* @tc.name : CAST_AUDIO_CALLBACK_0100
* @tc.desc : Testing cast audio
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_CALLBACK_0100
'
,
0
,
async
function
(
done
)
{
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
sessionId
=
session
.
sessionId
;
sessionToken
=
{
sessionId
,
pid
,
uid
};
}).
catch
((
err
)
=>
{
console
.
info
(
`Session create BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
avSession
.
castAudio
(
sessionToken
,
audioDevices
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`Cast audio to remote BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Cast audio to remote device
'
);
}
});
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
done
();
})
/* *
* @tc.number : SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_CALLBACK_0200
* @tc.name : CAST_AUDIO_CALLBACK_0200
* @tc.desc : Testing cast audio
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_AVSESSION_CAST_AUDIO_CALLBACK_0200
'
,
0
,
async
function
(
done
)
{
await
avSession
.
createAVSession
(
context
,
tag
,
type
).
then
((
data
)
=>
{
session
=
data
;
sessionId
=
session
.
sessionId
;
sessionToken
=
{
sessionId
,
pid
,
uid
};
}).
catch
((
err
)
=>
{
console
.
info
(
`Session create BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
avSession
.
castAudio
(
'
all
'
,
audioDevices
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
`Cast audio to remote BusinessError:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
expect
(
true
).
assertTrue
();
}
else
{
console
.
info
(
'
Cast audio to remote device
'
);
}
});
await
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
TestLog: Session Destroy SUCCESS
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
`TestLog: Session Destroy error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
done
();
})
})
}
\ No newline at end of file
multimedia/avsession/avsession_js_standard/avsessionManager/src/main/js/test/List.test.js
100644 → 100755
浏览文件 @
c7dd5985
...
...
@@ -18,6 +18,7 @@ import AVSessionManager from './AVSessionManager.test.js';
import
AVSessionCallback
from
'
./AVSessionCallback.test.js
'
;
import
AVSessionControllerCallback
from
'
./AVSessionControllerCallback.test.js
'
;
import
AVSessionManagerCallback
from
'
./AVSessionManagerCallback.test.js
'
;
import
AVSessionErrorCode
from
'
./AVSessionErrorCode.test
'
;
export
default
function
testsuite
()
{
AVSession
()
...
...
@@ -26,4 +27,5 @@ export default function testsuite() {
AVSessionCallback
()
AVSessionControllerCallback
()
AVSessionManagerCallback
()
AVSessionErrorCode
()
}
\ No newline at end of file
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/Camera.test.ets
浏览文件 @
c7dd5985
...
...
@@ -23,6 +23,7 @@ import cameraSessionVideoStabilizationTest from './CameraSessionVideoStabilizati
import cameraSessionBaseTest from './CameraSessionBaseTest.test.ets'
import cameraInputTest from './CameraInputTest.test.ets'
import cameraManagerTest from './CameraManagerTest.test.ets'
import cameraEnumTest from './CameraEnumTest.test.ets'
let TAG = 'CameraModuleTest: '
...
...
@@ -39,4 +40,5 @@ export default function cameraKit(surfaceId: any) {
cameraSessionVideoStabilizationTest(surfaceId)
cameraSessionBaseTest(surfaceId)
cameraManagerTest(surfaceId)
cameraEnumTest(surfaceId)
}
\ No newline at end of file
multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraEnumTest.test.ets
0 → 100644
浏览文件 @
c7dd5985
/*
* 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 camera from '@ohos.multimedia.camera';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
const TAG = "CameraEnumTest: ";
export default function cameraEnumTest(surfaceId: any) {
function isEmpty(data) {
if (data == null || data == undefined) {
return true;
}
return false;
}
describe('CameraEnumTest', function () {
console.info(TAG + '----------CameraEnumTest--------------');
beforeAll(async function () {
console.info('beforeAll case');
})
beforeEach(function () {
console.info('beforeEach case');
})
afterEach(async function () {
console.info('afterEach case');
})
afterAll(function () {
console.info('afterAll case');
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERASTATUS_0100
* @tc.name : Camera CameraStatus Eunm
* @tc.desc : Camera CameraStatus Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERASTATUS_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERASTATUS_0100--------------");
expect(camera.CameraStatus.CAMERA_STATUS_APPEAR == 0).assertTrue();
expect(camera.CameraStatus.CAMERA_STATUS_DISAPPEAR == 1).assertTrue();
expect(camera.CameraStatus.CAMERA_STATUS_AVAILABLE == 2).assertTrue();
expect(camera.CameraStatus.CAMERA_STATUS_UNAVAILABLE == 3).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERASTATUS_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAPOSITION_0100
* @tc.name : Camera CameraPosition Eunm
* @tc.desc : Camera CameraPosition Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAPOSITION_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAPOSITION_0100--------------");
expect(camera.CameraPosition.CAMERA_POSITION_UNSPECIFIED == 0).assertTrue();
expect(camera.CameraPosition.CAMERA_POSITION_BACK == 1).assertTrue();
expect(camera.CameraPosition.CAMERA_POSITION_FRONT == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAPOSITION_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100
* @tc.name : Camera CameraType Eunm
* @tc.desc : Camera CameraType Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100--------------");
expect(camera.CameraType.CAMERA_TYPE_UNSPECIFIED == 0).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_WIDE_ANGLE == 1).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_ULTRA_WIDE == 2).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_TELEPHOTO == 3).assertTrue();
expect(camera.CameraType.CAMERA_TYPE_TRUE_DEPTH == 4).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERATYPE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CONNECTIONTYPE_0100
* @tc.name : Camera ConnectionType Eunm
* @tc.desc : Camera ConnectionType Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CONNECTIONTYPE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CONNECTIONTYPE_0100--------------");
expect(camera.ConnectionType.CAMERA_CONNECTION_BUILT_IN == 0).assertTrue();
expect(camera.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN == 1).assertTrue();
expect(camera.ConnectionType.CAMERA_CONNECTION_REMOTE == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CONNECTIONTYPE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100
* @tc.name : Camera CameraInputErrorCode Eunm
* @tc.desc : Camera CameraInputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100--------------");
expect(camera.CameraInputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_NO_PERMISSION == 0).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DEVICE_PREEMPTED == 1).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DEVICE_DISCONNECTED == 2).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DEVICE_IN_USE == 3).assertTrue();
expect(camera.CameraInputErrorCode.ERROR_DRIVER_ERROR == 4).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAINPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAFORMAT_0100
* @tc.name : Camera CameraFormat Eunm
* @tc.desc : Camera CameraFormat Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAFORMAT_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAFORMAT_0100--------------");
expect(camera.CameraFormat.CAMERA_FORMAT_RGBA_8888 == 3).assertTrue();
expect(camera.CameraFormat.CAMERA_FORMAT_YUV_420_SP == 1003).assertTrue();
expect(camera.CameraFormat.CAMERA_FORMAT_JPEG == 2000).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAMERAFORMAT_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_FLASHMODE_0100
* @tc.name : Camera FlashMode Eunm
* @tc.desc : Camera FlashMode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_FLASHMODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_FLASHMODE_0100--------------");
expect(camera.FlashMode.FLASH_MODE_CLOSE == 0).assertTrue();
expect(camera.FlashMode.FLASH_MODE_OPEN == 1).assertTrue();
expect(camera.FlashMode.FLASH_MODE_AUTO == 2).assertTrue();
expect(camera.FlashMode.FLASH_MODE_ALWAYS_OPEN == 3).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_FLASHMODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_EXPOSUREMODE_0100
* @tc.name : Camera ExposureMode Eunm
* @tc.desc : CameraExposureMode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_EXPOSUREMODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_EXPOSUREMODE_0100--------------");
expect(camera.ExposureMode.EXPOSURE_MODE_LOCKED == 0).assertTrue();
expect(camera.ExposureMode.EXPOSURE_MODE_AUTO == 1).assertTrue();
expect(camera.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_EXPOSUREMODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSMODE_0100
* @tc.name : Camera FocusMode Eunm
* @tc.desc : Camera FocusMode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSMODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSMODE_0100--------------");
expect(camera.FocusMode.FOCUS_MODE_MANUAL == 0).assertTrue();
expect(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO == 1).assertTrue();
expect(camera.FocusMode.FOCUS_MODE_AUTO == 2).assertTrue();
expect(camera.FocusMode.FOCUS_MODE_LOCKED == 3).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSMODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSSTATE_0100
* @tc.name : Camera FocusState Eunm
* @tc.desc : Camera FocusState Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSSTATE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSSTATE_0100--------------");
expect(camera.FocusState.FOCUS_STATE_SCAN == 0).assertTrue();
expect(camera.FocusState.FOCUS_STATE_FOCUSED == 1).assertTrue();
expect(camera.FocusState.FOCUS_STATE_UNFOCUSED == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_FOCUSSTATE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOSTABILIZATIONMODE_0100
* @tc.name : Camera VideoStabilizationMode Eunm
* @tc.desc : Camera VideoStabilizationMode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOSTABILIZATIONMODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOSTABILIZATIONMODE_0100--------------");
expect(camera.VideoStabilizationMode.OFF == 0).assertTrue();
expect(camera.VideoStabilizationMode.LOW == 1).assertTrue();
expect(camera.VideoStabilizationMode.MIDDLE == 2).assertTrue();
expect(camera.VideoStabilizationMode.HIGH == 3).assertTrue();
expect(camera.VideoStabilizationMode.AUTO == 4).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOSTABILIZATIONMODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100
* @tc.name : Camera CaptureSessionErrorCode Eunm
* @tc.desc : Camera CaptureSessionErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100--------------");
expect(camera.CaptureSessionErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.CaptureSessionErrorCode.ERROR_INSUFFICIENT_RESOURCES == 0).assertTrue();
expect(camera.CaptureSessionErrorCode.ERROR_TIMEOUT == 1).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_CAPTURESESSIONERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100
* @tc.name : Camera PreviewOutputErrorCode Eunm
* @tc.desc : Camera PreviewOutputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100--------------");
expect(camera.PreviewOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_PREVIEWOUTPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_IMAGEROTATION_0100
* @tc.name : Camera ImageRotation Eunm
* @tc.desc : Camera ImageRotation Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_IMAGEROTATION_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_IMAGEROTATION_0100--------------");
expect(camera.ImageRotation.ROTATION_0 == 0).assertTrue();
expect(camera.ImageRotation.ROTATION_90 == 90).assertTrue();
expect(camera.ImageRotation.ROTATION_180 == 180).assertTrue();
expect(camera.ImageRotation.ROTATION_270 == 270).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_IMAGEROTATION_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_QUALITYLEVEL_0100
* @tc.name : Camera QualityLevel Eunm
* @tc.desc : Camera QualityLevel Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_QUALITYLEVEL_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_QUALITYLEVEL_0100--------------");
expect(camera.QualityLevel.QUALITY_LEVEL_HIGH == 0).assertTrue();
expect(camera.QualityLevel.QUALITY_LEVEL_MEDIUM == 1).assertTrue();
expect(camera.QualityLevel.QUALITY_LEVEL_LOW == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_QUALITYLEVEL_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100
* @tc.name : Camera PhotoOutputErrorCode Eunm
* @tc.desc : Camera PhotoOutputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100--------------");
expect(camera.PhotoOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.PhotoOutputErrorCode.ERROR_DRIVER_ERROR == 0).assertTrue();
expect(camera.PhotoOutputErrorCode.ERROR_INSUFFICIENT_RESOURCES == 1).assertTrue();
expect(camera.PhotoOutputErrorCode.ERROR_TIMEOUT == 2).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_PHOTOOUTPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100
* @tc.name : Camera VideoOutputErrorCode Eunm
* @tc.desc : Camera VideoOutputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100--------------");
expect(camera.VideoOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.VideoOutputErrorCode.ERROR_DRIVER_ERROR == 0).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_VIDEOOUTPUTERRORCODE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOBJECTTYPE_0100
* @tc.name : Camera MetadataObjectType Eunm
* @tc.desc : Camera MetadataObjectType Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOBJECTTYPE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOBJECTTYPE_0100--------------");
expect(camera.MetadataObjectType.FACE_DETECTION == 0).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOBJECTTYPE_0100 ends here");
done();
})
/**
* @tc.number : SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100
* @tc.name : Camera MetadataOutputErrorCode Eunm
* @tc.desc : Camera MetadataOutputErrorCode Eunm
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100', 2, async function (done) {
console.info("--------------SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100--------------");
expect(camera.MetadataOutputErrorCode.ERROR_UNKNOWN == -1).assertTrue();
expect(camera.MetadataOutputErrorCode.ERROR_INSUFFICIENT_RESOURCES == 0).assertTrue();
console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ENUM_METADATAOUTPUTERRORCODE_0100 ends here");
done();
})
})
}
\ No newline at end of file
request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets
浏览文件 @
c7dd5985
...
...
@@ -115,6 +115,93 @@ export default function requestDownloadJSUnit() {
console.info("====>------------------SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 end-----------------------");
done();
},5000)
});
});
/**
* @tc.number SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001
* @tc.desc Starts a download session.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001 is starting-----------------------");
let downloadFilePath = `${globalThis.abilityContext.tempDir}/test.txt`
console.debug("downloadFileConfig:" + `${globalThis.abilityContext.tempDir}/test.txt`)
let downloadFileConfig = {
url: 'http://download.ci.openharmony.cn/version/Daily_Version/',
header: {
headers: 'http'
},
enableMetered: false,
enableRoaming: false,
description: 'XTS download test!',
networkType: request.NETWORK_WIFI,
filePath: downloadFilePath,
title: 'XTS download test!',
background: true
}
try {
request.downloadFile(globalThis.abilityContext, downloadFileConfig, (err, data)=>{
downloadTask = data;
console.info("SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001 downloadTask: " + downloadTask);
try{
expect(true).assertEqual(downloadTask != undefined);
}catch(e){
console.info("SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001 except error: " + e);
}
});
} catch (err) {
console.error("SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001 error: " + err);
expect().assertFail();
}
console.info("-----------------------SUB_REQUEST_downloadFile_STAGE_API_CALLBACK_0001 end-----------------------");
done();
});
/**
* @tc.number SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001
* @tc.desc Starts a download session.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 is starting-----------------------");
let downloadFilePath = `${globalThis.abilityContext.tempDir}/test.txt`
console.debug("downloadFileConfig:" + `${globalThis.abilityContext.tempDir}/test.txt`)
let downloadFileConfig = {
url: 'http://download.ci.openharmony.cn/version/Daily_Version/',
header: {
headers: 'http'
},
enableMetered: false,
enableRoaming: false,
description: 'XTS download test!',
networkType: request.NETWORK_WIFI,
filePath: downloadFilePath,
title: 'XTS download test!',
background: true
}
try{
request.downloadFile(globalThis.abilityContext, downloadFileConfig).then(data => {
downloadTask = data;
console.info("SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 downloadTask: " + downloadTask);
try{
expect(true).assertEqual(downloadTask != undefined);
}catch(e){
console.info("SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 except error: " + e);
}
}).catch(err => {
console.error("SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 error: " + err);
expect().assertFail();
})
}catch(err){
console.error("SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 catch error: " + err);
}
console.info("-----------------------SUB_REQUEST_downloadFile_STAGE_API_PROMISE_0001 end-----------------------");
done();
});
});
}
\ No newline at end of file
request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets
浏览文件 @
c7dd5985
...
...
@@ -268,5 +268,66 @@ export default function requestUploadJSUnit() {
done();
}, 10000)
});
/**
* @tc.number SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001
* @tc.desc Starts a upload task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 is starting-----------------------");
try {
request.uploadFile(globalThis.abilityContext, uploadConfig, (err, data)=>{
uploadTask = data;
console.info("SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 uploadFile: " + uploadTask);
try{
expect(true).assertEqual(uploadTask != undefined);
}catch(e){
console.info("SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 except error: " + e);
}
});
} catch (err) {
console.error("SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 error: " + err);
expect().assertFail();
};
setTimeout(()=>{
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_CALLBACK_0001 end-----------------------");
done();
}, 10000);
});
/**
* @tc.number SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001
* @tc.desc Starts a upload task.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001', 0, async function (done) {
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 is starting-----------------------");
try{
request.uploadFile(globalThis.abilityContext, uploadConfig).then(data => {
uploadTask = data;
console.info("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 uploadFile: " + uploadTask);
try{
expect(true).assertEqual(uploadTask != undefined);
}catch(e){
console.info("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 except error: " + e);
}
}).catch(err => {
console.error("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 error: " + err);
expect().assertFail();
})
}catch(err){
console.error("SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 catch error: " + err);
}
setTimeout(()=>{
console.info("-----------------------SUB_REQUEST_uploadFile_STAGE_API_PROMISE_0001 end-----------------------");
done();
}, 10000);
});
})
}
telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/ObjectInterface_test.js
浏览文件 @
c7dd5985
...
...
@@ -417,7 +417,7 @@ export default function ObjectInterfaceTest() {
try
{
var
resultSet
=
await
contactsapi
.
queryContact
(
queryId
);
console
.
info
(
"
contactsApi_query_contact_test_400 : query resultSet =
"
+
JSON
.
stringify
(
resultSet
));
expect
(
resultSet
!=
null
).
assertTrue
();
expect
(
resultSet
==
undefined
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
"
contactsApi_query_contact_test_400 query error =
"
+
error
);
...
...
@@ -437,7 +437,7 @@ export default function ObjectInterfaceTest() {
done
();
return
;
}
var
queryId
=
gRawContactId
.
toString
()
;
var
queryId
=
gRawContactId
;
var
holder
=
{
bundleName
:
"
com.ohos.contacts
"
,
displayName
:
"
phone
"
,
holderId
:
1
}
...
...
@@ -445,7 +445,8 @@ export default function ObjectInterfaceTest() {
expect
(
holder
.
displayName
===
null
).
assertFalse
();
expect
(
holder
.
holderId
!=
0
).
assertTrue
();
try
{
var
resultSet
=
await
contactsapi
.
queryContact
(
queryId
,
holder
);
var
findKey
=
contactsapi
.
queryKey
(
queryId
);
var
resultSet
=
await
contactsapi
.
queryContact
(
findKey
,
holder
);
console
.
info
(
"
contactsApi_query_contact_test_500 : query resultSet =
"
+
JSON
.
stringify
(
resultSet
));
expect
(
resultSet
===
null
).
assertFalse
();
done
();
...
...
@@ -467,7 +468,7 @@ export default function ObjectInterfaceTest() {
done
();
return
;
}
var
queryId
=
gRawContactId
.
toString
()
;
var
queryId
=
gRawContactId
;
var
holder
=
{
bundleName
:
"
com.ohos.contacts
"
,
displayName
:
"
phone
"
,
holderId
:
1
};
...
...
@@ -475,7 +476,8 @@ export default function ObjectInterfaceTest() {
attributes
:
[
1
,
5
,
6
]
}
try
{
var
resultSet
=
await
contactsapi
.
queryContact
(
queryId
,
holder
,
ContactAttributes
);
var
findKey
=
contactsapi
.
queryKey
(
queryId
);
var
resultSet
=
await
contactsapi
.
queryContact
(
findKey
,
holder
,
ContactAttributes
);
console
.
info
(
"
contactsApi_query_contact_test_600 : query resultSet =
"
+
JSON
.
stringify
(
resultSet
));
expect
(
resultSet
===
null
).
assertFalse
();
done
();
...
...
@@ -1051,7 +1053,7 @@ export default function ObjectInterfaceTest() {
try
{
var
updateCode
=
await
contactsapi
.
updateContact
(
updateValues
,
condition
);
console
.
info
(
"
abnormal_contactsApi_update_test_3000 : updateCode =
"
+
updateCode
);
expect
(
updateCode
===
-
1
).
assert
Fals
e
();
expect
(
updateCode
===
-
1
).
assert
Tru
e
();
done
();
}
catch
(
error
)
{
console
.
info
(
"
abnormal_contactsApi_update_test_3000 : update error =
"
+
error
);
...
...
telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/js/test/Http.nopermission.test.js
浏览文件 @
c7dd5985
...
...
@@ -32,15 +32,12 @@ describe("Telephony_NetManager_NetWorkTest", function () {
},
fail
:
function
(
data
,
code
){
console
.
info
(
"
NetManager code
"
+
code
)
expect
(
code
==
=
602
).
assertTrue
()
expect
(
code
==
602
).
assertTrue
()
done
();
},
complete
:
function
(){
expect
().
assertTrue
()
done
();
}
})
done
();
});
/**
...
...
@@ -56,15 +53,12 @@ describe("Telephony_NetManager_NetWorkTest", function () {
},
fail
:
function
(
data
,
code
){
console
.
info
(
"
NetManager code
"
+
code
)
expect
(
code
==
=
602
).
assertTrue
()
expect
(
code
==
602
).
assertTrue
()
done
();
},
complete
:
function
(){
expect
().
assertTrue
()
done
();
}
})
done
();
});
/**
...
...
@@ -80,11 +74,10 @@ describe("Telephony_NetManager_NetWorkTest", function () {
},
fail
:
function
(
data
,
code
){
console
.
info
(
"
NetManager code
"
+
code
)
expect
(
code
==
=
602
).
assertTrue
()
expect
(
code
==
602
).
assertTrue
()
done
();
}
})
done
();
})
/**
...
...
@@ -100,11 +93,10 @@ describe("Telephony_NetManager_NetWorkTest", function () {
},
fail
:
function
(
data
,
code
){
console
.
info
(
"
NetManager code
"
+
code
)
expect
(
code
==
=
602
).
assertTrue
()
expect
(
code
==
602
).
assertTrue
()
done
();
}
})
done
();
})
});
...
...
telephony/telephonyjstest/netmanager_base/register/Test.json
浏览文件 @
c7dd5985
...
...
@@ -15,6 +15,14 @@
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"power-shell wakeup"
,
"power-shell setmode 602"
,
"uinput -T -m 425 1000 425 500 400"
]
}
]
}
telephony/telephonyjstest/netmanager_base/register/src/main/js/test/NetworkManagerRegister.test.js
浏览文件 @
c7dd5985
...
...
@@ -29,6 +29,7 @@
const
TIMEOUT
=
100
;
const
TIMEOUT_1
=
1000
;
let
VALUE
=
0
;
let
envReady
=
false
;
function
sleep
(
timeout
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -2258,6 +2259,11 @@
* @tc.desc Function test
*/
it
(
'
Telephony_NetworkManager_unregister_Async_0100
'
,
0
,
async
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
caseName
=
'
Telephony_NetworkManager_unregister_Async_0100
'
;
let
netSpecifier
=
{
netCapabilities
:
{
...
...
@@ -2353,6 +2359,11 @@
* @tc.desc Function test
*/
it
(
'
Telephony_NetworkManager_unregister_Async_0200
'
,
0
,
async
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
caseName
=
'
Telephony_NetworkManager_unregister_Async_0200
'
;
let
netConn
=
connection
.
createNetConnection
();
netConn
.
on
(
'
netAvailable
'
,
(
error
,
value
)
=>
{
...
...
@@ -2439,6 +2450,11 @@
* @tc.desc Function test
*/
it
(
'
Telephony_NetworkManager_unregister_Async_0300
'
,
0
,
async
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
caseName
=
'
Telephony_NetworkManager_unregister_Async_0300
'
;
let
netConn
=
connection
.
createNetConnection
();
netConn
.
on
(
'
netAvailable
'
,
(
error
,
value
)
=>
{
...
...
telephony/telephonyjstest/netmanager_base/socket/src/main/js/test/NetStackSocket.test.js
浏览文件 @
c7dd5985
...
...
@@ -19,7 +19,7 @@ export default function Telephony_NETSTACK_SocketTest() {
describe
(
'
Telephony_NETSTACK_SocketTest
'
,
function
()
{
let
envReady
=
false
;
/**
* @tc.number Telephony_NetStack_UDPTest0100
...
...
@@ -28,6 +28,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest0100
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
bind
({
address
:
"
127.0.0.1
"
,
...
...
@@ -47,6 +52,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest0200
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
bind
({
address
:
"
127.0.0.1
"
,
...
...
@@ -66,6 +76,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest0300
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
send
({
address
:
{
...
...
@@ -88,6 +103,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest0400
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
send
({
address
:
{
...
...
@@ -110,6 +130,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest0500
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
close
(
function
(
err
,
data
)
{
expect
(
err
!==
undefined
).
assertTrue
()
...
...
@@ -125,6 +150,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest0600
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
close
().
then
(
function
(
data
)
{
expect
(
data
!==
undefined
).
assertTrue
()
...
...
@@ -140,6 +170,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest0700
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
getState
(
function
(
err
,
data
)
{
expect
(
err
!==
undefined
).
assertTrue
()
...
...
@@ -155,6 +190,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest0800
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
getState
().
then
(
function
(
data
)
{
expect
(
data
!==
undefined
).
assertTure
()
...
...
@@ -170,6 +210,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest0900
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
setExtraOptions
({},
function
(
err
,
data
)
{
expect
(
err
!==
undefined
).
assertTure
()
...
...
@@ -185,6 +230,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest1000
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
setExtraOptions
({},).
then
(
function
(
date
)
{
expect
(
date
!==
undefined
).
assertTrue
()
...
...
@@ -200,6 +250,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest1100
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
on
(
'
message
'
,
function
()
{
expect
().
assertFail
()
...
...
@@ -227,6 +282,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_UDPTest1200
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
udp
=
netSocket
.
constructUDPSocketInstance
()
udp
.
on
(
'
message
'
,
function
()
{
})
...
...
@@ -262,6 +322,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest0100
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
bind
({
address
:
"
127.0.0.1
"
,
...
...
@@ -281,6 +346,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest0200
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
bind
({
address
:
"
127.0.0.1
"
,
...
...
@@ -300,6 +370,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest0300
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
send
({
data
:
"
Hello
"
...
...
@@ -317,6 +392,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest0400
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
send
({
data
:
"
Hello
"
...
...
@@ -334,6 +414,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest0500
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
close
(
function
(
err
,
data
)
{
expect
(
err
!==
undefined
).
assertTrue
()
...
...
@@ -349,6 +434,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest0600
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
close
().
then
(
function
(
data
)
{
expect
(
data
!==
undefined
).
assertTrue
()
...
...
@@ -364,6 +454,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest0700
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
getState
(
function
(
err
,
data
)
{
expect
(
err
!==
undefined
).
assertTrue
()
...
...
@@ -379,6 +474,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest0800
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
getState
().
then
(
function
(
data
)
{
expect
(
data
!==
undefined
).
assertTure
()
...
...
@@ -394,6 +494,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest0900
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
setExtraOptions
({},
function
(
err
,
data
)
{
expect
(
err
!==
undefined
).
assertTure
()
...
...
@@ -409,6 +514,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest1000
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
setExtraOptions
({},).
then
(
function
(
date
)
{
expect
(
date
!==
undefined
).
assertTrue
()
...
...
@@ -424,6 +534,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest1100
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
on
(
'
message
'
,
function
()
{
expect
().
assertFail
()
...
...
@@ -451,6 +566,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
*/
it
(
'
Telephony_NetStack_TCPTest1200
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
on
(
'
message
'
,
function
()
{
})
...
...
@@ -485,6 +605,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
* @tc.desc Function test
*/
it
(
'
Telephony_NetStack_TCPTest1300
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
getRemoteAddress
(
function
(
err
,
data
)
{
expect
(
err
!==
undefined
).
assertTure
()
...
...
@@ -499,6 +624,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
* @tc.desc Function test
*/
it
(
'
Telephony_NetStack_TCPTest1400
'
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
tcp
=
netSocket
.
constructTCPSocketInstance
()
tcp
.
getRemoteAddress
().
then
(
function
(
data
)
{
expect
(
data
!==
undefined
).
assertTure
()
...
...
@@ -513,6 +643,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
* @tc.desc Function test
*/
it
(
"
Telephony_NetStack_TCPTest_1500
"
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
TCP
=
netSocket
.
constructTCPSocketInstance
()
TCP
.
connect
({
address
:
{
...
...
@@ -534,6 +669,11 @@ describe('Telephony_NETSTACK_SocketTest', function () {
* @tc.desc Function test
*/
it
(
"
Telephony_NetStack_TCPTest_1600
"
,
0
,
function
(
done
)
{
if
(
!
envReady
)
{
console
.
info
(
"
The environment was not ready
"
);
done
();
return
;
}
let
TCP
=
netSocket
.
constructTCPSocketInstance
()
TCP
.
connect
({
address
:
{
...
...
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionJsunit.test.ets
浏览文件 @
c7dd5985
此差异已折叠。
点击以展开。
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionSecondJsUnit.test.ets
浏览文件 @
c7dd5985
...
...
@@ -19,12 +19,19 @@ import utils from './Utils.ets'
export default function connectionSecondJsUnit() {
describe("connectionSecondJsunit", function () {
let envReady = false;
/**
* @tc.name: Telephony_connection_ConnectionProperties_0100
* @tc.desc: ConnectionProperties Properties detection
* @tc.author: kangyuntao
*/
it("Telephony_connection_ConnectionProperties_0100", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony ConnectionProperties Test is starting-----------------------");
let caseName = 'Telephony_connection_ConnectionProperties_0100';
try {
...
...
@@ -74,6 +81,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getConnectionProperties_Async_0200', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getConnectionProperties Test is starting-----------------------");
if(false){
expect(true).assertTrue();
...
...
@@ -119,6 +131,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it("Telephony_connection_RouteInfo_0300", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("----------------------RouteInfo Properties Test is starting-----------------------");
try {
let resultInterface = {
...
...
@@ -158,6 +175,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getRouteInfo_Async_0400', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getRouteInfo Test is starting-----------------------");
let caseName = 'Telephony_connection_getRouteInfo_Async_0400';
connection.getAllNets((error, value) => {
...
...
@@ -195,6 +217,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it("Telephony_connection_LinkAddress_0500", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("----------------------LinkAddress Properties Test is starting-----------------------");
try {
let resultPrefixLength = {
...
...
@@ -214,6 +241,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getLinkAddress_Async_0600', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getLinkAddress Test is starting-----------------------");
let caseName = 'Telephony_connection_getLinkAddress_Async_0600';
connection.getAllNets((error, value) => {
...
...
@@ -249,6 +281,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it("Telephony_connection_NetAddress_0700", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("----------------------NetAddress Properties Test is starting-----------------------");
try {
let resultPort = {
...
...
@@ -268,6 +305,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetAddress_Async_0800', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getNetAddress Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetAddress_Async_0800';
connection.getAllNets((error, value) => {
...
...
@@ -303,6 +345,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it("Telephony_connection_NetCap_0900", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony NetCap Properties Test is starting-----------------------");
if (false) {
expect(true).assertTrue();
...
...
@@ -329,6 +376,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetCap_Async_1000', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getNetCap Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetCap_Async_1000';
connection.getAllNets((error, value) => {
...
...
@@ -362,6 +414,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it("Telephony_connection_NetBearType_1100", 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony NetBearType Properties Test is starting-----------------------");
if (false) {
expect(true).assertTrue();
...
...
@@ -385,6 +442,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetBearType_Async_1200', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getNetBearType Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetBearType_Async_1200';
connection.getAllNets((error, value) => {
...
...
@@ -418,6 +480,11 @@ export default function connectionSecondJsUnit() {
* @tc.author: kangyuntao
*/
it('Telephony_connection_getNetCapabilities_Promise_1300', 0, function (done) {
if (!envReady) {
console.info("The environment was not ready");
done();
return;
}
console.log("-----------------------Telephony getNetCapabilities Promise Test is starting-----------------------");
let caseName = 'Telephony_connection_getNetCapabilities_Promise_1300';
connection.getAllNets().then((handle) => {
...
...
telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/SocketJsunit.test.ets
浏览文件 @
c7dd5985
此差异已折叠。
点击以展开。
theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets
浏览文件 @
c7dd5985
...
...
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import screenLock from '@ohos.screenLock';
import {
describe, expect, it} from 'deccjsunit/index'
import {
describe, expect, it, beforeEach} from "hypium/index";
const SLEEP_TIME = 1000;
...
...
@@ -22,15 +22,11 @@ export default function ScreenLockPromiseTest(){
describe('ScreenLockServicePromiseTest', function () {
console.info("-----------------------ScreenlockPromiseTest is starting-----------------------");
function sleep(numberMillis) {
let now = new Date();
let exitTime = now.getTime() + numberMillis;
while (true) {
now = new Date();
if (now.getTime() > exitTime)
return;
}
}
let result = false
beforeEach(async function (done) {
result = await screenLock.isScreenLocked();
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_Promise_001
...
...
@@ -45,14 +41,16 @@ export default function ScreenLockPromiseTest(){
try {
screenLock.isScreenLocked().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_001 isScreenLocked result is " + data);
expect(data == true).assertTrue()
expect(data == result).assertTrue()
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_001-------------------");
done();
})
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_Promise_001 test_setScreenLocked : error = " + error);
expect(true).assertTrue();
expect().assertFail();
done();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_001-------------------");
done();
});
/*
...
...
@@ -68,14 +66,16 @@ export default function ScreenLockPromiseTest(){
try {
screenLock.isScreenLocked().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_002 isScreenLocked result is " + data);
expect(data == false).assertTrue();
expect(data == result).assertTrue();
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_002-------------------");
done();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_Promise_002 test_setScreenLocked : error = " + error);
expect(true).assertTrue();
expect().assertFail();
done();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_002-------------------");
done();
});
/*
...
...
@@ -92,84 +92,14 @@ export default function ScreenLockPromiseTest(){
screenLock.isSecureMode().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_003 isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("SUB_MISC_THEME_screenLock_API_Promise_003 isScreenLocked TRUE: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_003-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_Promise_004
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_Promise_004", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_004-------------------");
try {
screenLock.unlockScreen().then(() => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_004: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 0;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_004: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_004: isScreenLocked result is " + data);
expect(data == false).assertTrue();
});
} catch (error) {
console.info("Screenlock_Test_1400: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_004-------------------");
done();
});
/*
* @tc.number SUB_MISC_THEME_screenLock_API_Promise_005
* @tc.name Set to locked screen, query the lock screen state is locked state
* @tc.desc Test ScreenLock API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it("SUB_MISC_THEME_screenLock_API_Promise_005", 0, async function (done) {
console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_005-------------------");
try {
screenLock.unlockScreen().then(() => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_005: send unlockScreen issue success");
});
sleep(SLEEP_TIME);
let unlockScreenResult = 1;
let eventType = 'unlockScreenResult';
screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_005: sendScreenLockEvent result is " + data);
expect(data == true).assertTrue();
});
sleep(SLEEP_TIME);
screenLock.isScreenLocked().then((data) => {
console.info("SUB_MISC_THEME_screenLock_API_Promise_005: isScreenLocked result is " + data);
expect(data == true).assertTrue();
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_003-------------------");
done();
});
} catch (error) {
console.info("logMessage SUB_MISC_THEME_screenLock_API_Promise_005: error = " + error);
expect(true).assertTrue();
}
console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_005-------------------");
done();
console.info("SUB_MISC_THEME_screenLock_API_Promise_003 isScreenLocked TRUE: error = " + error);
expect().assertFail();
done();
}
});
})
}
theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets
浏览文件 @
c7dd5985
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录