Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
84166d74
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看板
未验证
提交
84166d74
编写于
1月 29, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 29, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7301 【OpenHarmony】【location】【master】LBS新框架适配及用例优化
Merge pull request !7301 from 权力/myfeature
上级
5abf4154
3604745e
变更
25
显示空白变更内容
内联
并排
Showing
25 changed file
with
2120 addition
and
958 deletion
+2120
-958
location/geolocation_standard/BUILD.gn
location/geolocation_standard/BUILD.gn
+3
-1
location/geolocation_standard/Test.json
location/geolocation_standard/Test.json
+6
-4
location/geolocation_standard/src/main/config.json
location/geolocation_standard/src/main/config.json
+39
-7
location/geolocation_standard/src/main/js/MainAbility/app.js
location/geolocation_standard/src/main/js/MainAbility/app.js
+0
-0
location/geolocation_standard/src/main/js/MainAbility/i18n/en-US.json
...location_standard/src/main/js/MainAbility/i18n/en-US.json
+0
-0
location/geolocation_standard/src/main/js/MainAbility/i18n/zh-CN.json
...location_standard/src/main/js/MainAbility/i18n/zh-CN.json
+0
-0
location/geolocation_standard/src/main/js/MainAbility/pages/index/index.css
...on_standard/src/main/js/MainAbility/pages/index/index.css
+0
-0
location/geolocation_standard/src/main/js/MainAbility/pages/index/index.hml
...on_standard/src/main/js/MainAbility/pages/index/index.hml
+0
-0
location/geolocation_standard/src/main/js/MainAbility/pages/index/index.js
...ion_standard/src/main/js/MainAbility/pages/index/index.js
+15
-7
location/geolocation_standard/src/main/js/TestAbility/app.js
location/geolocation_standard/src/main/js/TestAbility/app.js
+31
-0
location/geolocation_standard/src/main/js/TestAbility/i18n/en-US.json
...location_standard/src/main/js/TestAbility/i18n/en-US.json
+8
-0
location/geolocation_standard/src/main/js/TestAbility/i18n/zh-CN.json
...location_standard/src/main/js/TestAbility/i18n/zh-CN.json
+8
-0
location/geolocation_standard/src/main/js/TestAbility/pages/index/index.css
...on_standard/src/main/js/TestAbility/pages/index/index.css
+30
-0
location/geolocation_standard/src/main/js/TestAbility/pages/index/index.hml
...on_standard/src/main/js/TestAbility/pages/index/index.hml
+5
-0
location/geolocation_standard/src/main/js/TestAbility/pages/index/index.js
...ion_standard/src/main/js/TestAbility/pages/index/index.js
+26
-43
location/geolocation_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js
..._standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js
+59
-0
location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js
...olocation_standard/src/main/js/test/GeocoderMTest.test.js
+140
-96
location/geolocation_standard/src/main/js/test/GeocoderTest.test.js
...eolocation_standard/src/main/js/test/GeocoderTest.test.js
+152
-104
location/geolocation_standard/src/main/js/test/GetCountryCode.test.js
...location_standard/src/main/js/test/GetCountryCode.test.js
+75
-51
location/geolocation_standard/src/main/js/test/GetCountryCodeM.test.js
...ocation_standard/src/main/js/test/GetCountryCodeM.test.js
+76
-51
location/geolocation_standard/src/main/js/test/List.test.js
location/geolocation_standard/src/main/js/test/List.test.js
+32
-0
location/geolocation_standard/src/main/js/test/LocationMTest.test.js
...olocation_standard/src/main/js/test/LocationMTest.test.js
+657
-264
location/geolocation_standard/src/main/js/test/LocationTest.test.js
...eolocation_standard/src/main/js/test/LocationTest.test.js
+722
-314
location/geolocation_standard/src/main/js/test/SystemLocation.test.js
...location_standard/src/main/js/test/SystemLocation.test.js
+20
-16
location/geolocation_standard/src/main/resources/base/element/string.json
...tion_standard/src/main/resources/base/element/string.json
+16
-0
未找到文件。
location/geolocation_standard/BUILD.gn
浏览文件 @
84166d74
...
@@ -29,7 +29,9 @@ ohos_js_hap_suite("ActslocationJsTest") {
...
@@ -29,7 +29,9 @@ ohos_js_hap_suite("ActslocationJsTest") {
subsystem_name = "location"
subsystem_name = "location"
}
}
ohos_js_assets("geolocation_js_assets") {
ohos_js_assets("geolocation_js_assets") {
source_dir = "./src/main/js/default"
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
}
ohos_resources("geolocation_resources") {
ohos_resources("geolocation_resources") {
sources = [ "./src/main/resources" ]
sources = [ "./src/main/resources" ]
...
...
location/geolocation_standard/Test.json
浏览文件 @
84166d74
{
{
"description"
:
"Configuration for geolocation js api Tests"
,
"description"
:
"Configuration for geolocation js api Tests"
,
"driver"
:
{
"driver"
:
{
"type"
:
"JSUnitTest"
,
"type"
:
"OHJSUnitTest"
,
"bundle-name"
:
"ohos.acts.location.geolocation.function"
,
"package-name"
:
"ohos.acts.location.geolocation.function"
,
"test-timeout"
:
"600000"
,
"test-timeout"
:
"600000"
,
"
package"
:
"ohos.acts.location.geolocation.function
"
,
"
shell-timeout"
:
"60000
"
,
"
shell-timeout"
:
"60000"
"
testcase-timeout"
:
70000
},
},
"kits"
:
[
"kits"
:
[
{
{
...
...
location/geolocation_standard/src/main/config.json
浏览文件 @
84166d74
...
@@ -15,8 +15,9 @@
...
@@ -15,8 +15,9 @@
"deviceConfig"
:
{},
"deviceConfig"
:
{},
"module"
:
{
"module"
:
{
"package"
:
"ohos.acts.location.geolocation.function"
,
"package"
:
"ohos.acts.location.geolocation.function"
,
"name"
:
".MyApplication"
,
"name"
:
".entry"
,
"mainAbility"
:
"ohos.acts.location.geolocation.function.MainAbility"
,
"mainAbility"
:
".MainAbility"
,
"srcPath"
:
""
,
"deviceType"
:
[
"deviceType"
:
[
"tablet"
,
"tablet"
,
"default"
,
"default"
,
...
@@ -39,12 +40,29 @@
...
@@ -39,12 +40,29 @@
]
]
}
}
],
],
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:MainAbility_desc"
,
"label"
:
"$string:MainAbility_label"
,
"type"
:
"page"
,
"visible"
:
true
,
"visible"
:
true
,
"name"
:
"ohos.acts.location.geolocation.function.MainAbility"
,
"launchType"
:
"standard"
},
{
"orientation"
:
"unspecified"
,
"formsEnabled"
:
false
,
"name"
:
".TestAbility"
,
"srcLanguage"
:
"js"
,
"srcPath"
:
"TestAbility"
,
"icon"
:
"$media:icon"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:
mainability_description
"
,
"description"
:
"$string:
TestAbility_desc
"
,
"label"
:
"$string:
app_name
"
,
"label"
:
"$string:
TestAbility_label
"
,
"type"
:
"page"
,
"type"
:
"page"
,
"visible"
:
true
,
"launchType"
:
"standard"
"launchType"
:
"standard"
}
}
],
],
...
@@ -124,8 +142,22 @@
...
@@ -124,8 +142,22 @@
"designWidth"
:
720
,
"designWidth"
:
720
,
"autoDesignWidth"
:
false
"autoDesignWidth"
:
false
}
}
},
{
"pages"
:
[
"pages/index/index"
],
"name"
:
".TestAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
],
"testRunner"
:
{
"name"
:
"OpenHarmonyTestRunner"
,
"srcPath"
:
"TestRunner"
}
}
]
}
}
}
}
location/geolocation_standard/src/main/js/
default
/app.js
→
location/geolocation_standard/src/main/js/
MainAbility
/app.js
浏览文件 @
84166d74
文件已移动
location/geolocation_standard/src/main/js/
default
/i18n/en-US.json
→
location/geolocation_standard/src/main/js/
MainAbility
/i18n/en-US.json
浏览文件 @
84166d74
文件已移动
location/geolocation_standard/src/main/js/
default
/i18n/zh-CN.json
→
location/geolocation_standard/src/main/js/
MainAbility
/i18n/zh-CN.json
浏览文件 @
84166d74
文件已移动
location/geolocation_standard/src/main/js/
default
/pages/index/index.css
→
location/geolocation_standard/src/main/js/
MainAbility
/pages/index/index.css
浏览文件 @
84166d74
文件已移动
location/geolocation_standard/src/main/js/
default
/pages/index/index.hml
→
location/geolocation_standard/src/main/js/
MainAbility
/pages/index/index.hml
浏览文件 @
84166d74
文件已移动
location/geolocation_standard/src/main/js/
default/test/List.test
.js
→
location/geolocation_standard/src/main/js/
MainAbility/pages/index/index
.js
浏览文件 @
84166d74
...
@@ -13,10 +13,18 @@
...
@@ -13,10 +13,18 @@
* limitations under the License.
* limitations under the License.
*/
*/
require
(
'
./GeocoderTest.test.js
'
)
import
app
from
'
@system.app
'
require
(
'
./GeocoderMTest.test.js
'
)
require
(
'
./GetCountryCode.test.js
'
)
export
default
{
require
(
'
./GetCountryCodeM.test.js
'
)
data
:
{
require
(
'
./LocationTest.test.js
'
)
title
:
""
require
(
'
./LocationMTest.test.js
'
)
},
require
(
'
./SystemLocation.test.js
'
)
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
onShow finish
'
)
},
onReady
()
{
},
}
location/geolocation_standard/src/main/js/TestAbility/app.js
0 → 100644
浏览文件 @
84166d74
/*
* 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
import
{
Hypium
}
from
'
@ohos/hypium
'
import
testsuite
from
'
../test/List.test
'
export
default
{
onCreate
()
{
console
.
info
(
'
TestApplication onCreate
'
)
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
console
.
info
(
'
start run testcase!!!
'
)
Hypium
.
hypiumTest
(
abilityDelegator
,
abilityDelegatorArguments
,
testsuite
)
},
onDestroy
()
{
console
.
info
(
"
TestApplication onDestroy
"
);
}
};
location/geolocation_standard/src/main/js/TestAbility/i18n/en-US.json
0 → 100644
浏览文件 @
84166d74
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
},
"Files"
:
{
}
}
\ No newline at end of file
location/geolocation_standard/src/main/js/TestAbility/i18n/zh-CN.json
0 → 100644
浏览文件 @
84166d74
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
}
\ No newline at end of file
location/geolocation_standard/src/main/js/TestAbility/pages/index/index.css
0 → 100644
浏览文件 @
84166d74
.container
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
left
:
0px
;
top
:
0px
;
width
:
100%
;
height
:
100%
;
}
.title
{
font-size
:
60px
;
text-align
:
center
;
width
:
100%
;
height
:
40%
;
margin
:
10px
;
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
\ No newline at end of file
location/geolocation_standard/src/main/js/TestAbility/pages/index/index.hml
0 → 100644
浏览文件 @
84166d74
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
location/geolocation_standard/src/main/js/
default
/pages/index/index.js
→
location/geolocation_standard/src/main/js/
TestAbility
/pages/index/index.js
浏览文件 @
84166d74
/*
/*
* Copyright (
C) 2021 Huawei Device Co., Ltd.
* Copyright (
c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -13,31 +13,14 @@
...
@@ -13,31 +13,14 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
app
from
'
@system.app
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
export
default
{
export
default
{
data
:
{
data
:
{
title
:
""
title
:
""
},
},
onInit
()
{
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
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
()
{
},
}
location/geolocation_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js
0 → 100644
浏览文件 @
84166d74
/*
* 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
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
function
translateParamsToString
(
parameters
)
{
const
keySet
=
new
Set
([
'
-s class
'
,
'
-s notClass
'
,
'
-s suite
'
,
'
-s itName
'
,
'
-s level
'
,
'
-s testType
'
,
'
-s size
'
,
'
-s timeout
'
,
'
-s package
'
,
'
-s dryRun
'
])
let
targetParams
=
''
;
for
(
const
key
in
parameters
)
{
if
(
keySet
.
has
(
key
))
{
targetParams
+=
'
'
+
key
+
'
'
+
parameters
[
key
]
}
}
return
targetParams
.
trim
()
}
export
default
{
onPrepare
()
{
console
.
info
(
'
OpenHarmonyTestRunner OnPrepare
'
)
},
onRun
()
{
console
.
log
(
'
OpenHarmonyTestRunner onRun run
'
)
var
abilityDelegatorArguments
=
AbilityDelegatorRegistry
.
getArguments
()
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
()
var
testAbilityName
=
abilityDelegatorArguments
.
parameters
[
'
-p
'
]
+
'
.TestAbility
'
var
cmd
=
'
aa start -d 0 -a
'
+
testAbilityName
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
debug
=
abilityDelegatorArguments
.
parameters
[
"
-D
"
]
console
.
info
(
'
debug value :
'
+
debug
)
if
(
debug
==
'
true
'
)
{
cmd
+=
'
-D
'
}
console
.
info
(
'
cmd :
'
+
cmd
)
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
,
data
)
=>
{
console
.
info
(
'
executeShellCommand : err :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
stdResult
);
console
.
info
(
'
executeShellCommand : data :
'
+
data
.
exitCode
);
})
}
};
location/geolocation_standard/src/main/js/
default/
test/GeocoderMTest.test.js
→
location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js
浏览文件 @
84166d74
...
@@ -13,12 +13,12 @@
...
@@ -13,12 +13,12 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
geolocation
from
'
@ohos.geolocation
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
import
bundle
from
'
@ohos.bundle
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
let
LocationRequestScenario
=
{
let
LocationRequestScenario
=
{
UNSET
:
0x300
,
UNSET
:
0x300
,
...
@@ -44,7 +44,7 @@ async function changedLocationMode(){
...
@@ -44,7 +44,7 @@ async function changedLocationMode(){
let
result1
=
geolocationm
.
isLocationEnabled
();
let
result1
=
geolocationm
.
isLocationEnabled
();
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
if
(
!
result1
){
if
(
!
result1
){
await
geolocation
m
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
geolocation
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
sleep
(
3000
);
await
sleep
(
3000
);
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
...
@@ -83,7 +83,9 @@ async function applyPermission() {
...
@@ -83,7 +83,9 @@ async function applyPermission() {
}
}
}
}
describe
(
'
geolocationTest_geo5
'
,
function
()
{
export
default
function
geolocationTest_geo5
()
{
describe
(
'
geolocationTest_geo5
'
,
function
()
{
console
.
log
(
'
#start AccessTokenTests#
'
);
console
.
log
(
'
#start AccessTokenTests#
'
);
beforeAll
(
async
function
(
done
)
{
beforeAll
(
async
function
(
done
)
{
...
@@ -98,6 +100,7 @@ describe('geolocationTest_geo5', function () {
...
@@ -98,6 +100,7 @@ describe('geolocationTest_geo5', function () {
done
();
done
();
})
})
/**
/**
* @tc.number SUB_HSS_LocationSystem_Geo_1900
* @tc.number SUB_HSS_LocationSystem_Geo_1900
* @tc.name testIsGeoServiceAvailable
* @tc.name testIsGeoServiceAvailable
...
@@ -126,19 +129,23 @@ describe('geolocationTest_geo5', function () {
...
@@ -126,19 +129,23 @@ describe('geolocationTest_geo5', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_2000
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_2000
'
,
0
,
async
function
(
done
)
{
try
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
,
"
locale
"
:
"
zh
"
};
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
,
"
locale
"
:
"
zh
"
};
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
,
(
err
,
data
)
=>
{
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
,
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation20 callback err is:
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation4 callback err is:
'
+
JSON
.
stringify
(
err
));
return
;
}
else
{
}
else
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation
20
callback data is:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation
4
callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
}
}
resolve
();
});
});
})
}
catch
(
error
)
{
await
promise
.
then
(
done
);
console
.
info
(
"
[lbs_js] getAddressesFromLocation4 callback try error:
"
+
error
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
await
sleep
(
2000
);
done
();
})
})
/**
/**
...
@@ -150,6 +157,7 @@ describe('geolocationTest_geo5', function () {
...
@@ -150,6 +157,7 @@ describe('geolocationTest_geo5', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_2100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_2100
'
,
0
,
async
function
(
done
)
{
try
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
await
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
await
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation21 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation21 promise:
'
+
JSON
.
stringify
(
data
));
...
@@ -164,13 +172,16 @@ describe('geolocationTest_geo5', function () {
...
@@ -164,13 +172,16 @@ describe('geolocationTest_geo5', function () {
+
JSON
.
stringify
(
data
)[
0
].
roadName
+
JSON
.
stringify
(
data
)[
0
].
subAdministrativeArea
+
JSON
.
stringify
(
data
)[
0
].
roadName
+
JSON
.
stringify
(
data
)[
0
].
subAdministrativeArea
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
+
JSON
.
stringify
(
data
)[
0
].
isFromMock
);
+
JSON
.
stringify
(
data
)[
0
].
isFromMock
);
done
();
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation21 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation21 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation21 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -182,17 +193,21 @@ describe('geolocationTest_geo5', function () {
...
@@ -182,17 +193,21 @@ describe('geolocationTest_geo5', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_2200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_2200
'
,
0
,
async
function
(
done
)
{
try
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
5
};
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
5
};
await
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
await
geolocationm
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation22 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation22 promise:
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
done
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation22 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation22 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation22 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -403,6 +418,7 @@ describe('geolocationTest_geo5', function () {
...
@@ -403,6 +418,7 @@ describe('geolocationTest_geo5', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_2600
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_2600
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
1
};
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
1
};
try
{
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation09 callback data is:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation09 callback data is:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
...
@@ -410,6 +426,10 @@ describe('geolocationTest_geo5', function () {
...
@@ -410,6 +426,10 @@ describe('geolocationTest_geo5', function () {
console
.
info
(
"
[lbs_js] getAddressesFromLocationName09 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName09 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName26 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -422,6 +442,7 @@ describe('geolocationTest_geo5', function () {
...
@@ -422,6 +442,7 @@ describe('geolocationTest_geo5', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_2700
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_2700
'
,
0
,
async
function
(
done
)
{
try
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
5
};
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
5
};
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation10 promise data is:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation10 promise data is:
"
+
JSON
.
stringify
(
result
));
...
@@ -431,6 +452,10 @@ describe('geolocationTest_geo5', function () {
...
@@ -431,6 +452,10 @@ describe('geolocationTest_geo5', function () {
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName27 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -490,6 +515,7 @@ describe('geolocationTest_geo5', function () {
...
@@ -490,6 +515,7 @@ describe('geolocationTest_geo5', function () {
"
maxLatitude
"
:
31.1537977881
,
"
maxLatitude
"
:
31.1537977881
,
"
maxLongitude
"
:
121.8026736943
"
maxLongitude
"
:
121.8026736943
};
};
try
{
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation29 promise data is:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation29 promise data is:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
...
@@ -498,6 +524,10 @@ describe('geolocationTest_geo5', function () {
...
@@ -498,6 +524,10 @@ describe('geolocationTest_geo5', function () {
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName29 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -572,6 +602,7 @@ describe('geolocationTest_geo5', function () {
...
@@ -572,6 +602,7 @@ describe('geolocationTest_geo5', function () {
"
maxLatitude
"
:
40.95
,
"
maxLatitude
"
:
40.95
,
"
maxLongitude
"
:
116.45
"
maxLongitude
"
:
116.45
};
};
try
{
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName31 promise data is:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName31 promise data is:
"
+
JSON
.
stringify
(
result
));
expect
(
result
.
length
>=
0
).
assertTrue
();
expect
(
result
.
length
>=
0
).
assertTrue
();
...
@@ -580,6 +611,10 @@ describe('geolocationTest_geo5', function () {
...
@@ -580,6 +611,10 @@ describe('geolocationTest_geo5', function () {
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName31 message.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -601,6 +636,7 @@ describe('geolocationTest_geo5', function () {
...
@@ -601,6 +636,7 @@ describe('geolocationTest_geo5', function () {
"
maxLatitude
"
:
39.85
,
"
maxLatitude
"
:
39.85
,
"
maxLongitude
"
:
116.35
"
maxLongitude
"
:
116.35
};
};
try
{
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName32 promise data is:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName32 promise data is:
"
+
JSON
.
stringify
(
result
));
expect
(
result
.
length
>=
0
).
assertTrue
();
expect
(
result
.
length
>=
0
).
assertTrue
();
...
@@ -609,6 +645,10 @@ describe('geolocationTest_geo5', function () {
...
@@ -609,6 +645,10 @@ describe('geolocationTest_geo5', function () {
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName32 message.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -961,4 +1001,8 @@ describe('geolocationTest_geo5', function () {
...
@@ -961,4 +1001,8 @@ describe('geolocationTest_geo5', function () {
}
}
done
();
done
();
})
})
})
})
}
location/geolocation_standard/src/main/js/
default/
test/GeocoderTest.test.js
→
location/geolocation_standard/src/main/js/test/GeocoderTest.test.js
浏览文件 @
84166d74
...
@@ -18,7 +18,7 @@ import {LocationEventListener} from '@ohos.geolocation';
...
@@ -18,7 +18,7 @@ import {LocationEventListener} from '@ohos.geolocation';
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
import
bundle
from
'
@ohos.bundle
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
let
LocationRequestScenario
=
{
let
LocationRequestScenario
=
{
UNSET
:
0x300
,
UNSET
:
0x300
,
...
@@ -85,7 +85,10 @@ async function applyPermission() {
...
@@ -85,7 +85,10 @@ async function applyPermission() {
}
}
}
}
describe
(
'
geolocationTest_geo1
'
,
function
()
{
export
default
function
geolocationTest_geo1
()
{
describe
(
'
geolocationTest_geo1
'
,
function
()
{
console
.
log
(
'
#start AccessTokenTests#
'
);
console
.
log
(
'
#start AccessTokenTests#
'
);
beforeAll
(
async
function
(
done
)
{
beforeAll
(
async
function
(
done
)
{
...
@@ -100,6 +103,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -100,6 +103,7 @@ describe('geolocationTest_geo1', function () {
done
();
done
();
})
})
/**
/**
* @tc.number SUB_HSS_LocationSystem_Geo_0100
* @tc.number SUB_HSS_LocationSystem_Geo_0100
* @tc.name testIsGeoServiceAvailable
* @tc.name testIsGeoServiceAvailable
...
@@ -109,18 +113,23 @@ describe('geolocationTest_geo1', function () {
...
@@ -109,18 +113,23 @@ describe('geolocationTest_geo1', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0100
'
,
0
,
async
function
(
done
)
{
try
{
geolocation
.
isGeoServiceAvailable
(
async
(
err
,
data
)
=>
{
geolocation
.
isGeoServiceAvailable
(
async
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getGeoServiceState err is :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] getGeoServiceState err is :
'
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
console
.
info
(
'
[lbs_js] isGeoServiceAvailable callback result:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] isGeoServiceAvailable callback result:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
data
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
data
)
!=
null
);
done
();
}
}
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] isGeoServiceAvailable callback err.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] The geocode interface is not connected to a third-party service.
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
await
sleep
(
500
);
done
();
});
});
/**
/**
...
@@ -139,10 +148,12 @@ describe('geolocationTest_geo1', function () {
...
@@ -139,10 +148,12 @@ describe('geolocationTest_geo1', function () {
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
)
!=
null
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
).
assertFail
(
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] isGeoServiceAvailable error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] isGeoServiceAvailable error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] The geocode interface is not connected to a third-party service.
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
}
done
();
done
();
})
})
...
@@ -157,7 +168,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -157,7 +168,7 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0300
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
,
"
locale
"
:
"
zh
"
};
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
,
"
locale
"
:
"
zh
"
};
let
promise
=
new
Promise
((
resolve
,
reject
)
=>
{
try
{
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
,
(
err
,
data
)
=>
{
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
,
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation callback err is :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation callback err is :
'
+
JSON
.
stringify
(
err
));
...
@@ -165,10 +176,13 @@ describe('geolocationTest_geo1', function () {
...
@@ -165,10 +176,13 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
}
}
resolve
();
});
});
})
}
catch
(
error
)
{
await
promise
.
then
(
done
)
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback try err:
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
await
sleep
(
1000
);
done
();
})
})
/**
/**
...
@@ -181,6 +195,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -181,6 +195,7 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0400
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
1
};
try
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation04 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation04 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
addressUrl:
'
+
JSON
.
stringify
(
data
)[
0
].
addressUrl
console
.
info
(
'
addressUrl:
'
+
JSON
.
stringify
(
data
)[
0
].
addressUrl
...
@@ -194,13 +209,16 @@ describe('geolocationTest_geo1', function () {
...
@@ -194,13 +209,16 @@ describe('geolocationTest_geo1', function () {
+
JSON
.
stringify
(
data
)[
0
].
roadName
+
JSON
.
stringify
(
data
)[
0
].
subAdministrativeArea
+
JSON
.
stringify
(
data
)[
0
].
roadName
+
JSON
.
stringify
(
data
)[
0
].
subAdministrativeArea
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
+
JSON
.
stringify
(
data
)[
0
].
subLocality
+
JSON
.
stringify
(
data
)[
0
].
subRoadName
+
JSON
.
stringify
(
data
)[
0
].
isFromMock
);
+
JSON
.
stringify
(
data
)[
0
].
isFromMock
);
done
();
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation04 promise try err:
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -213,16 +231,20 @@ describe('geolocationTest_geo1', function () {
...
@@ -213,16 +231,20 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0500
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0500
'
,
0
,
async
function
(
done
)
{
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
5
};
let
reverseGeocodeRequest
=
{
"
latitude
"
:
31.265496
,
"
longitude
"
:
121.62771
,
"
maxItems
"
:
5
};
try
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
await
geolocation
.
getAddressesFromLocation
(
reverseGeocodeRequest
).
then
((
data
)
=>
{
console
.
info
(
'
[lbs_js] getAddressesFromLocation05 promise:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getAddressesFromLocation05 promise:
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
data
))
!=
null
);
done
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation05 promise try err:
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -435,13 +457,18 @@ describe('geolocationTest_geo1', function () {
...
@@ -435,13 +457,18 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_0900
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_0900
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
1
};
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
1
};
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is
:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation09 promise data
:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName09 promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName09 promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation09 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -455,14 +482,19 @@ describe('geolocationTest_geo1', function () {
...
@@ -455,14 +482,19 @@ describe('geolocationTest_geo1', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_Geo_1000
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_Geo_1000
'
,
0
,
async
function
(
done
)
{
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
5
};
let
geocodeRequest
=
{
"
description
"
:
"
上海市浦东新区金穗路1800号
"
,
"
maxItems
"
:
5
};
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation m callback data is
:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation10 promise data
:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName m
promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName10
promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation10 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -478,10 +510,10 @@ describe('geolocationTest_geo1', function () {
...
@@ -478,10 +510,10 @@ describe('geolocationTest_geo1', function () {
try
{
try
{
let
geocodeRequest
=
{
"
description
"
:
""
,
"
maxItems
"
:
1
};
let
geocodeRequest
=
{
"
description
"
:
""
,
"
maxItems
"
:
1
};
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation
promise data is
:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation
111 promise data
:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName
promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName
111
promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
...
@@ -492,15 +524,15 @@ describe('geolocationTest_geo1', function () {
...
@@ -492,15 +524,15 @@ describe('geolocationTest_geo1', function () {
let
geocodeRequest1
=
{
"
description
"
:
null
,
"
maxItems
"
:
1
};
let
geocodeRequest1
=
{
"
description
"
:
null
,
"
maxItems
"
:
1
};
try
{
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest1
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation
callback data is
:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation
112 promise data
:
"
+
JSON
.
stringify
(
result
));
expect
(
result
.
length
==
0
).
assertTrue
();
expect
(
result
.
length
==
0
).
assertTrue
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName
112
promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
});
});
}
catch
(
error
){
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocation
Name message.
"
+
JSON
.
stringify
(
error
.
message
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation
11 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
.
message
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
}
done
();
done
();
})
})
...
@@ -522,6 +554,7 @@ describe('geolocationTest_geo1', function () {
...
@@ -522,6 +554,7 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
31.1537977881
,
"
maxLatitude
"
:
31.1537977881
,
"
maxLongitude
"
:
121.8026736943
"
maxLongitude
"
:
121.8026736943
};
};
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
result
))
!=
null
);
...
@@ -530,6 +563,10 @@ describe('geolocationTest_geo1', function () {
...
@@ -530,6 +563,10 @@ describe('geolocationTest_geo1', function () {
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocation12 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -604,14 +641,19 @@ describe('geolocationTest_geo1', function () {
...
@@ -604,14 +641,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
40.95
,
"
maxLatitude
"
:
40.95
,
"
maxLongitude
"
:
116.45
"
maxLongitude
"
:
116.45
};
};
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback data is
:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation14 promise data
:
"
+
JSON
.
stringify
(
result
));
expect
(
result
.
length
>=
0
).
assertTrue
();
expect
(
result
.
length
>=
0
).
assertTrue
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then erro
r.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName14 promise then er
r.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocation14 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -633,14 +675,19 @@ describe('geolocationTest_geo1', function () {
...
@@ -633,14 +675,19 @@ describe('geolocationTest_geo1', function () {
"
maxLatitude
"
:
39.85
,
"
maxLatitude
"
:
39.85
,
"
maxLongitude
"
:
116.35
"
maxLongitude
"
:
116.35
};
};
try
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
await
geolocation
.
getAddressesFromLocationName
(
geocodeRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocation callback
data is:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getAddressesFromLocation15 promise
data is:
"
+
JSON
.
stringify
(
result
));
expect
(
result
.
length
>=
0
).
assertTrue
();
expect
(
result
.
length
>=
0
).
assertTrue
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getAddressesFromLocationName promise then erro
r.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getAddressesFromLocationName15 promise then er
r.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] not support now
'
);
console
.
info
(
'
[lbs_js] not support now
'
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
){
console
.
info
(
"
[lbs_js] getAddressesFromLocation15 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
((
JSON
.
stringify
(
error
))
!=
null
);
}
done
();
done
();
})
})
...
@@ -993,7 +1040,8 @@ describe('geolocationTest_geo1', function () {
...
@@ -993,7 +1040,8 @@ describe('geolocationTest_geo1', function () {
}
}
done
();
done
();
})
})
})
})
}
location/geolocation_standard/src/main/js/
default/
test/GetCountryCode.test.js
→
location/geolocation_standard/src/main/js/test/GetCountryCode.test.js
浏览文件 @
84166d74
...
@@ -17,7 +17,7 @@ import geolocationm from '@ohos.geoLocationManager';
...
@@ -17,7 +17,7 @@ import geolocationm from '@ohos.geoLocationManager';
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
import
bundle
from
'
@ohos.bundle
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
function
sleep
(
ms
)
{
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
@@ -76,7 +76,10 @@ let CountryCodeType = {
...
@@ -76,7 +76,10 @@ let CountryCodeType = {
COUNTRY_CODE_FROM_NETWORK
:
4
,
COUNTRY_CODE_FROM_NETWORK
:
4
,
}
}
describe
(
'
geolocationTest_4
'
,
function
()
{
export
default
function
geolocationTest_4
()
{
describe
(
'
geolocationTest_4
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
console
.
info
(
'
beforeAll case
'
);
await
applyPermission
();
await
applyPermission
();
...
@@ -97,18 +100,23 @@ describe('geolocationTest_4', function () {
...
@@ -97,18 +100,23 @@ describe('geolocationTest_4', function () {
* @tc.level since 9
* @tc.level since 9
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0100
'
,
0
,
async
function
(
done
)
{
try
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
console
.
info
(
"
[lbs_js] type:
"
+
result
.
type
);
console
.
info
(
"
[lbs_js] type:
"
+
result
.
type
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
==
CountryCodeType
.
COUNTRY_CODE_FROM_LOCALE
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
==
CountryCodeType
.
COUNTRY_CODE_FROM_LOCALE
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_SIM
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_SIM
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_LOCATION
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_LOCATION
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_NETWORK
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_NETWORK
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCountryCode promise try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
}
done
();
done
();
})
})
...
@@ -120,8 +128,7 @@ describe('geolocationTest_4', function () {
...
@@ -120,8 +128,7 @@ describe('geolocationTest_4', function () {
* @tc.level since 9
* @tc.level since 9
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0200
'
,
0
,
async
function
(
done
)
{
function
getCountryCodeCallback
()
{
try
{
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocationm
.
getCountryCode
((
err
,
data
)
=>
{
geolocationm
.
getCountryCode
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
return
console
.
info
(
"
getCountryCode callback err:
"
+
JSON
.
stringify
(
err
));
return
console
.
info
(
"
getCountryCode callback err:
"
+
JSON
.
stringify
(
err
));
...
@@ -129,11 +136,12 @@ describe('geolocationTest_4', function () {
...
@@ -129,11 +136,12 @@ describe('geolocationTest_4', function () {
console
.
info
(
"
getCountryCode callback success
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
getCountryCode callback success
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
!=
null
);
expect
(
true
).
assertEqual
(
data
!=
null
);
}
}
resolve
();
});
})
}
catch
(
error
)
{
})
console
.
info
(
"
[lbs_js] getCountryCode callback try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
}
}
await
getCountryCodeCallback
(
);
await
sleep
(
1000
);
done
();
done
();
})
})
...
@@ -146,21 +154,37 @@ describe('geolocationTest_4', function () {
...
@@ -146,21 +154,37 @@ describe('geolocationTest_4', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[lbs_js] countryCodeChange
"
);
console
.
info
(
"
[lbs_js] countryCodeChange
"
);
try
{
geolocationm
.
on
(
'
countryCodeChange
'
,
function
(
data
)
{
geolocationm
.
on
(
'
countryCodeChange
'
,
function
(
data
)
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
)
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] countryCodeChangeOn try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
)
!=
null
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCountryCode callback try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
}
try
{
geolocationm
.
off
(
'
countryCodeChange
'
,
function
(
data
)
{
geolocationm
.
off
(
'
countryCodeChange
'
,
function
(
data
)
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
));
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] countryCodeChangeOff try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
})
})
}
location/geolocation_standard/src/main/js/
default/
test/GetCountryCodeM.test.js
→
location/geolocation_standard/src/main/js/test/GetCountryCodeM.test.js
浏览文件 @
84166d74
...
@@ -13,11 +13,12 @@
...
@@ -13,11 +13,12 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
geolocation
from
'
@ohos.geolocation
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
import
bundle
from
'
@ohos.bundle
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
function
sleep
(
ms
)
{
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
@@ -28,7 +29,7 @@ async function changedLocationMode(){
...
@@ -28,7 +29,7 @@ async function changedLocationMode(){
let
result1
=
geolocationm
.
isLocationEnabled
();
let
result1
=
geolocationm
.
isLocationEnabled
();
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
if
(
!
result1
){
if
(
!
result1
){
await
geolocation
m
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
geolocation
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
sleep
(
3000
);
await
sleep
(
3000
);
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
...
@@ -74,7 +75,10 @@ let CountryCodeType = {
...
@@ -74,7 +75,10 @@ let CountryCodeType = {
COUNTRY_CODE_FROM_NETWORK
:
4
,
COUNTRY_CODE_FROM_NETWORK
:
4
,
}
}
describe
(
'
geolocationTest_6
'
,
function
()
{
export
default
function
geolocationTest_6
()
{
describe
(
'
geolocationTest_6
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
console
.
info
(
'
beforeAll case
'
);
await
applyPermission
();
await
applyPermission
();
...
@@ -95,18 +99,23 @@ describe('geolocationTest_6', function () {
...
@@ -95,18 +99,23 @@ describe('geolocationTest_6', function () {
* @tc.level since 9
* @tc.level since 9
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0400
'
,
0
,
async
function
(
done
)
{
try
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
console
.
info
(
"
[lbs_js] country :
"
+
result
.
country
);
console
.
info
(
"
[lbs_js] type:
"
+
result
.
type
);
console
.
info
(
"
[lbs_js] type:
"
+
result
.
type
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
==
CountryCodeType
.
COUNTRY_CODE_FROM_LOCALE
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
==
CountryCodeType
.
COUNTRY_CODE_FROM_LOCALE
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_SIM
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_SIM
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_LOCATION
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_LOCATION
);
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_NETWORK
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
.
type
)
!=
CountryCodeType
.
COUNTRY_CODE_FROM_NETWORK
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCountryCode promise try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
}
done
();
done
();
})
})
...
@@ -118,8 +127,7 @@ describe('geolocationTest_6', function () {
...
@@ -118,8 +127,7 @@ describe('geolocationTest_6', function () {
* @tc.level since 9
* @tc.level since 9
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0500
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0500
'
,
0
,
async
function
(
done
)
{
function
getCountryCodeCallback
()
{
try
{
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocationm
.
getCountryCode
((
err
,
data
)
=>
{
geolocationm
.
getCountryCode
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
return
console
.
info
(
"
[lbs_js] getCountryCode callback err:
"
+
JSON
.
stringify
(
err
));
return
console
.
info
(
"
[lbs_js] getCountryCode callback err:
"
+
JSON
.
stringify
(
err
));
...
@@ -127,11 +135,12 @@ describe('geolocationTest_6', function () {
...
@@ -127,11 +135,12 @@ describe('geolocationTest_6', function () {
console
.
info
(
"
[lbs_js] getCountryCode callback success
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[lbs_js] getCountryCode callback success
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
!=
null
);
expect
(
true
).
assertEqual
(
data
!=
null
);
}
}
resolve
();
})
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCountryCode callback try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
}
}
await
getCountryCodeCallback
(
);
await
sleep
(
1500
);
done
();
done
();
})
})
...
@@ -144,21 +153,37 @@ describe('geolocationTest_6', function () {
...
@@ -144,21 +153,37 @@ describe('geolocationTest_6', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_CountryCode_0600
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_CountryCode_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
"
[lbs_js] countryCodeChange
"
);
console
.
info
(
"
[lbs_js] countryCodeChange
"
);
try
{
geolocationm
.
on
(
'
countryCodeChange
'
,
function
(
data
)
{
geolocationm
.
on
(
'
countryCodeChange
'
,
function
(
data
)
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
)
);
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
)
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] countryCodeChangeOn try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
}
try
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
await
geolocationm
.
getCountryCode
().
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getCountryCode promise result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertTrue
(
JSON
.
stringify
(
result
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
)
!=
null
);
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] getCountryCode promise then error.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCountryCode promise try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
}
try
{
geolocationm
.
off
(
'
countryCodeChange
'
,
function
(
data
)
{
geolocationm
.
off
(
'
countryCodeChange
'
,
function
(
data
)
{
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] countryCodeChange
'
+
JSON
.
stringify
(
data
));
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] countryCodeChangeOn try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
}
done
();
done
();
})
})
})
})
}
location/geolocation_standard/src/main/js/test/List.test.js
0 → 100644
浏览文件 @
84166d74
/*
* Copyright (C) 2021 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
geolocationTest_geo5
from
'
./GeocoderMTest.test.js
'
import
geolocationTest_geo1
from
'
./GeocoderTest.test.js
'
import
geolocationTest_4
from
'
./GetCountryCode.test.js
'
import
geolocationTest_6
from
'
./GetCountryCodeM.test.js
'
import
geolocationTest_geo3
from
'
./LocationTest.test.js
'
import
geolocationTest_geo7
from
'
./LocationMTest.test.js
'
import
geolocationTest_geo2
from
'
./SystemLocation.test.js
'
export
default
function
testsuite
()
{
geolocationTest_geo5
()
geolocationTest_geo1
()
geolocationTest_4
()
geolocationTest_6
()
geolocationTest_geo3
()
geolocationTest_geo7
()
geolocationTest_geo2
()
}
location/geolocation_standard/src/main/js/
default/
test/LocationMTest.test.js
→
location/geolocation_standard/src/main/js/test/LocationMTest.test.js
浏览文件 @
84166d74
...
@@ -13,12 +13,12 @@
...
@@ -13,12 +13,12 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
geolocation
from
'
@ohos.geolocation
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
import
geolocationm
from
'
@ohos.geoLocationManager
'
;
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
import
bundle
from
'
@ohos.bundle
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
let
LocationRequestScenario
=
{
UNSET
:
0x300
,
NAVIGATION
:
0x301
,
let
LocationRequestScenario
=
{
UNSET
:
0x300
,
NAVIGATION
:
0x301
,
TRAJECTORY_TRACKING
:
0x302
,
CAR_HAILING
:
0x303
,
TRAJECTORY_TRACKING
:
0x302
,
CAR_HAILING
:
0x303
,
...
@@ -38,7 +38,7 @@ async function changedLocationMode(){
...
@@ -38,7 +38,7 @@ async function changedLocationMode(){
let
result1
=
geolocationm
.
isLocationEnabled
();
let
result1
=
geolocationm
.
isLocationEnabled
();
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
console
.
info
(
'
[lbs_js] getLocationSwitchState result:
'
+
JSON
.
stringify
(
result1
));
if
(
!
result1
){
if
(
!
result1
){
await
geolocation
m
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
geolocation
.
requestEnableLocation
().
then
(
async
(
result
)
=>
{
await
sleep
(
3000
);
await
sleep
(
3000
);
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] test requestEnableLocation promise result:
'
+
JSON
.
stringify
(
result
));
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
...
@@ -53,7 +53,7 @@ async function changedLocationMode(){
...
@@ -53,7 +53,7 @@ async function changedLocationMode(){
async
function
enableLocationSwitch
(){
async
function
enableLocationSwitch
(){
function
enableLocationSwitchCallback
(){
function
enableLocationSwitchCallback
(){
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocation
m
.
requestEnableLocation
((
err
,
data
)
=>
{
geolocation
.
requestEnableLocation
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] requestEnableLocation callback err is :
'
+
err
);
console
.
info
(
'
[lbs_js] requestEnableLocation callback err is :
'
+
err
);
}
else
{
}
else
{
...
@@ -65,7 +65,6 @@ async function enableLocationSwitch(){
...
@@ -65,7 +65,6 @@ async function enableLocationSwitch(){
}
}
await
enableLocationSwitchCallback
();
await
enableLocationSwitchCallback
();
done
();
done
();
}
}
...
@@ -96,7 +95,11 @@ async function applyPermission() {
...
@@ -96,7 +95,11 @@ async function applyPermission() {
}
}
}
}
describe
(
'
geolocationTest_geo7
'
,
function
()
{
export
default
function
geolocationTest_geo7
()
{
describe
(
'
geolocationTest_geo7
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
console
.
info
(
'
beforeAll case
'
);
await
applyPermission
();
await
applyPermission
();
...
@@ -109,6 +112,7 @@ describe('geolocationTest_geo7', function () {
...
@@ -109,6 +112,7 @@ describe('geolocationTest_geo7', function () {
afterEach
(
function
()
{
afterEach
(
function
()
{
})
})
/**
/**
* @tc.number SUB_HSS_LocationSystem_LocSwitch_0600
* @tc.number SUB_HSS_LocationSystem_LocSwitch_0600
* @tc.name Test requestrequestEnableLocation api
* @tc.name Test requestrequestEnableLocation api
...
@@ -118,9 +122,14 @@ describe('geolocationTest_geo7', function () {
...
@@ -118,9 +122,14 @@ describe('geolocationTest_geo7', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0600
'
,
0
,
function
()
{
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0600
'
,
0
,
function
()
{
try
{
let
state
=
geolocationm
.
isLocationEnabled
();
let
state
=
geolocationm
.
isLocationEnabled
();
console
.
info
(
'
[lbs_js] getLocationSwitchState06 result:
'
+
JSON
.
stringify
(
state
));
console
.
info
(
'
[lbs_js] getLocationSwitchState06 result:
'
+
JSON
.
stringify
(
state
));
expect
(
state
).
assertTrue
();
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
state
)
!=
null
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getLocationSwitchState06 try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
}
});
});
/**
/**
...
@@ -136,24 +145,32 @@ describe('geolocationTest_geo7', function () {
...
@@ -136,24 +145,32 @@ describe('geolocationTest_geo7', function () {
var
locationServiceState
=
(
state
)
=>
{
var
locationServiceState
=
(
state
)
=>
{
console
.
log
(
'
[lbs_js] locationServiceState: state:
'
+
JSON
.
stringify
(
state
));
console
.
log
(
'
[lbs_js] locationServiceState: state:
'
+
JSON
.
stringify
(
state
));
}
}
try
{
geolocationm
.
on
(
'
locationEnabledChange
'
,
locationServiceState
);
geolocationm
.
on
(
'
locationEnabledChange
'
,
locationServiceState
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationServiceStateOn07 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationEnabledChange
'
,
locationServiceState
);
geolocationm
.
off
(
'
locationEnabledChange
'
,
locationServiceState
);
expect
(
true
).
assertTrue
();
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationServiceStateOff07 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
/**
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_1500
* @tc.number SUB_HSS_LocationSystem_SingleLoc_1500
* @tc.name Test getCurrentLocation
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request in a specified scenario and set the navigation scenario.
.
* @tc.desc Initiate a single location request in a specified scenario and set the navigation scenario.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1500
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1500
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
function
getCurrentLocationCallback
()
{
try
{
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocationm
.
getCurrentLocation
(
currentLocationRequest
,
(
err
,
result
)
=>
{
geolocationm
.
getCurrentLocation
(
currentLocationRequest
,
(
err
,
result
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation15 callback err:
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
[lbs_js] getCurrentLocation15 callback err:
"
+
JSON
.
stringify
(
err
));
...
@@ -163,33 +180,37 @@ describe('geolocationTest_geo7', function () {
...
@@ -163,33 +180,37 @@ describe('geolocationTest_geo7', function () {
}
else
{
}
else
{
console
.
info
(
"
[lbs_js] getCurrentLocation15 callback result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getCurrentLocation15 callback result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
!=
null
);
expect
(
true
).
assertEqual
(
result
!=
null
);
resolve
();
}
}
});
});
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation15 callback try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
}
console
.
info
(
'
[lbs_js] getCurrentLocationCallback start
'
);
await
sleep
(
1500
);
await
getCurrentLocationCallback
();
done
();
done
();
})
})
/**
/**
* @tc.number SUB_HSS_LocationSystem_SingleLoc_1600
* @tc.number SUB_HSS_LocationSystem_SingleLoc_1600
* @tc.name Test getCurrentLocation
* @tc.name Test getCurrentLocation
* @tc.desc Initiate a single location request in a specified scenario and set the navigation scenario.
.
* @tc.desc Initiate a single location request in a specified scenario and set the navigation scenario.
* @tc.size MEDIUM
* @tc.size MEDIUM
* @tc.type Function
* @tc.type Function
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1600
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1600
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x203
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest
=
{
"
priority
"
:
0x203
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation16 promise result
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation16 promise result
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation16 promise err:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation16 promise err:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation16 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -203,13 +224,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -203,13 +224,18 @@ describe('geolocationTest_geo7', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1700
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1700
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x302
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x302
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
"
[lbs_js] getCurrentLocation callback17, result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js] getCurrentLocation callback17, result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
!=
null
);
expect
(
true
).
assertEqual
(
result
!=
null
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation callback17:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation callback17:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation callback17 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -223,13 +249,17 @@ describe('geolocationTest_geo7', function () {
...
@@ -223,13 +249,17 @@ describe('geolocationTest_geo7', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1800
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1800
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x303
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x303
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation18 promise result
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation18 promise result
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation18 promise err:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation18 promise err:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation18 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -243,13 +273,17 @@ describe('geolocationTest_geo7', function () {
...
@@ -243,13 +273,17 @@ describe('geolocationTest_geo7', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1900
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1900
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x304
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x304
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation19 promise result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation19 promise result:
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation19 promise err:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation19 promise err:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation18 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -265,19 +299,28 @@ describe('geolocationTest_geo7', function () {
...
@@ -265,19 +299,28 @@ describe('geolocationTest_geo7', function () {
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2000
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2000
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest1
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x305
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x305
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest2
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest2
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
try
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result201
'
+
JSON
.
stringify
(
result
));
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation1901 promise result:
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise err201
:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation1901 promise err
:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation1901 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest2
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest2
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result202
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation1902 promise result:
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation_0002 promise err202
:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation1902 promise err
:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation1902 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -291,13 +334,17 @@ describe('geolocationTest_geo7', function () {
...
@@ -291,13 +334,17 @@ describe('geolocationTest_geo7', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2100
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation21 promise result
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation21 promise result
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation21 promise err:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation21 promise err:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation21 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -311,13 +358,17 @@ describe('geolocationTest_geo7', function () {
...
@@ -311,13 +358,17 @@ describe('geolocationTest_geo7', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2200
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0203
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0203
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation22 promise result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation22 promise result:
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation22 promise err:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation22 promise err:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation22 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -331,13 +382,17 @@ describe('geolocationTest_geo7', function () {
...
@@ -331,13 +382,17 @@ describe('geolocationTest_geo7', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2300
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0202
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0202
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result23:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result23:
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise err23:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise err23:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation23 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -352,18 +407,28 @@ describe('geolocationTest_geo7', function () {
...
@@ -352,18 +407,28 @@ describe('geolocationTest_geo7', function () {
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2400
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0200
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
5
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0200
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
5
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0200
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
2
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0200
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
2
};
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result241
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result241
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise err241:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise err241:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation241 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result242
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result242
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise err242:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise err242:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation242 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -379,19 +444,28 @@ describe('geolocationTest_geo7', function () {
...
@@ -379,19 +444,28 @@ describe('geolocationTest_geo7', function () {
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2500
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2500
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
-
1
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
-
1
};
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result251
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result251
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise err0
251:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise err
251:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation251 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result252
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result252
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise err252:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise err252:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation252 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -406,19 +480,28 @@ describe('geolocationTest_geo7', function () {
...
@@ -406,19 +480,28 @@ describe('geolocationTest_geo7', function () {
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2600
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2600
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result261
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result261
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise err261:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise err261:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation261 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result262
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result262
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise err262:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise err262:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation262 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -433,19 +516,28 @@ describe('geolocationTest_geo7', function () {
...
@@ -433,19 +516,28 @@ describe('geolocationTest_geo7', function () {
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2700
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_2700
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0302
,
"
timeoutMs
"
:
0
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0302
,
"
timeoutMs
"
:
0
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0302
,
"
timeoutMs
"
:
-
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0302
,
"
timeoutMs
"
:
-
1000
,
"
maxAccuracy
"
:
0
};
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result271
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result271
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise err271:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise err271:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation271 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
await
geolocationm
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result272
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result272
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise err272:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise err272:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation272 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -517,8 +609,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -517,8 +609,18 @@ describe('geolocationTest_geo7', function () {
console
.
info
(
'
[lbs_js] locationChanger16 data:
'
+
JSON
.
stringify
(
location
));
console
.
info
(
'
[lbs_js] locationChanger16 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn16 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff16 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -538,8 +640,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -538,8 +640,18 @@ describe('geolocationTest_geo7', function () {
console
.
info
(
'
[lbs_js] locationChanger17 data:
'
+
JSON
.
stringify
(
location
));
console
.
info
(
'
[lbs_js] locationChanger17 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn17 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff17 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -559,8 +671,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -559,8 +671,18 @@ describe('geolocationTest_geo7', function () {
console
.
info
(
'
[lbs_js] locationChanger18 data:
'
+
JSON
.
stringify
(
location
));
console
.
info
(
'
[lbs_js] locationChanger18 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn18 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff18 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -580,8 +702,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -580,8 +702,18 @@ describe('geolocationTest_geo7', function () {
console
.
info
(
'
[lbs_js] locationChanger19 data:
'
+
JSON
.
stringify
(
location
));
console
.
info
(
'
[lbs_js] locationChanger19 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn19 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff19 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -606,10 +738,30 @@ describe('geolocationTest_geo7', function () {
...
@@ -606,10 +738,30 @@ describe('geolocationTest_geo7', function () {
console
.
log
(
'
[lbs_js] locationChanger202 data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
[lbs_js] locationChanger202 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange2
!=
null
);
expect
(
true
).
assertEqual
(
locationChange2
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange1
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn201 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange2
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn202 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange1
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff201 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange2
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff202 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -630,8 +782,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -630,8 +782,18 @@ describe('geolocationTest_geo7', function () {
console
.
log
(
'
[lbs_js] locationChanger21 data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
[lbs_js] locationChanger21 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn21 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff21 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -652,8 +814,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -652,8 +814,18 @@ describe('geolocationTest_geo7', function () {
console
.
log
(
'
[lbs_js] locationChanger22 data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
[lbs_js] locationChanger22 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn22 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff22 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -674,8 +846,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -674,8 +846,18 @@ describe('geolocationTest_geo7', function () {
console
.
log
(
'
[lbs_js] locationChanger23 data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
[lbs_js] locationChanger23 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn23 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff23 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -695,8 +877,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -695,8 +877,18 @@ describe('geolocationTest_geo7', function () {
console
.
log
(
'
[lbs_js] locationChanger24 data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
[lbs_js] locationChanger24 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn24 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff24 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -716,8 +908,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -716,8 +908,18 @@ describe('geolocationTest_geo7', function () {
console
.
log
(
'
[lbs_js] locationChanger25 data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
[lbs_js] locationChanger25 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn25 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff25 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -737,8 +939,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -737,8 +939,18 @@ describe('geolocationTest_geo7', function () {
console
.
log
(
'
[lbs_js] locationChanger26 data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
[lbs_js] locationChanger26 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn26 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff26 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -761,13 +973,33 @@ describe('geolocationTest_geo7', function () {
...
@@ -761,13 +973,33 @@ describe('geolocationTest_geo7', function () {
expect
(
true
).
assertEqual
(
locationChange1
!=
null
);
expect
(
true
).
assertEqual
(
locationChange1
!=
null
);
};
};
var
locationChange2
=
(
location
)
=>
{
var
locationChange2
=
(
location
)
=>
{
console
.
log
(
'
[lbs_js] locationChanger2
8
2 data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
[lbs_js] locationChanger2
7
2 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange2
!=
null
);
expect
(
true
).
assertEqual
(
locationChange2
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn271 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange1
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff271 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn272 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange2
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff272 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -793,10 +1025,30 @@ describe('geolocationTest_geo7', function () {
...
@@ -793,10 +1025,30 @@ describe('geolocationTest_geo7', function () {
console
.
log
(
'
[lbs_js] locationChanger282 data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
[lbs_js] locationChanger282 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange2
!=
null
);
expect
(
true
).
assertEqual
(
locationChange2
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn281 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange1
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff281 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn282 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange2
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff282 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -822,10 +1074,30 @@ describe('geolocationTest_geo7', function () {
...
@@ -822,10 +1074,30 @@ describe('geolocationTest_geo7', function () {
console
.
log
(
'
[lbs_js] locationChanger292 data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
[lbs_js] locationChanger292 data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange2
!=
null
);
expect
(
true
).
assertEqual
(
locationChange2
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn291 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange1
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff291 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn292 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange2
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff292 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -845,8 +1117,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -845,8 +1117,18 @@ describe('geolocationTest_geo7', function () {
console
.
info
(
'
[lbs_js] LastlocationChanger1: data:
'
+
JSON
.
stringify
(
location
));
console
.
info
(
'
[lbs_js] LastlocationChanger1: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn03 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff03 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
try
{
let
last
=
geolocationm
.
getLastLocation
();
let
last
=
geolocationm
.
getLastLocation
();
console
.
info
(
'
[lbs_js] getLastLocation latitude:
'
+
result
.
latitude
+
console
.
info
(
'
[lbs_js] getLastLocation latitude:
'
+
result
.
latitude
+
...
@@ -880,7 +1162,12 @@ describe('geolocationTest_geo7', function () {
...
@@ -880,7 +1162,12 @@ describe('geolocationTest_geo7', function () {
+
'
altitudes
'
+
data
[
0
].
altitudes
+
'
azimuths:
'
+
data
[
0
].
azimuths
+
+
'
altitudes
'
+
data
[
0
].
altitudes
+
'
azimuths:
'
+
data
[
0
].
azimuths
+
'
carrierFrequencies:
'
+
data
[
0
].
carrierFrequencies
);
'
carrierFrequencies:
'
+
data
[
0
].
carrierFrequencies
);
}
}
try
{
geolocationm
.
on
(
'
satelliteStatusChange
'
,
gnssStatusCb
);
geolocationm
.
on
(
'
satelliteStatusChange
'
,
gnssStatusCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] satelliteStatusOn03 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
enableLocationSwitch
();
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
...
@@ -888,9 +1175,24 @@ describe('geolocationTest_geo7', function () {
...
@@ -888,9 +1175,24 @@ describe('geolocationTest_geo7', function () {
console
.
log
(
'
[lbs_js] gnsslocationChanger3: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
[lbs_js] gnsslocationChanger3: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn03 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
satelliteStatusChange
'
,
gnssStatusCb
);
geolocationm
.
off
(
'
satelliteStatusChange
'
,
gnssStatusCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] satelliteStatusOff03 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff03 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -920,14 +1222,24 @@ describe('geolocationTest_geo7', function () {
...
@@ -920,14 +1222,24 @@ describe('geolocationTest_geo7', function () {
expect
(
true
).
assertEqual
(
error
!=
null
);
expect
(
true
).
assertEqual
(
error
!=
null
);
done
();
done
();
}
}
try
{
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocationm
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOn04 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
try
{
geolocationm
.
off
(
'
nmeaMessage
'
,
nmeaCb
);
geolocationm
.
off
(
'
nmeaMessage
'
,
nmeaCb
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
info
(
"
nmea off err:
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
nmea off err:
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
error
!=
null
);
expect
(
true
).
assertEqual
(
error
!=
null
);
}
}
try
{
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
geolocationm
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangerOff03 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -945,15 +1257,35 @@ describe('geolocationTest_geo7', function () {
...
@@ -945,15 +1257,35 @@ describe('geolocationTest_geo7', function () {
expect
(
true
).
assertEqual
(
locations
!=
null
);
expect
(
true
).
assertEqual
(
locations
!=
null
);
}
}
var
CachedGnssLoactionsRequest1
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
false
};
var
CachedGnssLoactionsRequest1
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
false
};
try
{
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest1
,
cachedLocationsCb1
);
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest1
,
cachedLocationsCb1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOn071 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb1
);
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOff071 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
var
cachedLocationsCb2
=
(
locations
)
=>
{
var
cachedLocationsCb2
=
(
locations
)
=>
{
console
.
log
(
'
[lbs_js] cachedGnssLocationsReporting7:locations:
'
+
JSON
.
stringify
(
locations
));
console
.
log
(
'
[lbs_js] cachedGnssLocationsReporting7:locations:
'
+
JSON
.
stringify
(
locations
));
expect
(
true
).
assertEqual
(
locations
!=
null
);
expect
(
true
).
assertEqual
(
locations
!=
null
);
}
}
var
CachedGnssLoactionsRequest2
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
false
};
var
CachedGnssLoactionsRequest2
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
false
};
try
{
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest2
,
cachedLocationsCb2
);
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest2
,
cachedLocationsCb2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOn072 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb1
);
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOff072 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -971,8 +1303,18 @@ describe('geolocationTest_geo7', function () {
...
@@ -971,8 +1303,18 @@ describe('geolocationTest_geo7', function () {
expect
(
true
).
assertEqual
(
locations
!=
null
);
expect
(
true
).
assertEqual
(
locations
!=
null
);
}
}
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
try
{
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOn08 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb
);
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOff08 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -990,25 +1332,33 @@ describe('geolocationTest_geo7', function () {
...
@@ -990,25 +1332,33 @@ describe('geolocationTest_geo7', function () {
expect
(
true
).
assertEqual
(
locations
!=
null
);
expect
(
true
).
assertEqual
(
locations
!=
null
);
}
}
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
try
{
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOn09 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb
);
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb
);
function
getCachedGnssLocationsSizeCallback
(){
}
catch
(
error
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
info
(
"
[lbs_js] cachedGnssLocOff09 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
getCachedGnssLocationsSize
((
err
,
data
)
=>
{
geolocationm
.
getCachedGnssLocationsSize
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getCachedGnssLocationsSize callback err is :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] getCachedGnssLocationsSize09 callback err:
'
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertTrue
(
err
!=
null
);
expect
(
true
).
assertEqual
(
err
!=
null
);
}
else
{
}
else
{
console
.
info
(
"
[lbs_js] getCachedGnssLocationsSize callback data is:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[lbs_js] getCachedGnssLocationsSize09 callback data:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
!=
null
);
expect
(
true
).
assertEqual
(
data
!=
null
);
}
}
resolve
();
});
});
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCachedGnssLocationsSize09 callback try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
}
await
getCachedGnssLocationsSizeCallback
(
);
await
sleep
(
1000
);
done
();
done
();
})
})
...
@@ -1026,19 +1376,31 @@ describe('geolocationTest_geo7', function () {
...
@@ -1026,19 +1376,31 @@ describe('geolocationTest_geo7', function () {
expect
(
true
).
assertEqual
(
locations
!=
null
);
expect
(
true
).
assertEqual
(
locations
!=
null
);
}
}
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
try
{
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOn10 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb
);
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOff10 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocationm
.
getCachedGnssLocationsSize
().
then
(
(
result
)
=>
{
await
geolocationm
.
getCachedGnssLocationsSize
().
then
(
(
result
)
=>
{
console
.
info
(
'
[lbs_js] getCachedGnssLocationsSiz promise
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCachedGnssLocationsSiz promise
'
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertTrue
(
result
!=
null
);
expect
(
true
).
assertEqual
(
result
!=
null
);
done
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertTrue
(
error
!=
null
);
expect
(
true
).
assertEqual
(
error
!=
null
);
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCachedGnssLocationsSize promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -1055,25 +1417,33 @@ describe('geolocationTest_geo7', function () {
...
@@ -1055,25 +1417,33 @@ describe('geolocationTest_geo7', function () {
expect
(
true
).
assertEqual
(
locations
!=
null
);
expect
(
true
).
assertEqual
(
locations
!=
null
);
}
}
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
try
{
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOn11 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb
);
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb
);
function
flushCachedGnssLocationsCallback
(){
}
catch
(
error
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
info
(
"
[lbs_js] cachedGnssLocOff11 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
flushCachedGnssLocations
((
err
,
data
)
=>
{
geolocationm
.
flushCachedGnssLocations
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] flushCachedGnssLocations
callback err is :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] flushCachedGnssLocations11
callback err is :
'
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertTrue
(
err
!=
null
);
expect
(
true
).
assertEqual
(
err
!=
null
);
}
else
{
}
else
{
console
.
info
(
"
[lbs_js] flushCachedGnssLocations
callback data is:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[lbs_js] flushCachedGnssLocations11
callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
);
expect
(
true
).
assertEqual
(
data
!=
null
);
}
}
resolve
();
});
});
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] flushCachedGnssLocations11 callback try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
}
await
flushCachedGnssLocationsCallback
(
);
await
sleep
(
1000
);
done
();
done
();
})
})
...
@@ -1091,19 +1461,29 @@ describe('geolocationTest_geo7', function () {
...
@@ -1091,19 +1461,29 @@ describe('geolocationTest_geo7', function () {
expect
(
true
).
assertEqual
(
locations
!=
null
);
expect
(
true
).
assertEqual
(
locations
!=
null
);
}
}
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
try
{
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocationm
.
on
(
'
cachedGnssLocationsChange
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOn11 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb
);
geolocationm
.
off
(
'
cachedGnssLocationsChange
'
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssLocOff11 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocationm
.
flushCachedGnssLocations
().
then
(
(
result
)
=>
{
await
geolocationm
.
flushCachedGnssLocations
().
then
(
(
result
)
=>
{
console
.
info
(
'
[lbs_js] flushCachedGnssLocations promise
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] flushCachedGnssLocations promise
'
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertTrue
(
result
);
expect
(
true
).
assertEqual
(
result
!=
null
);
done
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertTrue
(
error
!=
null
);
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] flushCachedGnssLocations11 promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -1119,10 +1499,7 @@ describe('geolocationTest_geo7', function () {
...
@@ -1119,10 +1499,7 @@ describe('geolocationTest_geo7', function () {
await
changedLocationMode
();
await
changedLocationMode
();
let
geofence
=
{
"
latitude
"
:
31.12
,
"
longitude
"
:
121.11
,
"
radius
"
:
1
,
"
expiration
"
:
""
};
let
geofence
=
{
"
latitude
"
:
31.12
,
"
longitude
"
:
121.11
,
"
radius
"
:
1
,
"
expiration
"
:
""
};
let
geofenceRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
geofence
"
:
geofence
};
let
geofenceRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
geofence
"
:
geofence
};
setTimeout
(
async
()
=>
{
try
{
let
want
=
(
wantAgent
)
=>
{
console
.
log
(
'
[lbs_js] wantAgent:
'
+
JSON
.
stringify
(
wantAgent
));
};
geolocationm
.
on
(
'
gnssFenceStatusChange
'
,
geofenceRequest
,
geolocationm
.
on
(
'
gnssFenceStatusChange
'
,
geofenceRequest
,
(
want
)
=>
{
(
want
)
=>
{
if
(
err
){
if
(
err
){
...
@@ -1130,8 +1507,12 @@ describe('geolocationTest_geo7', function () {
...
@@ -1130,8 +1507,12 @@ describe('geolocationTest_geo7', function () {
}
}
console
.
info
(
"
[lbs_js] fenceStatusChange2 callback result:
"
+
JSON
.
stringify
(
want
));
console
.
info
(
"
[lbs_js] fenceStatusChange2 callback result:
"
+
JSON
.
stringify
(
want
));
expect
(
true
).
assertEqual
(
want
!=
null
);
expect
(
true
).
assertEqual
(
want
!=
null
);
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] FenceStatusOn2 try error:
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
gnssFenceStatusChange
'
,
geofenceRequest
,
geolocationm
.
off
(
'
gnssFenceStatusChange
'
,
geofenceRequest
,
(
want
)
=>
{
(
want
)
=>
{
if
(
err
){
if
(
err
){
...
@@ -1140,7 +1521,11 @@ describe('geolocationTest_geo7', function () {
...
@@ -1140,7 +1521,11 @@ describe('geolocationTest_geo7', function () {
console
.
info
(
"
[lbs_js] off fenceStatusChange2 callback result:
"
+
JSON
.
stringify
(
want
));
console
.
info
(
"
[lbs_js] off fenceStatusChange2 callback result:
"
+
JSON
.
stringify
(
want
));
expect
(
true
).
assertEqual
(
want
!=
null
);
expect
(
true
).
assertEqual
(
want
!=
null
);
});
});
},
1000
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] FenceStatusOff2 try error:
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
await
sleep
(
1000
);
done
();
done
();
})
})
...
@@ -1156,10 +1541,7 @@ describe('geolocationTest_geo7', function () {
...
@@ -1156,10 +1541,7 @@ describe('geolocationTest_geo7', function () {
await
changedLocationMode
();
await
changedLocationMode
();
let
geofence
=
{
"
latitude
"
:
31.12
,
"
longitude
"
:
121.11
,
"
radius
"
:
1
,
"
expiration
"
:
""
};
let
geofence
=
{
"
latitude
"
:
31.12
,
"
longitude
"
:
121.11
,
"
radius
"
:
1
,
"
expiration
"
:
""
};
let
geofenceRequest
=
{
"
priority
"
:
0x203
,
"
scenario
"
:
0x301
,
"
geofence
"
:
geofence
};
let
geofenceRequest
=
{
"
priority
"
:
0x203
,
"
scenario
"
:
0x301
,
"
geofence
"
:
geofence
};
setTimeout
(
async
()
=>
{
try
{
let
want
=
(
wantAgent
)
=>
{
console
.
log
(
'
[lbs_js] wantAgent:
'
+
JSON
.
stringify
(
wantAgent
));
};
geolocationm
.
on
(
'
gnssFenceStatusChange
'
,
geofenceRequest
,
geolocationm
.
on
(
'
gnssFenceStatusChange
'
,
geofenceRequest
,
(
want
)
=>
{
(
want
)
=>
{
if
(
err
){
if
(
err
){
...
@@ -1167,8 +1549,12 @@ describe('geolocationTest_geo7', function () {
...
@@ -1167,8 +1549,12 @@ describe('geolocationTest_geo7', function () {
}
}
console
.
info
(
"
[lbs_js] fenceStatusChange3 callback result:
"
+
JSON
.
stringify
(
want
));
console
.
info
(
"
[lbs_js] fenceStatusChange3 callback result:
"
+
JSON
.
stringify
(
want
));
expect
(
true
).
assertEqual
(
want
!=
null
);
expect
(
true
).
assertEqual
(
want
!=
null
);
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] FenceStatusOn3 try error:
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocationm
.
off
(
'
gnssFenceStatusChange
'
,
geofenceRequest
,
geolocationm
.
off
(
'
gnssFenceStatusChange
'
,
geofenceRequest
,
(
want
)
=>
{
(
want
)
=>
{
if
(
err
){
if
(
err
){
...
@@ -1177,7 +1563,14 @@ describe('geolocationTest_geo7', function () {
...
@@ -1177,7 +1563,14 @@ describe('geolocationTest_geo7', function () {
console
.
info
(
"
[lbs_js] off fenceStatusChange3 callback result:
"
+
JSON
.
stringify
(
want
));
console
.
info
(
"
[lbs_js] off fenceStatusChange3 callback result:
"
+
JSON
.
stringify
(
want
));
expect
(
true
).
assertEqual
(
want
!=
null
);
expect
(
true
).
assertEqual
(
want
!=
null
);
});
});
},
1000
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] FenceStatusOff3 try error:
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
await
sleep
(
1000
);
done
();
done
();
})
})
})
})
}
location/geolocation_standard/src/main/js/
default/
test/LocationTest.test.js
→
location/geolocation_standard/src/main/js/test/LocationTest.test.js
浏览文件 @
84166d74
...
@@ -18,7 +18,7 @@ import { LocationEventListener } from '@ohos.geolocation';
...
@@ -18,7 +18,7 @@ import { LocationEventListener } from '@ohos.geolocation';
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
import
bundle
from
'
@ohos.bundle
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
let
LocationRequestScenario
=
{
UNSET
:
0x300
,
NAVIGATION
:
0x301
,
let
LocationRequestScenario
=
{
UNSET
:
0x300
,
NAVIGATION
:
0x301
,
TRAJECTORY_TRACKING
:
0x302
,
CAR_HAILING
:
0x303
,
TRAJECTORY_TRACKING
:
0x302
,
CAR_HAILING
:
0x303
,
DAILY_LIFE_SERVICE
:
0x304
,
NO_POWER
:
0x305
}
DAILY_LIFE_SERVICE
:
0x304
,
NO_POWER
:
0x305
}
...
@@ -97,7 +97,9 @@ async function applyPermission() {
...
@@ -97,7 +97,9 @@ async function applyPermission() {
}
}
}
}
describe
(
'
geolocationTest_geo3
'
,
function
()
{
export
default
function
geolocationTest_geo3
()
{
describe
(
'
geolocationTest_geo3
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
console
.
info
(
'
beforeAll case
'
);
await
applyPermission
();
await
applyPermission
();
...
@@ -110,6 +112,7 @@ describe('geolocationTest_geo3', function () {
...
@@ -110,6 +112,7 @@ describe('geolocationTest_geo3', function () {
afterEach
(
function
()
{
afterEach
(
function
()
{
})
})
/**
/**
* @tc.number SUB_HSS_LocationSystem_LocSwitch_0300
* @tc.number SUB_HSS_LocationSystem_LocSwitch_0300
* @tc.name Test requestrequestEnableLocation api
* @tc.name Test requestrequestEnableLocation api
...
@@ -119,6 +122,7 @@ describe('geolocationTest_geo3', function () {
...
@@ -119,6 +122,7 @@ describe('geolocationTest_geo3', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0300
'
,
0
,
async
function
(
done
)
{
try
{
geolocation
.
isLocationEnabled
(
async
(
err
,
data
)
=>
{
geolocation
.
isLocationEnabled
(
async
(
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getLocationSwitchState callback err is :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] getLocationSwitchState callback err is :
'
+
JSON
.
stringify
(
err
));
...
@@ -128,6 +132,11 @@ describe('geolocationTest_geo3', function () {
...
@@ -128,6 +132,11 @@ describe('geolocationTest_geo3', function () {
expect
(
data
).
assertTrue
();
expect
(
data
).
assertTrue
();
}
}
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getLocationSwitchState callback try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
await
sleep
(
1000
);
done
();
done
();
});
});
...
@@ -140,12 +149,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -140,12 +149,18 @@ describe('geolocationTest_geo3', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0400
'
,
0
,
async
function
(
done
)
{
try
{
await
geolocation
.
isLocationEnabled
().
then
((
result1
)
=>
{
await
geolocation
.
isLocationEnabled
().
then
((
result1
)
=>
{
console
.
info
(
'
[lbs_js] getLocationSwitchStateLocSwitch_0004 result:
'
+
JSON
.
stringify
(
result1
));
console
.
info
(
'
[lbs_js] getLocationSwitchStateLocSwitch_0004 result:
'
+
JSON
.
stringify
(
result1
));
expect
(
result1
).
assertTrue
();
expect
(
result1
).
assertTrue
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] getLocationSwitchStateLocSwitch_0004 err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
expect
().
assertFail
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getLocationSwitchState callback try err.
"
+
JSON
.
stringify
(
error
));
expect
().
assertFail
();
}
done
();
done
();
});
});
...
@@ -158,13 +173,22 @@ describe('geolocationTest_geo3', function () {
...
@@ -158,13 +173,22 @@ describe('geolocationTest_geo3', function () {
* @tc.level Level 2
* @tc.level Level 2
*/
*/
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0500
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_LocSwitch_0500
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
just for overwriting,locationServiceState test need system api
'
);
console
.
log
(
'
just for overwriting,locationServiceState test need system api
'
);
var
locationServiceState
=
(
state
)
=>
{
var
locationServiceState
=
(
state
)
=>
{
console
.
log
(
'
locationServiceState: state:
'
+
JSON
.
stringify
(
state
));
console
.
log
(
'
locationServiceState: state:
'
+
JSON
.
stringify
(
state
));
}
}
try
{
geolocation
.
on
(
'
locationServiceState
'
,
locationServiceState
);
geolocation
.
on
(
'
locationServiceState
'
,
locationServiceState
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationServiceStateOn05 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationServiceState
'
,
locationServiceState
);
geolocation
.
off
(
'
locationServiceState
'
,
locationServiceState
);
expect
(
true
).
assertTrue
();
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationServiceStateOff05 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -178,29 +202,22 @@ describe('geolocationTest_geo3', function () {
...
@@ -178,29 +202,22 @@ describe('geolocationTest_geo3', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0100
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
function
getCurrentLocationCallback
()
{
try
{
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocation
.
getCurrentLocation
(
currentLocationRequest
,
(
err
,
result
)
=>
{
geolocation
.
getCurrentLocation
(
currentLocationRequest
,
(
err
,
result
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
"
getCurrentLocation callback err:
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
[lbs_js]
getCurrentLocation callback err:
"
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertEqual
(
err
!=
null
);
expect
(
true
).
assertEqual
(
err
!=
null
);
console
.
info
(
'
getCurrentLocationCallback reject after
'
)
console
.
info
(
'
[lbs_js]
getCurrentLocationCallback reject after
'
)
}
else
{
}
else
{
console
.
info
(
"
getCurrentLocation callback, result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js]
getCurrentLocation callback, result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
!=
null
);
expect
(
true
).
assertEqual
(
result
!=
null
);
resolve
();
}
}
});
});
})
}
catch
(
error
)
{
}
console
.
info
(
"
[lbs_js] getCurrentLocation callback try err.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocationCallback start
'
);
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
"
getCurrentLocation callback_0003, result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
!=
null
);
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation callback_0003:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
}
await
sleep
(
1000
);
done
();
done
();
})
})
...
@@ -214,13 +231,17 @@ describe('geolocationTest_geo3', function () {
...
@@ -214,13 +231,17 @@ describe('geolocationTest_geo3', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0200
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x203
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x203
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation_0002 promise err:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js]
getCurrentLocation_0002 promise err:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -234,29 +255,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -234,29 +255,18 @@ describe('geolocationTest_geo3', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0300
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x302
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x302
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
function
getCurrentLocationCallback
()
{
try
{
return
new
Promise
((
resolve
,
reject
)
=>
{
geolocation
.
getCurrentLocation
(
currentLocationRequest
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
info
(
"
getCurrentLocation callback_0003 err:
"
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertEqual
(
err
!=
null
);
console
.
info
(
'
getCurrentLocationCallback reject after
'
)
}
else
{
console
.
info
(
"
getCurrentLocation callback_0003, result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
!=
null
);
resolve
();
}
});
})
}
console
.
info
(
'
getCurrentLocationCallback start
'
);
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
"
getCurrentLocation callback_0003, result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
[lbs_js]
getCurrentLocation callback_0003, result:
"
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
result
!=
null
);
expect
(
true
).
assertEqual
(
result
!=
null
);
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation callback_0003:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js]
getCurrentLocation callback_0003:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation callback03 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -270,13 +280,17 @@ describe('geolocationTest_geo3', function () {
...
@@ -270,13 +280,17 @@ describe('geolocationTest_geo3', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0400
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0400
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x303
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x303
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result004
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result004
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err004:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err004:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise04 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -290,13 +304,17 @@ describe('geolocationTest_geo3', function () {
...
@@ -290,13 +304,17 @@ describe('geolocationTest_geo3', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0500
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0500
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x304
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x304
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result005
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result005
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err005:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err005:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise05 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -312,19 +330,28 @@ describe('geolocationTest_geo3', function () {
...
@@ -312,19 +330,28 @@ describe('geolocationTest_geo3', function () {
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0600
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0600
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest1
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x305
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x305
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest2
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest2
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result0
061
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result
061
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err0
061:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js]getCurrentLocation promise err
061:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise061 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest2
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest2
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result0
062
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result
062
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation_0002 promise err0
062:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
[lbs_js]getCurrentLocation promise err
062:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise062 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -338,13 +365,17 @@ describe('geolocationTest_geo3', function () {
...
@@ -338,13 +365,17 @@ describe('geolocationTest_geo3', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0700
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0700
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result007
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result007
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err007:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err007:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise07 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -358,13 +389,17 @@ describe('geolocationTest_geo3', function () {
...
@@ -358,13 +389,17 @@ describe('geolocationTest_geo3', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0800
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0800
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0203
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0203
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
10
};
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result010
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result010
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err010:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err010:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise08 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -378,13 +413,17 @@ describe('geolocationTest_geo3', function () {
...
@@ -378,13 +413,17 @@ describe('geolocationTest_geo3', function () {
*/
*/
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0900
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_0900
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0202
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0202
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result009
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result009
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err009:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err009:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise09 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -399,18 +438,28 @@ describe('geolocationTest_geo3', function () {
...
@@ -399,18 +438,28 @@ describe('geolocationTest_geo3', function () {
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1000
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1000
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0200
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
5
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0200
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
5
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0200
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
2
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0200
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
2
};
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result010
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result010
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err010:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err010:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise101 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result0102
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result0102
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err0102:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err0102:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise102 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -426,19 +475,28 @@ describe('geolocationTest_geo3', function () {
...
@@ -426,19 +475,28 @@ describe('geolocationTest_geo3', function () {
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1100
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1100
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
-
1
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0300
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
-
1
};
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result011
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result011
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err011:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err011:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise111 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result0112
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result0112
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err0112:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err0112:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise112 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -453,19 +511,28 @@ describe('geolocationTest_geo3', function () {
...
@@ -453,19 +511,28 @@ describe('geolocationTest_geo3', function () {
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1200
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1200
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0301
,
"
timeoutMs
"
:
1000
,
"
maxAccuracy
"
:
0
};
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result012
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result012
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err012:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err012:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise121 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result0122
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result0122
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err0122:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err0122:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise122 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -480,19 +547,28 @@ describe('geolocationTest_geo3', function () {
...
@@ -480,19 +547,28 @@ describe('geolocationTest_geo3', function () {
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1300
'
,
0
,
async
function
(
done
)
{
it
(
'
SUB_HSS_LocationSystem_SingleLoc_1300
'
,
0
,
async
function
(
done
)
{
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0302
,
"
timeoutMs
"
:
0
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0302
,
"
timeoutMs
"
:
0
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0302
,
"
timeoutMs
"
:
-
1000
,
"
maxAccuracy
"
:
0
};
let
currentLocationRequest1
=
{
"
priority
"
:
0x0201
,
"
scenario
"
:
0x0302
,
"
timeoutMs
"
:
-
1000
,
"
maxAccuracy
"
:
0
};
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result0
131
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result
131
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err0122
:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err131
:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise131 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
await
geolocation
.
getCurrentLocation
(
currentLocationRequest1
).
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCurrentLocation promise result0
132
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCurrentLocation promise result
132
'
+
JSON
.
stringify
(
result
));
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
info
(
'
getCurrentLocation promise err012
2:
'
+
JSON
.
stringify
(
error
));
console
.
info
(
'
getCurrentLocation promise err13
2:
'
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
done
();
})
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCurrentLocation promise132 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -565,8 +641,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -565,8 +641,18 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn01 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff01 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -586,8 +672,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -586,8 +672,18 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn02 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff02 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -607,8 +703,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -607,8 +703,18 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn03 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff03 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -628,8 +734,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -628,8 +734,18 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn04 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff04 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -648,16 +764,36 @@ describe('geolocationTest_geo3', function () {
...
@@ -648,16 +764,36 @@ describe('geolocationTest_geo3', function () {
"
distanceInterval
"
:
5
,
"
maxAccuracy
"
:
10
};
"
distanceInterval
"
:
5
,
"
maxAccuracy
"
:
10
};
var
locationChange1
=
(
location
)
=>
{
var
locationChange1
=
(
location
)
=>
{
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
1
!=
null
);
};
};
var
locationChange2
=
(
location
)
=>
{
var
locationChange2
=
(
location
)
=>
{
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
2
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange1
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn051 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange2
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn052 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange1
);
geolocation
.
off
(
'
locationChange
'
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff051 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange2
);
geolocation
.
off
(
'
locationChange
'
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff052 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -678,8 +814,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -678,8 +814,18 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn07 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff07 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -700,8 +846,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -700,8 +846,18 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn08 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff08 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -722,8 +878,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -722,8 +878,18 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn09 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff09 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -743,8 +909,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -743,8 +909,18 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn10 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff10 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -764,8 +940,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -764,8 +940,18 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn11 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff11 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -785,8 +971,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -785,8 +971,18 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn12 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff12 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -806,16 +1002,36 @@ describe('geolocationTest_geo3', function () {
...
@@ -806,16 +1002,36 @@ describe('geolocationTest_geo3', function () {
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
var
locationChange1
=
(
location
)
=>
{
var
locationChange1
=
(
location
)
=>
{
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
1
!=
null
);
};
};
var
locationChange2
=
(
location
)
=>
{
var
locationChange2
=
(
location
)
=>
{
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
2
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn131 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange1
);
geolocation
.
off
(
'
locationChange
'
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff131 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn132 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange2
);
geolocation
.
off
(
'
locationChange
'
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff132 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -835,16 +1051,36 @@ describe('geolocationTest_geo3', function () {
...
@@ -835,16 +1051,36 @@ describe('geolocationTest_geo3', function () {
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
2
};
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
2
};
var
locationChange1
=
(
location
)
=>
{
var
locationChange1
=
(
location
)
=>
{
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
1
!=
null
);
};
};
var
locationChange2
=
(
location
)
=>
{
var
locationChange2
=
(
location
)
=>
{
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
2
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn141 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange1
);
geolocation
.
off
(
'
locationChange
'
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff141 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn142 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange2
);
geolocation
.
off
(
'
locationChange
'
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff142 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -864,16 +1100,36 @@ describe('geolocationTest_geo3', function () {
...
@@ -864,16 +1100,36 @@ describe('geolocationTest_geo3', function () {
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
-
1
};
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
-
1
};
var
locationChange1
=
(
location
)
=>
{
var
locationChange1
=
(
location
)
=>
{
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
1
!=
null
);
};
};
var
locationChange2
=
(
location
)
=>
{
var
locationChange2
=
(
location
)
=>
{
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
2
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo1
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn151 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange1
);
geolocation
.
off
(
'
locationChange
'
,
locationChange1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff151 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo2
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn152 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange2
);
geolocation
.
off
(
'
locationChange
'
,
locationChange2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff152 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -893,8 +1149,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -893,8 +1149,18 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn1 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff1 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
await
geolocation
.
getLastLocation
().
then
((
result
)
=>
{
await
geolocation
.
getLastLocation
().
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getLastLocation promise result:
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getLastLocation promise result:
'
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
)
!=
null
);
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
result
)
!=
null
);
...
@@ -928,24 +1194,33 @@ describe('geolocationTest_geo3', function () {
...
@@ -928,24 +1194,33 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
function
getLastLocationCallback
(){
console
.
info
(
"
[lbs_js] locationChangeOff2 try err.
"
+
JSON
.
stringify
(
error
));
return
new
Promise
((
resolve
,
reject
)
=>
{
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
getLastLocation
((
err
,
data
)
=>
{
geolocation
.
getLastLocation
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[LastLoc_0002] getLastLocation callback err is :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] getLastLocation2 callback err:
'
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertEqual
(
err
!=
null
);
expect
(
true
).
assertEqual
(
err
!=
null
);
}
else
{
}
else
{
console
.
info
(
'
[LastLoc_0002] getLastLocation callback result:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
[lbs_js] getLastLocation2 callback result:
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
!=
null
);
expect
(
true
).
assertEqual
(
data
!=
null
);
}
}
resolve
();
});
});
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getLastLocation2 callback try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
}
await
getLastLocationCallback
(
);
await
sleep
(
1000
);
done
();
done
();
})
})
...
@@ -967,7 +1242,12 @@ describe('geolocationTest_geo3', function () {
...
@@ -967,7 +1242,12 @@ describe('geolocationTest_geo3', function () {
+
'
altitudes
'
+
data
[
0
].
altitudes
+
'
azimuths:
'
+
data
[
0
].
azimuths
+
+
'
altitudes
'
+
data
[
0
].
altitudes
+
'
azimuths:
'
+
data
[
0
].
azimuths
+
'
carrierFrequencies:
'
+
data
[
0
].
carrierFrequencies
);
'
carrierFrequencies:
'
+
data
[
0
].
carrierFrequencies
);
}
}
try
{
geolocation
.
on
(
'
gnssStatusChange
'
,
gnssStatusCb
);
geolocation
.
on
(
'
gnssStatusChange
'
,
gnssStatusCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] gnssStatusChangeOn1 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
enableLocationSwitch
();
enableLocationSwitch
();
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
...
@@ -975,9 +1255,24 @@ describe('geolocationTest_geo3', function () {
...
@@ -975,9 +1255,24 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn1 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
gnssStatusChange
'
,
gnssStatusCb
);
geolocation
.
off
(
'
gnssStatusChange
'
,
gnssStatusCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] gnssStatusChangeOff1 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff1 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -1000,10 +1295,30 @@ describe('geolocationTest_geo3', function () {
...
@@ -1000,10 +1295,30 @@ describe('geolocationTest_geo3', function () {
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
console
.
log
(
'
locationChanger: data:
'
+
JSON
.
stringify
(
location
));
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
expect
(
true
).
assertEqual
(
locationChange
!=
null
);
};
};
try
{
geolocation
.
on
(
'
nmeaMessageChange
'
,
nmeaCb
);
geolocation
.
on
(
'
nmeaMessageChange
'
,
nmeaCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] nmeaChangeOn2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
geolocation
.
on
(
'
locationChange
'
,
requestInfo
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOn2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
nmeaMessageChange
'
,
nmeaCb
);
geolocation
.
off
(
'
nmeaMessageChange
'
,
nmeaCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] nmeaChangeOff2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
geolocation
.
off
(
'
locationChange
'
,
locationChange
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] locationChangeOff2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -1021,15 +1336,35 @@ describe('geolocationTest_geo3', function () {
...
@@ -1021,15 +1336,35 @@ describe('geolocationTest_geo3', function () {
expect
(
true
).
assertEqual
(
locations
!=
null
);
expect
(
true
).
assertEqual
(
locations
!=
null
);
}
}
var
CachedGnssLoactionsRequest1
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
false
};
var
CachedGnssLoactionsRequest1
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
false
};
try
{
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest1
,
cachedLocationsCb1
);
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest1
,
cachedLocationsCb1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOn11 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb1
);
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOff11 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
var
cachedLocationsCb2
=
(
locations
)
=>
{
var
cachedLocationsCb2
=
(
locations
)
=>
{
console
.
log
(
'
cachedGnssLocationsReporting: locations:
'
+
JSON
.
stringify
(
locations
));
console
.
log
(
'
cachedGnssLocationsReporting: locations:
'
+
JSON
.
stringify
(
locations
));
expect
(
true
).
assertEqual
(
locations
!=
null
);
expect
(
true
).
assertEqual
(
locations
!=
null
);
}
}
var
CachedGnssLoactionsRequest2
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
false
};
var
CachedGnssLoactionsRequest2
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
false
};
try
{
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest2
,
cachedLocationsCb2
);
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest2
,
cachedLocationsCb2
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOn12 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb1
);
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb1
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOff12 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -1049,8 +1384,18 @@ describe('geolocationTest_geo3', function () {
...
@@ -1049,8 +1384,18 @@ describe('geolocationTest_geo3', function () {
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
try
{
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOn2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOff2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -1070,23 +1415,33 @@ describe('geolocationTest_geo3', function () {
...
@@ -1070,23 +1415,33 @@ describe('geolocationTest_geo3', function () {
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
try
{
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOn2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
function
getCachedGnssLocationsSizeCallback
(){
}
catch
(
error
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
info
(
"
[lbs_js] cachedGnssOff2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
getCachedGnssLocationsSize
((
err
,
data
)
=>
{
geolocation
.
getCachedGnssLocationsSize
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] getCachedGnssLocationsSize callback err is :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] getCachedGnssLocationsSize callback err:
'
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertTrue
(
err
!=
null
);
expect
(
true
).
assertEqual
(
err
!=
null
);
}
else
{
}
else
{
console
.
info
(
"
[lbs_js] getCachedGnssLocationsSize callback data is:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[lbs_js] getCachedGnssLocationsSize callback data is:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
!=
null
);
expect
(
true
).
assertEqual
(
data
!=
null
);
}
}
resolve
();
});
});
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCachedGnssLocationsS callback try err:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
data
!=
null
);
}
}
await
getCachedGnssLocationsSizeCallback
(
);
await
sleep
(
1000
);
done
();
done
();
})
})
...
@@ -1106,17 +1461,31 @@ describe('geolocationTest_geo3', function () {
...
@@ -1106,17 +1461,31 @@ describe('geolocationTest_geo3', function () {
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
try
{
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOn2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
await
geolocation
.
getCachedGnssLocationsSize
().
then
(
(
result
)
=>
{
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOff2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocation
.
getCachedGnssLocationsSize
().
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] getCachedGnssLocationsSiz promise
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] getCachedGnssLocationsSiz promise
'
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertTrue
(
result
!=
null
);
expect
(
true
).
assertEqual
(
result
!=
null
);
done
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertTrue
(
error
!=
null
);
expect
(
true
).
assertEqual
(
error
!=
null
);
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] getCachedGnssLocationsS promise try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
})
})
/**
/**
...
@@ -1135,23 +1504,33 @@ describe('geolocationTest_geo3', function () {
...
@@ -1135,23 +1504,33 @@ describe('geolocationTest_geo3', function () {
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
try
{
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOn2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
function
flushCachedGnssLocationsCallback
(){
}
catch
(
error
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
info
(
"
[lbs_js] cachedGnssOff2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
flushCachedGnssLocations
((
err
,
data
)
=>
{
geolocation
.
flushCachedGnssLocations
((
err
,
data
)
=>
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
[lbs_js] flushCachedGnssLocations callback err is :
'
+
JSON
.
stringify
(
err
));
console
.
info
(
'
[lbs_js] flushCachedGnssLocations callback err:
'
+
JSON
.
stringify
(
err
));
expect
(
true
).
assertTrue
(
err
!=
null
);
expect
(
true
).
assertEqual
(
err
!=
null
);
}
else
{
}
else
{
console
.
info
(
"
[lbs_js] flushCachedGnssLocations callback data is:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
[lbs_js] flushCachedGnssLocations callback data:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
(
data
);
expect
(
true
).
assertEqual
(
data
!=
null
);
}
}
resolve
();
});
});
})
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] flushCachedGnssLoc callback try err:
"
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
}
await
flushCachedGnssLocationsCallback
(
);
await
sleep
(
1000
);
done
();
done
();
})
})
...
@@ -1171,17 +1550,30 @@ describe('geolocationTest_geo3', function () {
...
@@ -1171,17 +1550,30 @@ describe('geolocationTest_geo3', function () {
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
var
CachedGnssLoactionsRequest
=
{
'
reportingPeriodSec
'
:
5
,
'
wakeUpCacheQueueFull
'
:
true
};
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
let
requestInfo
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
timeInterval
"
:
0
,
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
"
distanceInterval
"
:
0
,
"
maxAccuracy
"
:
0
};
try
{
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
geolocation
.
on
(
'
cachedGnssLocationsReporting
'
,
CachedGnssLoactionsRequest
,
cachedLocationsCb
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOn2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
geolocation
.
off
(
'
cachedGnssLocationsReporting
'
,
cachedLocationsCb
);
await
geolocation
.
flushCachedGnssLocations
().
then
(
(
result
)
=>
{
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOff2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
await
geolocation
.
flushCachedGnssLocations
().
then
((
result
)
=>
{
console
.
info
(
'
[lbs_js] flushCachedGnssLocations promise
'
+
JSON
.
stringify
(
result
));
console
.
info
(
'
[lbs_js] flushCachedGnssLocations promise
'
+
JSON
.
stringify
(
result
));
expect
(
true
).
assertTrue
(
result
);
expect
(
true
).
assertEqual
(
result
!=
null
);
done
();
}).
catch
((
error
)
=>
{
}).
catch
((
error
)
=>
{
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
console
.
info
(
"
[lbs_js] promise then error.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertTrue
(
error
!=
null
);
expect
(
true
).
assertEqual
(
error
!=
null
);
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] cachedGnssOff2 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
...
@@ -1197,28 +1589,37 @@ describe('geolocationTest_geo3', function () {
...
@@ -1197,28 +1589,37 @@ describe('geolocationTest_geo3', function () {
await
changedLocationMode
();
await
changedLocationMode
();
let
geofence
=
{
"
latitude
"
:
31.12
,
"
longitude
"
:
121.11
,
"
radius
"
:
1
,
"
expiration
"
:
""
};
let
geofence
=
{
"
latitude
"
:
31.12
,
"
longitude
"
:
121.11
,
"
radius
"
:
1
,
"
expiration
"
:
""
};
let
geofenceRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
geofence
"
:
geofence
};
let
geofenceRequest
=
{
"
priority
"
:
0x200
,
"
scenario
"
:
0x301
,
"
geofence
"
:
geofence
};
setTimeout
(
async
()
=>
{
let
want
=
(
wantAgent
)
=>
{
let
want
=
(
wantAgent
)
=>
{
console
.
log
(
'
wantAgent:
'
+
JSON
.
stringify
(
wantAgent
));
console
.
log
(
'
wantAgent:
'
+
JSON
.
stringify
(
wantAgent
));
};
};
try
{
geolocation
.
on
(
'
fenceStatusChange
'
,
geofenceRequest
,
geolocation
.
on
(
'
fenceStatusChange
'
,
geofenceRequest
,
(
want
)
=>
{
(
want
)
=>
{
if
(
err
){
if
(
err
){
return
console
.
info
(
"
fenceStatusChange on callback err:
"
+
err
);
return
console
.
info
(
"
[lbs_js] fenceStatusChangeOn callback err:
"
+
err
);
}
}
console
.
info
(
"
fenceStatusChange callback,
result:
"
+
JSON
.
stringify
(
want
));
console
.
info
(
"
[lbs_js] fenceStatusChange callback
result:
"
+
JSON
.
stringify
(
want
));
expect
(
true
).
assertEqual
(
want
!=
null
);
expect
(
true
).
assertEqual
(
want
!=
null
);
done
();
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] fenceStatusChangeOn1 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
fenceStatusChange
'
,
geofenceRequest
,
geolocation
.
off
(
'
fenceStatusChange
'
,
geofenceRequest
,
(
want
)
=>
{
(
want
)
=>
{
if
(
err
){
if
(
err
){
return
console
.
info
(
"
fenceStatusChange callback err:
"
+
err
);
return
console
.
info
(
"
[lbs_js] fenceStatusChange callback err:
"
+
err
);
}
}
console
.
info
(
"
off fenceStatusChange callback, result:
"
+
JSON
.
stringify
(
want
));
console
.
info
(
"
[lbs_js] off fenceStatusChange callback result:
"
+
JSON
.
stringify
(
want
));
expect
(
true
).
assertEqual
(
want
!=
null
);
expect
(
true
).
assertEqual
(
want
!=
null
);
});
});
},
1000
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] fenceStatusChangeOff1 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
await
sleep
(
1000
);
done
();
done
();
})
})
...
@@ -1234,31 +1635,38 @@ describe('geolocationTest_geo3', function () {
...
@@ -1234,31 +1635,38 @@ describe('geolocationTest_geo3', function () {
await
changedLocationMode
();
await
changedLocationMode
();
let
geofence
=
{
"
latitude
"
:
31.12
,
"
longitude
"
:
121.11
,
"
radius
"
:
1
,
"
expiration
"
:
""
};
let
geofence
=
{
"
latitude
"
:
31.12
,
"
longitude
"
:
121.11
,
"
radius
"
:
1
,
"
expiration
"
:
""
};
let
geofenceRequest
=
{
"
priority
"
:
0x203
,
"
scenario
"
:
0x301
,
"
geofence
"
:
geofence
};
let
geofenceRequest
=
{
"
priority
"
:
0x203
,
"
scenario
"
:
0x301
,
"
geofence
"
:
geofence
};
setTimeout
(
async
()
=>
{
try
{
let
want
=
(
wantAgent
)
=>
{
console
.
log
(
'
wantAgent:
'
+
JSON
.
stringify
(
wantAgent
));
};
geolocation
.
on
(
'
fenceStatusChange
'
,
geofenceRequest
,
geolocation
.
on
(
'
fenceStatusChange
'
,
geofenceRequest
,
(
want
)
=>
{
(
want
)
=>
{
if
(
err
){
if
(
err
){
return
console
.
info
(
"
fenceStatusChange on callback err:
"
+
err
);
return
console
.
info
(
"
[lbs_js] fenceStatusChangeOn callback err:
"
+
err
);
}
}
console
.
info
(
"
fenceStatusChange callback, result:
"
+
JSON
.
stringify
(
want
));
console
.
info
(
"
[lbs_js]
fenceStatusChange callback, result:
"
+
JSON
.
stringify
(
want
));
expect
(
true
).
assertEqual
(
want
!=
null
);
expect
(
true
).
assertEqual
(
want
!=
null
);
done
();
done
();
});
});
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] fenceStatusChangeOn5 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
try
{
geolocation
.
off
(
'
fenceStatusChange
'
,
geofenceRequest
,
geolocation
.
off
(
'
fenceStatusChange
'
,
geofenceRequest
,
(
want
)
=>
{
(
want
)
=>
{
if
(
err
){
if
(
err
){
return
console
.
info
(
"
fenceStatusChange callback err:
"
+
err
);
return
console
.
info
(
"
[lbs_js] fenceStatusChange callback err:
"
+
err
);
}
}
console
.
info
(
"
off fenceStatusChange callback, result:
"
+
JSON
.
stringify
(
want
));
console
.
info
(
"
[lbs_js] fenceStatusChangeOff callback result:
"
+
JSON
.
stringify
(
want
));
expect
(
true
).
assertEqual
(
want
!=
null
);
expect
(
true
).
assertEqual
(
want
!=
null
);
});
});
},
1000
);
}
catch
(
error
)
{
console
.
info
(
"
[lbs_js] fenceStatusChangeOff5 try err.
"
+
JSON
.
stringify
(
error
));
expect
(
true
).
assertEqual
(
JSON
.
stringify
(
error
)
!=
null
);
}
done
();
done
();
})
})
})
})
}
location/geolocation_standard/src/main/js/
default/
test/SystemLocation.test.js
→
location/geolocation_standard/src/main/js/test/SystemLocation.test.js
浏览文件 @
84166d74
...
@@ -17,7 +17,7 @@ import geolocations from '@system.geolocation';
...
@@ -17,7 +17,7 @@ import geolocations from '@system.geolocation';
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
import
bundle
from
'
@ohos.bundle
'
import
bundle
from
'
@ohos.bundle
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
osaccount
from
'
@ohos.account.osAccount
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
function
sleep
(
ms
)
{
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
...
@@ -67,8 +67,9 @@ async function applyPermission() {
...
@@ -67,8 +67,9 @@ async function applyPermission() {
console
.
info
(
'
[permission] case apply permission failed, createAtManager failed
'
);
console
.
info
(
'
[permission] case apply permission failed, createAtManager failed
'
);
}
}
}
}
export
default
function
geolocationTest_geo2
()
{
describe
(
'
geolocationTest_geo2
'
,
function
()
{
describe
(
'
geolocationTest_geo2
'
,
function
()
{
beforeAll
(
async
function
(
done
)
{
beforeAll
(
async
function
(
done
)
{
console
.
info
(
'
beforeAll case
'
);
console
.
info
(
'
beforeAll case
'
);
await
applyPermission
();
await
applyPermission
();
...
@@ -82,6 +83,7 @@ describe('geolocationTest_geo2', function () {
...
@@ -82,6 +83,7 @@ describe('geolocationTest_geo2', function () {
afterEach
(
function
()
{
afterEach
(
function
()
{
})
})
/**
/**
* @tc.number SUB_HSS_LocationSystem_systemapi_0100
* @tc.number SUB_HSS_LocationSystem_systemapi_0100
* @tc.name Test getLocation
* @tc.name Test getLocation
...
@@ -191,7 +193,9 @@ describe('geolocationTest_geo2', function () {
...
@@ -191,7 +193,9 @@ describe('geolocationTest_geo2', function () {
expect
(
true
).
assertEqual
(
types
.
length
!=
0
);
expect
(
true
).
assertEqual
(
types
.
length
!=
0
);
})
})
})
})
}
...
...
location/geolocation_standard/src/main/resources/base/element/string.json
浏览文件 @
84166d74
...
@@ -7,6 +7,22 @@
...
@@ -7,6 +7,22 @@
{
{
"name"
:
"mainability_description"
,
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
"value"
:
"JS_Phone_Empty Feature Ability"
},
{
"name"
:
"MainAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"MainAbility_label"
,
"value"
:
"label"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"description"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"label"
}
}
]
]
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录