Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
1ab6bc90
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看板
提交
1ab6bc90
编写于
7月 08, 2022
作者:
Z
zhangyushuai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modified screenlok api
Signed-off-by:
N
zhangyushuai
<
zhangyushuai1@huawei.com
>
上级
bcd1366b
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
189 addition
and
461 deletion
+189
-461
miscservices/screenlock_js/src/main/js/test/screenlock_service_test.js
...screenlock_js/src/main/js/test/screenlock_service_test.js
+165
-406
miscservices/screenlock_js/src/main/js/test/screenlock_service_test_promise.js
...ck_js/src/main/js/test/screenlock_service_test_promise.js
+24
-55
未找到文件。
miscservices/screenlock_js/src/main/js/test/screenlock_service_test.js
浏览文件 @
1ab6bc90
此差异已折叠。
点击以展开。
miscservices/screenlock_js/src/main/js/test/screenlock_service_test_promise.js
浏览文件 @
1ab6bc90
...
...
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
screenLock
from
'
@ohos.
app.screenlockability
'
;
import
screenLock
from
'
@ohos.
screenLock
'
;
import
{
describe
,
expect
,
it
}
from
'
deccjsunit/index
'
const
SLEEP_TIME
=
1000
;
describe
(
'
ScreenLockServicePromiseTest
'
,
function
()
{
console
.
log
(
"
-----------------------ScreenlockPromiseTest is starting-----------------------
"
);
console
.
info
(
"
-----------------------ScreenlockPromiseTest is starting-----------------------
"
);
function
sleep
(
numberMillis
)
{
var
now
=
new
Date
();
...
...
@@ -41,21 +41,16 @@ describe('ScreenLockServicePromiseTest', function () {
console
.
info
(
"
------------------start ScreenLock_Test_Promise_0100-------------------
"
);
var
isScreenLocked
=
true
;
try
{
screenLock
.
test_setScreenLocked
(
isScreenLocked
).
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0100 test_setScreenLocked result is
"
+
data
);
expect
(
data
==
true
).
assertTrue
();
screenLock
.
isScreenLocked
().
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0100 isScreenLocked result is
"
+
data
);
expect
(
data
==
true
).
assertTrue
();
done
();
})
screenLock
.
isScreenLocked
().
then
((
data
)
=>
{
console
.
info
(
"
ScreenLock_Test_Promise_0100 isScreenLocked result is
"
+
data
);
expect
(
data
==
true
).
assertTrue
()
})
}
catch
(
error
)
{
console
.
log
(
"
ScreenLock_Test_Promise_0100 test_setScreenLocked : error =
"
+
error
);
expect
(
true
).
assertTrue
();
done
();
console
.
info
(
"
ScreenLock_Test_Promise_0100 test_setScreenLocked : error =
"
+
error
);
expect
(
true
).
assertTrue
();
}
console
.
info
(
"
------------------end ScreenLock_Test_Promise_0100-------------------
"
);
done
();
});
/*
...
...
@@ -68,21 +63,16 @@ describe('ScreenLockServicePromiseTest', function () {
console
.
info
(
"
------------------start ScreenLock_Test_Promise_0200-------------------
"
);
var
isScreenLocked
=
false
;
try
{
screenLock
.
test_setScreenLocked
(
isScreenLocked
).
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0200 test_setScreenLocked result is
"
+
data
);
expect
(
data
==
true
).
assertTrue
();
screenLock
.
isScreenLocked
().
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0200 isScreenLocked result is
"
+
data
);
expect
(
data
==
false
).
assertTrue
();
done
();
});
screenLock
.
isScreenLocked
().
then
((
data
)
=>
{
console
.
info
(
"
ScreenLock_Test_Promise_0200 isScreenLocked result is
"
+
data
);
expect
(
data
==
false
).
assertTrue
();
});
}
catch
(
error
)
{
console
.
log
(
"
ScreenLock_Test_Promise_0200 test_setScreenLocked : error =
"
+
error
);
console
.
info
(
"
ScreenLock_Test_Promise_0200 test_setScreenLocked : error =
"
+
error
);
expect
(
true
).
assertTrue
();
done
();
}
console
.
info
(
"
------------------end ScreenLock_Test_Promise_0200-------------------
"
);
done
();
});
/*
...
...
@@ -95,16 +85,15 @@ describe('ScreenLockServicePromiseTest', function () {
console
.
info
(
"
------------------start ScreenLock_Test_Promise_0300-------------------
"
);
try
{
screenLock
.
isSecureMode
().
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0300 isScreenLocked result is
"
+
data
);
console
.
info
(
"
ScreenLock_Test_Promise_0300 isScreenLocked result is
"
+
data
);
expect
(
data
==
false
).
assertTrue
();
done
();
});
}
catch
(
error
)
{
console
.
log
(
"
ScreenLock_Test_Promise_0300 isScreenLocked TRUE: error =
"
+
error
);
console
.
info
(
"
ScreenLock_Test_Promise_0300 isScreenLocked TRUE: error =
"
+
error
);
expect
(
true
).
assertTrue
();
done
();
}
console
.
info
(
"
------------------end ScreenLock_Test_Promise_0300-------------------
"
);
done
();
});
/*
...
...
@@ -116,41 +105,27 @@ describe('ScreenLockServicePromiseTest', function () {
it
(
"
ScreenLock_Test_Promise_0400
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------start ScreenLock_Test_Promise_0400-------------------
"
);
try
{
var
isScreenLocked
=
true
;
screenLock
.
test_setScreenLocked
(
isScreenLocked
).
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0400: test_setScreenLocked1
"
+
data
+
"
result is successfull
"
);
});
sleep
(
SLEEP_TIME
);
screenLock
.
unlockScreen
().
then
(()
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0400: send unlockScreen issue success
"
);
console
.
info
(
"
ScreenLock_Test_Promise_0400: send unlockScreen issue success
"
);
});
sleep
(
SLEEP_TIME
);
var
unlockScreenResult
=
0
;
var
eventType
=
'
unlockScreenResult
'
;
screenLock
.
sendScreenLockEvent
(
eventType
,
unlockScreenResult
).
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0400: sendScreenLockEvent result is
"
+
data
);
console
.
info
(
"
ScreenLock_Test_Promise_0400: sendScreenLockEvent result is
"
+
data
);
expect
(
data
==
true
).
assertTrue
();
});
sleep
(
SLEEP_TIME
);
screenLock
.
isScreenLocked
().
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0400: isScreenLocked result is
"
+
data
);
console
.
info
(
"
ScreenLock_Test_Promise_0400: isScreenLocked result is
"
+
data
);
expect
(
data
==
false
).
assertTrue
();
});
sleep
(
SLEEP_TIME
);
screenLock
.
test_setScreenLocked
(
isScreenLocked
).
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0400: test_setScreenLocked2
"
+
data
+
"
result is successfull
"
);
done
();
});
}
catch
(
error
)
{
console
.
info
(
"
Screenlock_Test_1400: error =
"
+
error
);
expect
(
true
).
assertTrue
();
done
();
}
console
.
info
(
"
------------------end ScreenLock_Test_Promise_0400-------------------
"
);
done
();
});
/*
...
...
@@ -162,36 +137,30 @@ describe('ScreenLockServicePromiseTest', function () {
it
(
"
ScreenLock_Test_Promise_0500
"
,
0
,
async
function
(
done
)
{
console
.
info
(
"
------------------start ScreenLock_Test_Promise_0500-------------------
"
);
try
{
var
isScreenLocked
=
true
;
screenLock
.
test_setScreenLocked
(
isScreenLocked
).
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0500: test_setScreenLocked
"
+
data
+
"
result is successfull
"
);
});
sleep
(
SLEEP_TIME
);
screenLock
.
unlockScreen
().
then
(()
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0500: send unlockScreen issue success
"
);
console
.
info
(
"
ScreenLock_Test_Promise_0500: send unlockScreen issue success
"
);
});
sleep
(
SLEEP_TIME
);
var
unlockScreenResult
=
1
;
var
eventType
=
'
unlockScreenResult
'
;
screenLock
.
sendScreenLockEvent
(
eventType
,
unlockScreenResult
).
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0500: sendScreenLockEvent result is
"
+
data
);
console
.
info
(
"
ScreenLock_Test_Promise_0500: sendScreenLockEvent result is
"
+
data
);
expect
(
data
==
true
).
assertTrue
();
});
sleep
(
SLEEP_TIME
);
screenLock
.
isScreenLocked
().
then
((
data
)
=>
{
console
.
log
(
"
ScreenLock_Test_Promise_0500: isScreenLocked result is
"
+
data
);
console
.
info
(
"
ScreenLock_Test_Promise_0500: isScreenLocked result is
"
+
data
);
expect
(
data
==
true
).
assertTrue
();
done
();
});
}
catch
(
error
)
{
console
.
info
(
"
logMessage ScreenLock_Test_Promise_0500: error =
"
+
error
);
expect
(
true
).
assertTrue
();
done
();
}
console
.
info
(
"
------------------end ScreenLock_Test_Promise_0500-------------------
"
);
done
();
});
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录