Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b9a89fb6
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看板
未验证
提交
b9a89fb6
编写于
2月 18, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 18, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7628 【代码上库】【xts_acts】【powermgr】【master】 power test code optimization
Merge pull request !7628 from kangqiao/master
上级
f545f365
4434bbc4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
3313 addition
and
2329 deletion
+3313
-2329
powermgr/battery_manager/src/main/js/test/battery_common_event.test.js
...ery_manager/src/main/js/test/battery_common_event.test.js
+3238
-2258
powermgr/display_manager/src/main/js/test/system_display.test.js
...r/display_manager/src/main/js/test/system_display.test.js
+15
-19
powermgr/power_manager/src/main/js/test/power_manager_power.test.js
...ower_manager/src/main/js/test/power_manager_power.test.js
+2
-2
powermgr/thermal_manager/src/main/js/test/thermal_common_event.test.js
...mal_manager/src/main/js/test/thermal_common_event.test.js
+58
-50
未找到文件。
powermgr/battery_manager/src/main/js/test/battery_common_event.test.js
浏览文件 @
b9a89fb6
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
powermgr/display_manager/src/main/js/test/system_display.test.js
浏览文件 @
b9a89fb6
...
...
@@ -93,22 +93,19 @@ export default async function SystemDisplayTest() {
brightness
.
setKeepScreenOn
({
keepScreenOn
:
true
,
success
:
function
()
{
console
.
log
(
'
handling set keep screen on success
0
.
'
);
console
.
log
(
'
handling set keep screen on success.
'
);
brightness
.
setValue
({
value
:
50
,
success
:
function
()
{
console
.
log
(
'
set keep screen on success1.
'
);
setTimeout
(()
=>
{
console
.
log
(
'
set keep screen on success2.
'
);
brightness
.
getValue
({
success
:
(
data
)
=>
{
console
.
log
(
"
set_value_success_value, brightness:
"
+
data
.
value
);
expect
(
data
.
value
===
50
).
assertTrue
();
done
();
}
});
},
1000
);
console
.
log
(
'
set_value_success_value success.
'
);
expect
(
true
).
assertTrue
();
done
();
},
fail
:
function
()
{
console
.
log
(
'
set_value_success_value fail.
'
);
expect
().
assertFail
();
done
();
}
});
},
fail
:
function
(
data
,
code
)
{
...
...
@@ -188,13 +185,12 @@ export default async function SystemDisplayTest() {
mode
:
0
,
success
:
()
=>
{
console
.
log
(
"
set_mode_success success
"
);
brightness
.
getMode
({
success
:
(
data
)
=>
{
console
.
log
(
"
set_mode_success, data:
"
+
data
.
mode
);
expect
(
data
.
mode
===
0
).
assertTrue
();
done
();
}
});
expect
(
true
).
assertTrue
();
},
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
set_mode_success, data:
"
+
data
+
"
, code:
"
+
code
);
expect
(
code
==
200
).
assertTrue
();
done
();
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
...
...
powermgr/power_manager/src/main/js/test/power_manager_power.test.js
浏览文件 @
b9a89fb6
...
...
@@ -67,8 +67,8 @@ describe('PowerManagerPowerTest', function () {
console
.
log
(
'
Power_Is_Screnn_On_Callback_JSTest0030:
'
+
error
);
expect
().
assertFail
();
}
})
done
();
done
();
})
})
/**
...
...
powermgr/thermal_manager/src/main/js/test/thermal_common_event.test.js
浏览文件 @
b9a89fb6
...
...
@@ -16,59 +16,67 @@ import commonEvent from '@ohos.commonEvent';
import
thermal
from
"
@ohos.thermal
"
export
default
function
ThermalCommonEvent
()
{
describe
(
'
ThermalCommonEvent
'
,
function
()
{
console
.
log
(
"
*************Thermal commonEvent Test Begin*************
"
);
describe
(
'
ThermalCommonEvent
'
,
function
()
{
console
.
log
(
"
*************Thermal commonEvent Test Begin*************
"
);
/**
* @tc.number ThermalCommonEventTest_001
* @tc.name subscribe thermal level changed common event
* @tc.desc Thermal acquisition kit
*/
it
(
'
ThermalCommonEventTest_001
'
,
0
,
function
(
done
)
{
createSubscriber
();
done
();
/**
* @tc.number ThermalCommonEventTest_001
* @tc.name subscribe thermal level changed common event
* @tc.desc Thermal acquisition kit
*/
it
(
'
ThermalCommonEventTest_001
'
,
0
,
function
(
done
)
{
createSubscriber
();
done
();
})
console
.
log
(
"
*************Thermal commonEvent Test End*************
"
);
})
console
.
log
(
"
*************Thermal commonEvent Test End*************
"
);
})
function
createSubscriber
()
{
let
commonEventSubscribeInfo
=
{
events
:
[
commonEvent
.
Support
.
COMMON_EVENT_THERMAL_LEVEL_CHANGED
],
};
commonEvent
.
createSubscriber
(
commonEventSubscribeInfo
)
.
then
(
subscriber
=>
{
console
.
info
(
'
createSubscriber success
'
);
let
mySubscriber
=
subscriber
;
console
.
log
(
subscriber
);
function
createSubscriber
()
{
let
commonEventSubscribeInfo
=
{
events
:
[
commonEvent
.
Support
.
COMMON_EVENT_THERMAL_LEVEL_CHANGED
],
};
commonEvent
.
createSubscriber
(
commonEventSubscribeInfo
)
.
then
(
subscriber
=>
{
console
.
info
(
'
createSubscriber success
'
);
let
mySubscriber
=
subscriber
;
console
.
log
(
subscriber
);
if
(
subscriber
==
""
||
subscriber
==
undefined
||
subscriber
==
null
)
{
console
.
info
(
"
createSubscriber failed
"
);
}
mySubscriber
.
getCode
()
.
then
((
data
)
=>
{
console
.
info
(
'
Subscriber getCode success :
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
error
(
'
Subscriber getCode error because:
'
+
JSON
.
stringify
(
error
));
})
mySubscriber
.
getData
()
.
then
((
data
)
=>
{
console
.
info
(
'
Subscriber getData success :
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
error
(
'
Subscriber getData error because:
'
+
JSON
.
stringify
(
error
));
})
console
.
info
(
'
subscribe begin
'
);
if
(
subscriber
==
""
||
subscriber
==
undefined
||
subscriber
==
null
)
{
console
.
info
(
"
createSubscriber failed
"
);
}
mySubscriber
.
getCode
()
.
then
((
data
)
=>
{
console
.
info
(
'
Subscriber getCode success :
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
error
(
'
Subscriber getCode error because:
'
+
JSON
.
stringify
(
error
));
})
mySubscriber
.
getData
()
.
then
((
data
)
=>
{
console
.
info
(
'
Subscriber getData success :
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
error
(
'
Subscriber getData error because:
'
+
JSON
.
stringify
(
error
));
})
console
.
info
(
'
subscribe begin
'
);
commonEvent
.
subscribe
(
mySubscriber
,
(
error
,
commonEventData
)
=>
{
console
.
error
(
'
err code:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
subscribe callback:
'
+
JSON
.
stringify
(
commonEventData
));
console
.
info
(
"
commonEventData event:
"
+
commonEventData
.
event
);
console
.
info
(
"
commonEventData bundleName:
"
+
commonEventData
.
bundleName
);
console
.
info
(
"
commonEventData data:
"
+
commonEventData
.
data
);
console
.
info
(
"
commonEventData parameter:
"
+
commonEventData
.
parameters
[
0
]);
let
level
=
-
1
;
expect
(
level
>=
thermal
.
ThermalLevel
.
COOL
&&
warm
<=
level
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
commonEvent
.
subscribe
(
mySubscriber
,
(
error
,
commonEventData
)
=>
{
console
.
error
(
'
err code:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
subscribe callback:
'
+
JSON
.
stringify
(
commonEventData
));
console
.
info
(
"
commonEventData event:
"
+
commonEventData
.
event
);
console
.
info
(
"
commonEventData bundleName:
"
+
commonEventData
.
bundleName
);
console
.
info
(
"
commonEventData data:
"
+
commonEventData
.
data
);
console
.
info
(
"
commonEventData parameter:
"
+
commonEventData
.
parameters
[
0
]);
let
level
=
-
1
;
expect
(
level
>=
thermal
.
ThermalLevel
.
COOL
&&
warm
<=
level
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
});
commonEvent
.
unsubscribe
(
mySubscriber
,
(
error
)
=>
{
if
(
error
.
code
)
{
console
.
error
(
`unsubscribe failed, code is
${
err
.
code
}
`
);
}
else
{
console
.
info
(
"
unsubscribe
"
);
}
})
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
});
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
});
}}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录