Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a4075ea3
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看板
提交
a4075ea3
编写于
3月 08, 2022
作者:
K
kirl.liu
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add serviceability xts case
Signed-off-by:
N
kirl.liu
<
kirl.liu@huawei.com
>
上级
aa365bff
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
594 addition
and
0 deletion
+594
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/BUILD.gn
...afwk_standard/ActsStServiceAbilityClientCaseTest/BUILD.gn
+31
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/Test.json
...fwk_standard/ActsStServiceAbilityClientCaseTest/Test.json
+18
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/config.json
...StServiceAbilityClientCaseTest/entry/src/main/config.json
+91
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/app.js
...iceAbilityClientCaseTest/entry/src/main/js/default/app.js
+22
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/i18n/en-US.json
...yClientCaseTest/entry/src/main/js/default/i18n/en-US.json
+6
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/i18n/zh-CN.json
...yClientCaseTest/entry/src/main/js/default/i18n/zh-CN.json
+6
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/pages/index/index.css
...tCaseTest/entry/src/main/js/default/pages/index/index.css
+12
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/pages/index/index.hml
...tCaseTest/entry/src/main/js/default/pages/index/index.hml
+8
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/pages/index/index.js
...ntCaseTest/entry/src/main/js/default/pages/index/index.js
+44
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/resources/base/element/string.json
...Test/entry/src/main/js/resources/base/element/string.json
+12
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/resources/base/media/icon.png
...tCaseTest/entry/src/main/js/resources/base/media/icon.png
+0
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js
...c/main/js/test/ActsStServiceAbilityClientCaseTest.test.js
+329
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/test/List.test.js
...AbilityClientCaseTest/entry/src/main/js/test/List.test.js
+15
-0
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/signature/openharmony_sx.p7b
...ServiceAbilityClientCaseTest/signature/openharmony_sx.p7b
+0
-0
未找到文件。
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/BUILD.gn
0 → 100644
浏览文件 @
a4075ea3
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsStServiceAbilityClientCaseTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsStServiceAbilityClientCaseTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ]
hap_profile = "./entry/src/main/config.json"
}
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/Test.json
0 → 100644
浏览文件 @
a4075ea3
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"60000"
,
"package"
:
"com.amsst.actsstserviceabilityclientcasetest"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsStServiceAbilityClientCaseTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/config.json
0 → 100644
浏览文件 @
a4075ea3
{
"app"
:
{
"bundleName"
:
"com.amsst.actsstserviceabilityclientcasetest"
,
"vendor"
:
"amsst"
,
"version"
:
{
"code"
:
1
,
"name"
:
"1.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
,
"releaseType"
:
"Beta1"
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.amsst.actsstserviceabilityclientcasetest"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"com.amsst.actsstserviceabilityclientcasetest.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"launchType"
:
"standard"
,
"visible"
:
true
}
],
"reqPermissions"
:
[
{
"name"
:
"ohos.permission.INSTALL_BUNDLE"
,
"reason"
:
"need use ohos.permission.INSTALL_BUNDLE"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO"
,
"reason"
:
"need use ohos.permission.GET_BUNDLE_INFO"
},
{
"name"
:
"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
,
"reason"
:
"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name"
:
"ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
,
"reason"
:
"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE"
},
{
"name"
:
"ohos.permission.REMOVE_CACHE_FILES"
,
"reason"
:
"need use ohos.permission.REMOVE_CACHE_FILES"
},
{
"name"
:
"ohos.permission.LISTEN_BUNDLE_CHANGE"
,
"reason"
:
"need use ohos.permission.LISTEN_BUNDLE_CHANGE"
},
{
"name"
:
"ohos.permission.MANAGE_LOCAL_ACCOUNTS"
,
"reason"
:
"need use ohos.permission.MANAGE_LOCAL_ACCOUNTS"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/app.js
0 → 100644
浏览文件 @
a4075ea3
/*
* 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.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
AceApplication onDestroy
'
);
}
};
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/i18n/en-US.json
0 → 100644
浏览文件 @
a4075ea3
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/i18n/zh-CN.json
0 → 100644
浏览文件 @
a4075ea3
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/pages/index/index.css
0 → 100644
浏览文件 @
a4075ea3
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
.titleST
{
font-size
:
32px
;
}
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/pages/index/index.hml
0 → 100644
浏览文件 @
a4075ea3
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
StServiceAbilityClient
</text>
</div>
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/default/pages/index/index.js
0 → 100644
浏览文件 @
a4075ea3
/*
* 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
file
from
'
@system.file
'
import
app
from
'
@system.app
'
import
{
Core
,
ExpectExtend
,
ReportExtend
}
from
'
deccjsunit/index
'
export
default
{
data
:
{
title
:
""
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
},
onShow
()
{
console
.
info
(
'
====onShow finish====<
'
)
const
core
=
Core
.
getInstance
()
const
expectExtend
=
new
ExpectExtend
({
'
id
'
:
'
extend
'
})
const
reportExtend
=
new
ReportExtend
(
file
)
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
addService
(
'
report
'
,
reportExtend
)
core
.
init
()
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
\ No newline at end of file
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/resources/base/element/string.json
0 → 100644
浏览文件 @
a4075ea3
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"StSeAbClient"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/resources/base/media/icon.png
0 → 100644
浏览文件 @
a4075ea3
6.6 KB
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/test/ActsStServiceAbilityClientCaseTest.test.js
0 → 100644
浏览文件 @
a4075ea3
/*
* 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
featureAbility
from
'
@ohos.ability.featureAbility
'
import
abilityManager
from
'
@ohos.app.abilityManager
'
import
commonEvent
from
'
@ohos.commonevent
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
ActsStServiceAbilityTest
'
,
function
()
{
let
bundleName
=
"
com.amsst.stserviceabilityserver
"
;
let
abilityName
=
"
com.amsst.stserviceabilityserver.ServiceAbility
"
;
var
subscriber0100
;
var
CommonEventSubscribeInfo0100
=
{
events
:
[
"
ACTS_SerivceAbilityServer_onCommand_PageStartService_0100
"
,
],
};
var
subscriber0200
;
var
CommonEventSubscribeInfo0200
=
{
events
:
[
"
ACTS_SerivceAbilityServer_onCommand_PageStartService_0200
"
,
],
};
var
subscriber0300
;
var
CommonEventSubscribeInfo0300
=
{
events
:
[
"
ACTS_SerivceAbilityServer_onCommand_PageStartService_0300
"
,
"
ACTS_SerivceAbilityServer_onCommand_PageStartService_0301
"
,
],
};
var
subscriber0400
;
var
CommonEventSubscribeInfo0400
=
{
events
:
[
"
ACTS_SerivceAbilityServer_onCommand_PageStartService_0400
"
,
"
ACTS_SerivceAbilityServer_onCommand_PageStartService_0401
"
,
],
};
var
subscriber0500
;
var
CommonEventSubscribeInfo0500
=
{
events
:
[
"
ACTS_SerivceAbilityServer_onConnect_PageConnectService_0500
"
,
"
ACTS_SerivceAbilityServer_onDisConnect
"
,
],
};
var
subscriber0600
;
var
CommonEventSubscribeInfo0600
=
{
events
:
[
"
ACTS_SerivceAbilityServer_onConnect_PageConnectService_0600
"
,
"
ACTS_SerivceAbilityServer_onDisConnect
"
,
],
};
var
subscriber0900
;
var
CommonEventSubscribeInfo0900
=
{
events
:
[
"
ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_0900
"
,
],
};
var
subscriber1000
;
var
CommonEventSubscribeInfo1000
=
{
events
:
[
"
ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_1000
"
,
],
};
var
subscriber1300
;
var
CommonEventSubscribeInfo1300
=
{
events
:
[
"
ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1300
"
,
"
ACTS_SerivceAbilityServerSecond_onDisConnect
"
,
],
};
var
subscriber1400
;
var
CommonEventSubscribeInfo1400
=
{
events
:
[
"
ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1400
"
,
"
ACTS_SerivceAbilityServerSecond_onDisConnect
"
,
],
};
var
subscriber1500
;
var
CommonEventSubscribeInfo1500
=
{
events
:
[
"
ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1500
"
,
"
ACTS_SerivceAbilityServer_onDisConnect
"
,
],
};
function
unsubscribe
(
caller
,
subscriber
)
{
commonEvent
.
unsubscribe
(
subscriber
,
(
err
,
data
)
=>
{
console
.
debug
(
"
=ACTS_unsubscribe (err,data)=======>
"
+
(
caller
)
+
(
"
, json err【
"
)
+
JSON
.
stringify
(
err
)
+
(
"
】
"
)
+
(
"
json data【
"
)
+
JSON
.
stringify
(
data
)
+
(
"
】
"
)
+
"
,err=
"
+
err
+
"
,data=
"
+
data
);
});
}
let
gSetTimeout
=
1000
beforeAll
(
async
(
done
)
=>
{
console
.
debug
(
'
= ACTS_beforeAll 1127 ====<begin
'
);
console
.
debug
(
'
= ACTS_beforeAll ====<end
'
);
done
();
})
beforeEach
(
async
(
done
)
=>
{
setTimeout
(
function
()
{
done
();
},
gSetTimeout
);
})
afterEach
(
async
(
done
)
=>
{
setTimeout
(
function
()
{
done
();
},
gSetTimeout
);
})
afterAll
((
done
)
=>
{
console
.
debug
(
'
= ACTS_afterAll ====<begin
'
);
setTimeout
(
function
()
{
console
.
debug
(
'
= ACTS_afterAll ====<end
'
);
featureAbility
.
terminateSelf
();
done
();
},
gSetTimeout
);
})
/*
* @tc.number ACTS_AbilityStartSetting_0100
* @tc.name The configured URI is started and the page is not configured
* @tc.desc Function test
* @tc.level 0
*/
it
(
"
ACTS_AbilityStartSetting_0100
"
,
0
,
async
function
(
done
){
console
.
info
(
"
ACTS_------------------logMessage 1 ACTS_AbilityStartSetting_0100-------------------
"
);
try
{
let
Want
=
{
bundleName
:
"
com.example.abilityStartSettingApp
"
,
abilityName
:
"
com.example.abilityStartSettingApp.MainAbility
"
,
}
let
abilityStartSetting
=
{
[
featureAbility
.
AbilityStartSetting
.
BOUNDS_KEY
]
:
[
100
,
200
,
300
,
400
],
[
featureAbility
.
AbilityStartSetting
.
WINDOW_MODE_KEY
]
:
featureAbility
.
AbilityWindowConfiguration
.
WINDOW_MODE_FULLSCREEN
,
[
featureAbility
.
AbilityStartSetting
.
DISPLAY_ID_KEY
]
:
1
,
}
var
StartAbilityParameter
=
{
want
:
Want
,
abilityStartSetting
:
abilityStartSetting
}
featureAbility
.
startAbility
(
StartAbilityParameter
,(
err
,
data
)
=>
{
console
.
log
(
'
ACTS_AbilityStartSetting_0100 asyncCallback errCode :
'
+
JSON
.
stringify
(
err
)
+
"
data:
"
+
JSON
.
stringify
(
data
));
expect
(
2097152
).
assertEqual
(
err
.
code
);
done
();
});
}
catch
(
error
){
console
.
log
(
"
ACTS_AbilityStartSetting_0100 : error =
"
+
error
);
done
();
}
})
/*
* @tc.number: ACTS_JsServiceAbility_0600
* @tc.name: featureAbility.ConnectAbility : Connects an ability to a Service ability.
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_JsServiceAbility_0600
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_JsServiceAbility_0600====<begin
'
);
try
{
var
mConnIdJsAsyncCallback
;
commonEvent
.
createSubscriber
(
CommonEventSubscribeInfo0600
).
then
(
async
(
data
)
=>
{
console
.
debug
(
"
=ACTS_JsServiceAbility_0600 createSubscriber .then(data)=======>
"
+
(
"
json data【
"
)
+
JSON
.
stringify
(
data
)
+
(
"
】
"
)
+
"
,data=
"
+
data
);
subscriber0600
=
data
;
await
commonEvent
.
subscribe
(
subscriber0600
,
async
(
err
,
data
)
=>
{
console
.
debug
(
"
=ACTS_JsServiceAbility_0600 subscribe (err,data)=======>
"
+
(
"
json err【
"
)
+
JSON
.
stringify
(
err
)
+
(
"
】
"
)
+
(
"
json data【
"
)
+
JSON
.
stringify
(
data
)
+
(
"
】
"
)
+
"
,err=
"
+
err
+
"
,data=
"
+
data
);
if
(
data
.
event
!=
"
ACTS_SerivceAbilityServer_onDisConnect
"
)
{
expect
(
"
ACTS_SerivceAbilityServer_onConnect_PageConnectService_0600
"
).
assertEqual
(
data
.
event
);
featureAbility
.
disconnectAbility
(
mConnIdJsAsyncCallback
,
(
err
)
=>
{
console
.
debug
(
"
=ACTS_JsServiceAbility_0600 disconnectAbility err====>
"
+
(
"
json err=
"
)
+
JSON
.
stringify
(
err
));
})
}
else
{
clearTimeout
(
currentAlertTimeout
);
expect
(
"
ACTS_SerivceAbilityServer_onDisConnect
"
).
assertEqual
(
data
.
event
);
unsubscribe
(
"
ACTS_JsServiceAbility_0600_unsubscribe
"
,
subscriber0600
);
console
.
log
(
'
ACTS_JsServiceAbility_0600====<end
'
)
done
();
}
});
})
function
onConnectCallback
(
element
,
remote
)
{
console
.
debug
(
'
ACTS_JsServiceAbility_0600_onConnectCallback ====> mConnIdJsAsyncCallback=
'
+
JSON
.
stringify
(
mConnIdJsAsyncCallback
)
+
"
,
"
+
mConnIdJsAsyncCallback
);
console
.
debug
(
'
ACTS_JsServiceAbility_0600_onConnectCallback ====> element=
'
+
JSON
.
stringify
(
element
)
+
"
,
"
+
element
);
console
.
debug
(
'
ACTS_JsServiceAbility_0600_onConnectCallback ====> remote=
'
+
JSON
.
stringify
(
remote
)
+
"
,
"
+
remote
);
console
.
debug
(
'
ACTS_JsServiceAbility_0600_onConnectCallback ====> remote is proxy:
'
+
(
remote
instanceof
rpc
.
RemoteProxy
));
}
function
onDisconnectCallback
(
element
)
{
console
.
debug
(
'
ACTS_JsServiceAbility_0600_onDisconnectCallback ====> element=
'
+
JSON
.
stringify
(
element
)
+
"
,
"
+
element
);
}
function
onFailedCallback
(
code
)
{
console
.
debug
(
'
ACTS_JsServiceAbility_0600_onFailedCallback ====> code=
'
+
JSON
.
stringify
(
code
)
+
"
,
"
+
code
)
expect
(
code
==
featureAbility
.
ErrorCode
.
ABILITY_NOT_FOUND
||
(
code
!=
featureAbility
.
ErrorCode
.
NO_ERROR
||
code
!=
featureAbility
.
ErrorCode
.
INVALID_PARAMETER
||
code
!=
featureAbility
.
ErrorCode
.
PERMISSION_DENY
)).
assertTrue
();
}
mConnIdJsAsyncCallback
=
featureAbility
.
connectAbility
(
{
bundleName
:
bundleName
,
abilityName
:
abilityName
,
action
:
"
PageConnectService_0600
"
,
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
,
},
)
currentAlertTimeout
=
setTimeout
(
mySetTimeout
,
gSetTimeout
);
function
mySetTimeout
()
{
console
.
log
(
'
ACTS_JsServiceAbility_1400====<end mySetTimeout
'
)
done
();
}
}
catch
(
err
)
{
clearTimeout
(
currentAlertTimeout
);
console
.
log
(
'
ACTS_JsServiceAbility_0600====<end err=
'
+
err
)
done
();
}
})
/*
* @tc.number: ACTS_JsServiceAbility_1400
* @tc.name: particleability.ConnectAbility : Connects an ability to a Service ability.
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it
(
'
ACTS_JsServiceAbility_1400
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
ACTS_JsServiceAbility_1400====<begin
'
);
try
{
var
mConnIdJsAsyncCallback
;
var
currentAlertTimeout
;
commonEvent
.
createSubscriber
(
CommonEventSubscribeInfo1400
).
then
(
async
(
data
)
=>
{
console
.
debug
(
"
=ACTS_JsServiceAbility_1400 createSubscriber .then(data)=======>
"
+
(
"
json data【
"
)
+
JSON
.
stringify
(
data
)
+
(
"
】
"
)
+
"
,data=
"
+
data
);
subscriber1400
=
data
;
await
commonEvent
.
subscribe
(
subscriber1400
,
async
(
err
,
data
)
=>
{
console
.
debug
(
"
=ACTS_JsServiceAbility_1400 subscribe (err,data)=======>
"
+
(
"
json err【
"
)
+
JSON
.
stringify
(
err
)
+
(
"
】
"
)
+
(
"
json data【
"
)
+
JSON
.
stringify
(
data
)
+
(
"
】
"
)
+
"
,err=
"
+
err
+
"
,data=
"
+
data
);
if
(
data
.
event
!=
"
ACTS_SerivceAbilityServerSecond_onDisConnect
"
)
{
expect
(
"
ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1400
"
).
assertEqual
(
data
.
event
);
featureAbility
.
disconnectAbility
(
mConnIdJsAsyncCallback
,
(
err
)
=>
{
console
.
debug
(
"
=ACTS_JsServiceAbility_1400 disconnectAbility err====>
"
+
(
"
json err=
"
)
+
JSON
.
stringify
(
err
));
})
}
else
{
clearTimeout
(
currentAlertTimeout
);
expect
(
"
ACTS_SerivceAbilityServerSecond_onDisConnect
"
).
assertEqual
(
data
.
event
);
unsubscribe
(
"
ACTS_JsServiceAbility_1400_unsubscribe
"
,
subscriber1400
);
console
.
log
(
'
ACTS_JsServiceAbility_1400====<end
'
)
done
();
}
});
})
function
onConnectCallback
(
element
,
remote
)
{
console
.
debug
(
'
ACTS_JsServiceAbility_1400_onConnectCallback ====> mConnIdJsAsyncCallback=
'
+
JSON
.
stringify
(
mConnIdJsAsyncCallback
)
+
"
,
"
+
mConnIdJsAsyncCallback
);
console
.
debug
(
'
ACTS_JsServiceAbility_1400_onConnectCallback ====> element=
'
+
JSON
.
stringify
(
element
)
+
"
,
"
+
element
);
console
.
debug
(
'
ACTS_JsServiceAbility_1400_onConnectCallback ====> remote=
'
+
JSON
.
stringify
(
remote
)
+
"
,
"
+
remote
);
console
.
debug
(
'
ACTS_JsServiceAbility_1400_onConnectCallback ====> remote is proxy:
'
+
(
remote
instanceof
rpc
.
RemoteProxy
));
}
function
onDisconnectCallback
(
element
)
{
console
.
debug
(
'
ACTS_JsServiceAbility_1400_onDisconnectCallback ====> element=
'
+
JSON
.
stringify
(
element
)
+
"
,
"
+
element
);
}
function
onFailedCallback
(
code
)
{
console
.
debug
(
'
ACTS_JsServiceAbility_1400_onFailedCallback ====> code=
'
+
JSON
.
stringify
(
code
)
+
"
,
"
+
code
)
}
mConnIdJsAsyncCallback
=
featureAbility
.
connectAbility
(
{
bundleName
:
bundleName
,
abilityName
:
abilityName
,
action
:
"
ServiceConnectService_1400
"
,
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
,
},
)
currentAlertTimeout
=
setTimeout
(
mySetTimeout
,
gSetTimeout
);
function
mySetTimeout
()
{
console
.
log
(
'
ACTS_JsServiceAbility_1400====<end mySetTimeout
'
)
done
();
}
}
catch
(
err
)
{
clearTimeout
(
currentAlertTimeout
);
console
.
log
(
'
ACTS_JsServiceAbility_1400====<end err
'
+
err
)
done
();
}
})
})
\ No newline at end of file
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/entry/src/main/js/test/List.test.js
0 → 100644
浏览文件 @
a4075ea3
/*
* 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.
*/
require
(
'
./ActsStServiceAbilityClientCaseTest.test.js
'
)
\ No newline at end of file
aafwk/aafwk_standard/ActsStServiceAbilityClientCaseTest/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
a4075ea3
文件已添加
鸿蒙社区
@harmonycommunity
mentioned in commit
5363a034
·
3月 12, 2022
mentioned in commit
5363a034
mentioned in commit 5363a03431e602e5862ca7bf14031f995516b763
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录