提交 eca76e80 编写于 作者: Z zhaoyuan17

Update xts account test 1213

Signed-off-by: Nzhaoyuan17 <zhaoyuan17@huawei.com>
上级 a8dd248a
......@@ -475,7 +475,7 @@ describe('ActsAccountOAuthToken', function () {
* @tc.desc : Obtain the oauth token after clearing the unset oauth token
*/
it('ActsAccountOAuthToken_1800', 0, async function (done) {
console.debug("====>ActsAccountOAuthToken_1200 start====");
console.debug("====>ActsAccountOAuthToken_1800 start====");
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat finish====");
console.debug("====>add account ActsAccountOAuthToken_1800 start====");
......@@ -609,7 +609,7 @@ describe('ActsAccountOAuthToken', function () {
var data = await appAccountManager.getOAuthToken("accountToken_promise_empty");
expect(data).assertEqual("");
await appAccountManager.deleteAccount("accountToken_promise_empty");
console.debug("====>ActsAccountOAuthToken_2000 end====");
console.debug("====>ActsAccountOAuthToken_2200 end====");
done();
});
......@@ -773,7 +773,7 @@ describe('ActsAccountOAuthToken', function () {
console.debug("====>creat finish====");
console.debug("====>add account ActsAccountOAuthToken_2800 start====");
await appAccountManager.addAccount("accountToken_promise_limit");
console.debug("====>setOAuthToken 2400 start====");
console.debug("====>setOAuthToken 2800 start====");
await appAccountManager.setOAuthToken("accountToken_promise_limit", tokenLimit);
console.debug("====>getOAuthToken ActsAccountOAuthToken_2800 start====");
var data = await appAccountManager.getOAuthToken("accountToken_promise_limit");
......@@ -795,7 +795,7 @@ describe('ActsAccountOAuthToken', function () {
appAccountManager.clearOAuthToken("", (err)=>{
console.debug("====>clearOAuthToken 2900 err:" + JSON.stringify(err));
expect(err.code != 0).assertEqual(true);
console.debug("====>ActsAccountOAuthToken_1900 end====");
console.debug("====>ActsAccountOAuthToken_2900 end====");
done();
});
});
......
......@@ -16,10 +16,10 @@ import account from '@ohos.account.appAccount'
import featureAbility from '@ohos.ability.featureability'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
const TIMEOUT = 3000;
const TIMEOUT = 5000;
describe('ActsGetAllAccessibleMultiple', function () {
beforeAll(async function (done) {
console.debug("====>startAbility first 0100 start====");
console.debug("====>startAbility first start====");
await featureAbility.startAbility(
{
want:
......@@ -33,9 +33,17 @@ describe('ActsGetAllAccessibleMultiple', function () {
},
},
);
setTimeout(done(), 5000);
sleep(TIMEOUT);
done();
});
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
/*
* @tc.number : ActsGetAllAccessibleMultiple_0100
* @tc.name : getAllAccessibleAccounts
......@@ -44,6 +52,7 @@ describe('ActsGetAllAccessibleMultiple', function () {
*/
it('ActsGetAllAccessibleMultiple_0100', 0, async function (done) {
console.debug("====>ActsGetAllAccessibleMultiple_0100 start====");
let dataMap = new Map();
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat finish====");
console.debug("====>add first account 0100 start====");
......@@ -52,59 +61,68 @@ describe('ActsGetAllAccessibleMultiple', function () {
await appAccountManager.addAccount("accessibleAccount_this_application_second");
console.debug("====>add third account 0100 start====");
await appAccountManager.addAccount("accessibleAccount_this_application_third");
console.debug("====>startAbility second 0100 start====");
await featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsaccountaccessiblesecond",
abilityName: "com.example.actsaccountaccessiblesecond.MainAbility",
action: "action1",
parameters:
{},
},
}
);
setTimeout(async function(){
console.debug("====>getAllAccessibleAccounts 0100 start====");
try{
var data = await appAccountManager.getAllAccessibleAccounts();
}
catch(err){
console.error("====>getAllAccessibleAccounts 0100 fail err:" + JSON.stringify(err));
expect().assertFail();
done();
}
console.debug("====>getAllAccessibleAccounts 0100 data:" + JSON.stringify(data));
expect(data.length).assertEqual(7);
try{
expect(data[0].name).assertEqual("account_name_scene_first_first");
expect(data[0].owner).assertEqual("com.example.actsaccountaccessiblefirst");
expect(data[1].name).assertEqual("account_name_scene_first_second");
expect(data[1].owner).assertEqual("com.example.actsaccountaccessiblefirst");
expect(data[2].name).assertEqual("account_name_scene_second_first");
expect(data[2].owner).assertEqual("com.example.actsaccountaccessiblesecond");
expect(data[3].name).assertEqual("account_name_scene_second_second");
expect(data[3].owner).assertEqual("com.example.actsaccountaccessiblesecond");
expect(data[4].name).assertEqual("accessibleAccount_this_application_first");
expect(data[4].owner).assertEqual("com.example.actsgetallaccessiblemultiple");
expect(data[5].name).assertEqual("accessibleAccount_this_application_second");
expect(data[5].owner).assertEqual("com.example.actsgetallaccessiblemultiple");
expect(data[6].name).assertEqual("accessibleAccount_this_application_third");
expect(data[6].owner).assertEqual("com.example.actsgetallaccessiblemultiple");
}
catch(err){
console.error("====>check data 0100 fail err:" + JSON.stringify(err));
expect().assertFail();
done();
}
console.debug("====>delete account 0100 start====");
await appAccountManager.deleteAccount("accessibleAccount_this_application_first");
await appAccountManager.deleteAccount("accessibleAccount_this_application_second");
await appAccountManager.deleteAccount("accessibleAccount_this_application_third");
console.debug("====>ActsGetAllAccessibleAccounts_0100 end====");
console.debug("====>getAllAccessibleAccounts 0100 start====");
try{
var data = await appAccountManager.getAllAccessibleAccounts();
}
catch(err){
console.error("====>getAllAccessibleAccounts 0100 fail err:" + JSON.stringify(err));
expect().assertFail();
done();
}, TIMEOUT);
}
console.debug("====>getAllAccessibleAccounts 0100 data:" + JSON.stringify(data));
expect(data.length).assertEqual(7);
console.debug("====>data.length:" + data.length);
for (let i = 0, len = data.length; i < len; i++) {
dataMap.set(data[i].name, data[i].owner)
}
expect(dataMap.has("account_name_scene_first_first")).assertTrue();
if (dataMap.has("account_name_scene_first_first")) {
let data = dataMap.get("account_name_scene_first_first");
console.debug("====>first account owner is: " + data);
expect(data).assertEqual("com.example.actsaccountaccessiblefirst");
}
expect(dataMap.has("account_name_scene_first_second")).assertTrue();
if (dataMap.has("account_name_scene_first_second")) {
let data = dataMap.get("account_name_scene_first_second");
console.debug("====>second account owner is: " + data);
expect(data).assertEqual("com.example.actsaccountaccessiblefirst");
}
expect(dataMap.has("account_name_scene_second_first")).assertTrue();
if (dataMap.has("account_name_scene_second_first")) {
let data = dataMap.get("account_name_scene_second_first");
console.debug("====>third account owner is: " + data);
expect(data).assertEqual("com.example.actsaccountaccessiblesecond");
}
expect(dataMap.has("account_name_scene_second_second")).assertTrue();
if (dataMap.has("account_name_scene_second_second")) {
let data = dataMap.get("account_name_scene_second_second");
console.debug("====>fourth account owner is: " + data);
expect(data).assertEqual("com.example.actsaccountaccessiblesecond");
}
expect(dataMap.has("accessibleAccount_this_application_first")).assertTrue();
if (dataMap.has("accessibleAccount_this_application_first")) {
let data = dataMap.get("accessibleAccount_this_application_first");
console.debug("====>fifth account owner is: " + data);
expect(data).assertEqual("com.example.actsgetallaccessiblemultiple");
}
expect(dataMap.has("accessibleAccount_this_application_second")).assertTrue();
if (dataMap.has("accessibleAccount_this_application_second")) {
let data = dataMap.get("accessibleAccount_this_application_second");
console.debug("====>sixth account owner is: " + data);
expect(data).assertEqual("com.example.actsgetallaccessiblemultiple");
}
expect(dataMap.has("accessibleAccount_this_application_third")).assertTrue();
if (dataMap.has("accessibleAccount_this_application_third")) {
let data = dataMap.get("accessibleAccount_this_application_third");
console.debug("====>seventh account owner is: " + data);
expect(data).assertEqual("com.example.actsgetallaccessiblemultiple");
}
console.debug("====>delete account start====");
await appAccountManager.deleteAccount("accessibleAccount_this_application_first");
await appAccountManager.deleteAccount("accessibleAccount_this_application_second");
await appAccountManager.deleteAccount("accessibleAccount_this_application_third");
console.debug("====>ActsGetAllAccessibleAccounts_0100 end====");
done();
});
})
\ No newline at end of file
......@@ -38,10 +38,20 @@ export default {
console.debug("====>add second account err:" + JSON.stringify(err));
appAccountManager.enableAppAccess("account_name_scene_first_second", enableBundle, (err)=>{
console.debug("====>enableAppAccess second account err:" + JSON.stringify(err));
featureAbility.terminateSelf(
(err, data)=>{
console.debug('====>Terminate Ability Success====')
});
console.debug("====>startAbility second start====");
featureAbility.startAbility(
{
want:
{
deviceId: "",
bundleName: "com.example.actsaccountaccessiblesecond",
abilityName: "com.example.actsaccountaccessiblesecond.MainAbility",
action: "action1",
parameters:
{},
},
}
);
})
})
})
......
......@@ -24,6 +24,13 @@ export default {
this.title = "scene accessible second application";
},
onShow() {
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
}
}
console.debug('====>scene accessible second application start====');
var appAccountManager = account.createAppAccountManager();
console.debug("====>creat second scene manager finish====");
......@@ -37,6 +44,7 @@ export default {
console.debug("====>add second account err:" + JSON.stringify(err));
appAccountManager.enableAppAccess("account_name_scene_second_second", enableBundle, (err)=>{
console.debug("====>enableAppAccess second account err:" + JSON.stringify(err));
sleep(3000);
featureAbility.terminateSelf(
(err, data)=>{
console.debug('====>Terminate Ability Success====')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册