提交 aefe5de5 编写于 作者: G gaoxi785

Update account xts code for release branch

Signed-off-by: Ngaoxi785 <gaoxi785@huawei.com>
上级 e97667db
......@@ -2,7 +2,7 @@
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "500000",
"test-timeout": "3000000",
"package": "com.example.actsaccounttest",
"shell-timeout": "60000"
},
......@@ -11,7 +11,8 @@
"test-file-name": [
"ActsAccountTest.hap",
"ActsAccountSceneAppAccess.hap",
"ActsAccountSceneOnOff.hap"
"ActsAccountSceneOnOff.hap",
"ActsAccountOauthtoken.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -18,6 +18,7 @@ require('./AppAccess.test.js')
require('./ExtraInfo.test.js')
require('./AssociatedData.test.js')
require('./Credential.test.js')
require('./OAuthToken.test.js')
require('./CreatManager.test.js')
require('./NoPermission.test.js')
require('./OnOff.js')
\ No newline at end of file
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -28,12 +28,12 @@
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ACCOUNTS_PRIVILEGED"
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ACCOUNTS_PRIVILEGED",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
"reason": "ceshi"
},
{
......
......@@ -28,12 +28,12 @@
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ACCOUNTS_PRIVILEGED"
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ACCOUNTS_PRIVILEGED",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
"reason": "ceshi"
},
{
......
......@@ -28,12 +28,12 @@
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.GET_ACCOUNTS_PRIVILEGED"
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_ACCOUNTS_PRIVILEGED",
"name": "ohos.permission.GET_ALL_APP_ACCOUNTS",
"reason": "ceshi"
},
{
......
......@@ -19,6 +19,7 @@ group("appaccount_scene") {
deps = [
"actsaccountaccessibleFirst:ActsAccountAccessibleFirst",
"actsaccountaccessibleSecond:ActsAccountAccessibleSecond",
"actsaccountoauthtoken:ActsAccountOauthtoken",
"actsaccountsceneaccessible:ActsAccountSceneAccessible",
"actsaccountsceneappaccess:ActsAccountSceneAppAccess",
"actsaccountsceneonoff:ActsAccountSceneOnOff",
......
# 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_hap("ActsAccountOauthtoken") {
hap_profile = "./entry/src/main/config.json"
hap_name = "ActsAccountOauthtoken"
subsystem_name = XTS_SUITENAME
final_hap_path =
"${SUITES_OUTPUT_ROOT}/${XTS_SUITENAME}/testcases/${hap_name}.hap"
testonly = true
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
}
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"
}
{
"description": "Configuration for hjunit demo Tests",
}
{
"app": {
"bundleName": "com.example.actsaccountOauthtoken",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsaccountOauthtoken",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home",
"ohos.account.appAccount.action.oauth"
]
}
],
"name": "com.example.actsaccountOauthtoken.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "service",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* 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');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* 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 appAccount from '@ohos.account.appAccount';
import featureAbility from '@ohos.ability.featureAbility';
import rpc from '@ohos.rpc';
class MyAuthenticator extends appAccount.Authenticator
{
authenticate(name, authType, callerBundleName, options, callback) {
var randNumber = Math.ceil(Math.random()*10000)
var newTokenData = "service/authenticate/tokenInfo" + randNumber;
console.log("Service authenticate name: " + name + ", authType: " + authType + ", options: "+ JSON.stringify(options));
callback.onResult(0, {"name":name,"authType":authType,"token":newTokenData});
}
addAccountImplicitly(authType, callerBundleName, options, callback) {
console.log("Service addAccountImplicitly authType: " + authType + " callerBundleName: " + callerBundleName + "options: "+ JSON.stringify(options));
callback.onRequestRedirected({
bundleName: "com.huawei.openharmonyappdemo.service",
abilityName: "com.huawei.openharmonyappdemo.service.settingAbility",
});
}
}
export default {
onStart(want) {
console.info('ServiceAbility onStart');
},
onStop() {
console.info('ServiceAbility onStop');
},
onConnect(want) {
console.info('ServiceAbility onConnect start');
try{
console.info("ServiceAbility want: " + typeof(want));
console.info("ServiceAbility want: " + JSON.stringify(want));
console.info("ServiceAbility want name: " + want.bundleName);
}catch(err){
console.info("ServiceAbility error: " + err);
}
console.info('ServiceAbility onConnect start');
return new MyAuthenticator();
},
onReconnect(want) {
console.info('ServiceAbility onReconnect');
},
onDisconnect(want) {
console.info('ServiceAbility onDisconnect');
console.info("ServiceAbility want: " + JSON.stringify(want));
},
onCommand(want, startId) {
console.info('ServiceAbility onCommand');
console.info("ServiceAbility want: " + JSON.stringify(want));
console.info("ServiceAbility startId : " + startId);
}
};
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ActsAccountSceneAppAccess"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ group("osaccount_hap") {
testonly = true
if (is_standard_system) {
deps = [
"actsosaccountdomaintest:ActsOsAccountDomainTest",
"actsosaccountpermissiontest:osaccount_permission",
"actsosaccountsystemtest:ActsOsAccountSystemTest",
"actsosaccountthirdpartytest:ActsOsAccountThirdPartyTest",
......
# 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("ActsOsAccountDomainTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsOsAccountDomainTest"
}
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"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "200000",
"package": "com.example.actsosaccountdomaintest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsOsAccountDomainTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.example.actsosaccountdomaintest",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.actsosaccountdomaintest",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"defPermissions": [
{
"availableScope": [],
"grantMode": "system_grant",
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS"
}
],
"reqPermissions": [
{
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS",
"reason": "ceshi"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"name":"ohos.permission.GET_BUNDLE_INFO",
"reason":"need use ohos.permission.GET_BUNDLE_INFO"
},
{
"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"
}
],
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.actsosaccountdomaintest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* 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');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
.titleST {
font-size: 32px;
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<text class="titleST">
STActsOsAccountDomainTest
</text>
</div>
/*
* 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 {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
this.timeout = 30000;
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "ActsOsAccountDomainTest"
},
{
"name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
/*
* 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 account from '@ohos.account.osAccount'
const ERR_OSACCOUNT_SERVICE_INNER_DOMAIN_ALREADY_BIND_ERROR = 4653103;
describe('ActsOsAccountSystemTest', function () {
/**
* @tc.number ActsAccountDomainTest_0100
* @tc.name Test createOsAccountForDomain getOsAccountLocalIdFromDomain pormise
* @tc.desc Test createOsAccountForDomain getOsAccountLocalIdFromDomain API functionality
*/
it('ActsOsAccountDomainTest_0100', 0, async function (done) {
console.debug("====>ActsOsAccountDomainTest_0100 start====");
var osAccountManager = account.getAccountManager();
console.debug("====>createosAccountFormDomain start====");
var osAccountInfo = await osAccountManager.createOsAccountForDomain(0,{
domain: "abc",
accountName: "abcdef",
});
var localId = osAccountInfo.localId;
console.debug("====>OsAccountInfo" + JSON.stringify(osAccountInfo));
expect(osAccountInfo.localName).assertEqual("abc/abcdef");
console.debug("====>createosAccountFromDomain end====");
console.debug("====>getOsAccountLocalIdFromDomain start====");
var Number = await osAccountManager.getOsAccountLocalIdFromDomain({
domain: "abc",
accountName: "abcdef",
});
expect(Number).assertEqual(localId);
console.debug("====>getOsAccountLocalIdFromDomain end====");
osAccountManager.removeOsAccount(localId);
console.debug("====>ActsOsAccountDomainTest_0100 end====");
done();
});
/**
* @tc.number ActsAccountDomainTest_0200
* @tc.name Test createOsAccountForDomain callback
* @tc.desc Test repeated call createOsAccountForDomain API functionality
*/
it('ActsOsAccountDomainTest_0200', 0, async function (done) {
console.debug("====>ActsOsAccountDomainTest_0200 start====");
var osAccountManager = account.getAccountManager();
console.debug("====>createosAccountFormDomain start====");
osAccountManager.createOsAccountForDomain(0,{
domain: "def",
accountName: "abcdef",
}, (err, osAccountInfo)=>{
console.debug("====>err" + JSON.stringify(err));
console.debug("====>OsAccountInfo" + JSON.stringify(osAccountInfo));
expect(err.code).assertEqual(0);
expect(osAccountInfo.localName).assertEqual("def/abcdef");
var localId = osAccountInfo.localId;
console.debug("====>createosAccountFormDomain end====");
console.debug("====>createosAccountFormDomain repeat start====");
osAccountManager.createOsAccountForDomain(0,{
domain: "def",
accountName: "abcdef",
}, (err,OsAccountInfo)=>{
console.debug("====>createOsAccountFormDomain repeat err : " + JSON.stringify(err));
expect(err.code).assertEqual(ERR_OSACCOUNT_SERVICE_INNER_DOMAIN_ALREADY_BIND_ERROR);
console.debug("====>createosAccountFormDomain repeat end====");
osAccountManager.removeOsAccount(localId, (err)=>{
console.debug("====>removeOsAccount err:" + JSON.stringify(err));
expect(err.code).assertEqual(0);
console.debug("====>ActsOsAccountDomainTest_0200 end====");
done();
})
});
});
});
});
\ No newline at end of file
/*
* 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('./DomainInfo.test.js')
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册