Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
eca76e80
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看板
提交
eca76e80
编写于
12月 13, 2021
作者:
Z
zhaoyuan17
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update xts account test 1213
Signed-off-by:
N
zhaoyuan17
<
zhaoyuan17@huawei.com
>
上级
a8dd248a
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
100 addition
and
64 deletion
+100
-64
account/appaccount/actsaccounttest/entry/src/main/js/test/OAuthToken.test.js
...actsaccounttest/entry/src/main/js/test/OAuthToken.test.js
+4
-4
account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/test/Getmultiple.test.js
...ssiblemultiple/entry/src/main/js/test/Getmultiple.test.js
+74
-56
account/appaccount/sceneProject/actsaccountaccessibleFirst/entry/src/main/js/default/pages/index/index.js
...sibleFirst/entry/src/main/js/default/pages/index/index.js
+14
-4
account/appaccount/sceneProject/actsaccountaccessibleSecond/entry/src/main/js/default/pages/index/index.js
...ibleSecond/entry/src/main/js/default/pages/index/index.js
+8
-0
未找到文件。
account/appaccount/actsaccounttest/entry/src/main/js/test/OAuthToken.test.js
浏览文件 @
eca76e80
...
...
@@ -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_1
2
00 start====
"
);
console
.
debug
(
"
====>ActsAccountOAuthToken_1
8
00 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_2
0
00 end====
"
);
console
.
debug
(
"
====>ActsAccountOAuthToken_2
2
00 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 2
4
00 start====
"
);
console
.
debug
(
"
====>setOAuthToken 2
8
00 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_
1
900 end====
"
);
console
.
debug
(
"
====>ActsAccountOAuthToken_
2
900 end====
"
);
done
();
});
});
...
...
account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/test/Getmultiple.test.js
浏览文件 @
eca76e80
...
...
@@ -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
=
3
000
;
const
TIMEOUT
=
5
000
;
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,21 +61,6 @@ 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
();
...
...
@@ -78,33 +72,57 @@ describe('ActsGetAllAccessibleMultiple', function () {
}
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
"
);
console
.
debug
(
"
====>data.length:
"
+
data
.
length
);
for
(
let
i
=
0
,
len
=
data
.
length
;
i
<
len
;
i
++
)
{
dataMap
.
set
(
data
[
i
].
name
,
data
[
i
].
owner
)
}
catch
(
err
){
console
.
error
(
"
====>check data 0100 fail err:
"
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
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 0100
start====
"
);
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
();
},
TIMEOUT
);
});
})
\ No newline at end of file
account/appaccount/sceneProject/actsaccountaccessibleFirst/entry/src/main/js/default/pages/index/index.js
浏览文件 @
eca76e80
...
...
@@ -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
:
{},
},
}
);
})
})
})
...
...
account/appaccount/sceneProject/actsaccountaccessibleSecond/entry/src/main/js/default/pages/index/index.js
浏览文件 @
eca76e80
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录