Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
797038f9
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看板
未验证
提交
797038f9
编写于
1月 20, 2022
作者:
O
openharmony_ci
提交者:
Gitee
1月 20, 2022
浏览文件
操作
浏览文件
下载
差异文件
!1592 Add powermgr battery statistic XTS
Merge pull request !1592 from ShiJie/master
上级
874cace2
5d5bad5a
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
639 addition
and
1 deletion
+639
-1
powermgr/BUILD.gn
powermgr/BUILD.gn
+4
-1
powermgr/powermgrbatterystats/BUILD.gn
powermgr/powermgrbatterystats/BUILD.gn
+31
-0
powermgr/powermgrbatterystats/Test.json
powermgr/powermgrbatterystats/Test.json
+19
-0
powermgr/powermgrbatterystats/signature/openharmony_sx.p7b
powermgr/powermgrbatterystats/signature/openharmony_sx.p7b
+0
-0
powermgr/powermgrbatterystats/src/main/config.json
powermgr/powermgrbatterystats/src/main/config.json
+60
-0
powermgr/powermgrbatterystats/src/main/js/default/app.js
powermgr/powermgrbatterystats/src/main/js/default/app.js
+24
-0
powermgr/powermgrbatterystats/src/main/js/default/i18n/en-US.json
.../powermgrbatterystats/src/main/js/default/i18n/en-US.json
+6
-0
powermgr/powermgrbatterystats/src/main/js/default/i18n/zh-CN.json
.../powermgrbatterystats/src/main/js/default/i18n/zh-CN.json
+6
-0
powermgr/powermgrbatterystats/src/main/js/default/pages/index/index.css
...mgrbatterystats/src/main/js/default/pages/index/index.css
+9
-0
powermgr/powermgrbatterystats/src/main/js/default/pages/index/index.hml
...mgrbatterystats/src/main/js/default/pages/index/index.hml
+5
-0
powermgr/powermgrbatterystats/src/main/js/default/pages/index/index.js
...rmgrbatterystats/src/main/js/default/pages/index/index.js
+43
-0
powermgr/powermgrbatterystats/src/main/js/default/test/List.test.js
...owermgrbatterystats/src/main/js/default/test/List.test.js
+15
-0
powermgr/powermgrbatterystats/src/main/js/default/test/batterystats_uint.test.js
...ystats/src/main/js/default/test/batterystats_uint.test.js
+405
-0
powermgr/powermgrbatterystats/src/main/resources/base/element/string.json
...rbatterystats/src/main/resources/base/element/string.json
+12
-0
powermgr/powermgrbatterystats/src/main/resources/base/media/icon.png
...wermgrbatterystats/src/main/resources/base/media/icon.png
+0
-0
未找到文件。
powermgr/BUILD.gn
浏览文件 @
797038f9
...
...
@@ -19,7 +19,10 @@ group("powermgr") {
}
} else {
if (is_standard_system) {
deps = [ "powermgrbattery:powermgr_battery_test" ]
deps = [
"powermgrbattery:powermgr_battery_test",
"powermgrbatterystats:powermgr_batterystats_test",
]
}
}
}
powermgr/powermgrbatterystats/BUILD.gn
0 → 100755
浏览文件 @
797038f9
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("powermgr_batterystats_test") {
hap_profile = "./src/main/config.json"
deps = [
":powermgr_batterystats_js_assets",
":powermgr_batterystats_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsPowerMgrBatterystatsTest"
}
ohos_js_assets("powermgr_batterystats_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("powermgr_batterystats_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
powermgr/powermgrbatterystats/Test.json
0 → 100755
浏览文件 @
797038f9
{
"description"
:
"Configuration for powermgr batterystats Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"60000"
,
"package"
:
"com.example.mybatterystatsapp"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsPowerMgrBatterystatsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
powermgr/powermgrbatterystats/signature/openharmony_sx.p7b
0 → 100755
浏览文件 @
797038f9
文件已添加
powermgr/powermgrbatterystats/src/main/config.json
0 → 100755
浏览文件 @
797038f9
{
"app"
:
{
"bundleName"
:
"com.example.mybatterystatsapp"
,
"vendor"
:
"example"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.example.mybatterystatsapp"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"abilities"
:
[
{
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"com.example.mybatterystatsapp.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
powermgr/powermgrbatterystats/src/main/js/default/app.js
0 → 100755
浏览文件 @
797038f9
/*
* 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
device
from
'
@system.device
'
;
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
powermgr/powermgrbatterystats/src/main/js/default/i18n/en-US.json
0 → 100755
浏览文件 @
797038f9
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
powermgr/powermgrbatterystats/src/main/js/default/i18n/zh-CN.json
0 → 100755
浏览文件 @
797038f9
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
powermgr/powermgrbatterystats/src/main/js/default/pages/index/index.css
0 → 100755
浏览文件 @
797038f9
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
powermgr/powermgrbatterystats/src/main/js/default/pages/index/index.hml
0 → 100755
浏览文件 @
797038f9
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
powermgr/powermgrbatterystats/src/main/js/default/pages/index/index.js
0 → 100755
浏览文件 @
797038f9
/*
* 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
app
from
'
@system.app
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
export
default
{
data
:
{
title
:
""
},
onInit
()
{
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
()
{
},
}
\ No newline at end of file
powermgr/powermgrbatterystats/src/main/js/default/test/List.test.js
0 → 100755
浏览文件 @
797038f9
/*
* 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.
*/
require
(
'
./batterystats_uint.test.js
'
)
\ No newline at end of file
powermgr/powermgrbatterystats/src/main/js/default/test/batterystats_uint.test.js
0 → 100755
浏览文件 @
797038f9
/*
* 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
app
from
'
@system.app
'
import
batterystats
from
"
@ohos.batterystats
"
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
var
ConsumptionType
=
{
CONSUMPTION_TYPE_INVALID
:
-
17
,
CONSUMPTION_TYPE_APP
:
-
16
,
CONSUMPTION_TYPE_BLUETOOTH
:
-
15
,
CONSUMPTION_TYPE_IDLE
:
-
14
,
CONSUMPTION_TYPE_PHONE
:
-
13
,
CONSUMPTION_TYPE_RADIO
:
-
12
,
CONSUMPTION_TYPE_SCREEN
:
-
11
,
CONSUMPTION_TYPE_USER
:
-
10
,
CONSUMPTION_TYPE_WIFI
:
-
9
,
}
describe
(
'
appInfoTest
'
,
function
()
{
console
.
log
(
"
*************Batterystats API Test Begin*************
"
);
/**
/* @tc.number batterystats_js_001
* @tc.name Batterystats_001
* @tc.desc BatteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH
*/
it
(
'
Batterystats_001
'
,
0
,
async
function
(
done
)
{
var
infoList
;
let
promise
=
batterystats
.
getBatteryStats
().
then
(
function
(
value
)
{
infoList
=
value
;
console
.
info
(
"
Executing
"
);
},
function
(
msg
)
{
console
.
info
(
"
Promise error:
"
+
msg
);
});
await
promise
;
console
.
info
(
"
Waiting
"
);
var
found
=
false
;
for
(
let
i
=
0
;
i
<
infoList
.
length
;
i
++
)
{
if
(
infoList
[
i
].
type
==
ConsumptionType
.
CONSUMPTION_TYPE_BLUETOOTH
)
{
expect
(
infoList
[
i
].
uid
).
assertEqual
(
-
1
);
console
.
info
(
"
Found Bluetooth consumption
"
);
found
=
true
;
}
}
done
();
expect
(
found
).
assertTrue
();
})
/**
/* @tc.number batterystats_js_002
* @tc.name Batterystats_002
* @tc.desc BatteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_IDLE
*/
it
(
'
Batterystats_002
'
,
0
,
async
function
(
done
)
{
var
infoList
;
let
promise
=
batterystats
.
getBatteryStats
().
then
(
function
(
value
)
{
infoList
=
value
;
console
.
info
(
"
Executing
"
);
},
function
(
msg
)
{
console
.
info
(
"
Promise error:
"
+
msg
);
});
await
promise
;
console
.
info
(
"
Waiting
"
);
var
found
=
false
;
for
(
let
i
=
0
;
i
<
infoList
.
length
;
i
++
)
{
if
(
infoList
[
i
].
type
==
ConsumptionType
.
CONSUMPTION_TYPE_IDLE
)
{
expect
(
infoList
[
i
].
uid
).
assertEqual
(
-
1
);
console
.
info
(
"
Found Idle consumption
"
);
found
=
true
;
}
}
done
();
expect
(
found
).
assertTrue
();
})
/**
/* @tc.number batterystats_js_003
* @tc.name Batterystats_003
* @tc.desc BatteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_PHONE
*/
it
(
'
Batterystats_003
'
,
0
,
async
function
(
done
)
{
var
infoList
;
let
promise
=
batterystats
.
getBatteryStats
().
then
(
function
(
value
)
{
infoList
=
value
;
console
.
info
(
"
Executing
"
);
},
function
(
msg
)
{
console
.
info
(
"
Promise error:
"
+
msg
);
});
await
promise
;
console
.
info
(
"
Waiting
"
);
var
found
=
false
;
for
(
let
i
=
0
;
i
<
infoList
.
length
;
i
++
)
{
if
(
infoList
[
i
].
type
==
ConsumptionType
.
CONSUMPTION_TYPE_PHONE
)
{
expect
(
infoList
[
i
].
uid
).
assertEqual
(
-
1
);
console
.
info
(
"
Found Phone consumption
"
);
found
=
true
;
}
}
done
();
expect
(
found
).
assertTrue
();
})
/**
/* @tc.number batterystats_js_004
* @tc.name Batterystats_004
* @tc.desc BatteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_RADIO
*/
it
(
'
Batterystats_004
'
,
0
,
async
function
(
done
)
{
var
infoList
;
let
promise
=
batterystats
.
getBatteryStats
().
then
(
function
(
value
)
{
infoList
=
value
;
console
.
info
(
"
Executing
"
);
},
function
(
msg
)
{
console
.
info
(
"
Promise error:
"
+
msg
);
});
await
promise
;
console
.
info
(
"
Waiting
"
);
var
found
=
false
;
for
(
let
i
=
0
;
i
<
infoList
.
length
;
i
++
)
{
if
(
infoList
[
i
].
type
==
ConsumptionType
.
CONSUMPTION_TYPE_RADIO
)
{
expect
(
infoList
[
i
].
uid
).
assertEqual
(
-
1
);
console
.
info
(
"
Found Radio consumption
"
);
found
=
true
;
}
}
done
();
expect
(
found
).
assertTrue
();
})
/**
/* @tc.number batterystats_js_005
* @tc.name Batterystats_005
* @tc.desc BatteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_SCREEN
*/
it
(
'
Batterystats_005
'
,
0
,
async
function
(
done
)
{
var
infoList
;
let
promise
=
batterystats
.
getBatteryStats
().
then
(
function
(
value
)
{
infoList
=
value
;
console
.
info
(
"
Executing
"
);
},
function
(
msg
)
{
console
.
info
(
"
Promise error:
"
+
msg
);
});
await
promise
;
console
.
info
(
"
Waiting
"
);
var
found
=
false
;
for
(
let
i
=
0
;
i
<
infoList
.
length
;
i
++
)
{
if
(
infoList
[
i
].
type
==
ConsumptionType
.
CONSUMPTION_TYPE_SCREEN
)
{
expect
(
infoList
[
i
].
uid
).
assertEqual
(
-
1
);
console
.
info
(
"
Found Screen consumption
"
);
found
=
true
;
}
}
done
();
expect
(
found
).
assertTrue
();
})
/* @tc.number batterystats_js_006
* @tc.name Batterystats_006
* @tc.desc BatteryStats getAppPowerValue Interface Test uid = 111
*/
it
(
'
Batterystats_006
'
,
0
,
function
()
{
var
power
=
batterystats
.
getAppPowerValue
(
111
);
console
.
info
(
"
App consumption power of uid 111 is:
"
+
power
);
expect
(
power
>=
0
).
assertTrue
();
})
/* @tc.number batterystats_js_007
* @tc.name Batterystats_007
* @tc.desc BatteryStats getAppPowerValue Interface Test uid = -111
*/
it
(
'
Batterystats_007
'
,
0
,
function
()
{
var
power
=
batterystats
.
getAppPowerValue
(
-
111
);
console
.
info
(
"
App consumption power of uid -111 is:
"
+
power
);
expect
(
power
).
assertEqual
(
0
);
})
/* @tc.number batterystats_js_008
* @tc.name Batterystats_008
* @tc.desc BatteryStats getAppPowerValue Interface Test uid = 0
*/
it
(
'
Batterystats_008
'
,
0
,
function
()
{
var
power
=
batterystats
.
getAppPowerValue
(
0
);
console
.
info
(
"
App consumption power of uid 0 is:
"
+
power
);
expect
(
power
>=
0
).
assertTrue
();
})
/* @tc.number batterystats_js_009
* @tc.name Batterystats_009
* @tc.desc BatteryStats getAppPowerValue Interface Test uid = "111"
*/
it
(
'
Batterystats_009
'
,
0
,
function
()
{
try
{
batterystats
.
getAppPowerValue
(
"
111
"
);
}
catch
(
e
)
{
var
errorMsg
=
"
Argument type check works:
"
+
e
;
console
.
debug
(
"
errorMsg
"
);
expect
(
errorMsg
.
includes
(
"
Wrong argument type
"
)).
assertTrue
();
}
})
/* @tc.number batterystats_js_010
* @tc.name Batterystats_010
* @tc.desc BatteryStats getAppPowerValue Interface Test uid = 111, 222
*/
it
(
'
Batterystats_010
'
,
0
,
function
()
{
try
{
batterystats
.
getAppPowerValue
(
111
,
222
);
}
catch
(
e
)
{
var
errorMsg
=
"
Argument number check works:
"
+
e
;
console
.
debug
(
errorMsg
);
expect
(
errorMsg
.
includes
(
"
Wrong number of arguments
"
)).
assertTrue
();
}
})
/* @tc.number batterystats_js_011
* @tc.name Batterystats_011
* @tc.desc BatteryStats getAppPowerPercent Interface Test uid = 111
*/
it
(
'
Batterystats_011
'
,
0
,
function
()
{
var
powerPercent
=
batterystats
.
getAppPowerPercent
(
111
);
console
.
info
(
"
App consumption percent of uid 111 is:
"
+
powerPercent
);
expect
(
powerPercent
>=
0
).
assertTrue
();
})
/* @tc.number batterystats_js_012
* @tc.name Batterystats_012
* @tc.desc BatteryStats getAppPowerPercent Interface Test uid = -111
*/
it
(
'
Batterystats_012
'
,
0
,
function
()
{
var
powerPercent
=
batterystats
.
getAppPowerPercent
(
-
111
);
console
.
info
(
"
App consumption percent of uid -111 is:
"
+
powerPercent
);
expect
(
powerPercent
).
assertEqual
(
0
);
})
/* @tc.number batterystats_js_013
* @tc.name Batterystats_013
* @tc.desc BatteryStats getAppPowerPercent Interface Test uid = 0
*/
it
(
'
Batterystats_013
'
,
0
,
function
()
{
var
powerPercent
=
batterystats
.
getAppPowerPercent
(
0
);
console
.
info
(
"
App consumption percent of uid 0 is:
"
+
powerPercent
);
expect
(
powerPercent
>=
0
).
assertTrue
();
})
/* @tc.number batterystats_js_014
* @tc.name Batterystats_014
* @tc.desc BatteryStats getAppPowerPercent Interface Test uid = "111"
*/
it
(
'
Batterystats_014
'
,
0
,
function
()
{
try
{
batterystats
.
getAppPowerPercent
(
"
111
"
);
}
catch
(
e
)
{
var
errorMsg
=
"
Argument type check works:
"
+
e
;
console
.
debug
(
"
errorMsg
"
);
expect
(
errorMsg
.
includes
(
"
Wrong argument type
"
)).
assertTrue
();
}
})
/* @tc.number batterystats_js_015
* @tc.name Batterystats_015
* @tc.desc BatteryStats getAppPowerPercent Interface Test uid = 111, 222
*/
it
(
'
Batterystats_015
'
,
0
,
function
()
{
try
{
batterystats
.
getAppPowerPercent
(
111
,
222
);
}
catch
(
e
)
{
var
errorMsg
=
"
Argument number check works:
"
+
e
;
console
.
debug
(
errorMsg
);
expect
(
errorMsg
.
includes
(
"
Wrong number of arguments
"
)).
assertTrue
();
}
})
/* @tc.number batterystats_js_016
* @tc.name Batterystats_016
* @tc.desc BatteryStats getHardwareUnitPowerValue Interface Test type = ConsumptionType.CONSUMPTION_TYPE_IDLE
*/
it
(
'
Batterystats_016
'
,
0
,
function
()
{
var
power
=
batterystats
.
getHardwareUnitPowerValue
(
ConsumptionType
.
CONSUMPTION_TYPE_IDLE
);
console
.
info
(
"
Idle consumption power is:
"
+
power
);
expect
(
power
>=
0
).
assertTrue
();
})
/* @tc.number batterystats_js_017
* @tc.name Batterystats_017
* @tc.desc BatteryStats getHardwareUnitPowerValue Interface Test type = 111
*/
it
(
'
Batterystats_017
'
,
0
,
function
()
{
var
power
=
batterystats
.
getHardwareUnitPowerValue
(
111
);
console
.
info
(
"
111's consumption power is:
"
+
power
);
expect
(
power
).
assertEqual
(
0
);
})
/* @tc.number batterystats_js_018
* @tc.name Batterystats_018
* @tc.desc BatteryStats getHardwareUnitPowerValue Interface Test type = 0
*/
it
(
'
Batterystats_018
'
,
0
,
function
()
{
var
power
=
batterystats
.
getHardwareUnitPowerValue
(
0
);
console
.
info
(
"
0's consumption power is:
"
+
power
);
expect
(
power
).
assertEqual
(
0
);
})
/* @tc.number batterystats_js_019
* @tc.name Batterystats_019
* @tc.desc BatteryStats getHardwareUnitPowerValue Interface Test type = "test"
*/
it
(
'
Batterystats_019
'
,
0
,
function
()
{
try
{
batterystats
.
getHardwareUnitPowerValue
(
"
test
"
);
}
catch
(
e
)
{
var
errorMsg
=
"
Argument type check works:
"
+
e
;
console
.
debug
(
"
errorMsg
"
);
expect
(
errorMsg
.
includes
(
"
Wrong argument type
"
)).
assertTrue
();
}
})
/* @tc.number batterystats_js_020
* @tc.name Batterystats_020
* @tc.desc BatteryStats getHardwareUnitPowerValue Interface Test type = ConsumptionType.CONSUMPTION_TYPE_IDLE
* and ConsumptionType.CONSUMPTION_TYPE_WIFI
*/
it
(
'
Batterystats_020
'
,
0
,
function
()
{
try
{
batterystats
.
getHardwareUnitPowerValue
(
ConsumptionType
.
CONSUMPTION_TYPE_IDLE
,
ConsumptionType
.
CONSUMPTION_TYPE_WIFI
);
}
catch
(
e
)
{
var
errorMsg
=
"
Argument number check works:
"
+
e
;
console
.
debug
(
errorMsg
);
expect
(
errorMsg
.
includes
(
"
Wrong number of arguments
"
)).
assertTrue
();
}
})
/* @tc.number batterystats_js_021
* @tc.name Batterystats_021
* @tc.desc BatteryStats getHardwareUnitPowerPercent Interface Test type = ConsumptionType.CONSUMPTION_TYPE_IDLE
*/
it
(
'
Batterystats_021
'
,
0
,
function
()
{
var
powerPercent
=
batterystats
.
getHardwareUnitPowerPercent
(
ConsumptionType
.
CONSUMPTION_TYPE_IDLE
);
console
.
info
(
"
Idle consumption percent is:
"
+
powerPercent
);
expect
(
powerPercent
>=
0
).
assertTrue
();
})
/* @tc.number batterystats_js_022
* @tc.name Batterystats_022
* @tc.desc BatteryStats getHardwareUnitPowerPercent Interface Test type = 111
*/
it
(
'
Batterystats_022
'
,
0
,
function
()
{
var
powerPercent
=
batterystats
.
getHardwareUnitPowerPercent
(
111
);
console
.
info
(
"
111's consumption percent is:
"
+
powerPercent
);
expect
(
powerPercent
).
assertEqual
(
0
);
})
/* @tc.number batterystats_js_023
* @tc.name Batterystats_023
* @tc.desc BatteryStats getHardwareUnitPowerPercent Interface Test type = 0
*/
it
(
'
Batterystats_023
'
,
0
,
function
()
{
var
powerPercent
=
batterystats
.
getHardwareUnitPowerPercent
(
0
);
console
.
info
(
"
0's consumption percent is:
"
+
powerPercent
);
expect
(
powerPercent
).
assertEqual
(
0
);
})
/* @tc.number batterystats_js_024
* @tc.name Batterystats_024
* @tc.desc BatteryStats getHardwareUnitPowerPercent Interface Test type = "test"
*/
it
(
'
Batterystats_024
'
,
0
,
function
()
{
try
{
batterystats
.
getHardwareUnitPowerPercent
(
"
test
"
);
}
catch
(
e
)
{
var
errorMsg
=
"
Argument type check works:
"
+
e
;
console
.
debug
(
"
errorMsg
"
);
expect
(
errorMsg
.
includes
(
"
Wrong argument type
"
)).
assertTrue
();
}
})
/* @tc.number batterystats_js_025
* @tc.name Batterystats_025
* @tc.desc BatteryStats getHardwareUnitPowerPercent Interface Test type = ConsumptionType.CONSUMPTION_TYPE_IDLE
* and ConsumptionType.CONSUMPTION_TYPE_WIFI
*/
it
(
'
Batterystats_025
'
,
0
,
function
()
{
try
{
batterystats
.
getHardwareUnitPowerPercent
(
ConsumptionType
.
CONSUMPTION_TYPE_IDLE
,
ConsumptionType
.
CONSUMPTION_TYPE_WIFI
);
}
catch
(
e
)
{
var
errorMsg
=
"
Argument number check works:
"
+
e
;
console
.
debug
(
errorMsg
);
expect
(
errorMsg
.
includes
(
"
Wrong number of arguments
"
)).
assertTrue
();
}
})
})
\ No newline at end of file
powermgr/powermgrbatterystats/src/main/resources/base/element/string.json
0 → 100755
浏览文件 @
797038f9
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"MyBatterystatsApp"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
powermgr/powermgrbatterystats/src/main/resources/base/media/icon.png
0 → 100755
浏览文件 @
797038f9
6.6 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录