Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0b9e5528
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
接近 2 年 前同步成功
通知
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看板
提交
0b9e5528
编写于
4月 20, 2022
作者:
Q
qiuxiangdong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: Add a description
Signed-off-by:
N
qiuxiangdong
<
qiuxiangdong3@huawei.com
>
上级
1cc038fb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
85 addition
and
14 deletion
+85
-14
powermgr/powermgrpower/src/main/js/default/test/power_manager_power.test.js
...ower/src/main/js/default/test/power_manager_power.test.js
+24
-0
powermgr/powermgrpower/src/main/js/default/test/power_manager_running_lock.test.js
...c/main/js/default/test/power_manager_running_lock.test.js
+61
-14
未找到文件。
powermgr/powermgrpower/src/main/js/default/test/power_manager_power.test.js
浏览文件 @
0b9e5528
...
...
@@ -19,6 +19,12 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
describe
(
'
appInfoTest
'
,
function
()
{
console
.
log
(
"
*************Power Unit Test Begin*************
"
);
/**
* @tc.number power_js_001
* @tc.name power_is_screen_on_promise_test
* @tc.desc Checks whether the screen of a device is on or off
*/
it
(
'
power_is_screen_on_promise_test
'
,
0
,
async
function
(
done
)
{
//isScreenOn(): Promise<boolean>
power
.
wakeupDevice
(
"
power_is_screen_on_promise_test
"
);
power
.
isScreenOn
()
...
...
@@ -34,6 +40,12 @@ describe('appInfoTest', function () {
done
();
})
})
/**
* @tc.number power_js_002
* @tc.name power_is_screen_on_callback_test
* @tc.desc Checks whether the screen of a device is on or off
*/
it
(
'
power_is_screen_on_callback_test
'
,
0
,
async
function
(
done
)
{
//isScreenOn(callback: AsyncCallback<boolean>)
power
.
wakeupDevice
(
"
power_is_screen_on_callback_test
"
);
power
.
isScreenOn
((
error
,
screenOn
)
=>
{
...
...
@@ -49,6 +61,12 @@ describe('appInfoTest', function () {
}
})
})
/**
* @tc.number power_js_003
* @tc.name power_wakeupDevice_test_string
* @tc.desc Try to wakeup the device and let screen on
*/
it
(
'
power_wakeupDevice_test_string
'
,
0
,
async
function
(
done
)
{
//wakeupDevice(detail: string): void
power
.
isScreenOn
()
.
then
(
screenOn
=>
{
...
...
@@ -78,6 +96,12 @@ describe('appInfoTest', function () {
})
},
2000
);
})
/**
* @tc.number power_js_003
* @tc.name power_suspendDevice_test
* @tc.desc Try to suspend the device and let screen off
*/
it
(
'
power_suspendDevice_test
'
,
0
,
async
function
(
done
)
{
//function suspendDevice(): void;
power
.
isScreenOn
()
.
then
(
screenOn
=>
{
...
...
powermgr/powermgrpower/src/main/js/default/test/power_manager_running_lock.test.js
浏览文件 @
0b9e5528
...
...
@@ -13,17 +13,19 @@
* limitations under the License.
*/
import
app
from
'
@system.app
'
import
Context
from
'
@ohos.napi_context
'
import
runningLock
from
'
@ohos.runningLock
'
;
import
power
from
'
@ohos.power
'
;
import
'
@ohos.permission.RUNNING_LOCK
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
appInfoTest
'
,
function
()
{
console
.
log
(
"
*************Power Unit Test Begin*************
"
);
//createRunningLock(name: string, type: RunningLockType): Promise<RunningLock>
console
.
log
(
"
*************RunningLock Unit Test Begin*************
"
);
/**
* @tc.number running_lock_js_001
* @tc.name create_running_lock_promise_test
* @tc.desc Create running lock
*/
it
(
'
create_running_lock_promise_test
'
,
0
,
async
function
(
done
)
{
runningLock
.
createRunningLock
(
"
running_lock_test_1
"
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
runninglock
=>
{
...
...
@@ -37,7 +39,12 @@ describe('appInfoTest', function () {
done
();
})
})
//createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback<RunningLock>)
/**
* @tc.number running_lock_js_002
* @tc.name create_running_lock_callback_test
* @tc.desc Create running lock
*/
it
(
'
create_running_lock_callback_test
'
,
0
,
async
function
(
done
)
{
runningLock
.
createRunningLock
(
"
running_lock_test_2
"
,
runningLock
.
RunningLockType
.
BACKGROUND
,
(
error
,
runninglock
)
=>
{
...
...
@@ -60,7 +67,12 @@ describe('appInfoTest', function () {
}
})
})
//lock(timeout: number)
/**
* @tc.number running_lock_js_003
* @tc.name running_lock_lock_test
* @tc.desc Prevents the system from hibernating and sets the lock duration
*/
it
(
'
running_lock_lock_test
'
,
0
,
async
function
(
done
)
{
runningLock
.
createRunningLock
(
"
running_lock_test_3
"
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
runninglock
=>
{
...
...
@@ -81,7 +93,12 @@ describe('appInfoTest', function () {
done
();
})
})
//isUsed()
/**
* @tc.number running_lock_js_004
* @tc.name running_lock_lock_test
* @tc.desc Checks whether a lock is held or in use
*/
it
(
'
running_lock_isused_test
'
,
0
,
async
function
(
done
)
{
runningLock
.
createRunningLock
(
"
running_lock_test_4
"
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
runninglock
=>
{
...
...
@@ -98,7 +115,12 @@ describe('appInfoTest', function () {
done
();
})
})
//unlock()
/**
* @tc.number running_lock_js_005
* @tc.name running_lock_unlock_test
* @tc.desc Release running lock
*/
it
(
'
running_lock_unlock_test
'
,
0
,
async
function
(
done
)
{
runningLock
.
createRunningLock
(
"
running_lock_test_5
"
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
runninglock
=>
{
...
...
@@ -123,21 +145,36 @@ describe('appInfoTest', function () {
done
();
})
})
//Runninglock锁的类型为BACKGROUND
/**
* @tc.number running_lock_js_006
* @tc.name enum_runningLock_type_background_test
* @tc.desc The lock type is BACKGROUND
*/
it
(
'
enum_runningLock_type_background_test
'
,
0
,
function
()
{
let
runningLockType
=
runningLock
.
RunningLockType
.
BACKGROUND
;
console
.
info
(
'
runningLockType =
'
+
runningLockType
);
expect
(
runningLockType
==
1
).
assertTrue
();
console
.
info
(
'
enum_runningLock_type_background_test success
'
);
})
//Runninglock锁的类型为PROXIMITY_SCREEN_CONTROL
/**
* @tc.number running_lock_js_007
* @tc.name enum_runningLock_type_proximityscreencontrol_test
* @tc.desc The lock type is PROXIMITY_SCREEN_CONTROL
*/
it
(
'
enum_runningLock_type_proximityscreencontrol_test
'
,
0
,
function
()
{
let
runningLockType
=
runningLock
.
RunningLockType
.
PROXIMITY_SCREEN_CONTROL
;
console
.
info
(
'
runningLockType =
'
+
runningLockType
);
expect
(
runningLockType
==
2
).
assertTrue
();
console
.
info
(
'
enum_runningLock_type_proximityscreencontrol_test success
'
);
})
//isRunningLockTypeSupported(type: RunningLockType): Promise<boolean>
/**
* @tc.number running_lock_js_008
* @tc.name is_runninglock_type_supported_promise_test_1
* @tc.desc Checks whether the specified RunningLockType is supported.
*/
it
(
'
is_runninglock_type_supported_promise_test_1
'
,
0
,
async
function
(
done
)
{
runningLock
.
isRunningLockTypeSupported
(
runningLock
.
RunningLockType
.
PROXIMITY_SCREEN_CONTROL
)
.
then
(
supported
=>
{
...
...
@@ -152,7 +189,12 @@ describe('appInfoTest', function () {
done
();
})
})
//isRunningLockTypeSupported(type: RunningLockType) 多余
/**
* @tc.number running_lock_js_009
* @tc.name is_runninglock_type_supported_promise_test_2
* @tc.desc Checks whether the specified RunningLockType is supported.
*/
it
(
'
is_runninglock_type_supported_promise_test_2
'
,
0
,
async
function
(
done
)
{
runningLock
.
isRunningLockTypeSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
(
supported
=>
{
...
...
@@ -167,7 +209,12 @@ describe('appInfoTest', function () {
done
();
})
})
//isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback<boolean>)
/**
* @tc.number running_lock_js_010
* @tc.name is_runninglock_type_supported_callback_test_3
* @tc.desc Checks whether the specified RunningLockType is supported.
*/
it
(
'
is_runninglock_type_supported_callback_test_3
'
,
0
,
async
function
(
done
)
{
runningLock
.
isRunningLockTypeSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
,
(
error
,
supported
)
=>
{
if
(
typeof
error
===
"
undefined
"
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录