Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
296b5c12
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看板
提交
296b5c12
编写于
2月 24, 2022
作者:
Y
yu.xu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modify thermal xts
Signed-off-by:
N
yu.xu
<
yu.xu@neusoft.com
>
上级
70adb131
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
289 addition
and
82 deletion
+289
-82
powermgr/BUILD.gn
powermgr/BUILD.gn
+4
-1
powermgr/powermgrthermal/README_zh.md
powermgr/powermgrthermal/README_zh.md
+15
-0
powermgr/powermgrthermal/Test.json
powermgr/powermgrthermal/Test.json
+2
-2
powermgr/powermgrthermal/src/main/js/default/pages/index/index.js
.../powermgrthermal/src/main/js/default/pages/index/index.js
+21
-20
powermgr/powermgrthermal/src/main/js/default/test/thermal_common_event.test.js
...mal/src/main/js/default/test/thermal_common_event.test.js
+73
-0
powermgr/powermgrthermal/src/main/js/default/test/thermal_performance.test.js
...rmal/src/main/js/default/test/thermal_performance.test.js
+84
-0
powermgr/powermgrthermal/src/main/js/default/test/thermal_uint.test.js
...rmgrthermal/src/main/js/default/test/thermal_uint.test.js
+74
-44
powermgr/powermgrthermal/src/main/js/default/test/thermal_unittest.test.js
...thermal/src/main/js/default/test/thermal_unittest.test.js
+5
-3
powermgr/powermgrthermal/temp.sh
powermgr/powermgrthermal/temp.sh
+11
-12
未找到文件。
powermgr/BUILD.gn
浏览文件 @
296b5c12
...
...
@@ -15,7 +15,10 @@ group("powermgr") {
testonly = true
if (device_name == "rk3568") {
if (is_standard_system) {
deps = [ "powermgrbattery_rk3568:powermgr_battery_test_rk3568" ]
deps = [
"powermgrbattery_rk3568:powermgr_battery_test_rk3568",
"powermgrthermal:powermgr_thermal_test",
]
}
} else {
if (is_standard_system) {
...
...
powermgr/powermgrthermal/README_zh.md
0 → 100644
浏览文件 @
296b5c12
# 热管理服务XTS
-
[
描述
](
#section0056945901
)
## 描述<a name="section0056945901"></a>
### 执行性能测试(thermal_common_event.test.js), 单元测试用例(thermal_unittest.test.js)和接收公共事件用例(thermal_common_event.test.js)前, 请手动执行temp.sh
步骤:
$ hdc_std file send temp.sh /data
$ sh temp.sh
powermgr/powermgrthermal/Test.json
浏览文件 @
296b5c12
...
...
@@ -2,9 +2,9 @@
"description"
:
"Configuration for powermgr thermal Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"
6
0000"
,
"test-timeout"
:
"
12
0000"
,
"package"
:
"com.example.mythermalapp"
,
"shell-timeout"
:
"
6
0000"
"shell-timeout"
:
"
12
0000"
},
"kits"
:
[
{
...
...
powermgr/powermgrthermal/src/main/js/default/pages/index/index.js
浏览文件 @
296b5c12
...
...
@@ -12,31 +12,32 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
device
from
'
@system.device
'
;
import
app
from
'
@system.app
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
const
core
=
Core
.
getInstance
();
core
.
init
()
require
(
'
../../test/List.test
'
)
core
.
execute
()
export
default
{
data
:
{
title
:
"
world
"
,
width
:
0
,
height
:
0
title
:
""
},
onInit
()
{
device
.
getInfo
({
success
:(
data
)
=>
{
this
.
width
=
data
.
windowWidth
;
this
.
height
=
data
.
windowHeight
;
}
});
}
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
powermgr/powermgrthermal/src/main/js/default/test/thermal_common_event.test.js
0 → 100644
浏览文件 @
296b5c12
/*
* 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
commonEvent
from
'
@ohos.commonEvent
'
;
import
thermal
from
"
@ohos.thermal
"
describe
(
'
appInfoTest
'
,
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
();
})
console
.
log
(
"
*************Thermal commonEvent Test End*************
"
);
})
function
createSubscriber
()
{
var
commonEventSubscribeInfo
=
{
events
:
[
commonEvent
.
Support
.
COMMON_EVENT_THERMAL_LEVEL_CHANGED
],
};
commonEvent
.
createSubscriber
(
commonEventSubscribeInfo
)
.
then
(
subscriber
=>
{
console
.
info
(
'
createSubscriber success
'
);
var
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
'
);
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
]);
var
level
=
-
1
;
expect
(
level
>=
thermal
.
ThermalLevel
.
COOL
&&
warm
<=
level
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
});
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause:
'
+
JSON
.
stringify
(
error
));
});
}
\ No newline at end of file
powermgr/powermgrthermal/src/main/js/default/test/thermal_performance.test.js
0 → 100644
浏览文件 @
296b5c12
/*
* 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
thermal
from
"
@ohos.thermal
"
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
;
describe
(
'
appInfoTest
'
,
function
()
{
console
.
log
(
"
*************Thermal Performance Test Begin*************
"
);
performanceTest1
();
performanceTest2
();
performanceTest3
();
console
.
log
(
"
*************Thermal Performance Test End*************
"
);
})
function
performanceTest1
()
{
var
MAXNUM
=
1000
;
/**
* @tc.number ThermalPerformance_001
* @tc.name test get thermal level
* @tc.desc Thermal acquisition kit
*/
it
(
'
ThermalPerformance_001
'
,
0
,
function
()
{
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
MAXNUM
;
i
++
)
{
var
level
=
thermal
.
getThermalLevel
();
}
let
waitTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
waitTime
;
//us
console
.
info
(
`ThermalPerformance_001: Promise: getlevel Wait Time :
${
waitTime
}
`
);
})
}
function
performanceTest2
()
{
var
MAXNUM
=
1000
;
/**
* @tc.number ThermalPerformance_002
* @tc.name subscribe thermal level
* @tc.desc Thermal acquisition kit
*/
it
(
'
ThermalPerformance_002
'
,
0
,
function
()
{
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
MAXNUM
;
i
++
)
{
thermal
.
subscribeThermalLevel
((
level
)
=>
{
console
.
info
(
"
hot level is:
"
+
level
);
})
}
let
waitTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
waitTime
;
//us
console
.
info
(
`ThermalPerformance_002: Promise: subscribeThermalLevel Wait Time :
${
waitTime
}
`
);
})
}
function
performanceTest3
()
{
var
MAXNUM
=
1000
;
/**
* @tc.number ThermalPerformance_002
* @tc.name subscribe thermal level
* @tc.desc Thermal acquisition kit
*/
it
(
'
ThermalPerformance_003
'
,
0
,
function
()
{
let
startTime
=
new
Date
().
getTime
();
for
(
let
i
=
0
;
i
<
MAXNUM
;
i
++
)
{
thermal
.
unsubscribeThermalLevel
();
}
let
waitTime
=
new
Date
().
getTime
()
-
startTime
;
let
avgTime
=
waitTime
;
//us
console
.
info
(
`ThermalPerformance_003: Promise: unsubscribeThermalLevel Wait Time :
${
waitTime
}
`
);
})
}
\ No newline at end of file
powermgr/powermgrthermal/src/main/js/default/test/thermal_uint.test.js
浏览文件 @
296b5c12
// @ts-nocheck
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
...
...
@@ -20,7 +21,6 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '
describe
(
'
appInfoTest
'
,
function
()
{
console
.
log
(
"
*************Thermal API Test Begin*************
"
);
const
MSEC_1000
=
1000
;
test1
();
test2
();
test3
();
...
...
@@ -34,9 +34,11 @@ describe('appInfoTest', function () {
test11
();
test12
();
test13
();
console
.
log
(
"
*************Thermal API Test End*************
"
);
})
function
test1
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_001
* @tc.name Thermal_001
...
...
@@ -48,34 +50,36 @@ function test1() {
setTimeout
(()
=>
{
var
cold
=
thermal
.
getThermalLevel
();
console
.
info
(
"
cold level is:
"
+
cold
);
expect
(
cold
>=
0
&&
cold
<=
6
).
assertTrue
();
expect
(
cold
>=
thermal
.
ThermalLevel
.
COOL
&&
cold
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
resolve
();
},
MSEC_1000
*
4
);
done
();
},
MSEC_1000
*
1
);
})
done
();
})
}
function
test2
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_002
* @tc.name Thermal_002
* @tc.desc Thermal acquisition kit
*/
it
(
'
Thermal_002
'
,
0
,
async
function
(
done
)
{
await
new
Promise
((
resolve
,
reject
)
=>
{
await
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
var
warm
=
thermal
.
getThermalLevel
();
console
.
info
(
"
warm level is:
"
+
warm
);
expect
(
warm
>=
0
&&
warm
<=
6
).
assertTrue
();
expect
(
warm
>=
thermal
.
ThermalLevel
.
COOL
&&
warm
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
resolve
();
},
MSEC_1000
*
4
);
done
();
},
MSEC_1000
*
1
);
})
done
();
})
}
function
test3
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_003
* @tc.name Thermal_003
...
...
@@ -86,15 +90,16 @@ function test3() {
setTimeout
(()
=>
{
var
hot
=
thermal
.
getThermalLevel
();
console
.
info
(
"
hot level is:
"
+
hot
);
expect
(
hot
>=
0
&&
hot
<=
6
).
assertTrue
();
expect
(
hot
>=
thermal
.
ThermalLevel
.
COOL
&&
hot
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
resolve
();
},
MSEC_1000
*
4
);
done
();
},
MSEC_1000
*
1
);
})
done
();
})
}
function
test4
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_004
* @tc.name Thermal_004
...
...
@@ -105,15 +110,17 @@ function test4() {
setTimeout
(()
=>
{
var
overheated
=
thermal
.
getThermalLevel
();
console
.
info
(
"
overheated level is:
"
+
overheated
);
expect
(
overheated
>=
0
&&
overheated
<=
6
).
assertTrue
();
expect
(
overheated
>=
thermal
.
ThermalLevel
.
COOL
&&
overheated
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
resolve
();
},
MSEC_1000
*
4
);
done
();
},
MSEC_1000
*
1
);
})
done
();
})
}
function
test5
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_005
* @tc.name Thermal_005
...
...
@@ -124,15 +131,16 @@ function test5() {
setTimeout
(()
=>
{
var
warning
=
thermal
.
getThermalLevel
();
console
.
info
(
"
warning level is:
"
+
warning
);
expect
(
warning
>=
0
&&
warning
<=
6
).
assertTrue
();
expect
(
warning
>=
thermal
.
ThermalLevel
.
COOL
&&
warning
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
resolve
();
},
MSEC_1000
*
4
);
done
();
},
MSEC_1000
*
1
);
})
done
();
})
}
function
test6
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_006
* @tc.name Thermal_006
...
...
@@ -143,15 +151,17 @@ function test6() {
setTimeout
(()
=>
{
var
emergency
=
thermal
.
getThermalLevel
();
console
.
info
(
"
emergency level is:
"
+
emergency
);
expect
(
emergency
>=
0
&&
emergency
<=
6
).
assertTrue
();
expect
(
emergency
>=
thermal
.
ThermalLevel
.
COOL
&&
emergency
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
resolve
();
},
MSEC_1000
*
4
);
done
();
},
MSEC_1000
*
1
);
})
done
();
})
}
function
test7
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_007
* @tc.name Thermal_007
...
...
@@ -159,21 +169,23 @@ function test7() {
*/
it
(
'
Thermal_007
'
,
0
,
async
function
(
done
)
{
thermal
.
subscribeThermalLevel
((
cool
)
=>
{
console
.
info
(
"
cool
level is:
"
+
cool
);
count
++
;
expect
(
cool
>=
0
&&
cool
<=
6
).
assertTru
e
();
console
.
info
(
"
warm
level is:
"
+
cool
);
expect
(
cool
>=
thermal
.
ThermalLevel
.
COOL
&&
cool
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
()
;
don
e
();
})
await
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
thermal
.
unsubscribeThermalLevel
();
thermal
.
unsubscribeThermalLevel
(()
=>
{
console
.
info
(
"
unsubscribe successfully!
"
);
});
resolve
();
},
MSEC_1000
*
4
);
})
done
();
})
}
function
test8
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_008
* @tc.name Thermal_008
...
...
@@ -181,20 +193,23 @@ function test8() {
*/
it
(
'
Thermal_008
'
,
0
,
async
function
(
done
)
{
thermal
.
subscribeThermalLevel
((
warm
)
=>
{
console
.
info
(
"
cool level is:
"
+
warm
);
expect
(
warm
>=
0
&&
warm
<=
6
).
assertTrue
();
console
.
info
(
"
warm level is:
"
+
warm
);
expect
(
warm
>=
thermal
.
ThermalLevel
.
COOL
&&
warm
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
done
();
})
await
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
thermal
.
unsubscribeThermalLevel
();
thermal
.
unsubscribeThermalLevel
(()
=>
{
console
.
info
(
"
unsubscribe successfully!
"
);
});
resolve
();
},
MSEC_1000
*
4
);
})
done
();
})
}
function
test9
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_009
* @tc.name Thermal_009
...
...
@@ -203,20 +218,23 @@ function test9() {
it
(
'
Thermal_009
'
,
0
,
async
function
(
done
)
{
thermal
.
subscribeThermalLevel
((
hot
)
=>
{
console
.
info
(
"
hot level is:
"
+
hot
);
expect
(
hot
>=
0
&&
hot
<=
6
).
assertTrue
();
expect
(
hot
>=
thermal
.
ThermalLevel
.
COOL
&&
hot
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
done
();
})
await
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
thermal
.
unsubscribeThermalLevel
();
thermal
.
unsubscribeThermalLevel
(()
=>
{
console
.
info
(
"
unsubscribe successfully!
"
);
});
resolve
();
},
MSEC_1000
*
2
);
})
done
();
})
}
function
test10
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_010
* @tc.name Thermal_010
...
...
@@ -225,19 +243,23 @@ function test10() {
it
(
'
Thermal_010
'
,
0
,
async
function
(
done
)
{
thermal
.
subscribeThermalLevel
((
overheated
)
=>
{
console
.
info
(
"
overheated level is:
"
+
overheated
);
expect
(
overheated
>=
0
&&
overheated
<=
6
).
assertTrue
();
expect
(
overheated
>=
thermal
.
ThermalLevel
.
COOL
&&
overheated
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
done
();
})
await
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
thermal
.
unsubscribeThermalLevel
();
thermal
.
unsubscribeThermalLevel
(()
=>
{
console
.
info
(
"
unsubscribe successfully!
"
);
});
resolve
();
},
MSEC_1000
*
2
);
})
done
();
})
}
function
test11
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_011
* @tc.name Thermal_011
...
...
@@ -246,19 +268,22 @@ function test11() {
it
(
'
Thermal_011
'
,
0
,
async
function
(
done
)
{
thermal
.
subscribeThermalLevel
((
warning
)
=>
{
console
.
info
(
"
warning level is:
"
+
warning
);
expect
(
warning
>=
0
&&
warning
<=
6
).
assertTrue
();
expect
(
warning
>=
thermal
.
ThermalLevel
.
COOL
&&
warning
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
done
();
})
await
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
thermal
.
unsubscribeThermalLevel
();
thermal
.
unsubscribeThermalLevel
(()
=>
{
console
.
info
(
"
unsubscribe successfully!
"
);
});
resolve
();
},
MSEC_1000
*
4
);
})
done
();
})
}
function
test12
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_012
* @tc.name Thermal_012
...
...
@@ -267,19 +292,22 @@ function test12() {
it
(
'
Thermal_012
'
,
0
,
async
function
(
done
)
{
thermal
.
subscribeThermalLevel
((
emergency
)
=>
{
console
.
info
(
"
emergency level is:
"
+
emergency
);
expect
(
emergency
>=
0
&&
emergency
<=
6
).
assertTrue
();
expect
(
emergency
>=
thermal
.
ThermalLevel
.
COOL
&&
emergency
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
done
();
})
await
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
thermal
.
unsubscribeThermalLevel
();
thermal
.
unsubscribeThermalLevel
(()
=>
{
console
.
info
(
"
unsubscribe successfully!
"
);
});
resolve
();
},
MSEC_1000
*
4
);
})
done
();
})
}
function
test13
()
{
const
MSEC_1000
=
1000
;
/* @tc.number thermal_manager_js_013
* @tc.name Thermal_013
...
...
@@ -288,14 +316,16 @@ function test13() {
it
(
'
Thermal_013
'
,
0
,
async
function
(
done
)
{
thermal
.
subscribeThermalLevel
((
cool
)
=>
{
console
.
info
(
"
cool level is:
"
+
cool
);
expect
(
cool
>=
0
&&
cool
<=
6
).
assertTrue
();
expect
(
cool
>=
thermal
.
ThermalLevel
.
COOL
&&
cool
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
done
();
})
await
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
thermal
.
unsubscribeThermalLevel
();
thermal
.
unsubscribeThermalLevel
(()
=>
{
console
.
info
(
"
unsubscribe successfully!
"
);
});
resolve
();
},
MSEC_1000
*
4
);
})
done
();
})
}
\ No newline at end of file
powermgr/powermgrthermal/src/main/js/default/test/thermal_unittest.test.js
浏览文件 @
296b5c12
...
...
@@ -39,9 +39,9 @@ function test14() {
console
.
info
(
"
level is:
"
+
level
);
expect
(
level
==
-
1
).
assertTrue
();
resolve
();
done
();
},
MSEC_1000
*
4
);
})
done
();
})
}
...
...
@@ -55,13 +55,15 @@ function test15() {
thermal
.
subscribeThermalLevel
((
level
)
=>
{
console
.
info
(
"
level is:
"
+
level
);
expect
(
level
==
-
1
).
assertTrue
();
done
();
})
await
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
thermal
.
unsubscribeThermalLevel
();
thermal
.
unsubscribeThermalLevel
(()
=>
{
console
.
info
(
"
unsubscribe successfully!
"
);
});
resolve
();
},
MSEC_1000
*
4
);
})
done
();
})
}
\ No newline at end of file
powermgr/powermgrthermal/temp.sh
浏览文件 @
296b5c12
...
...
@@ -13,24 +13,23 @@
# limitations under the License.
count
=
0
coldTemp
=
-22000
highTemp
=
40100
output
=
/data/sensor/battery/temp
while
((
count < 100
))
do
if
[
$((
$count
%
4
))
==
0
]
;
then
temp
=
-21000
let
"temp = temp + 2000"
echo
$temp
echo
$temp
>
$output
sleep
10
if
[
$((
$count
%
2
))
==
0
]
;
then
let
"coldTemp = coldTemp + 1000"
echo
$coldTemp
echo
$coldTemp
>
$output
sleep
5
else
temp
=
40100
let
"temp = temp + 2000"
echo
$temp
echo
$temp
>
$output
sleep
10
let
"highTemp = highTemp + 1000"
echo
$highTemp
echo
$highTemp
>
$output
sleep
5
fi
let
"count = count + 1"
echo
$count
cat
$output
done
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录