diff --git a/account/OsAccountTest_js/BUILD.gn b/account/OsAccountTest_js/BUILD.gn
old mode 100755
new mode 100644
index 1029b594c0a6f9d2f463fa61a8b291f8f20625b5..913fece4fe33206ad488c273ec091bc717dfd90f
--- a/account/OsAccountTest_js/BUILD.gn
+++ b/account/OsAccountTest_js/BUILD.gn
@@ -16,16 +16,19 @@ import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsOsAccountJSApiTest") {
hap_profile = "./src/main/config.json"
deps = [
- ":osaccount_js_assets",
- ":osaccount_resources",
+ ":hjs_demo_js_assets",
+ ":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsOsAccountJSApiTest"
}
-ohos_js_assets("osaccount_js_assets") {
- source_dir = "./src/main/js/default"
+ohos_js_assets("hjs_demo_js_assets") {
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
-ohos_resources("osaccount_resources") {
+
+ohos_resources("hjs_demo_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
diff --git a/account/OsAccountTest_js/Test.json b/account/OsAccountTest_js/Test.json
old mode 100755
new mode 100644
index 48740b5768136aae5c1833ee57bb1640427d36d1..af6c4fe53face45ac799b79dc9e39a88aed46563
--- a/account/OsAccountTest_js/Test.json
+++ b/account/OsAccountTest_js/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for osaccount js api Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "60000",
- "package": "ohos.acts.account.osaccount",
+ "bundle-name": "ohos.acts.account.osaccount",
+ "package-name": "ohos.acts.account.osaccount",
"shell-timeout": "60000"
},
"kits": [
diff --git a/account/OsAccountTest_js/src/main/config.json b/account/OsAccountTest_js/src/main/config.json
old mode 100755
new mode 100644
index 92730f17deebfa1fdd9d9bbd4e28b4e48e391666..2ed8950e0d75e5997286b43a59bf1f94b888a755
--- a/account/OsAccountTest_js/src/main/config.json
+++ b/account/OsAccountTest_js/src/main/config.json
@@ -14,7 +14,9 @@
"deviceConfig": {},
"module": {
"package": "ohos.acts.account.osaccount",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -38,25 +40,42 @@
],
"abilities": [
{
- "visible": true,
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "ohos.acts.account.osaccount.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "launchType": "standard"
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "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,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
}
- ],
+ ],
"js": [
{
"pages": [
@@ -67,7 +86,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
diff --git a/account/OsAccountTest_js/src/main/js/default/app.js b/account/OsAccountTest_js/src/main/js/MainAbility/app.js
similarity index 100%
rename from account/OsAccountTest_js/src/main/js/default/app.js
rename to account/OsAccountTest_js/src/main/js/MainAbility/app.js
diff --git a/account/OsAccountTest_js/src/main/js/default/i18n/en-US.json b/account/OsAccountTest_js/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from account/OsAccountTest_js/src/main/js/default/i18n/en-US.json
rename to account/OsAccountTest_js/src/main/js/MainAbility/i18n/en-US.json
diff --git a/account/OsAccountTest_js/src/main/js/default/i18n/zh-CN.json b/account/OsAccountTest_js/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from account/OsAccountTest_js/src/main/js/default/i18n/zh-CN.json
rename to account/OsAccountTest_js/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/account/appaccount/actssetchecksyncenable/entry/src/main/js/test/List.test.js b/account/OsAccountTest_js/src/main/js/MainAbility/pages/index/index.css
old mode 100755
new mode 100644
similarity index 82%
rename from account/appaccount/actssetchecksyncenable/entry/src/main/js/test/List.test.js
rename to account/OsAccountTest_js/src/main/js/MainAbility/pages/index/index.css
index 1328947d050117acb7c077dcff37e0074b9538af..2334ecfa2c147f276998e82e2c35f62800cfb031
--- a/account/appaccount/actssetchecksyncenable/entry/src/main/js/test/List.test.js
+++ b/account/OsAccountTest_js/src/main/js/MainAbility/pages/index/index.css
@@ -1,15 +1,24 @@
-/*
- * 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('./Syncenable.test.js')
\ 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.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/account/OsAccountTest_js/src/main/js/MainAbility/pages/index/index.hml b/account/OsAccountTest_js/src/main/js/MainAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..267b40ae9f5c40064ab1fd18a43ae425ef789f7d
--- /dev/null
+++ b/account/OsAccountTest_js/src/main/js/MainAbility/pages/index/index.hml
@@ -0,0 +1,19 @@
+
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/account/OsAccountTest_js/src/main/js/MainAbility/pages/index/index.js b/account/OsAccountTest_js/src/main/js/MainAbility/pages/index/index.js
new file mode 100755
index 0000000000000000000000000000000000000000..7f41e27f73e2884ed0223a48d5ff696d6913d400
--- /dev/null
+++ b/account/OsAccountTest_js/src/main/js/MainAbility/pages/index/index.js
@@ -0,0 +1,30 @@
+/*
+ * 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 app from '@system.app'
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('onShow finish')
+ },
+ onReady() {
+ },
+}
diff --git a/account/OsAccountTest_js/src/main/js/TestAbility/app.js b/account/OsAccountTest_js/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/account/OsAccountTest_js/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
diff --git a/account/OsAccountTest_js/src/main/js/TestAbility/i18n/en-US.json b/account/OsAccountTest_js/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/account/OsAccountTest_js/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/OsAccountTest_js/src/main/js/TestAbility/i18n/zh-CN.json b/account/OsAccountTest_js/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/account/OsAccountTest_js/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/OsAccountTest_js/src/main/js/TestAbility/pages/index/index.css b/account/OsAccountTest_js/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..1ba8e4e82ace01dad36c1279ea520b4903c57e8f
--- /dev/null
+++ b/account/OsAccountTest_js/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
+
+
+@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
diff --git a/account/OsAccountTest_js/src/main/js/TestAbility/pages/index/index.hml b/account/OsAccountTest_js/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/account/OsAccountTest_js/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/account/OsAccountTest_js/src/main/js/TestAbility/pages/index/index.js b/account/OsAccountTest_js/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/account/OsAccountTest_js/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/account/OsAccountTest_js/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/OsAccountTest_js/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/account/OsAccountTest_js/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/account/OsAccountTest_js/src/main/js/default/pages/index/index.css b/account/OsAccountTest_js/src/main/js/default/pages/index/index.css
deleted file mode 100755
index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000
--- a/account/OsAccountTest_js/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
diff --git a/account/OsAccountTest_js/src/main/js/default/pages/index/index.hml b/account/OsAccountTest_js/src/main/js/default/pages/index/index.hml
deleted file mode 100755
index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000
--- a/account/OsAccountTest_js/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{ $t('strings.hello') }} {{ title }}
-
-
diff --git a/account/OsAccountTest_js/src/main/js/default/pages/index/index.js b/account/OsAccountTest_js/src/main/js/default/pages/index/index.js
deleted file mode 100755
index e485a7268c3ee81c50468c02d5efa2ebd3e5840b..0000000000000000000000000000000000000000
--- a/account/OsAccountTest_js/src/main/js/default/pages/index/index.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 app from '@system.app'
-
-//import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
-export default {
- data: {
- title: ""
- },
- onInit() {
- this.title = this.$t('strings.world');
- },
- onShow() {
- console.info('onShow finish')
- const core = Core.getInstance()
- // const instrumentLog = new InstrumentLog({
- // 'id': 'report'
- // })
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- // core.addService('report', instrumentLog)
- core.init()
- // core.subscribeEvent('spec', instrumentLog)
- // core.subscribeEvent('suite', instrumentLog)
- // core.subscribeEvent('task', instrumentLog)
-
- const configService = core.getDefaultService('config')
- configService.setConfig(this)
-
- require('../../test/List.test')
- core.execute()
- },
- onReady() {
- },
-}
diff --git a/account/OsAccountTest_js/src/main/js/default/test/OsAccount.test.js b/account/OsAccountTest_js/src/main/js/default/test/OsAccount.test.js
deleted file mode 100755
index d96f762ba6f742d0d75de8e05e8f76e7d246df39..0000000000000000000000000000000000000000
--- a/account/OsAccountTest_js/src/main/js/default/test/OsAccount.test.js
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * 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.
- */
-
-// @ts-nocheck
-import {describe, beforeEach, afterEach, it, expect} from 'deccjsunit/index'
-import account from '@ohos.account.distributedAccount'
-
-describe('AccountTest', function () {
- beforeEach(function () {
- })
- afterEach(function () {
- })
-
- /**
- * @tc.number ActsDistributedAccountDeviceId_0100
- * @tc.name Test query the distribruted id by callback.
- * @tc.desc Test distributedAccount.queryOsAccountDistributedInfo API functionality by callback.
- */
- it('ActsDistributedAccountDeviceId_0100', 0, async function(done){
- console.log("test query distribtued id start");
- const distributedId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5';
- const accountAbility = account.getDistributedAccountAbility();
- accountAbility.updateOsAccountDistributedInfo(
- {
- name: 'ZhangSan',
- id: '12345',
- event: "Ohos.account.event.LOGIN"
- }, (err)=>{
- console.log("update distributedInfo err:" + JSON.stringify(err));
- accountAbility.queryOsAccountDistributedInfo((err, distributedInfo)=>{
- console.log("query distributedInfo err:" + JSON.stringify(err));
- console.log("query distributedInfo:" + JSON.stringify(distributedInfo));
- expect(distributedInfo.name).assertEqual('ZhangSan');
- expect(distributedInfo.id).assertEqual(distributedId);
- console.log("test query distribtued id end");
- done();
- })
- })
- })
-
- /**
- * @tc.number SUB_Account_distributedAccount_JS_API_0100
- * @tc.name Test distributedAccount.getDistributedAccountAbility.
- * @tc.desc Test distributedAccount.getDistributedAccountAbility API functionality.
- */
- it('account_getDistributedAccountAbility_test', 0, function () {
- var ret = false;
- const accountAbility = account.getDistributedAccountAbility()
- if(accountAbility !== null){
- ret = true;
- }
- expect(ret).assertTrue()
- })
-
- /**
- * @tc.number SUB_Account_distributedAccount_JS_API_0200
- * @tc.name Test distributedAccount.queryOsAccountDistributedInfo.
- * @tc.desc Test distributedAccount.queryOsAccountDistributedInfo API functionality.
- */
- it('account_queryOsAccountDistributedInfo_test001', 0, function () {
- const accountAbility = account.getDistributedAccountAbility()
- accountAbility.queryOsAccountDistributedInfo().then(function (data) {
- expect(data.name).assertEqual('anonymous')
- });
- })
-
- /**
- * @tc.number SUB_Account_distributedAccount_JS_API_0300
- * @tc.name Test distributedAccount.queryOsAccountDistributedInfo by callback.
- * @tc.desc Test distributedAccount.queryOsAccountDistributedInfo API functionality by callback.
- */
- it('account_queryOsAccountDistributedInfo_test002', 0, function () {
- const accountAbility = account.getDistributedAccountAbility()
- accountAbility.queryOsAccountDistributedInfo(function (data) {
- expect(data.name).assertEqual('anonymous')
- });
- })
-
- /**
- * @tc.number SUB_Account_distributedAccount_JS_API_0400
- * @tc.name Test distributedAccount.updateOsAccountDistributedInfo.
- * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality.
- */
- it('account_updateOsAccountDistributedInfo_test001', 0, function () {
- const accountAbility = account.getDistributedAccountAbility()
- let data = null
- let obj = {
- id: '12345',
- name: 'ZhangSan',
- event: 'Ohos.account.event.LOGIN',
- scalableData:data
- };
- accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) {
- expect(result).assertTrue()
- accountAbility.queryOsAccountDistributedInfo(function (data) {
- expect(data.name).assertEqual('ZhangSan')
- expect(data.id).assertEqual('12345')
- let obj = {
- id: '12345',
- name: 'ZhangSan',
- event: 'Ohos.account.event.LOGOUT'
- };
- accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) {
- expect(result).assertTrue()
- });
- });
- });
- accountAbility.queryOsAccountDistributedInfo(function (data) {
- execpt(data).assertNull()
- })
- })
-
- /**
- * @tc.number SUB_Account_distributedAccount_JS_API_0500
- * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback.
- * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
- */
- it('account_updateOsAccountDistributedInfo_test002', 0, function () {
- let data = null
- const accountAbility = account.getDistributedAccountAbility()
- let obj = {
- id: '12345',
- name: 'ZhangSan',
- event: 'Ohos.account.event.LOGIN',
- scalableData:data
- };
- accountAbility.updateOsAccountDistributedInfo(obj, function (result) {
- expect(result).assertTrue()
- accountAbility.queryOsAccountDistributedInfo(function (data) {
- expect(data.name).assertEqual('ZhangSan')
- expect(data.id).assertEqual('12345')
- const accountAbility = account.getDistributedAccountAbility()
- let obj = {
- id: '12345',
- name: 'ZhangSan',
- event: 'Ohos.account.event.LOGOUT'
-
- };
- accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) {
- expect(result).assertTrue()
- });
- });
- });
- })
-
- /**
- * @tc.number SUB_Account_distributedAccount_JS_API_0300
- * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback.
- * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
- */
- it('account_updateOsAccountDistributedInfo_test003', 0, function () {
- const accountAbility = account.getDistributedAccountAbility()
- let data = null
- let obj = {
- id: '12345',
- name: 'ZhangSan',
- event: 'Ohos.account.event.TOKEN_INVALID',
- scalableData:data
- };
- accountAbility.updateOsAccountDistributedInfo(obj, function (result) {
- expect(result).assertTrue()
- accountAbility.queryOsAccountDistributedInfo(obj).then(function (data) {
- except(data.name).assertNull()
- })
- });
- })
-
- /**
- * @tc.number SUB_Account_distributedAccount_JS_API_0500
- * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback.
- * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
- */
- it('account_updateOsAccountDistributedInfo_test004', 0, function () {
- const accountAbility = account.getDistributedAccountAbility()
- let data = null
- let obj = {
- id: '12345',
- name: 'ZhangSan',
- event: 'Ohos.account.event.LOGIN',
- scalableData:data
- };
- accountAbility.updateOsAccountDistributedInfo(obj, function (result) {
- expect(result).assertTrue()
- accountAbility.queryOsAccountDistributedInfo(function (data) {
- expect(data.name).assertEqual('ZhangSan')
- expect(data.id).assertEqual('12345')
- const accountAbility = account.getDistributedAccountAbility()
- let obj = {
- id: '12345',
- name: 'ZhangSan',
- event: 'Ohos.account.event.LOGOFF'
-
- };
- accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) {
- expect(result).assertNull()
- });
- });
- });
- })
-})
diff --git a/account/OsAccountTest_js/src/main/js/default/test/List.test.js b/account/OsAccountTest_js/src/main/js/test/List.test.js
similarity index 83%
rename from account/OsAccountTest_js/src/main/js/default/test/List.test.js
rename to account/OsAccountTest_js/src/main/js/test/List.test.js
index facd38d5b5e9961a17599ef0c071af933f7a7d2a..90369e959345b4af6b635a17fd0a32efcb042cf3 100755
--- a/account/OsAccountTest_js/src/main/js/default/test/List.test.js
+++ b/account/OsAccountTest_js/src/main/js/test/List.test.js
@@ -12,5 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+import AccountTest from './OsAccount.test.js'
-require('./OsAccount.test.js')
\ No newline at end of file
+export default function testsuite() {
+ AccountTest()
+}
\ No newline at end of file
diff --git a/account/OsAccountTest_js/src/main/js/test/OsAccount.test.js b/account/OsAccountTest_js/src/main/js/test/OsAccount.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..72b910a1219bb36c609744905a1814c08308005f
--- /dev/null
+++ b/account/OsAccountTest_js/src/main/js/test/OsAccount.test.js
@@ -0,0 +1,214 @@
+/*
+ * 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.
+ */
+
+// @ts-nocheck
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+import account from '@ohos.account.distributedAccount'
+export default function AccountTest() {
+ describe('AccountTest', function () {
+ beforeEach(function () {
+ })
+ afterEach(function () {
+ })
+
+ /**
+ * @tc.number ActsDistributedAccountDeviceId_0100
+ * @tc.name Test query the distribruted id by callback.
+ * @tc.desc Test distributedAccount.queryOsAccountDistributedInfo API functionality by callback.
+ */
+ it('ActsDistributedAccountDeviceId_0100', 0, async function(done){
+ console.log("test query distribtued id start");
+ const distributedId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5';
+ const accountAbility = account.getDistributedAccountAbility();
+ accountAbility.updateOsAccountDistributedInfo(
+ {
+ name: 'ZhangSan',
+ id: '12345',
+ event: "Ohos.account.event.LOGIN"
+ }, (err)=>{
+ console.log("update distributedInfo err:" + JSON.stringify(err));
+ accountAbility.queryOsAccountDistributedInfo((err, distributedInfo)=>{
+ console.log("query distributedInfo err:" + JSON.stringify(err));
+ console.log("query distributedInfo:" + JSON.stringify(distributedInfo));
+ expect(distributedInfo.name).assertEqual('ZhangSan');
+ expect(distributedInfo.id).assertEqual(distributedId);
+ console.log("test query distribtued id end");
+ done();
+ })
+ })
+ })
+
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0100
+ * @tc.name Test distributedAccount.getDistributedAccountAbility.
+ * @tc.desc Test distributedAccount.getDistributedAccountAbility API functionality.
+ */
+ it('account_getDistributedAccountAbility_test', 0, function () {
+ var ret = false;
+ const accountAbility = account.getDistributedAccountAbility()
+ if(accountAbility !== null){
+ ret = true;
+ }
+ expect(ret).assertTrue()
+ })
+
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0200
+ * @tc.name Test distributedAccount.queryOsAccountDistributedInfo.
+ * @tc.desc Test distributedAccount.queryOsAccountDistributedInfo API functionality.
+ */
+ it('account_queryOsAccountDistributedInfo_test001', 0, function () {
+ const accountAbility = account.getDistributedAccountAbility()
+ accountAbility.queryOsAccountDistributedInfo().then(function (data) {
+ expect(data.name).assertEqual('anonymous')
+ });
+ })
+
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0300
+ * @tc.name Test distributedAccount.queryOsAccountDistributedInfo by callback.
+ * @tc.desc Test distributedAccount.queryOsAccountDistributedInfo API functionality by callback.
+ */
+ it('account_queryOsAccountDistributedInfo_test002', 0, function () {
+ const accountAbility = account.getDistributedAccountAbility()
+ accountAbility.queryOsAccountDistributedInfo(function (data) {
+ expect(data.name).assertEqual('anonymous')
+ });
+ })
+
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0400
+ * @tc.name Test distributedAccount.updateOsAccountDistributedInfo.
+ * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality.
+ */
+ it('account_updateOsAccountDistributedInfo_test001', 0, function () {
+ const accountAbility = account.getDistributedAccountAbility()
+ let data = null
+ let obj = {
+ id: '12345',
+ name: 'ZhangSan',
+ event: 'Ohos.account.event.LOGIN',
+ scalableData:data
+ };
+ accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) {
+ expect(result).assertTrue()
+ accountAbility.queryOsAccountDistributedInfo(function (data) {
+ expect(data.name).assertEqual('ZhangSan')
+ expect(data.id).assertEqual('12345')
+ let obj = {
+ id: '12345',
+ name: 'ZhangSan',
+ event: 'Ohos.account.event.LOGOUT'
+ };
+ accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) {
+ expect(result).assertTrue()
+ });
+ });
+ });
+ accountAbility.queryOsAccountDistributedInfo(function (data) {
+ execpt(data).assertNull()
+ })
+ })
+
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0500
+ * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback.
+ * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
+ */
+ it('account_updateOsAccountDistributedInfo_test002', 0, function () {
+ let data = null
+ const accountAbility = account.getDistributedAccountAbility()
+ let obj = {
+ id: '12345',
+ name: 'ZhangSan',
+ event: 'Ohos.account.event.LOGIN',
+ scalableData:data
+ };
+ accountAbility.updateOsAccountDistributedInfo(obj, function (result) {
+ expect(result).assertTrue()
+ accountAbility.queryOsAccountDistributedInfo(function (data) {
+ expect(data.name).assertEqual('ZhangSan')
+ expect(data.id).assertEqual('12345')
+ const accountAbility = account.getDistributedAccountAbility()
+ let obj = {
+ id: '12345',
+ name: 'ZhangSan',
+ event: 'Ohos.account.event.LOGOUT'
+
+ };
+ accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) {
+ expect(result).assertTrue()
+ });
+ });
+ });
+ })
+
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0300
+ * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback.
+ * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
+ */
+ it('account_updateOsAccountDistributedInfo_test003', 0, function () {
+ const accountAbility = account.getDistributedAccountAbility()
+ let data = null
+ let obj = {
+ id: '12345',
+ name: 'ZhangSan',
+ event: 'Ohos.account.event.TOKEN_INVALID',
+ scalableData:data
+ };
+ accountAbility.updateOsAccountDistributedInfo(obj, function (result) {
+ expect(result).assertTrue()
+ accountAbility.queryOsAccountDistributedInfo(obj).then(function (data) {
+ except(data.name).assertNull()
+ })
+ });
+ })
+
+ /**
+ * @tc.number SUB_Account_distributedAccount_JS_API_0500
+ * @tc.name Test distributedAccount.updateOsAccountDistributedInfo by callback.
+ * @tc.desc Test distributedAccount.updateOsAccountDistributedInfo API functionality by callback.
+ */
+ it('account_updateOsAccountDistributedInfo_test004', 0, function () {
+ const accountAbility = account.getDistributedAccountAbility()
+ let data = null
+ let obj = {
+ id: '12345',
+ name: 'ZhangSan',
+ event: 'Ohos.account.event.LOGIN',
+ scalableData:data
+ };
+ accountAbility.updateOsAccountDistributedInfo(obj, function (result) {
+ expect(result).assertTrue()
+ accountAbility.queryOsAccountDistributedInfo(function (data) {
+ expect(data.name).assertEqual('ZhangSan')
+ expect(data.id).assertEqual('12345')
+ const accountAbility = account.getDistributedAccountAbility()
+ let obj = {
+ id: '12345',
+ name: 'ZhangSan',
+ event: 'Ohos.account.event.LOGOFF'
+
+ };
+ accountAbility.updateOsAccountDistributedInfo(obj).then(function (result) {
+ expect(result).assertNull()
+ });
+ });
+ });
+ })
+ })
+}
diff --git a/account/OsAccountTest_js/src/main/resources/base/element/string.json b/account/OsAccountTest_js/src/main/resources/base/element/string.json
index 14f9c3a9210f78b12caf3b945dc2b2c0f63f7d3d..841f6d1ff59e0fb5088ce9a6f9946adbe98e42be 100755
--- a/account/OsAccountTest_js/src/main/resources/base/element/string.json
+++ b/account/OsAccountTest_js/src/main/resources/base/element/string.json
@@ -7,6 +7,22 @@
{
"name": "mainability_description",
"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
diff --git a/account/appaccount/actsaccountpressure/BUILD.gn b/account/appaccount/actsaccountpressure/BUILD.gn
index a0f36d00ad5e1d0a2e0cb74aa586ef4bb7ccb640..9845012481fbadcb63822d02e64027d77f69e53f 100644
--- a/account/appaccount/actsaccountpressure/BUILD.gn
+++ b/account/appaccount/actsaccountpressure/BUILD.gn
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAccountPressure") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsAccountPressure") {
hap_name = "ActsAccountPressure"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/account/appaccount/actsaccountpressure/Test.json b/account/appaccount/actsaccountpressure/Test.json
index 6a464d872c47147d07907e0b2936041da9cc4b2e..5d4e86f754ca0b0d3cef84e43bda93dd788d57dd 100644
--- a/account/appaccount/actsaccountpressure/Test.json
+++ b/account/appaccount/actsaccountpressure/Test.json
@@ -1,10 +1,11 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "1500000",
- "package": "com.example.actsaccountpressure",
- "shell-timeout": "60000"
+ "bundle-name": "com.example.actsaccountpressure",
+ "package-name": "com.example.actsaccountpressure",
+ "shell-timeout": "1500000"
},
"kits": [
{
diff --git a/account/appaccount/actsaccountpressure/entry/src/main/js/default/pages/index/index.css b/account/appaccount/actsaccountpressure/entry/src/main/js/default/pages/index/index.css
deleted file mode 100644
index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000
--- a/account/appaccount/actsaccountpressure/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
diff --git a/account/appaccount/actsaccountpressure/entry/src/main/js/default/pages/index/index.hml b/account/appaccount/actsaccountpressure/entry/src/main/js/default/pages/index/index.hml
deleted file mode 100644
index c45422b42d0bf788a1c2c0eb299a981f07ce8613..0000000000000000000000000000000000000000
--- a/account/appaccount/actsaccountpressure/entry/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{title}}
-
-
diff --git a/account/appaccount/actsaccountpressure/entry/src/main/js/resources/base/element/string.json b/account/appaccount/actsaccountpressure/entry/src/main/js/resources/base/element/string.json
deleted file mode 100644
index fecd7c5d952385ddd11c8e7d344dd67a98b50cc5..0000000000000000000000000000000000000000
--- a/account/appaccount/actsaccountpressure/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "ActsAccountPressure"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/account/appaccount/actsaccountpressure/entry/src/main/js/test/Pressure.test.js b/account/appaccount/actsaccountpressure/entry/src/main/js/test/Pressure.test.js
deleted file mode 100644
index 6a4fb5af6eb477811ffd3084c8d64cf3c458f075..0000000000000000000000000000000000000000
--- a/account/appaccount/actsaccountpressure/entry/src/main/js/test/Pressure.test.js
+++ /dev/null
@@ -1,786 +0,0 @@
-/*
- * 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 abilityAccessCtrl from '@ohos.abilityAccessCtrl'
-import account from '@ohos.account.appAccount'
-import bundle from '@ohos.bundle'
-import featureAbility from '@ohos.ability.featureAbility'
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-
-const STRESSLEVEL = 100;
-const TIMEOUT = 300;
-const ACCOUNTLIMIT = 1000;
-const PERMISSION_USER_SET = 1;
-const PERMISSION_USER_NAME = "ohos.permission.DISTRIBUTED_DATASYNC";
-var tokenID = undefined;
-describe('ActsAccountPressure', function () {
-
- beforeAll(async function (done) {
- console.debug("====>beforeAll start====");
- var appInfo = await bundle.getApplicationInfo('com.example.actsaccountpressure', 0, 100);
- tokenID = appInfo.accessTokenId;
- console.debug("accessTokenId" + appInfo.accessTokenId + " bundleName:" + appInfo.bundleName);
- var atManager = abilityAccessCtrl.createAtManager();
- var result = await atManager.grantUserGrantedPermission(tokenID, PERMISSION_USER_NAME, PERMISSION_USER_SET);
- console.debug("tokenId" + tokenID + " result:" + result);
- sleep(2000);
- console.debug("====>startAbility start====");
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.example.actsaccountsceneappaccess",
- abilityName: "com.example.actsaccountsceneappaccess.MainAbility",
- action: "action1",
- parameters:
- {},
- },
- },
- );
- sleep(TIMEOUT);
- setTimeout(done(), TIMEOUT);
- });
-
- function sleep(delay) {
- var start = (new Date()).getTime();
- while((new Date()).getTime() - start < delay) {
- continue;
- }
- }
-
- /*
- * @tc.number : ActsAccountPressure_0100
- * @tc.name : Stress test add and delete accounts
- * @tc.desc : Stress test to add and delete accounts, and to determine the success of the addition and
- * deletion by obtaining the specified application information
- */
- it('ActsAccountPressure_0100', 0, async function (done) {
- console.debug("====>ActsAccountPressure_0100 start====");
- var appAccountManager = account.createAppAccountManager();
- var selfBundle = "com.example.actsaccountpressure";
- let count;
- for (count = 0; count < STRESSLEVEL; count++) {
- console.debug("====>addAccount time: " + count);
- try{
- await appAccountManager.addAccount("account_pressure_promise");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>addAccount fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- var data = await appAccountManager.getAllAccounts(selfBundle);
- sleep(TIMEOUT);
- console.debug("====>getAllAccounts time: " + count);
- console.debug('====>getAllAccounts data: ' + JSON.stringify(data));
- expect(typeof data).assertEqual('object');
- expect(data[0].name).assertEqual("account_pressure_promise");
- expect(data[0].owner).assertEqual(selfBundle);
- expect(data.length).assertEqual(1);
- console.debug("====>deleteAccount time: " + count);
- try{
- await appAccountManager.deleteAccount("account_pressure_promise");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>deleteAccount fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- var dataDel = await appAccountManager.getAllAccounts(selfBundle);
- console.debug("====>getAllAccounts time: " + count);
- console.debug('====>getAllAccounts dataDel: ' + JSON.stringify(dataDel));
- expect(typeof data).assertEqual('object');
- expect(dataDel.length).assertEqual(0);
- if(data.length != 1 || dataDel.length != 0){
- break;
- }
- sleep(TIMEOUT);
- }
- console.debug("====>the number of times to complete the stress test is: " + count);
- console.debug("====>ActsAccountPressure_0100 end====");
- done();
- });
-
- /*
- * @tc.number : ActsAccountPressure_0200
- * @tc.name : Stress test add and delete accounts
- * @tc.desc : Stress test callback form add and delete accounts
- */
- it('ActsAccountPressure_0200', 0, async function (done) {
- console.debug("====>ActsAccountPressure_0200 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- let flag = true;
- let count = 0;
- let STRESSNUM;
- if(STRESSLEVEL > ACCOUNTLIMIT){
- STRESSNUM = ACCOUNTLIMIT;
- }else{
- STRESSNUM = STRESSLEVEL;
- }
- for (let i = 0; i < STRESSNUM; i++) {
- let accountName = "account_pressure_callback" + i;
- sleep(TIMEOUT);
- appAccountManager.addAccount(accountName, (err)=>{
- console.debug('====>addAccount name: ' + accountName);
- expect(err.code).assertEqual(0);
- if(err.code != 0){
- console.error("====>addAccount fail err:" + JSON.stringify(err));
- expect().assertFail();
- flag = false;
- done();
- }
- sleep(TIMEOUT);
- appAccountManager.deleteAccount(accountName, (err)=>{
- console.debug('====>deleteAccount name: ' + accountName);
- expect(err.code).assertEqual(0);
- if(err.code != 0){
- console.error("====>deleteAccount fail err:" + JSON.stringify(err));
- console.error('====>call function level is: ' + count);
- expect().assertFail();
- flag = false;
- done();
- }
- if (count == STRESSLEVEL - 1) {
- count++;
- console.debug("====>the number of times to complete the stress test is: " + count);
- console.debug("====>ActsAccountPressure_0200 end====");
- done();
- }
- count++;
- })
- });
- if (!flag) {
- done();
- break;
- }
- }
- });
-
- /*
- * @tc.number : ActsAccountPressure_0300
- * @tc.name : Stress test add and delete accounts
- * @tc.desc : Stress testing a large number of adding accounts together and deleting accounts together
- */
- it('ActsAccountPressure_0300', 0, async function (done) {
- console.debug("====>ActsAccountPressure_0300 start====");
- var appAccountManager = account.createAppAccountManager();
- let count;
- let STRESSNUM;
- if(STRESSLEVEL > ACCOUNTLIMIT){
- STRESSNUM = ACCOUNTLIMIT;
- }else{
- STRESSNUM = STRESSLEVEL;
- }
- console.debug("====>addAccount start====");
- for (count = 0; count < STRESSNUM; count++) {
- let accountName = "account_pressure_limit" + count;
- console.debug('====>addAccount name: ' + accountName);
- try{
- await appAccountManager.addAccount(accountName);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>addAccount fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- }
- if(STRESSNUM == ACCOUNTLIMIT){
- try{
- await appAccountManager.addAccount("account_name_limit");
- console.debug("====>the number of added accounts exceeds the limit====");
- expect().assertFail();
- done();
- }
- catch(err){
- console.debug("====>add Account that exceed the limit err:" + JSON.stringify(err));
- expect(err.code != 0).assertEqual(true);
- console.debug("====>deleteAccount start====");
- for (count = 0; count < STRESSNUM; count++) {
- let accountName = "account_pressure_limit" + count;
- console.debug('====>deleteAccount name: ' + accountName);
- try{
- await appAccountManager.deleteAccount(accountName);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>deleteAccount fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- }
- console.debug("====>the number of times to complete the stress test is: " + count)
- console.debug("====>ActsAccountPressure_0300 end====");
- done();
- }
- }else{
- console.debug("====>deleteAccount start====");
- for (count = 0; count < STRESSNUM; count++) {
- let accountName = "account_pressure_limit" + count;
- console.debug('====>deleteAccount name: ' + accountName);
- try{
- await appAccountManager.deleteAccount(accountName);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>deleteAccount fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- }
- console.debug("====>the number of times to complete the stress test is: " + count)
- console.debug("====>ActsAccountPressure_0300 end====");
- done();
- }
- });
-
- /*
- * @tc.number : ActsAccountPressure_0400
- * @tc.name : Stress test enableAppAccess and disableAppAccess
- * @tc.desc : Stress test authorize the account to the application and de-authorize the account to the
- * application
- */
- it('ActsAccountPressure_0400', 0, async function (done) {
- console.debug("====>ActsAccountPressure_0400 start====");
- var appAccountManager = account.createAppAccountManager();
- var enableBundle = "com.example.actsaccountsceneappaccess";
- let count;
- console.debug("====>addAccount 0400 start====");
- try{
- await appAccountManager.addAccount("account_pressure_enable");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>addAccount fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- for (count = 0; count < STRESSLEVEL; count++) {
- console.debug("====>enableAppAccess time: " + count);
- try{
- await appAccountManager.enableAppAccess("account_pressure_enable", enableBundle);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>enableAppAccess 0400 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>disableAppAccess time: " + count);
- try{
- await appAccountManager.disableAppAccess("account_pressure_enable", enableBundle);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>disableAppAccess 0400 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- }
- console.debug("====>deleteAccount 0400 start====");
- try{
- await appAccountManager.deleteAccount("account_pressure_enable");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>deleteAccount fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>the number of times to complete the stress test is: " + count)
- console.debug("====>ActsAccountPressure_0400 end====");
- done();
- });
-
- /*
- * @tc.number : ActsAccountPressure_0500
- * @tc.name : Stress test setAssociatedData and getAssociatedData
- * @tc.desc : Stress test setting associated data and obtaining associated data
- */
- it('ActsAccountPressure_0500', 0, async function (done) {
- console.debug("====>ActsAccountPressure_0500 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- let count;
- let associateKey = "";
- let associateValue = "";
- console.debug("====>add account 0500 start====");
- try{
- await appAccountManager.addAccount("account_pressure_associate");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>add Account ActsAccountPressure_0500 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- for (count = 0; count < STRESSLEVEL; count++) {
- console.debug("====>setAssociatedData time: " + count);
- associateKey = "key_pre" + count;
- associateValue = "value_pressure" + count;
- try{
- await appAccountManager.setAssociatedData("account_pressure_associate", associateKey, associateValue);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>setAssociatedData ActsAccountPressure_0500 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAssociatedData time: " + count);
- try{
- var data = await appAccountManager.getAssociatedData("account_pressure_associate", associateKey);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>getAssociatedData ActsAccountPressure_0500 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAssociatedData data:" + JSON.stringify(data));
- expect(data).assertEqual(associateValue);
- }
- console.debug("====>deleteAccount 0500 start====");
- try{
- await appAccountManager.deleteAccount("account_pressure_associate");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>delete account 0500 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>the number of times to complete the stress test is: " + count)
- console.debug("====>ActsAccountPressure_0500 end====");
- done();
- });
-
- /*
- * @tc.number : ActsAccountPressure_0600
- * @tc.name : Stress test setAccountExtraInfo and getAccountExtraInfo
- * @tc.desc : Stress test setting additional information and obtaining additional information
- */
- it('ActsAccountPressure_0600', 0, async function (done) {
- console.debug("====>ActsAccountPressure_0600 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- let count;
- let extraInfo = "";
- console.debug("====>add account 0600 start====");
- try{
- await appAccountManager.addAccount("account_pressure_extrainfo");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>addAccount 0600 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- for (count = 0; count < STRESSLEVEL; count++) {
- console.debug("====>setAccountExtraInfo time: " + count);
- extraInfo = "pressure_extra" + count;
- try{
- await appAccountManager.setAccountExtraInfo("account_pressure_extrainfo", extraInfo);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>setAccountExtraInfo 0600 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAccountExtraInfo time: " + count);
- try{
- var data = await appAccountManager.getAccountExtraInfo("account_pressure_extrainfo");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>getAccountExtraInfo 0600 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAccountExtraInfo data:" + JSON.stringify(data));
- expect(data).assertEqual(extraInfo);
- }
- console.debug("====>delete account 0600 start====");
- try{
- await appAccountManager.deleteAccount("account_pressure_extrainfo");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>deleteAccount 0600 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>the number of times to complete the stress test is: " + count)
- console.debug("====>ActsAccountPressure_0600 end====");
- done();
- });
-
- /*
- * @tc.number : ActsAccountPressure_0700
- * @tc.name : Stress test setAccountCredential and getAccountCredential
- * @tc.desc : Stress test setting credential and obtaining credential
- */
- it('ActsAccountPressure_0700', 0, async function (done) {
- console.debug("====>ActsAccountPressure_0700 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- let count;
- let credentialType = "";
- let credentialvalue = "";
- console.debug("====>addAccount 0700 start====");
- try{
- await appAccountManager.addAccount("account_credential");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("addAccount 0700 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- for (count = 0; count < STRESSLEVEL; count++) {
- console.debug("====>setAccountCredential time: " + count);
- credentialType = "pressure_credentialType" + count;
- credentialvalue = "pressure_credential" + count;
- try{
- await appAccountManager.setAccountCredential("account_credential", credentialType, credentialvalue);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("setAccountCredential 0700 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAccountCredential time: " + count);
- try{
- var data = await appAccountManager.getAccountCredential("account_credential", credentialType);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("getAccountCredential 0700 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAccountCredential 0700 data:" + JSON.stringify(data));
- expect(data).assertEqual(credentialvalue);
- }
- console.debug("====>delete account 0700 start====");
- try{
- await appAccountManager.deleteAccount("account_credential");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("deleteAccount 0700 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>the number of times to complete the stress test is: " + count)
- console.debug("====>ActsAccountPressure_0700 end====");
- done();
- });
-
- // /*
- // * @tc.number : ActsAccountPressure_0800
- // * @tc.name : setOAuthToken getOAuthToken and clearOAuthToken
- // * @tc.desc : Stress test sets the token, obtains the token and then clears the token
- // */
- // it('ActsAccountPressure_0800', 0, async function (done) {
- // console.debug("====>ActsAccountPressure_0800 start====");
- // var appAccountManager = account.createAppAccountManager();
- // console.debug("====>creat finish====");
- // let count;
- // let oauthToken = "";
- // console.debug("====>addAccount 0800 start====");
- // try{
- // await appAccountManager.addAccount("accountToken_pressure_token");
- // sleep(TIMEOUT);
- // }
- // catch(err){
- // console.error("addAccount 0800 err:" + JSON.stringify(err));
- // expect().assertFail();
- // done();
- // }
- // for (count = 0; count < STRESSLEVEL; count++) {
- // console.debug("====>setOAuthToken time: " + count);
- // oauthToken = "pressure_token" + count;
- // try{
- // await appAccountManager.setOAuthToken("accountToken_pressure_token", oauthToken);
- // sleep(TIMEOUT);
- // }
- // catch(err){
- // console.error("setOAuthToken 0800 err:" + JSON.stringify(err));
- // expect().assertFail();
- // done();
- // }
- // console.debug("====>getOAuthToken time: " + count);
- // try{
- // var data = await appAccountManager.getOAuthToken("accountToken_pressure_token");
- // sleep(TIMEOUT);
- // }
- // catch(err){
- // console.error("getOAuthToken 0800 err:" + JSON.stringify(err));
- // expect().assertFail();
- // done();
- // }
- // console.debug("====>getOAuthToken data: " + data);
- // expect(data).assertEqual(oauthToken);
- // console.debug("====>clearOAuthToken time: " + count);
- // try{
- // await appAccountManager.clearOAuthToken("accountToken_pressure_token");
- // sleep(TIMEOUT);
- // }
- // catch(err){
- // console.error("clearOAuthToken 0800 err:" + JSON.stringify(err));
- // expect().assertFail();
- // done();
- // }
- // }
- // console.debug("====>delete account 0800 start====");
- // try{
- // await appAccountManager.deleteAccount("accountToken_pressure_token");
- // sleep(TIMEOUT);
- // }
- // catch(err){
- // console.error("deleteAccount 0800 err:" + JSON.stringify(err));
- // expect().assertFail();
- // done();
- // }
- // console.debug("====>the number of times to complete the stress test is: " + count);
- // console.debug("====>ActsAccountPressure_0800 end====");
- // done();
- // });
-
- /*
- * @tc.number : ActsAccountPressure_0900
- * @tc.name : Stress test setAppAccountSyncEnable and checkAppAccountSyncEnable
- * @tc.desc : Stress test setting synchronization flag and obtaining synchronization flag
- */
- it('ActsAccountPressure_0900', 0, async function (done) {
- console.debug("====>ActsAccountPressure_0900 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- let count;
- console.debug("====>add account 0900 start====");
- try{
- await appAccountManager.addAccount("account_pressure_syncenable");
- }
- catch(err){
- console.error("====>add account 0900 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- for (count = 0; count < STRESSLEVEL; count++) {
- console.debug("====>setAppAccountSyncEnable time: " + count);
- try{
- await appAccountManager.setAppAccountSyncEnable("account_pressure_syncenable", true);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>setAppAccountSyncEnable 0900 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>checkAppAccountSyncEnable time: " + count);
- try{
- var data = await appAccountManager.checkAppAccountSyncEnable("account_pressure_syncenable");
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>checkAppAccountSyncEnable 0900 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>checkAppAccountSyncEnable data:" + data);
- expect(data).assertEqual(true);
- }
- console.debug("====>delete account 0900 start====");
- try{
- await appAccountManager.deleteAccount("account_pressure_syncenable");
- }
- catch(err){
- console.error("====>delete account 0900 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>the number of times to complete the stress test is: " + count);
- console.debug("====>ActsAccountPressure_0900 end====");
- done();
- });
-
- /*
- * @tc.number : ActsAccountPressure_1000
- * @tc.name : Stress test getAllAccounts
- * @tc.desc : Stress test to obtain specified application information
- */
- it('ActsAccountPressure_1000', 0, async function (done) {
- console.debug("====>ActsAccountPressure_1000 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- let count;
- var specifyBundle = "com.example.actsaccountsceneappaccess";
- for (count = 0; count < STRESSLEVEL; count++) {
- console.debug("====>getAllAccounts time: " + count);
- try{
- var data = await appAccountManager.getAllAccounts(specifyBundle);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>getAllAccounts 1000 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccounts data: " + JSON.stringify(data));
- expect(data[0].name).assertEqual("account_name_scene_first");
- expect(data[0].owner).assertEqual(specifyBundle);
- expect(data[1].name).assertEqual("account_name_scene_second");
- expect(data[1].owner).assertEqual(specifyBundle);
- }
- console.debug("====>the number of times to complete the stress test is: " + count);
- console.debug("====>ActsAccountPressure_1000 end====");
- done();
- });
-
- /*
- * @tc.number : ActsAccountPressure_1100
- * @tc.name : Stress test getAllAccessibleAccounts
- * @tc.desc : Stress test to obtain the application account information and authorized account information
- */
- it('ActsAccountPressure_1100', 0, async function (done) {
- console.debug("====>ActsAccountPressure_1100 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- let count;
- var selfBundle = "com.example.actsaccountpressure";
- var specifyBundle = "com.example.actsaccountsceneappaccess";
- console.debug("====>add account 1100 start====");
- try{
- await appAccountManager.addAccount("account_accessible_first");
- await appAccountManager.addAccount("account_accessible_second");
- }
- catch(err){
- console.error("====>add account 1100 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- for (count = 0; count < STRESSLEVEL; count++) {
- console.debug("====>getAllAccounts time: " + count);
- try{
- var data = await appAccountManager.getAllAccessibleAccounts();
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>getAllAccounts 1100 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccounts data: " + JSON.stringify(data));
- console.debug("====>getAllAccounts data.length: " + data.length);
- expect(data.length).assertEqual(4);
- expect(data[0].name).assertEqual("account_name_scene_first");
- expect(data[0].owner).assertEqual(specifyBundle);
- expect(data[1].name).assertEqual("account_name_scene_second");
- expect(data[1].owner).assertEqual(specifyBundle);
- expect(data[2].name).assertEqual("account_accessible_first");
- expect(data[2].owner).assertEqual(selfBundle);
- expect(data[3].name).assertEqual("account_accessible_second");
- expect(data[3].owner).assertEqual(selfBundle);
- }
- console.debug("====>delete account 1100 start====");
- try{
- await appAccountManager.deleteAccount("account_accessible_first");
- await appAccountManager.deleteAccount("account_accessible_second");
- }
- catch(err){
- console.error("====>delete account 1100 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>the number of times to complete the stress test is: " + count);
- console.debug("====>ActsAccountPressure_1100 end====");
- done();
- });
-
- /*
- * @tc.number : ActsAccountPressure_1200
- * @tc.name : Stress test on and off
- * @tc.desc : Stress test receive account information changes
- */
- it('ActsAccountPressure_1200', 0, async function (done) {
- console.debug("====>ActsAccountPressure_1200 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat appAccountManager finish");
- console.debug("====>add account 1200 start");
- let count;
- var countSign = 0;
- let changeExtra = "";
- try{
- await appAccountManager.addAccount("account_pressure_onoff");
- }
- catch(err){
- console.error("====>add account 1200 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- function changeOnCallback(data){
- console.debug("====>receive change 1200 data:" + JSON.stringify(data));
- expect(data[0].name).assertEqual("account_pressure_onoff");
- expect(data[0].owner).assertEqual("com.example.actsaccountpressure");
- countSign++;
- }
- console.debug("====>on ActsAccountPressure_1200 start");
- try{
- appAccountManager.on('change', ["com.example.actsaccountpressure"], changeOnCallback);
- }
- catch(err){
- console.error("====>on ActsAccountPressure_1200 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- for (count = 0; count < STRESSLEVEL; count++) {
- console.debug("====>change account information time: " + count);
- changeExtra = "pressure_extra" + count;
- try{
- await appAccountManager.setAccountExtraInfo("account_pressure_onoff", changeExtra);
- sleep(TIMEOUT);
- }
- catch(err){
- console.error("====>setAccountExtraInfo fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- }
- console.debug("====>off 1200 start====");
- appAccountManager.off('change', async function (){
- console.debug("====>off enter====");
- console.debug("====>countSign is: " + countSign);
- expect(countSign).assertEqual(STRESSLEVEL);
- console.debug("====>delete account====");
- try{
- await appAccountManager.deleteAccount("account_pressure_onoff");
- }
- catch(err){
- console.error("====>delete account 1200 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>the number of times to complete the stress test is: " + count);
- console.debug("====>ActsAccountPressure_1200 end====");
- done();
- });
- });
-})
\ No newline at end of file
diff --git a/account/appaccount/actsaccountpressure/entry/src/main/config.json b/account/appaccount/actsaccountpressure/src/main/config.json
similarity index 54%
rename from account/appaccount/actsaccountpressure/entry/src/main/config.json
rename to account/appaccount/actsaccountpressure/src/main/config.json
index a0910dafefb4a0ee9208b0ab4b1cda7fe4508a0e..aaa92454ad11f81d8352d1158023f3578017d526 100644
--- a/account/appaccount/actsaccountpressure/entry/src/main/config.json
+++ b/account/appaccount/actsaccountpressure/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsaccountpressure",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -72,36 +74,67 @@
],
"abilities": [
{
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.actsaccountpressure.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "visible": true,
- "launchType": "standard"
- }
- ],
- "js": [
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "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,
+ "launchType": "standard"
+ },
{
- "pages": [
- "pages/index/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": false
- }
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
}
- ]
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/account/appaccount/actsaccountpressure/entry/src/main/js/default/app.js b/account/appaccount/actsaccountpressure/src/main/js/MainAbility/app.js
similarity index 100%
rename from account/appaccount/actsaccountpressure/entry/src/main/js/default/app.js
rename to account/appaccount/actsaccountpressure/src/main/js/MainAbility/app.js
diff --git a/account/appaccount/actsaccountpressure/entry/src/main/js/default/i18n/en-US.json b/account/appaccount/actsaccountpressure/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from account/appaccount/actsaccountpressure/entry/src/main/js/default/i18n/en-US.json
rename to account/appaccount/actsaccountpressure/src/main/js/MainAbility/i18n/en-US.json
diff --git a/account/appaccount/actsaccountpressure/entry/src/main/js/default/i18n/zh-CN.json b/account/appaccount/actsaccountpressure/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from account/appaccount/actsaccountpressure/entry/src/main/js/default/i18n/zh-CN.json
rename to account/appaccount/actsaccountpressure/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/test/List.test.js b/account/appaccount/actsaccountpressure/src/main/js/MainAbility/pages/index/index.css
old mode 100755
new mode 100644
similarity index 82%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/test/List.test.js
rename to account/appaccount/actsaccountpressure/src/main/js/MainAbility/pages/index/index.css
index 493d3c706514721f75a835604b23f2c48af2941a..2334ecfa2c147f276998e82e2c35f62800cfb031
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/test/List.test.js
+++ b/account/appaccount/actsaccountpressure/src/main/js/MainAbility/pages/index/index.css
@@ -1,15 +1,24 @@
-/*
- * 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('./Getallaccessible.test.js')
\ 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.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/account/appaccount/actsaccountpressure/src/main/js/MainAbility/pages/index/index.hml b/account/appaccount/actsaccountpressure/src/main/js/MainAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f7fa13538134ab88f502a6d53885f46df315d7bf
--- /dev/null
+++ b/account/appaccount/actsaccountpressure/src/main/js/MainAbility/pages/index/index.hml
@@ -0,0 +1,20 @@
+
+
+
+
+ {{title}}
+
+
diff --git a/account/appaccount/actsaccountpressure/entry/src/main/js/default/pages/index/index.js b/account/appaccount/actsaccountpressure/src/main/js/MainAbility/pages/index/index.js
similarity index 69%
rename from account/appaccount/actsaccountpressure/entry/src/main/js/default/pages/index/index.js
rename to account/appaccount/actsaccountpressure/src/main/js/MainAbility/pages/index/index.js
index 21dce8485e7329da7cc3e28e0fc853048030635f..b96fb1c174d0681ed04e262a5917fc9f5886f502 100644
--- a/account/appaccount/actsaccountpressure/entry/src/main/js/default/pages/index/index.js
+++ b/account/appaccount/actsaccountpressure/src/main/js/MainAbility/pages/index/index.js
@@ -13,7 +13,6 @@
* 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')
@@ -27,19 +26,6 @@ export default {
},
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 = 180000;
- configService.setConfig(this)
-
- require('../../../test/List.test')
- core.execute()
},
onReady() {
},
diff --git a/account/appaccount/actsaccountpressure/src/main/js/TestAbility/app.js b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
diff --git a/account/appaccount/actsaccountpressure/src/main/js/TestAbility/i18n/en-US.json b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/actsaccountpressure/src/main/js/TestAbility/i18n/zh-CN.json b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/actsaccountpressure/src/main/js/TestAbility/pages/index/index.css b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2b45eb97c17e67ef5d63436aad8998113aa95d6d
--- /dev/null
+++ b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+.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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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
diff --git a/account/appaccount/actsaccountpressure/src/main/js/TestAbility/pages/index/index.hml b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/account/appaccount/actsaccountpressure/src/main/js/TestAbility/pages/index/index.js b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/account/appaccount/actsaccountpressure/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/account/appaccount/actsaccountpressure/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/appaccount/actsaccountpressure/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/account/appaccount/actsaccountpressure/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/account/appaccount/actsgetallaccounts/entry/src/main/js/test/List.test.js b/account/appaccount/actsaccountpressure/src/main/js/test/List.test.js
old mode 100755
new mode 100644
similarity index 83%
rename from account/appaccount/actsgetallaccounts/entry/src/main/js/test/List.test.js
rename to account/appaccount/actsaccountpressure/src/main/js/test/List.test.js
index 8f39a18e324168ee07643339e39f59a584904a09..f90121363ea7b92df4b5a29340263366bc9064da
--- a/account/appaccount/actsgetallaccounts/entry/src/main/js/test/List.test.js
+++ b/account/appaccount/actsaccountpressure/src/main/js/test/List.test.js
@@ -1,15 +1,19 @@
-/*
- * 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('./Getallaccounts.test.js')
\ 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 ActsAccountPressure from './Pressure.test.js'
+
+export default function testsuite() {
+ ActsAccountPressure()
+}
\ No newline at end of file
diff --git a/account/appaccount/actsaccountpressure/src/main/js/test/Pressure.test.js b/account/appaccount/actsaccountpressure/src/main/js/test/Pressure.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..088c549ace308448dcae1581c42dc496ede5ab7f
--- /dev/null
+++ b/account/appaccount/actsaccountpressure/src/main/js/test/Pressure.test.js
@@ -0,0 +1,788 @@
+/*
+ * 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 abilityAccessCtrl from '@ohos.abilityAccessCtrl'
+import account from '@ohos.account.appAccount'
+import bundle from '@ohos.bundle'
+import featureAbility from '@ohos.ability.featureAbility'
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+const STRESSLEVEL = 100;
+const TIMEOUT = 300;
+const ACCOUNTLIMIT = 1000;
+const PERMISSION_USER_SET = 1;
+const PERMISSION_USER_NAME = "ohos.permission.DISTRIBUTED_DATASYNC";
+var tokenID = undefined;
+export default function ActsAccountPressure() {
+ describe('ActsAccountPressure', function () {
+
+ beforeAll(async function (done) {
+ console.debug("====>beforeAll start====");
+ var appInfo = await bundle.getApplicationInfo('com.example.actsaccountpressure', 0, 100);
+ tokenID = appInfo.accessTokenId;
+ console.debug("accessTokenId" + appInfo.accessTokenId + " bundleName:" + appInfo.bundleName);
+ var atManager = abilityAccessCtrl.createAtManager();
+ var result = await atManager.grantUserGrantedPermission(tokenID, PERMISSION_USER_NAME, PERMISSION_USER_SET);
+ console.debug("tokenId" + tokenID + " result:" + result);
+ sleep(2000);
+ console.debug("====>startAbility start====");
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.example.actsaccountsceneappaccess",
+ abilityName: "com.example.actsaccountsceneappaccess.MainAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ },
+ );
+ sleep(TIMEOUT);
+ setTimeout(done(), TIMEOUT);
+ });
+
+ function sleep(delay) {
+ var start = (new Date()).getTime();
+ while((new Date()).getTime() - start < delay) {
+ continue;
+ }
+ }
+
+ /*
+ * @tc.number : ActsAccountPressure_0100
+ * @tc.name : Stress test add and delete accounts
+ * @tc.desc : Stress test to add and delete accounts, and to determine the success of the addition and
+ * deletion by obtaining the specified application information
+ */
+ it('ActsAccountPressure_0100', 0, async function (done) {
+ console.debug("====>ActsAccountPressure_0100 start====");
+ var appAccountManager = account.createAppAccountManager();
+ var selfBundle = "com.example.actsaccountpressure";
+ let count;
+ for (count = 0; count < STRESSLEVEL; count++) {
+ console.debug("====>addAccount time: " + count);
+ try{
+ await appAccountManager.addAccount("account_pressure_promise");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>addAccount fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ var data = await appAccountManager.getAllAccounts(selfBundle);
+ sleep(TIMEOUT);
+ console.debug("====>getAllAccounts time: " + count);
+ console.debug('====>getAllAccounts data: ' + JSON.stringify(data));
+ expect(typeof data).assertEqual('object');
+ expect(data[0].name).assertEqual("account_pressure_promise");
+ expect(data[0].owner).assertEqual(selfBundle);
+ expect(data.length).assertEqual(1);
+ console.debug("====>deleteAccount time: " + count);
+ try{
+ await appAccountManager.deleteAccount("account_pressure_promise");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>deleteAccount fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ var dataDel = await appAccountManager.getAllAccounts(selfBundle);
+ console.debug("====>getAllAccounts time: " + count);
+ console.debug('====>getAllAccounts dataDel: ' + JSON.stringify(dataDel));
+ expect(typeof data).assertEqual('object');
+ expect(dataDel.length).assertEqual(0);
+ if(data.length != 1 || dataDel.length != 0){
+ break;
+ }
+ sleep(TIMEOUT);
+ }
+ console.debug("====>the number of times to complete the stress test is: " + count);
+ console.debug("====>ActsAccountPressure_0100 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsAccountPressure_0200
+ * @tc.name : Stress test add and delete accounts
+ * @tc.desc : Stress test callback form add and delete accounts
+ */
+ it('ActsAccountPressure_0200', 0, async function (done) {
+ console.debug("====>ActsAccountPressure_0200 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ let flag = true;
+ let count = 0;
+ let STRESSNUM;
+ if(STRESSLEVEL > ACCOUNTLIMIT){
+ STRESSNUM = ACCOUNTLIMIT;
+ }else{
+ STRESSNUM = STRESSLEVEL;
+ }
+ for (let i = 0; i < STRESSNUM; i++) {
+ let accountName = "account_pressure_callback" + i;
+ sleep(TIMEOUT);
+ appAccountManager.addAccount(accountName, (err)=>{
+ console.debug('====>addAccount name: ' + accountName);
+ expect(err.code).assertEqual(0);
+ if(err.code != 0){
+ console.error("====>addAccount fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ flag = false;
+ done();
+ }
+ sleep(TIMEOUT);
+ appAccountManager.deleteAccount(accountName, (err)=>{
+ console.debug('====>deleteAccount name: ' + accountName);
+ expect(err.code).assertEqual(0);
+ if(err.code != 0){
+ console.error("====>deleteAccount fail err:" + JSON.stringify(err));
+ console.error('====>call function level is: ' + count);
+ expect().assertFail();
+ flag = false;
+ done();
+ }
+ if (count == STRESSLEVEL - 1) {
+ count++;
+ console.debug("====>the number of times to complete the stress test is: " + count);
+ console.debug("====>ActsAccountPressure_0200 end====");
+ done();
+ }
+ count++;
+ })
+ });
+ if (!flag) {
+ done();
+ break;
+ }
+ }
+ });
+
+ /*
+ * @tc.number : ActsAccountPressure_0300
+ * @tc.name : Stress test add and delete accounts
+ * @tc.desc : Stress testing a large number of adding accounts together and deleting accounts together
+ */
+ it('ActsAccountPressure_0300', 0, async function (done) {
+ console.debug("====>ActsAccountPressure_0300 start====");
+ var appAccountManager = account.createAppAccountManager();
+ let count;
+ let STRESSNUM;
+ if(STRESSLEVEL > ACCOUNTLIMIT){
+ STRESSNUM = ACCOUNTLIMIT;
+ }else{
+ STRESSNUM = STRESSLEVEL;
+ }
+ console.debug("====>addAccount start====");
+ for (count = 0; count < STRESSNUM; count++) {
+ let accountName = "account_pressure_limit" + count;
+ console.debug('====>addAccount name: ' + accountName);
+ try{
+ await appAccountManager.addAccount(accountName);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>addAccount fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ }
+ if(STRESSNUM == ACCOUNTLIMIT){
+ try{
+ await appAccountManager.addAccount("account_name_limit");
+ console.debug("====>the number of added accounts exceeds the limit====");
+ expect().assertFail();
+ done();
+ }
+ catch(err){
+ console.debug("====>add Account that exceed the limit err:" + JSON.stringify(err));
+ expect(err.code != 0).assertEqual(true);
+ console.debug("====>deleteAccount start====");
+ for (count = 0; count < STRESSNUM; count++) {
+ let accountName = "account_pressure_limit" + count;
+ console.debug('====>deleteAccount name: ' + accountName);
+ try{
+ await appAccountManager.deleteAccount(accountName);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>deleteAccount fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ }
+ console.debug("====>the number of times to complete the stress test is: " + count)
+ console.debug("====>ActsAccountPressure_0300 end====");
+ done();
+ }
+ }else{
+ console.debug("====>deleteAccount start====");
+ for (count = 0; count < STRESSNUM; count++) {
+ let accountName = "account_pressure_limit" + count;
+ console.debug('====>deleteAccount name: ' + accountName);
+ try{
+ await appAccountManager.deleteAccount(accountName);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>deleteAccount fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ }
+ console.debug("====>the number of times to complete the stress test is: " + count)
+ console.debug("====>ActsAccountPressure_0300 end====");
+ done();
+ }
+ });
+
+ /*
+ * @tc.number : ActsAccountPressure_0400
+ * @tc.name : Stress test enableAppAccess and disableAppAccess
+ * @tc.desc : Stress test authorize the account to the application and de-authorize the account to the
+ * application
+ */
+ it('ActsAccountPressure_0400', 0, async function (done) {
+ console.debug("====>ActsAccountPressure_0400 start====");
+ var appAccountManager = account.createAppAccountManager();
+ var enableBundle = "com.example.actsaccountsceneappaccess";
+ let count;
+ console.debug("====>addAccount 0400 start====");
+ try{
+ await appAccountManager.addAccount("account_pressure_enable");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>addAccount fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ for (count = 0; count < STRESSLEVEL; count++) {
+ console.debug("====>enableAppAccess time: " + count);
+ try{
+ await appAccountManager.enableAppAccess("account_pressure_enable", enableBundle);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>enableAppAccess 0400 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>disableAppAccess time: " + count);
+ try{
+ await appAccountManager.disableAppAccess("account_pressure_enable", enableBundle);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>disableAppAccess 0400 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ }
+ console.debug("====>deleteAccount 0400 start====");
+ try{
+ await appAccountManager.deleteAccount("account_pressure_enable");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>deleteAccount fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>the number of times to complete the stress test is: " + count)
+ console.debug("====>ActsAccountPressure_0400 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsAccountPressure_0500
+ * @tc.name : Stress test setAssociatedData and getAssociatedData
+ * @tc.desc : Stress test setting associated data and obtaining associated data
+ */
+ it('ActsAccountPressure_0500', 0, async function (done) {
+ console.debug("====>ActsAccountPressure_0500 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ let count;
+ let associateKey = "";
+ let associateValue = "";
+ console.debug("====>add account 0500 start====");
+ try{
+ await appAccountManager.addAccount("account_pressure_associate");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>add Account ActsAccountPressure_0500 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ for (count = 0; count < STRESSLEVEL; count++) {
+ console.debug("====>setAssociatedData time: " + count);
+ associateKey = "key_pre" + count;
+ associateValue = "value_pressure" + count;
+ try{
+ await appAccountManager.setAssociatedData("account_pressure_associate", associateKey, associateValue);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>setAssociatedData ActsAccountPressure_0500 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAssociatedData time: " + count);
+ try{
+ var data = await appAccountManager.getAssociatedData("account_pressure_associate", associateKey);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>getAssociatedData ActsAccountPressure_0500 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAssociatedData data:" + JSON.stringify(data));
+ expect(data).assertEqual(associateValue);
+ }
+ console.debug("====>deleteAccount 0500 start====");
+ try{
+ await appAccountManager.deleteAccount("account_pressure_associate");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>delete account 0500 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>the number of times to complete the stress test is: " + count)
+ console.debug("====>ActsAccountPressure_0500 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsAccountPressure_0600
+ * @tc.name : Stress test setAccountExtraInfo and getAccountExtraInfo
+ * @tc.desc : Stress test setting additional information and obtaining additional information
+ */
+ it('ActsAccountPressure_0600', 0, async function (done) {
+ console.debug("====>ActsAccountPressure_0600 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ let count;
+ let extraInfo = "";
+ console.debug("====>add account 0600 start====");
+ try{
+ await appAccountManager.addAccount("account_pressure_extrainfo");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>addAccount 0600 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ for (count = 0; count < STRESSLEVEL; count++) {
+ console.debug("====>setAccountExtraInfo time: " + count);
+ extraInfo = "pressure_extra" + count;
+ try{
+ await appAccountManager.setAccountExtraInfo("account_pressure_extrainfo", extraInfo);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>setAccountExtraInfo 0600 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAccountExtraInfo time: " + count);
+ try{
+ var data = await appAccountManager.getAccountExtraInfo("account_pressure_extrainfo");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>getAccountExtraInfo 0600 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAccountExtraInfo data:" + JSON.stringify(data));
+ expect(data).assertEqual(extraInfo);
+ }
+ console.debug("====>delete account 0600 start====");
+ try{
+ await appAccountManager.deleteAccount("account_pressure_extrainfo");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>deleteAccount 0600 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>the number of times to complete the stress test is: " + count)
+ console.debug("====>ActsAccountPressure_0600 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsAccountPressure_0700
+ * @tc.name : Stress test setAccountCredential and getAccountCredential
+ * @tc.desc : Stress test setting credential and obtaining credential
+ */
+ it('ActsAccountPressure_0700', 0, async function (done) {
+ console.debug("====>ActsAccountPressure_0700 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ let count;
+ let credentialType = "";
+ let credentialvalue = "";
+ console.debug("====>addAccount 0700 start====");
+ try{
+ await appAccountManager.addAccount("account_credential");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("addAccount 0700 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ for (count = 0; count < STRESSLEVEL; count++) {
+ console.debug("====>setAccountCredential time: " + count);
+ credentialType = "pressure_credentialType" + count;
+ credentialvalue = "pressure_credential" + count;
+ try{
+ await appAccountManager.setAccountCredential("account_credential", credentialType, credentialvalue);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("setAccountCredential 0700 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAccountCredential time: " + count);
+ try{
+ var data = await appAccountManager.getAccountCredential("account_credential", credentialType);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("getAccountCredential 0700 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAccountCredential 0700 data:" + JSON.stringify(data));
+ expect(data).assertEqual(credentialvalue);
+ }
+ console.debug("====>delete account 0700 start====");
+ try{
+ await appAccountManager.deleteAccount("account_credential");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("deleteAccount 0700 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>the number of times to complete the stress test is: " + count)
+ console.debug("====>ActsAccountPressure_0700 end====");
+ done();
+ });
+
+ // /*
+ // * @tc.number : ActsAccountPressure_0800
+ // * @tc.name : setOAuthToken getOAuthToken and clearOAuthToken
+ // * @tc.desc : Stress test sets the token, obtains the token and then clears the token
+ // */
+ // it('ActsAccountPressure_0800', 0, async function (done) {
+ // console.debug("====>ActsAccountPressure_0800 start====");
+ // var appAccountManager = account.createAppAccountManager();
+ // console.debug("====>creat finish====");
+ // let count;
+ // let oauthToken = "";
+ // console.debug("====>addAccount 0800 start====");
+ // try{
+ // await appAccountManager.addAccount("accountToken_pressure_token");
+ // sleep(TIMEOUT);
+ // }
+ // catch(err){
+ // console.error("addAccount 0800 err:" + JSON.stringify(err));
+ // expect().assertFail();
+ // done();
+ // }
+ // for (count = 0; count < STRESSLEVEL; count++) {
+ // console.debug("====>setOAuthToken time: " + count);
+ // oauthToken = "pressure_token" + count;
+ // try{
+ // await appAccountManager.setOAuthToken("accountToken_pressure_token", oauthToken);
+ // sleep(TIMEOUT);
+ // }
+ // catch(err){
+ // console.error("setOAuthToken 0800 err:" + JSON.stringify(err));
+ // expect().assertFail();
+ // done();
+ // }
+ // console.debug("====>getOAuthToken time: " + count);
+ // try{
+ // var data = await appAccountManager.getOAuthToken("accountToken_pressure_token");
+ // sleep(TIMEOUT);
+ // }
+ // catch(err){
+ // console.error("getOAuthToken 0800 err:" + JSON.stringify(err));
+ // expect().assertFail();
+ // done();
+ // }
+ // console.debug("====>getOAuthToken data: " + data);
+ // expect(data).assertEqual(oauthToken);
+ // console.debug("====>clearOAuthToken time: " + count);
+ // try{
+ // await appAccountManager.clearOAuthToken("accountToken_pressure_token");
+ // sleep(TIMEOUT);
+ // }
+ // catch(err){
+ // console.error("clearOAuthToken 0800 err:" + JSON.stringify(err));
+ // expect().assertFail();
+ // done();
+ // }
+ // }
+ // console.debug("====>delete account 0800 start====");
+ // try{
+ // await appAccountManager.deleteAccount("accountToken_pressure_token");
+ // sleep(TIMEOUT);
+ // }
+ // catch(err){
+ // console.error("deleteAccount 0800 err:" + JSON.stringify(err));
+ // expect().assertFail();
+ // done();
+ // }
+ // console.debug("====>the number of times to complete the stress test is: " + count);
+ // console.debug("====>ActsAccountPressure_0800 end====");
+ // done();
+ // });
+
+ /*
+ * @tc.number : ActsAccountPressure_0900
+ * @tc.name : Stress test setAppAccountSyncEnable and checkAppAccountSyncEnable
+ * @tc.desc : Stress test setting synchronization flag and obtaining synchronization flag
+ */
+ it('ActsAccountPressure_0900', 0, async function (done) {
+ console.debug("====>ActsAccountPressure_0900 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ let count;
+ console.debug("====>add account 0900 start====");
+ try{
+ await appAccountManager.addAccount("account_pressure_syncenable");
+ }
+ catch(err){
+ console.error("====>add account 0900 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ for (count = 0; count < STRESSLEVEL; count++) {
+ console.debug("====>setAppAccountSyncEnable time: " + count);
+ try{
+ await appAccountManager.setAppAccountSyncEnable("account_pressure_syncenable", true);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>setAppAccountSyncEnable 0900 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>checkAppAccountSyncEnable time: " + count);
+ try{
+ var data = await appAccountManager.checkAppAccountSyncEnable("account_pressure_syncenable");
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>checkAppAccountSyncEnable 0900 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>checkAppAccountSyncEnable data:" + data);
+ expect(data).assertEqual(true);
+ }
+ console.debug("====>delete account 0900 start====");
+ try{
+ await appAccountManager.deleteAccount("account_pressure_syncenable");
+ }
+ catch(err){
+ console.error("====>delete account 0900 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>the number of times to complete the stress test is: " + count);
+ console.debug("====>ActsAccountPressure_0900 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsAccountPressure_1000
+ * @tc.name : Stress test getAllAccounts
+ * @tc.desc : Stress test to obtain specified application information
+ */
+ it('ActsAccountPressure_1000', 0, async function (done) {
+ console.debug("====>ActsAccountPressure_1000 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ let count;
+ var specifyBundle = "com.example.actsaccountsceneappaccess";
+ for (count = 0; count < STRESSLEVEL; count++) {
+ console.debug("====>getAllAccounts time: " + count);
+ try{
+ var data = await appAccountManager.getAllAccounts(specifyBundle);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>getAllAccounts 1000 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccounts data: " + JSON.stringify(data));
+ expect(data[0].name).assertEqual("account_name_scene_first");
+ expect(data[0].owner).assertEqual(specifyBundle);
+ expect(data[1].name).assertEqual("account_name_scene_second");
+ expect(data[1].owner).assertEqual(specifyBundle);
+ }
+ console.debug("====>the number of times to complete the stress test is: " + count);
+ console.debug("====>ActsAccountPressure_1000 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsAccountPressure_1100
+ * @tc.name : Stress test getAllAccessibleAccounts
+ * @tc.desc : Stress test to obtain the application account information and authorized account information
+ */
+ it('ActsAccountPressure_1100', 0, async function (done) {
+ console.debug("====>ActsAccountPressure_1100 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ let count;
+ var selfBundle = "com.example.actsaccountpressure";
+ var specifyBundle = "com.example.actsaccountsceneappaccess";
+ console.debug("====>add account 1100 start====");
+ try{
+ await appAccountManager.addAccount("account_accessible_first");
+ await appAccountManager.addAccount("account_accessible_second");
+ }
+ catch(err){
+ console.error("====>add account 1100 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ for (count = 0; count < STRESSLEVEL; count++) {
+ console.debug("====>getAllAccounts time: " + count);
+ try{
+ var data = await appAccountManager.getAllAccessibleAccounts();
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>getAllAccounts 1100 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccounts data: " + JSON.stringify(data));
+ console.debug("====>getAllAccounts data.length: " + data.length);
+ expect(data.length).assertEqual(4);
+ expect(data[0].name).assertEqual("account_name_scene_first");
+ expect(data[0].owner).assertEqual(specifyBundle);
+ expect(data[1].name).assertEqual("account_name_scene_second");
+ expect(data[1].owner).assertEqual(specifyBundle);
+ expect(data[2].name).assertEqual("account_accessible_first");
+ expect(data[2].owner).assertEqual(selfBundle);
+ expect(data[3].name).assertEqual("account_accessible_second");
+ expect(data[3].owner).assertEqual(selfBundle);
+ }
+ console.debug("====>delete account 1100 start====");
+ try{
+ await appAccountManager.deleteAccount("account_accessible_first");
+ await appAccountManager.deleteAccount("account_accessible_second");
+ }
+ catch(err){
+ console.error("====>delete account 1100 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>the number of times to complete the stress test is: " + count);
+ console.debug("====>ActsAccountPressure_1100 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsAccountPressure_1200
+ * @tc.name : Stress test on and off
+ * @tc.desc : Stress test receive account information changes
+ */
+ it('ActsAccountPressure_1200', 0, async function (done) {
+ console.debug("====>ActsAccountPressure_1200 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat appAccountManager finish");
+ console.debug("====>add account 1200 start");
+ let count;
+ var countSign = 0;
+ let changeExtra = "";
+ try{
+ await appAccountManager.addAccount("account_pressure_onoff");
+ }
+ catch(err){
+ console.error("====>add account 1200 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ function changeOnCallback(data){
+ console.debug("====>receive change 1200 data:" + JSON.stringify(data));
+ expect(data[0].name).assertEqual("account_pressure_onoff");
+ expect(data[0].owner).assertEqual("com.example.actsaccountpressure");
+ countSign++;
+ }
+ console.debug("====>on ActsAccountPressure_1200 start");
+ try{
+ appAccountManager.on('change', ["com.example.actsaccountpressure"], changeOnCallback);
+ }
+ catch(err){
+ console.error("====>on ActsAccountPressure_1200 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ for (count = 0; count < STRESSLEVEL; count++) {
+ console.debug("====>change account information time: " + count);
+ changeExtra = "pressure_extra" + count;
+ try{
+ await appAccountManager.setAccountExtraInfo("account_pressure_onoff", changeExtra);
+ sleep(TIMEOUT);
+ }
+ catch(err){
+ console.error("====>setAccountExtraInfo fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ }
+ console.debug("====>off 1200 start====");
+ appAccountManager.off('change', async function (){
+ console.debug("====>off enter====");
+ console.debug("====>countSign is: " + countSign);
+ expect(countSign).assertEqual(STRESSLEVEL);
+ console.debug("====>delete account====");
+ try{
+ await appAccountManager.deleteAccount("account_pressure_onoff");
+ }
+ catch(err){
+ console.error("====>delete account 1200 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>the number of times to complete the stress test is: " + count);
+ console.debug("====>ActsAccountPressure_1200 end====");
+ done();
+ });
+ });
+ })
+}
\ No newline at end of file
diff --git a/account/appaccount/actsaccountpressure/src/main/resources/base/element/string.json b/account/appaccount/actsaccountpressure/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..d43be82875dc199de442811300003b9efeeb0a0b
--- /dev/null
+++ b/account/appaccount/actsaccountpressure/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ActsAccountPressure"
+ },
+ {
+ "name": "mainability_description",
+ "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
diff --git a/account/appaccount/actsaccountpressure/entry/src/main/js/resources/base/media/icon.png b/account/appaccount/actsaccountpressure/src/main/resources/base/media/icon.png
similarity index 100%
rename from account/appaccount/actsaccountpressure/entry/src/main/js/resources/base/media/icon.png
rename to account/appaccount/actsaccountpressure/src/main/resources/base/media/icon.png
diff --git a/account/appaccount/actsaccounttest/BUILD.gn b/account/appaccount/actsaccounttest/BUILD.gn
old mode 100755
new mode 100644
index 0a668834c230e3a7049d4f06c222612f4130d32c..b6bc39e7c29af3ab7435b793fcee3140d45f3962
--- a/account/appaccount/actsaccounttest/BUILD.gn
+++ b/account/appaccount/actsaccounttest/BUILD.gn
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAccountTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsAccountTest") {
hap_name = "ActsAccountTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/account/appaccount/actsaccounttest/Test.json b/account/appaccount/actsaccounttest/Test.json
old mode 100755
new mode 100644
index 17b543c5327fcf8b77f5f9bcaf4ceb5a5f7e4b9f..f1c6d4fab38faf4864ce2ee01bb311d29a4abee9
--- a/account/appaccount/actsaccounttest/Test.json
+++ b/account/appaccount/actsaccounttest/Test.json
@@ -1,10 +1,11 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "3000000",
- "package": "com.example.actsaccounttest",
- "shell-timeout": "60000"
+ "bundle-name": "com.example.actsaccounttest",
+ "package-name": "com.example.actsaccounttest",
+ "shell-timeout": "3000000"
},
"kits": [
{
diff --git a/account/appaccount/actsaccounttest/entry/src/main/js/default/pages/index/index.css b/account/appaccount/actsaccounttest/entry/src/main/js/default/pages/index/index.css
deleted file mode 100755
index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000
--- a/account/appaccount/actsaccounttest/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
diff --git a/account/appaccount/actsaccounttest/entry/src/main/js/default/pages/index/index.hml b/account/appaccount/actsaccounttest/entry/src/main/js/default/pages/index/index.hml
deleted file mode 100755
index c45422b42d0bf788a1c2c0eb299a981f07ce8613..0000000000000000000000000000000000000000
--- a/account/appaccount/actsaccounttest/entry/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/account/appaccount/actsaccounttest/src/main/js/MainAbility/pages/index/index.js b/account/appaccount/actsaccounttest/src/main/js/MainAbility/pages/index/index.js
new file mode 100755
index 0000000000000000000000000000000000000000..78f8ddb742337bd3eb9acb1368a144454870c331
--- /dev/null
+++ b/account/appaccount/actsaccounttest/src/main/js/MainAbility/pages/index/index.js
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ onInit() {
+ this.title = "Application account js test";
+ },
+ onShow() {
+ console.info('onShow finish')
+ },
+ onReady() {
+ },
+}
\ No newline at end of file
diff --git a/account/appaccount/actsaccounttest/src/main/js/TestAbility/app.js b/account/appaccount/actsaccounttest/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/account/appaccount/actsaccounttest/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
diff --git a/account/appaccount/actsaccounttest/src/main/js/TestAbility/i18n/en-US.json b/account/appaccount/actsaccounttest/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/account/appaccount/actsaccounttest/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/actsaccounttest/src/main/js/TestAbility/i18n/zh-CN.json b/account/appaccount/actsaccounttest/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/account/appaccount/actsaccounttest/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/actsaccounttest/src/main/js/TestAbility/pages/index/index.css b/account/appaccount/actsaccounttest/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2b45eb97c17e67ef5d63436aad8998113aa95d6d
--- /dev/null
+++ b/account/appaccount/actsaccounttest/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+.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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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
diff --git a/account/appaccount/actsaccounttest/src/main/js/TestAbility/pages/index/index.hml b/account/appaccount/actsaccounttest/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/account/appaccount/actsaccounttest/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
diff --git a/account/appaccount/actsgetallaccounts/entry/src/main/js/resources/base/element/string.json b/account/appaccount/actsgetallaccounts/entry/src/main/js/resources/base/element/string.json
deleted file mode 100755
index b50238a04201f2c134fb640b84189e89bd2b75fa..0000000000000000000000000000000000000000
--- a/account/appaccount/actsgetallaccounts/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "ActsGetAllAccounts"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/account/appaccount/actsgetallaccounts/entry/src/main/js/test/Getallaccounts.test.js b/account/appaccount/actsgetallaccounts/entry/src/main/js/test/Getallaccounts.test.js
deleted file mode 100755
index dcf06f897445e6b0d59e9744ed0df31aaf193f77..0000000000000000000000000000000000000000
--- a/account/appaccount/actsgetallaccounts/entry/src/main/js/test/Getallaccounts.test.js
+++ /dev/null
@@ -1,651 +0,0 @@
-/*
- * 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.appAccount'
-import featureAbility from '@ohos.ability.featureAbility'
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-
-const TIMEOUT = 2000;
-const LENGTHLIMIT = 1024;
-describe('ActsGetAllAccounts', function () {
-
- /*
- * @tc.number : ActsGetAllAccounts_0100
- * @tc.name : getAllAccounts callback
- * @tc.desc : This application gets its own application information after adding an account
- */
- it('ActsGetAllAccounts_0100', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_0100 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var selfBundle = "com.example.actsgetallaaccounts";
- appAccountManager.addAccount("Account_this_application_callback", (err)=>{
- console.debug("====>add account 0100 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
- console.debug("====>getAllAccounts 0100 err:" + JSON.stringify(err));
- console.debug("====>getAllAccounts 0100 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- try{
- expect(data[0].name).assertEqual("Account_this_application_callback");
- expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
- }
- catch(err){
- console.error("====>getAllAccounts 0100 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- appAccountManager.deleteAccount("Account_this_application_callback", (err)=>{
- console.debug("====>delete account 0100 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsGetAllAccounts_0100 end====");
- done();
- });
- })
- });
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_0200
- * @tc.name : getAllAccounts promise
- * @tc.desc : This application gets its own application information after adding an account
- */
- it('ActsGetAllAccounts_0200', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_0200 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>getAllAccounts for clean====");
- var selfBundle = "com.example.actsgetallaaccounts";
- try{
- var acclist = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>account list length: " + acclist.length);
- if(acclist.length > 0){
- for(var i = 0;i < acclist.length; i++){
- await appAccountManager.deleteAccount(acclist[i].name);
- }
- }
- console.debug("====>add account 0200 start====");
- await appAccountManager.addAccount("Account_this_application_promise");
- console.debug("====>getAllAccounts 0200 start====");
- try{
- var data = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts 0200 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- try{
- expect(data[0].name).assertEqual("Account_this_application_promise");
- expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
- }
- catch(err){
- console.error("====>check data 0200 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>delete account 0200 start====");
- await appAccountManager.deleteAccount("Account_this_application_promise");
- console.debug("====>ActsGetAllAccounts_0200 end====");
- done();
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_0300
- * @tc.name : getAllAccounts callback
- * @tc.desc : No account has been added to this application and it is not authorized by other applications to
- * obtain account information for this application
- */
- it('ActsGetAllAccounts_0300', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_0300 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var selfBundle = "com.example.actsgetallaaccounts";
- appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
- console.debug("====>getAllAccounts 0300 err:" + JSON.stringify(err));
- console.debug("====>getAllAccounts 0300 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data.length).assertEqual(0);
- console.debug("====>ActsGetAllAccounts_0300 end====");
- done();
- })
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_0400
- * @tc.name : getAllAccounts promise
- * @tc.desc : No account has been added to this application and it is not authorized by other applications to
- * obtain account information for this application
- */
- it('ActsGetAllAccounts_0400', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_0400 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>getAllAccounts for clean====");
- var selfBundle = "com.example.actsgetallaaccounts";
- try{
- var acclist = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>account list length: " + acclist.length);
- if(acclist.length > 0){
- for(var i = 0;i < acclist.length; i++){
- await appAccountManager.deleteAccount(acclist[i].name);
- }
- }
- var data = await appAccountManager.getAllAccounts(selfBundle);
- console.debug("====>getAllAccounts 0400 data:" + JSON.stringify(data));
- expect(data.length).assertEqual(0);
- console.debug("====>ActsGetAllAccounts_0400 end====");
- done();
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_0500
- * @tc.name : getAllAccounts callback
- * @tc.desc : The parameter owner is an empty string
- */
- it('ActsGetAllAccounts_0500', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_0500 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var emptyBundle = "";
- appAccountManager.getAllAccounts(emptyBundle, (err, data)=>{
- console.debug("====>getAllAccounts 0500 err:" + JSON.stringify(err));
- expect(err.code != 0).assertEqual(true);
- console.debug("====>ActsGetAllAccounts_0500 end====");
- done();
- })
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_0600
- * @tc.name : getAllAccounts promise
- * @tc.desc : The parameter owner is an empty string
- */
- it('ActsGetAllAccounts_0600', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_0600 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var emptyBundle = "";
- try{
- var data = await appAccountManager.getAllAccounts(emptyBundle);
- }
- catch(err){
- console.debug("====>getAllAccounts 0600 err:" + JSON.stringify(err));
- expect(err.code != 0).assertEqual(true);
- console.debug("====>ActsGetAllAccounts_0600 end====");
- done();
- }
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_0700
- * @tc.name : getAllAccounts callback
- * @tc.desc : The parameter owner is a string that exceeds the length limit
- */
- it('ActsGetAllAccounts_0700', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_0700 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var limitBundle = '';
- for (var i = 0; i < LENGTHLIMIT + 1; i++) {
- limitBundle += 't';
- }
- appAccountManager.getAllAccounts(limitBundle, (err, data)=>{
- console.debug("====>getAllAccounts 0700 err:" + JSON.stringify(err));
- expect(err.code != 0).assertEqual(true);
- console.debug("====>ActsGetAllAccounts_0700 end====");
- done();
- })
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_0800
- * @tc.name : getAllAccounts promise
- * @tc.desc : The parameter owner is a string that exceeds the length limit
- */
- it('ActsGetAllAccounts_0800', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_0800 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var limitBundle = '';
- for (var i = 0; i < LENGTHLIMIT + 1; i++) {
- limitBundle += 'n';
- }
- try{
- var data = await appAccountManager.getAllAccounts(limitBundle);
- }
- catch(err){
- console.debug("====>getAllAccounts 0800 err:" + JSON.stringify(err));
- expect(err.code != 0).assertEqual(true);
- console.debug("====>ActsGetAllAccounts_0800 end====");
- done();
- }
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_0900
- * @tc.name : getAllAccounts callback
- * @tc.desc : This application adds an account, and after other applications authorize an account to this
- * application, this application obtains the information of its own application
- */
- it('ActsGetAllAccounts_0900', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_0900 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var selfBundle = "com.example.actsgetallaaccounts";
- console.debug("====>add account 0900 start====");
- await appAccountManager.addAccount("Account_application_callback");
- console.debug("====>startAbility 0900 start====");
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.example.actsscenegetallaccounts",
- abilityName: "com.example.actsscenegetallaccounts.MainAbility",
- action: "action1",
- parameters:
- {},
- },
- },
- );
- function getAllCallback(err, data){
- console.debug("====>getAllAccounts 0900 err:" + JSON.stringify(err));
- console.debug("====>getAllAccounts 0900 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data[0].name).assertEqual("Account_application_callback");
- expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
- appAccountManager.deleteAccount("Account_application_callback", (err)=>{
- console.debug("====>delete account 0900 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsGetAllAccounts_0900 end====");
- done();
- });
- }
- setTimeout(async function(){
- console.debug("====>getAllAccounts 0900 start====");
- appAccountManager.getAllAccounts(selfBundle, getAllCallback);
- }, TIMEOUT);
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_1000
- * @tc.name : getAllAccounts promise
- * @tc.desc : This application adds an account, and after other applications authorize an account to this
- * application, this application obtains the information of its own application
- */
- it('ActsGetAllAccounts_1000', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_1000 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var selfBundle = "com.example.actsgetallaaccounts";
- console.debug("====>add account 1000 start====");
- await appAccountManager.addAccount("Account_application_promise");
- console.debug("====>startAbility 1000 start====");
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.example.actsscenegetallaccounts",
- abilityName: "com.example.actsscenegetallaccounts.MainAbility",
- action: "action1",
- parameters:
- {},
- },
- },
- );
- setTimeout(async function(){
- console.debug("====>getAllAccounts 1000 start====");
- try{
- var data = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts 1000 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccounts 1000 data:" + JSON.stringify(data));
- try{
- expect(data[0].name).assertEqual("Account_application_promise");
- expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
- }
- catch(err){
- console.error("====>check data 1000 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>delete account 1000 start====");
- await appAccountManager.deleteAccount("Account_application_promise");
- console.debug("====>ActsGetAllAccounts_1000 end====");
- done();
- }, TIMEOUT);
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_1100
- * @tc.name : getAllAccounts callback
- * @tc.desc : This application adds an account, and after other applications authorize an account to this
- * application, this application obtains the information of its own application
- */
- it('ActsGetAllAccounts_1100', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_0900 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var specifiedBundle = "com.example.actsscenegetallaccounts";
- console.debug("====>startAbility 1100 start====");
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.example.actsscenegetallaccounts",
- abilityName: "com.example.actsscenegetallaccounts.MainAbility",
- action: "action1",
- parameters:
- {},
- },
- },
- );
- function getAllCallback(err, data){
- console.debug("====>getAllAccounts 1100 err:" + JSON.stringify(err));
- console.debug("====>getAllAccounts 1100 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data[0].name).assertEqual("account_name_scene_single");
- expect(data[0].owner).assertEqual("com.example.actsscenegetallaccounts");
- console.debug("====>ActsGetAllAccounts_1100 end====");
- done();
- }
- setTimeout(async function(){
- console.debug("====>getAllAccounts 1100 start====");
- appAccountManager.getAllAccounts(specifiedBundle, getAllCallback);
- }, TIMEOUT);
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_1200
- * @tc.name : getAllAccounts promise
- * @tc.desc : This application adds an account, and after other applications authorize an account to this
- * application, this application obtains the information of its own application
- */
- it('ActsGetAllAccounts_1200', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_1200 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var specifiedBundle = "com.example.actsscenegetallaccounts";
- console.debug("====>startAbility 1200 start====");
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.example.actsscenegetallaccounts",
- abilityName: "com.example.actsscenegetallaccounts.MainAbility",
- action: "action1",
- parameters:
- {},
- },
- },
- );
- setTimeout(async function(){
- console.debug("====>getAllAccounts 1200 start====");
- try{
- var data = await appAccountManager.getAllAccounts(specifiedBundle);
- }
- catch(err){
- console.error("====>getAllAccounts 1200 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccounts 1200 data:" + JSON.stringify(data));
- expect(data[0].name).assertEqual("account_name_scene_single");
- expect(data[0].owner).assertEqual("com.example.actsscenegetallaccounts");
- console.debug("====>ActsGetAllAccounts_1200 end====");
- done();
- }, TIMEOUT);
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_1300
- * @tc.name : getAllAccounts callback
- * @tc.desc : The parameter owner is a bundlename that does not exist
- */
- it('ActsGetAllAccounts_1300', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_1300 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var nonexistentBundle = "com.example.actsgetallaccountsnonexistent";
- appAccountManager.getAllAccounts(nonexistentBundle, (err, data)=>{
- console.debug("====>getAllAccounts 1300 err:" + JSON.stringify(err));
- expect(err.code != 0).assertEqual(true);
- console.debug("====>ActsGetAllAccounts_1300 end====");
- done();
- })
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_1400
- * @tc.name : getAllAccounts promise
- * @tc.desc : The parameter owner is a bundlename that does not exist
- */
- it('ActsGetAllAccounts_1400', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_1400 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var nonexistentBundle = "com.example.actsgetallaccountsnonexistent";
- try{
- var data = await appAccountManager.getAllAccounts(nonexistentBundle);
- }
- catch(err){
- console.debug("====>getAllAccounts 1400 err:" + JSON.stringify(err));
- expect(err.code != 0).assertEqual(true);
- console.debug("====>ActsGetAllAccounts_1400 end====");
- done();
- }
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_1500
- * @tc.name : getAllAccounts callback
- * @tc.desc : Get account information after adding and deleting account
- */
- it('ActsGetAllAccounts_1500', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_1500 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var selfBundle = "com.example.actsgetallaaccounts";
- appAccountManager.addAccount("account_callback_delete", (err)=>{
- console.debug("====>add account 1500 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
- console.debug("====>getAllAccounts 1500 err:" + JSON.stringify(err));
- console.debug("====>getAllAccounts 1500 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data[0].name).assertEqual("account_callback_delete");
- expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
- appAccountManager.deleteAccount("account_callback_delete", (err)=>{
- console.debug("====>delete account 1500 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
- console.debug("====>getAllAccounts 1500 err:" + JSON.stringify(err));
- console.debug("====>getAllAccounts 1500 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data.length).assertEqual(0);
- console.debug("====>ActsGetAllAccounts_1500 end====");
- done();
- })
- });
- })
- });
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_1600
- * @tc.name : getAllAccounts promise
- * @tc.desc : Get account information after adding and deleting account
- */
- it('ActsGetAllAccounts_1600', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_1600 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>getAllAccounts for clean====");
- var selfBundle = "com.example.actsgetallaaccounts";
- try{
- var acclist = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>account list length: " + acclist.length);
- if(acclist.length > 0){
- for(var i = 0;i < acclist.length; i++){
- await appAccountManager.deleteAccount(acclist[i].name);
- }
- }
- console.debug("====>add account 1600 start====");
- await appAccountManager.addAccount("account_promise_delete");
- console.debug("====>first getAllAccounts 1600 start====");
- try{
- var data = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts 1600 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- expect(data[0].name).assertEqual("account_promise_delete");
- expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
- console.debug("====>delete account 1600 start====");
- await appAccountManager.deleteAccount("account_promise_delete");
- console.debug("====>second getAllAccounts 1600 start====");
- try{
- var dataDelete = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>second getAllAccounts 1600 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- expect(dataDelete.length).assertEqual(0);
- console.debug("====>ActsGetAllAccounts_1600 end====");
- done();
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_1700
- * @tc.name : getAllAccounts callback
- * @tc.desc : Get account information after adding an account with additional information and deleting an
- * account
- */
- it('ActsGetAllAccounts_1700', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_1700 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var selfBundle = "com.example.actsgetallaaccounts";
- appAccountManager.addAccount("account_callback_additional", "account_extrainfo", (err)=>{
- console.debug("====>add account 1700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
- console.debug("====>getAllAccounts 1700 err:" + JSON.stringify(err));
- console.debug("====>getAllAccounts 1700 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data[0].name).assertEqual("account_callback_additional");
- expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
- appAccountManager.deleteAccount("account_callback_additional", (err)=>{
- console.debug("====>delete account 1700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
- console.debug("====>getAllAccounts 1700 err:" + JSON.stringify(err));
- console.debug("====>getAllAccounts 1700 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data.length).assertEqual(0);
- console.debug("====>ActsGetAllAccounts_1700 end====");
- done();
- })
- });
- })
- });
- });
-
- /*
- * @tc.number : ActsGetAllAccounts_1800
- * @tc.name : getAllAccounts promise
- * @tc.desc : Get account information after adding an account with additional information and deleting an
- * account
- */
- it('ActsGetAllAccounts_1800', 0, async function (done) {
- console.debug("====>ActsGetAllAccounts_1800 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>getAllAccounts for clean====");
- var selfBundle = "com.example.actsgetallaaccounts";
- try{
- var acclist = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>account list length: " + acclist.length);
- if(acclist.length > 0){
- for(var i = 0;i < acclist.length; i++){
- await appAccountManager.deleteAccount(acclist[i].name);
- }
- }
- console.debug("====>add account 1800 start====");
- await appAccountManager.addAccount("account_promise_additional", "account_extrainfo");
- console.debug("====>first getAllAccounts 1800 start====");
- try{
- var data = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts 1800 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>first getAllAccounts 1800 data:" + JSON.stringify(data));
- expect(data[0].name).assertEqual("account_promise_additional");
- expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
- console.debug("====>delete account 1800 start====");
- await appAccountManager.deleteAccount("account_promise_additional");
- console.debug("====>second getAllAccounts 1800 start====");
- try{
- var dataDelete = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>second getAllAccounts 1800 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>second getAllAccounts 1800 data:" + JSON.stringify(data));
- expect(dataDelete.length).assertEqual(0);
- console.debug("====>ActsGetAllAccounts_1800 end====");
- done();
- });
-})
\ No newline at end of file
diff --git a/account/appaccount/actsgetallaccounts/entry/src/main/config.json b/account/appaccount/actsgetallaccounts/src/main/config.json
old mode 100755
new mode 100644
similarity index 52%
rename from account/appaccount/actsgetallaccounts/entry/src/main/config.json
rename to account/appaccount/actsgetallaccounts/src/main/config.json
index 16393adc2a7e3f560ce122a121bcd71d45aa1e2d..96bc2a2bb660c048e17515080ba1c2cb6fc372c5
--- a/account/appaccount/actsgetallaccounts/entry/src/main/config.json
+++ b/account/appaccount/actsgetallaccounts/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsgetallaaccounts",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -59,25 +61,42 @@
],
"abilities": [
{
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.actsgetallaaccounts.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "visible": true,
- "launchType": "standard"
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "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,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
}
- ],
+ ],
"js": [
{
"pages": [
@@ -88,7 +107,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/account/appaccount/actsgetallaccounts/entry/src/main/js/default/app.js b/account/appaccount/actsgetallaccounts/src/main/js/MainAbility/app.js
similarity index 100%
rename from account/appaccount/actsgetallaccounts/entry/src/main/js/default/app.js
rename to account/appaccount/actsgetallaccounts/src/main/js/MainAbility/app.js
diff --git a/account/appaccount/actsgetallaccounts/entry/src/main/js/default/i18n/en-US.json b/account/appaccount/actsgetallaccounts/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from account/appaccount/actsgetallaccounts/entry/src/main/js/default/i18n/en-US.json
rename to account/appaccount/actsgetallaccounts/src/main/js/MainAbility/i18n/en-US.json
diff --git a/account/appaccount/actsgetallaccounts/entry/src/main/js/default/i18n/zh-CN.json b/account/appaccount/actsgetallaccounts/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from account/appaccount/actsgetallaccounts/entry/src/main/js/default/i18n/zh-CN.json
rename to account/appaccount/actsgetallaccounts/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/account/appaccount/actsgetallaccounts/src/main/js/MainAbility/pages/index/index.css b/account/appaccount/actsgetallaccounts/src/main/js/MainAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2334ecfa2c147f276998e82e2c35f62800cfb031
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/js/MainAbility/pages/index/index.css
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/account/appaccount/actsgetallaccounts/src/main/js/MainAbility/pages/index/index.hml b/account/appaccount/actsgetallaccounts/src/main/js/MainAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..58fdc144440ca578003fa3982fb8d0029cc2cdc7
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/js/MainAbility/pages/index/index.hml
@@ -0,0 +1,19 @@
+
+
+
+ {{title}}
+
+
diff --git a/account/appaccount/actsgetallaccounts/entry/src/main/js/default/pages/index/index.js b/account/appaccount/actsgetallaccounts/src/main/js/MainAbility/pages/index/index.js
similarity index 69%
rename from account/appaccount/actsgetallaccounts/entry/src/main/js/default/pages/index/index.js
rename to account/appaccount/actsgetallaccounts/src/main/js/MainAbility/pages/index/index.js
index dd93588f4e962bb765d3719f0861caa798f35f77..0c25c846b99ffeba372e8ad4c25d6d4c10c67498 100755
--- a/account/appaccount/actsgetallaccounts/entry/src/main/js/default/pages/index/index.js
+++ b/account/appaccount/actsgetallaccounts/src/main/js/MainAbility/pages/index/index.js
@@ -12,8 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
@@ -26,18 +24,6 @@ export default {
},
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() {
},
diff --git a/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/app.js b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
diff --git a/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/i18n/en-US.json b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/i18n/zh-CN.json b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/pages/index/index.css b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2b45eb97c17e67ef5d63436aad8998113aa95d6d
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+.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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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
diff --git a/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/pages/index/index.hml b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/pages/index/index.js b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/account/appaccount/actsgetallaccounts/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/appaccount/actsgetallaccounts/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js b/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..73ab6372b8fccf4eebf2a206de6ad8c7532487de
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js
@@ -0,0 +1,653 @@
+/*
+ * 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.appAccount'
+import featureAbility from '@ohos.ability.featureAbility'
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+const TIMEOUT = 2000;
+const LENGTHLIMIT = 1024;
+export default function ActsGetAllAccounts() {
+ describe('ActsGetAllAccounts', function () {
+
+ /*
+ * @tc.number : ActsGetAllAccounts_0100
+ * @tc.name : getAllAccounts callback
+ * @tc.desc : This application gets its own application information after adding an account
+ */
+ it('ActsGetAllAccounts_0100', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_0100 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var selfBundle = "com.example.actsgetallaaccounts";
+ appAccountManager.addAccount("Account_this_application_callback", (err)=>{
+ console.debug("====>add account 0100 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
+ console.debug("====>getAllAccounts 0100 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccounts 0100 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ try{
+ expect(data[0].name).assertEqual("Account_this_application_callback");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
+ }
+ catch(err){
+ console.error("====>getAllAccounts 0100 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ appAccountManager.deleteAccount("Account_this_application_callback", (err)=>{
+ console.debug("====>delete account 0100 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsGetAllAccounts_0100 end====");
+ done();
+ });
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_0200
+ * @tc.name : getAllAccounts promise
+ * @tc.desc : This application gets its own application information after adding an account
+ */
+ it('ActsGetAllAccounts_0200', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_0200 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>getAllAccounts for clean====");
+ var selfBundle = "com.example.actsgetallaaccounts";
+ try{
+ var acclist = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>account list length: " + acclist.length);
+ if(acclist.length > 0){
+ for(var i = 0;i < acclist.length; i++){
+ await appAccountManager.deleteAccount(acclist[i].name);
+ }
+ }
+ console.debug("====>add account 0200 start====");
+ await appAccountManager.addAccount("Account_this_application_promise");
+ console.debug("====>getAllAccounts 0200 start====");
+ try{
+ var data = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts 0200 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ try{
+ expect(data[0].name).assertEqual("Account_this_application_promise");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
+ }
+ catch(err){
+ console.error("====>check data 0200 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>delete account 0200 start====");
+ await appAccountManager.deleteAccount("Account_this_application_promise");
+ console.debug("====>ActsGetAllAccounts_0200 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_0300
+ * @tc.name : getAllAccounts callback
+ * @tc.desc : No account has been added to this application and it is not authorized by other applications to
+ * obtain account information for this application
+ */
+ it('ActsGetAllAccounts_0300', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_0300 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var selfBundle = "com.example.actsgetallaaccounts";
+ appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
+ console.debug("====>getAllAccounts 0300 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccounts 0300 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data.length).assertEqual(0);
+ console.debug("====>ActsGetAllAccounts_0300 end====");
+ done();
+ })
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_0400
+ * @tc.name : getAllAccounts promise
+ * @tc.desc : No account has been added to this application and it is not authorized by other applications to
+ * obtain account information for this application
+ */
+ it('ActsGetAllAccounts_0400', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_0400 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>getAllAccounts for clean====");
+ var selfBundle = "com.example.actsgetallaaccounts";
+ try{
+ var acclist = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>account list length: " + acclist.length);
+ if(acclist.length > 0){
+ for(var i = 0;i < acclist.length; i++){
+ await appAccountManager.deleteAccount(acclist[i].name);
+ }
+ }
+ var data = await appAccountManager.getAllAccounts(selfBundle);
+ console.debug("====>getAllAccounts 0400 data:" + JSON.stringify(data));
+ expect(data.length).assertEqual(0);
+ console.debug("====>ActsGetAllAccounts_0400 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_0500
+ * @tc.name : getAllAccounts callback
+ * @tc.desc : The parameter owner is an empty string
+ */
+ it('ActsGetAllAccounts_0500', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_0500 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var emptyBundle = "";
+ appAccountManager.getAllAccounts(emptyBundle, (err, data)=>{
+ console.debug("====>getAllAccounts 0500 err:" + JSON.stringify(err));
+ expect(err.code != 0).assertEqual(true);
+ console.debug("====>ActsGetAllAccounts_0500 end====");
+ done();
+ })
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_0600
+ * @tc.name : getAllAccounts promise
+ * @tc.desc : The parameter owner is an empty string
+ */
+ it('ActsGetAllAccounts_0600', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_0600 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var emptyBundle = "";
+ try{
+ var data = await appAccountManager.getAllAccounts(emptyBundle);
+ }
+ catch(err){
+ console.debug("====>getAllAccounts 0600 err:" + JSON.stringify(err));
+ expect(err.code != 0).assertEqual(true);
+ console.debug("====>ActsGetAllAccounts_0600 end====");
+ done();
+ }
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_0700
+ * @tc.name : getAllAccounts callback
+ * @tc.desc : The parameter owner is a string that exceeds the length limit
+ */
+ it('ActsGetAllAccounts_0700', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_0700 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var limitBundle = '';
+ for (var i = 0; i < LENGTHLIMIT + 1; i++) {
+ limitBundle += 't';
+ }
+ appAccountManager.getAllAccounts(limitBundle, (err, data)=>{
+ console.debug("====>getAllAccounts 0700 err:" + JSON.stringify(err));
+ expect(err.code != 0).assertEqual(true);
+ console.debug("====>ActsGetAllAccounts_0700 end====");
+ done();
+ })
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_0800
+ * @tc.name : getAllAccounts promise
+ * @tc.desc : The parameter owner is a string that exceeds the length limit
+ */
+ it('ActsGetAllAccounts_0800', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_0800 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var limitBundle = '';
+ for (var i = 0; i < LENGTHLIMIT + 1; i++) {
+ limitBundle += 'n';
+ }
+ try{
+ var data = await appAccountManager.getAllAccounts(limitBundle);
+ }
+ catch(err){
+ console.debug("====>getAllAccounts 0800 err:" + JSON.stringify(err));
+ expect(err.code != 0).assertEqual(true);
+ console.debug("====>ActsGetAllAccounts_0800 end====");
+ done();
+ }
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_0900
+ * @tc.name : getAllAccounts callback
+ * @tc.desc : This application adds an account, and after other applications authorize an account to this
+ * application, this application obtains the information of its own application
+ */
+ it('ActsGetAllAccounts_0900', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_0900 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var selfBundle = "com.example.actsgetallaaccounts";
+ console.debug("====>add account 0900 start====");
+ await appAccountManager.addAccount("Account_application_callback");
+ console.debug("====>startAbility 0900 start====");
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.example.actsscenegetallaccounts",
+ abilityName: "com.example.actsscenegetallaccounts.MainAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ },
+ );
+ function getAllCallback(err, data){
+ console.debug("====>getAllAccounts 0900 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccounts 0900 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data[0].name).assertEqual("Account_application_callback");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
+ appAccountManager.deleteAccount("Account_application_callback", (err)=>{
+ console.debug("====>delete account 0900 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsGetAllAccounts_0900 end====");
+ done();
+ });
+ }
+ setTimeout(async function(){
+ console.debug("====>getAllAccounts 0900 start====");
+ appAccountManager.getAllAccounts(selfBundle, getAllCallback);
+ }, TIMEOUT);
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_1000
+ * @tc.name : getAllAccounts promise
+ * @tc.desc : This application adds an account, and after other applications authorize an account to this
+ * application, this application obtains the information of its own application
+ */
+ it('ActsGetAllAccounts_1000', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_1000 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var selfBundle = "com.example.actsgetallaaccounts";
+ console.debug("====>add account 1000 start====");
+ await appAccountManager.addAccount("Account_application_promise");
+ console.debug("====>startAbility 1000 start====");
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.example.actsscenegetallaccounts",
+ abilityName: "com.example.actsscenegetallaccounts.MainAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ },
+ );
+ setTimeout(async function(){
+ console.debug("====>getAllAccounts 1000 start====");
+ try{
+ var data = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts 1000 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccounts 1000 data:" + JSON.stringify(data));
+ try{
+ expect(data[0].name).assertEqual("Account_application_promise");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
+ }
+ catch(err){
+ console.error("====>check data 1000 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>delete account 1000 start====");
+ await appAccountManager.deleteAccount("Account_application_promise");
+ console.debug("====>ActsGetAllAccounts_1000 end====");
+ done();
+ }, TIMEOUT);
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_1100
+ * @tc.name : getAllAccounts callback
+ * @tc.desc : This application adds an account, and after other applications authorize an account to this
+ * application, this application obtains the information of its own application
+ */
+ it('ActsGetAllAccounts_1100', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_0900 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var specifiedBundle = "com.example.actsscenegetallaccounts";
+ console.debug("====>startAbility 1100 start====");
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.example.actsscenegetallaccounts",
+ abilityName: "com.example.actsscenegetallaccounts.MainAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ },
+ );
+ function getAllCallback(err, data){
+ console.debug("====>getAllAccounts 1100 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccounts 1100 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data[0].name).assertEqual("account_name_scene_single");
+ expect(data[0].owner).assertEqual("com.example.actsscenegetallaccounts");
+ console.debug("====>ActsGetAllAccounts_1100 end====");
+ done();
+ }
+ setTimeout(async function(){
+ console.debug("====>getAllAccounts 1100 start====");
+ appAccountManager.getAllAccounts(specifiedBundle, getAllCallback);
+ }, TIMEOUT);
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_1200
+ * @tc.name : getAllAccounts promise
+ * @tc.desc : This application adds an account, and after other applications authorize an account to this
+ * application, this application obtains the information of its own application
+ */
+ it('ActsGetAllAccounts_1200', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_1200 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var specifiedBundle = "com.example.actsscenegetallaccounts";
+ console.debug("====>startAbility 1200 start====");
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.example.actsscenegetallaccounts",
+ abilityName: "com.example.actsscenegetallaccounts.MainAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ },
+ );
+ setTimeout(async function(){
+ console.debug("====>getAllAccounts 1200 start====");
+ try{
+ var data = await appAccountManager.getAllAccounts(specifiedBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts 1200 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccounts 1200 data:" + JSON.stringify(data));
+ expect(data[0].name).assertEqual("account_name_scene_single");
+ expect(data[0].owner).assertEqual("com.example.actsscenegetallaccounts");
+ console.debug("====>ActsGetAllAccounts_1200 end====");
+ done();
+ }, TIMEOUT);
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_1300
+ * @tc.name : getAllAccounts callback
+ * @tc.desc : The parameter owner is a bundlename that does not exist
+ */
+ it('ActsGetAllAccounts_1300', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_1300 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var nonexistentBundle = "com.example.actsgetallaccountsnonexistent";
+ appAccountManager.getAllAccounts(nonexistentBundle, (err, data)=>{
+ console.debug("====>getAllAccounts 1300 err:" + JSON.stringify(err));
+ expect(err.code != 0).assertEqual(true);
+ console.debug("====>ActsGetAllAccounts_1300 end====");
+ done();
+ })
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_1400
+ * @tc.name : getAllAccounts promise
+ * @tc.desc : The parameter owner is a bundlename that does not exist
+ */
+ it('ActsGetAllAccounts_1400', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_1400 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var nonexistentBundle = "com.example.actsgetallaccountsnonexistent";
+ try{
+ var data = await appAccountManager.getAllAccounts(nonexistentBundle);
+ }
+ catch(err){
+ console.debug("====>getAllAccounts 1400 err:" + JSON.stringify(err));
+ expect(err.code != 0).assertEqual(true);
+ console.debug("====>ActsGetAllAccounts_1400 end====");
+ done();
+ }
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_1500
+ * @tc.name : getAllAccounts callback
+ * @tc.desc : Get account information after adding and deleting account
+ */
+ it('ActsGetAllAccounts_1500', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_1500 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var selfBundle = "com.example.actsgetallaaccounts";
+ appAccountManager.addAccount("account_callback_delete", (err)=>{
+ console.debug("====>add account 1500 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
+ console.debug("====>getAllAccounts 1500 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccounts 1500 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data[0].name).assertEqual("account_callback_delete");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
+ appAccountManager.deleteAccount("account_callback_delete", (err)=>{
+ console.debug("====>delete account 1500 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
+ console.debug("====>getAllAccounts 1500 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccounts 1500 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data.length).assertEqual(0);
+ console.debug("====>ActsGetAllAccounts_1500 end====");
+ done();
+ })
+ });
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_1600
+ * @tc.name : getAllAccounts promise
+ * @tc.desc : Get account information after adding and deleting account
+ */
+ it('ActsGetAllAccounts_1600', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_1600 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>getAllAccounts for clean====");
+ var selfBundle = "com.example.actsgetallaaccounts";
+ try{
+ var acclist = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>account list length: " + acclist.length);
+ if(acclist.length > 0){
+ for(var i = 0;i < acclist.length; i++){
+ await appAccountManager.deleteAccount(acclist[i].name);
+ }
+ }
+ console.debug("====>add account 1600 start====");
+ await appAccountManager.addAccount("account_promise_delete");
+ console.debug("====>first getAllAccounts 1600 start====");
+ try{
+ var data = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts 1600 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ expect(data[0].name).assertEqual("account_promise_delete");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
+ console.debug("====>delete account 1600 start====");
+ await appAccountManager.deleteAccount("account_promise_delete");
+ console.debug("====>second getAllAccounts 1600 start====");
+ try{
+ var dataDelete = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>second getAllAccounts 1600 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ expect(dataDelete.length).assertEqual(0);
+ console.debug("====>ActsGetAllAccounts_1600 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_1700
+ * @tc.name : getAllAccounts callback
+ * @tc.desc : Get account information after adding an account with additional information and deleting an
+ * account
+ */
+ it('ActsGetAllAccounts_1700', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_1700 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var selfBundle = "com.example.actsgetallaaccounts";
+ appAccountManager.addAccount("account_callback_additional", "account_extrainfo", (err)=>{
+ console.debug("====>add account 1700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
+ console.debug("====>getAllAccounts 1700 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccounts 1700 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data[0].name).assertEqual("account_callback_additional");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
+ appAccountManager.deleteAccount("account_callback_additional", (err)=>{
+ console.debug("====>delete account 1700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.getAllAccounts(selfBundle, (err, data)=>{
+ console.debug("====>getAllAccounts 1700 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccounts 1700 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data.length).assertEqual(0);
+ console.debug("====>ActsGetAllAccounts_1700 end====");
+ done();
+ })
+ });
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccounts_1800
+ * @tc.name : getAllAccounts promise
+ * @tc.desc : Get account information after adding an account with additional information and deleting an
+ * account
+ */
+ it('ActsGetAllAccounts_1800', 0, async function (done) {
+ console.debug("====>ActsGetAllAccounts_1800 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>getAllAccounts for clean====");
+ var selfBundle = "com.example.actsgetallaaccounts";
+ try{
+ var acclist = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>account list length: " + acclist.length);
+ if(acclist.length > 0){
+ for(var i = 0;i < acclist.length; i++){
+ await appAccountManager.deleteAccount(acclist[i].name);
+ }
+ }
+ console.debug("====>add account 1800 start====");
+ await appAccountManager.addAccount("account_promise_additional", "account_extrainfo");
+ console.debug("====>first getAllAccounts 1800 start====");
+ try{
+ var data = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts 1800 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>first getAllAccounts 1800 data:" + JSON.stringify(data));
+ expect(data[0].name).assertEqual("account_promise_additional");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaaccounts");
+ console.debug("====>delete account 1800 start====");
+ await appAccountManager.deleteAccount("account_promise_additional");
+ console.debug("====>second getAllAccounts 1800 start====");
+ try{
+ var dataDelete = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>second getAllAccounts 1800 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>second getAllAccounts 1800 data:" + JSON.stringify(data));
+ expect(dataDelete.length).assertEqual(0);
+ console.debug("====>ActsGetAllAccounts_1800 end====");
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/account/appaccount/actsgetallaccounts/src/main/js/test/List.test.js b/account/appaccount/actsgetallaccounts/src/main/js/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..70b68168e70f2b5e0484dba90d8608c4ba165c02
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * 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 ActsGetAllAccounts from './Getallaccounts.test.js'
+
+export default function testsuite() {
+ ActsGetAllAccounts()
+}
\ No newline at end of file
diff --git a/account/appaccount/actsgetallaccounts/src/main/resources/base/element/string.json b/account/appaccount/actsgetallaccounts/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..6e2452f1a3264fe13ac62b7949e4776513ba5e9a
--- /dev/null
+++ b/account/appaccount/actsgetallaccounts/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ActsGetAllAccounts"
+ },
+ {
+ "name": "mainability_description",
+ "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
diff --git a/account/appaccount/actsgetallaccounts/entry/src/main/js/resources/base/media/icon.png b/account/appaccount/actsgetallaccounts/src/main/resources/base/media/icon.png
similarity index 100%
rename from account/appaccount/actsgetallaccounts/entry/src/main/js/resources/base/media/icon.png
rename to account/appaccount/actsgetallaccounts/src/main/resources/base/media/icon.png
diff --git a/account/appaccount/actssetchecksyncenable/BUILD.gn b/account/appaccount/actssetchecksyncenable/BUILD.gn
old mode 100755
new mode 100644
index a00df5595637b292659e9fe383860445599b4da5..2685a3a9d222842748502cafdd622189569e05ec
--- a/account/appaccount/actssetchecksyncenable/BUILD.gn
+++ b/account/appaccount/actssetchecksyncenable/BUILD.gn
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsSetCheckSyncEnableTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsSetCheckSyncEnableTest") {
hap_name = "ActsSetCheckSyncEnableTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/account/appaccount/actssetchecksyncenable/Test.json b/account/appaccount/actssetchecksyncenable/Test.json
old mode 100755
new mode 100644
index e9fe505081a3443b2fbe142916b486b14103dc45..5fe66209b7091cc06ef75b4386ffc8a206d8662c
--- a/account/appaccount/actssetchecksyncenable/Test.json
+++ b/account/appaccount/actssetchecksyncenable/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "60000",
- "package": "com.example.actssetchecksyncenable",
+ "bundle-name": "com.example.actssetchecksyncenable",
+ "package-name": "com.example.actssetchecksyncenable",
"shell-timeout": "60000"
},
"kits": [
diff --git a/account/appaccount/actssetchecksyncenable/entry/src/main/js/default/pages/index/index.css b/account/appaccount/actssetchecksyncenable/entry/src/main/js/default/pages/index/index.css
deleted file mode 100755
index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000
--- a/account/appaccount/actssetchecksyncenable/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
diff --git a/account/appaccount/actssetchecksyncenable/entry/src/main/js/default/pages/index/index.hml b/account/appaccount/actssetchecksyncenable/entry/src/main/js/default/pages/index/index.hml
deleted file mode 100755
index c45422b42d0bf788a1c2c0eb299a981f07ce8613..0000000000000000000000000000000000000000
--- a/account/appaccount/actssetchecksyncenable/entry/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{title}}
-
-
diff --git a/account/appaccount/actssetchecksyncenable/entry/src/main/js/resources/base/element/string.json b/account/appaccount/actssetchecksyncenable/entry/src/main/js/resources/base/element/string.json
deleted file mode 100755
index 52efec27776c61fecdfd7bd9c8f9bbb6e7e5e234..0000000000000000000000000000000000000000
--- a/account/appaccount/actssetchecksyncenable/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "ActsSetCheckSyncEnable"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/account/appaccount/actssetchecksyncenable/entry/src/main/js/test/Syncenable.test.js b/account/appaccount/actssetchecksyncenable/entry/src/main/js/test/Syncenable.test.js
deleted file mode 100755
index 28717aeb0cb307c9c2af367ab88eb55c2913fb36..0000000000000000000000000000000000000000
--- a/account/appaccount/actssetchecksyncenable/entry/src/main/js/test/Syncenable.test.js
+++ /dev/null
@@ -1,573 +0,0 @@
-/*
- * 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 abilityAccessCtrl from '@ohos.abilityAccessCtrl'
-import account from '@ohos.account.appAccount'
-import bundle from '@ohos.bundle'
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-
-const TIMEOUT = 2000;
-const PERMISSION_USER_SET = 1;
-const PERMISSION_USER_NAME = "ohos.permission.DISTRIBUTED_DATASYNC";
-var tokenID = undefined;
-describe('ActsSetCheckSyncEnable', function () {
- beforeAll(async function (done) {
- console.debug("====>beforeAll start====");
- var appInfo = await bundle.getApplicationInfo('com.example.actssetchecksyncenable', 0, 100);
- tokenID = appInfo.accessTokenId;
- console.debug("accessTokenId" + appInfo.accessTokenId + " bundleName:" + appInfo.bundleName);
- var atManager = abilityAccessCtrl.createAtManager();
- var result = await atManager.grantUserGrantedPermission(tokenID, PERMISSION_USER_NAME, PERMISSION_USER_SET);
- console.debug("tokenId" + tokenID + " result:" + result);
- sleep(TIMEOUT);
- console.debug("====>beforeAll end====");
- done();
- })
-
- function sleep(delay) {
- var start = (new Date()).getTime();
- while((new Date()).getTime() - start < delay) {
- continue;
- }
- }
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_0100
- * @tc.name : Check sync flag callback form
- * @tc.desc : Get the synchronization flag of the account that has not set the synchronization flag
- */
- it('ActsSetCheckSyncEnable_0100', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_0100 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- appAccountManager.addAccount("syncenable_callback_notset", (err)=>{
- console.debug("====>add account ActsSetCheckSyncEnable_0100 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.checkAppAccountSyncEnable("syncenable_callback_notset", (err, data)=>{
- console.debug("====>checkAppAccountSyncEnable 0100 err:" + JSON.stringify(err));
- console.debug("====>checkAppAccountSyncEnable 0100 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data).assertEqual(false);
- appAccountManager.deleteAccount("syncenable_callback_notset", (err)=>{
- console.debug("====>delete Account ActsSetCheckSyncEnable_0100 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsSetCheckSyncEnable_0100 end====");
- done();
- });
- })
- });
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_0200
- * @tc.name : Check sync flag promise form
- * @tc.desc : Get the synchronization flag of the account that has not set the synchronization flag
- */
- it('ActsSetCheckSyncEnable_0200', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_0200 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>add account ActsSetCheckSyncEnable_0200 start====");
- try{
- await appAccountManager.addAccount("syncenable_promise_notset");
- }
- catch(err){
- console.error("====>add account ActsSetCheckSyncEnable_0200 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_0200 start====");
- try{
- var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_notset");
- }
- catch(err){
- console.error("====>checkAppAccountSyncEnable 0200 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>checkAppAccountSyncEnable 0200 data:" + JSON.stringify(data));
- expect(data).assertEqual(false);
- console.debug("====>delete account ActsSetCheckSyncEnable_0200 start====");
- try{
- await appAccountManager.deleteAccount("syncenable_promise_notset");
- }
- catch(err){
- console.error("====>delete account 0200 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>ActsSetCheckSyncEnable_0200 end====");
- done();
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_0300
- * @tc.name : Check the set synchronization flag callback form
- * @tc.desc : Check the synchronization flag after setting the synchronization flag to true for the account
- */
- it('ActsSetCheckSyncEnable_0300', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_0300 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- appAccountManager.addAccount("syncenable_callback_settrue", (err)=>{
- console.debug("====>add account ActsSetCheckSyncEnable_0300 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.setAppAccountSyncEnable("syncenable_callback_settrue", true, (err)=>{
- console.debug("====>setAppAccountSyncEnable 0300 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.checkAppAccountSyncEnable("syncenable_callback_settrue", (err, data)=>{
- console.debug("====>checkAppAccountSyncEnable 0300 err:" + JSON.stringify(err));
- console.debug("====>checkAppAccountSyncEnable 0300 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data).assertEqual(true);
- appAccountManager.deleteAccount("syncenable_callback_settrue", (err)=>{
- console.debug("====>delete Account ActsSetCheckSyncEnable_0300 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsSetCheckSyncEnable_0300 end====");
- done();
- });
- })
- })
- });
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_0400
- * @tc.name : Check the set synchronization flag promise form
- * @tc.desc : Check the synchronization flag after setting the synchronization flag to true for the account
- */
- it('ActsSetCheckSyncEnable_0400', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_0400 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>add account ActsSetCheckSyncEnable_0400 start====");
- try{
- await appAccountManager.addAccount("syncenable_promise_settrue");
- }
- catch(err){
- console.error("====>add account ActsSetCheckSyncEnable_0400 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>setAppAccountSyncEnable ActsSetCheckSyncEnable_0400 start====");
- await appAccountManager.setAppAccountSyncEnable("syncenable_promise_settrue", true);
- console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_0400 start====");
- try{
- var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_settrue");
- }
- catch(err){
- console.error("====>checkAppAccountSyncEnable 0400 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>checkAppAccountSyncEnable 0400 data:" + JSON.stringify(data));
- expect(data).assertEqual(true);
- console.debug("====>delete account ActsSetCheckSyncEnable_0400 start====");
- try{
- await appAccountManager.deleteAccount("syncenable_promise_settrue");
- }
- catch(err){
- console.error("====>delete account 0400 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>ActsSetCheckSyncEnable_0400 end====");
- done();
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_0500
- * @tc.name : Check the set synchronization flag callback form
- * @tc.desc : Check the synchronization flag after setting the synchronization flag to false for the account
- */
- it('ActsSetCheckSyncEnable_0500', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_0500 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- appAccountManager.addAccount("syncenable_callback_setfalse", (err)=>{
- console.debug("====>add account ActsSetCheckSyncEnable_0500 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.setAppAccountSyncEnable("syncenable_callback_setfalse", false, (err)=>{
- console.debug("====>setAppAccountSyncEnable 0500 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.checkAppAccountSyncEnable("syncenable_callback_setfalse", (err, data)=>{
- console.debug("====>checkAppAccountSyncEnable 0500 err:" + JSON.stringify(err));
- console.debug("====>checkAppAccountSyncEnable 0500 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data).assertEqual(false);
- appAccountManager.deleteAccount("syncenable_callback_setfalse", (err)=>{
- console.debug("====>delete Account ActsSetCheckSyncEnable_0500 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsSetCheckSyncEnable_0500 end====");
- done();
- });
- })
- })
- });
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_0600
- * @tc.name : Check the set synchronization flag promise form
- * @tc.desc : Check the synchronization flag after setting the synchronization flag to false for the account
- */
- it('ActsSetCheckSyncEnable_0600', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_0600 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>add account ActsSetCheckSyncEnable_0600 start====");
- try{
- await appAccountManager.addAccount("syncenable_promise_setfalse");
- }
- catch(err){
- console.error("====>add account ActsSetCheckSyncEnable_0600 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>setAppAccountSyncEnable ActsSetCheckSyncEnable_0600 start====");
- await appAccountManager.setAppAccountSyncEnable("syncenable_promise_setfalse", false);
- console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_0600 start====");
- try{
- var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_setfalse");
- }
- catch(err){
- console.error("====>checkAppAccountSyncEnable 0600 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>checkAppAccountSyncEnable 0600 data:" + JSON.stringify(data));
- expect(data).assertEqual(false);
- console.debug("====>delete account ActsSetCheckSyncEnable_0600 start====");
- try{
- await appAccountManager.deleteAccount("syncenable_promise_setfalse");
- }
- catch(err){
- console.error("====>delete account 0600 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>ActsSetCheckSyncEnable_0600 end====");
- done();
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_0700
- * @tc.name : Check the set synchronization flag callback form
- * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to false
- * for the first time and true for the second time
- */
- it('ActsSetCheckSyncEnable_0700', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_0700 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- appAccountManager.addAccount("syncenable_callback_falsetrue", (err)=>{
- console.debug("====>add account ActsSetCheckSyncEnable_0700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", false, (err)=>{
- console.debug("====>setAppAccountSyncEnable first time 0700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", true, (err)=>{
- console.debug("====>setAppAccountSyncEnable second time 0700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.checkAppAccountSyncEnable("syncenable_callback_falsetrue", (err, data)=>{
- console.debug("====>checkAppAccountSyncEnable 0700 err:" + JSON.stringify(err));
- console.debug("====>checkAppAccountSyncEnable 0700 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data).assertEqual(true);
- appAccountManager.deleteAccount("syncenable_callback_falsetrue", (err)=>{
- console.debug("====>delete Account 0700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsSetCheckSyncEnable_0700 end====");
- done();
- });
- })
- })
- })
- });
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_0800
- * @tc.name : Check the set synchronization flag promise form
- * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to false
- * for the first time and true for the second time
- */
- it('ActsSetCheckSyncEnable_0800', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_0800 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>add account ActsSetCheckSyncEnable_0800 start====");
- await appAccountManager.addAccount("syncenable_promise_truefalse");
- console.debug("====>setAppAccountSyncEnable first time ActsSetCheckSyncEnable_0800 start====");
- await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truefalse", false);
- console.debug("====>setAppAccountSyncEnable second time ActsSetCheckSyncEnable_0800 start====");
- await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truefalse", true);
- console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_0800 start====");
- try{
- var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_truefalse");
- }
- catch(err){
- console.error("====>checkAppAccountSyncEnable 0800 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>checkAppAccountSyncEnable 0800 data:" + JSON.stringify(data));
- expect(data).assertEqual(true);
- console.debug("====>delete account ActsSetCheckSyncEnable_0800 start====");
- try{
- await appAccountManager.deleteAccount("syncenable_promise_truefalse");
- }
- catch(err){
- console.error("====>delete account 0800 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>ActsSetCheckSyncEnable_0800 end====");
- done();
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_0900
- * @tc.name : Check the set synchronization flag callback form
- * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true
- * for the first time and false for the second time
- */
- it('ActsSetCheckSyncEnable_0900', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_0900 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- appAccountManager.addAccount("syncenable_callback_falsetrue", (err)=>{
- console.debug("====>add account ActsSetCheckSyncEnable_0900 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", true, (err)=>{
- console.debug("====>setAppAccountSyncEnable first time 0900 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", false, (err)=>{
- console.debug("====>setAppAccountSyncEnable second time 0900 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.checkAppAccountSyncEnable("syncenable_callback_falsetrue", (err, data)=>{
- console.debug("====>checkAppAccountSyncEnable 0900 err:" + JSON.stringify(err));
- console.debug("====>checkAppAccountSyncEnable 0900 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data).assertEqual(false);
- appAccountManager.deleteAccount("syncenable_callback_falsetrue", (err)=>{
- console.debug("====>delete Account 0900 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsSetCheckSyncEnable_0900 end====");
- done();
- });
- })
- })
- })
- });
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_1000
- * @tc.name : Check the set synchronization flag promise form
- * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true
- * for the first time and false for the second time
- */
- it('ActsSetCheckSyncEnable_1000', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_1000 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>add account ActsSetCheckSyncEnable_1000 start====");
- await appAccountManager.addAccount("syncenable_promise_truefalse");
- console.debug("====>setAppAccountSyncEnable first time ActsSetCheckSyncEnable_1000 start====");
- await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truefalse", true);
- console.debug("====>setAppAccountSyncEnable second time ActsSetCheckSyncEnable_1000 start====");
- await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truefalse", false);
- console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_1000 start====");
- try{
- var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_truefalse");
- }
- catch(err){
- console.error("====>checkAppAccountSyncEnable 1000 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>checkAppAccountSyncEnable 1000 data:" + JSON.stringify(data));
- expect(data).assertEqual(false);
- console.debug("====>delete account ActsSetCheckSyncEnable_1000 start====");
- try{
- await appAccountManager.deleteAccount("syncenable_promise_truefalse");
- }
- catch(err){
- console.error("====>delete account 1000 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>ActsSetCheckSyncEnable_1000 end====");
- done();
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_1100
- * @tc.name : Check the set synchronization flag callback form
- * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true
- * for the first time and true for the second time
- */
- it('ActsSetCheckSyncEnable_1100', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_1100 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- appAccountManager.addAccount("syncenable_callback_truetrue", (err)=>{
- console.debug("====>add account ActsSetCheckSyncEnable_1100 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.setAppAccountSyncEnable("syncenable_callback_truetrue", true, (err)=>{
- console.debug("====>setAppAccountSyncEnable first time 1100 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.setAppAccountSyncEnable("syncenable_callback_truetrue", true, (err)=>{
- console.debug("====>setAppAccountSyncEnable second time 1100 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.checkAppAccountSyncEnable("syncenable_callback_truetrue", (err, data)=>{
- console.debug("====>checkAppAccountSyncEnable 1100 err:" + JSON.stringify(err));
- console.debug("====>checkAppAccountSyncEnable 1100 data:" + JSON.stringify(data));
- expect(err.code).assertEqual(0);
- expect(data).assertEqual(true);
- appAccountManager.deleteAccount("syncenable_callback_truetrue", (err)=>{
- console.debug("====>delete Account 1100 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsSetCheckSyncEnable_1100 end====");
- done();
- });
- })
- })
- })
- });
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_1200
- * @tc.name : Check the set synchronization flag promise form
- * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true
- * for the true time and true for the second time
- */
- it('ActsSetCheckSyncEnable_1200', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_1200 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>add account ActsSetCheckSyncEnable_1200 start====");
- await appAccountManager.addAccount("syncenable_promise_truetrue");
- console.debug("====>setAppAccountSyncEnable first time ActsSetCheckSyncEnable_1200 start====");
- await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truetrue", true);
- console.debug("====>setAppAccountSyncEnable second time ActsSetCheckSyncEnable_1200 start====");
- await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truetrue", true);
- console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_1200 start====");
- try{
- var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_truetrue");
- }
- catch(err){
- console.error("====>checkAppAccountSyncEnable 1200 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>checkAppAccountSyncEnable 1200 data:" + JSON.stringify(data));
- expect(data).assertEqual(true);
- console.debug("====>delete account ActsSetCheckSyncEnable_1200 start====");
- try{
- await appAccountManager.deleteAccount("syncenable_promise_truetrue");
- }
- catch(err){
- console.error("====>delete account 1200 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>ActsSetCheckSyncEnable_1200 end====");
- done();
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_1300
- * @tc.name : setAppAccountSyncEnable callback form
- * @tc.desc : Set synchronization flag for non-existent account
- */
- it('ActsSetCheckSyncEnable_1300', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_1300 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>setAppAccountSyncEnable ActsSetCheckSyncEnable_1300 start====")
- var accountNotExist = "syncenable_callback_notexist";
- appAccountManager.setAppAccountSyncEnable(accountNotExist, true, (err)=>{
- console.debug("====>setAppAccountSyncEnable 1300 err:" + JSON.stringify(err));
- expect(err.code != 0).assertEqual(true);
- console.debug("====>ActsSetCheckSyncEnable_1300 end====");
- done();
- });
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_1400
- * @tc.name : setAppAccountSyncEnable promise form
- * @tc.desc : Set synchronization flag for non-existent account
- */
- it('ActsSetCheckSyncEnable_1400', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_1400 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>setAppAccountSyncEnable ActsSetCheckSyncEnable_1400 start====")
- var accountNotExist = "syncenable_promise_notexist";
- try{
- await appAccountManager.setAppAccountSyncEnable(accountNotExist, true);
- }
- catch(err){
- console.debug("====>setAppAccountSyncEnable 1400 err:" + JSON.stringify(err));
- expect(err.code != 0).assertEqual(true);
- console.debug("====>ActsSetCheckSyncEnable_1400 end====");
- done();
- }
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_1500
- * @tc.name : checkAppAccountSyncEnable callback form
- * @tc.desc : Check synchronization flag for non-existent account
- */
- it('ActsSetCheckSyncEnable_1500', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_1500 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_1500 start====")
- var accountNotExist = "syncenable_callback_notexist";
- appAccountManager.checkAppAccountSyncEnable(accountNotExist, (err, data)=>{
- console.debug("====>checkAppAccountSyncEnable 1500 err:" + JSON.stringify(err));
- expect(err.code != 0).assertEqual(true);
- console.debug("====>ActsSetCheckSyncEnable_1500 end====");
- done();
- });
- });
-
- /*
- * @tc.number : ActsSetCheckSyncEnable_1600
- * @tc.name : checkAppAccountSyncEnable promise form
- * @tc.desc : Check synchronization flag for non-existent account
- */
- it('ActsSetCheckSyncEnable_1600', 0, async function (done) {
- console.debug("====>ActsSetCheckSyncEnable_1600 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_1600 start====")
- var accountNotExist = "syncenable_promise_notexist";
- try{
- await appAccountManager.checkAppAccountSyncEnable(accountNotExist);
- }
- catch(err){
- console.debug("====>checkAppAccountSyncEnable 1600 err:" + JSON.stringify(err));
- expect(err.code != 0).assertEqual(true);
- console.debug("====>ActsSetCheckSyncEnable_1600 end====");
- done();
- }
- });
-})
\ No newline at end of file
diff --git a/account/appaccount/actssetchecksyncenable/entry/src/main/config.json b/account/appaccount/actssetchecksyncenable/src/main/config.json
old mode 100755
new mode 100644
similarity index 54%
rename from account/appaccount/actssetchecksyncenable/entry/src/main/config.json
rename to account/appaccount/actssetchecksyncenable/src/main/config.json
index ff2b444eb672b7aeb4b9ec215db5a5eb13e56882..b0165606aae85d240e2eafa83def35d3283edd77
--- a/account/appaccount/actssetchecksyncenable/entry/src/main/config.json
+++ b/account/appaccount/actssetchecksyncenable/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actssetchecksyncenable",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -63,25 +65,42 @@
],
"abilities": [
{
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.actssetchecksyncenable.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "visible": true,
- "launchType": "standard"
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "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,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
}
- ],
+ ],
"js": [
{
"pages": [
@@ -92,7 +111,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/account/appaccount/actssetchecksyncenable/entry/src/main/js/default/app.js b/account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/app.js
similarity index 100%
rename from account/appaccount/actssetchecksyncenable/entry/src/main/js/default/app.js
rename to account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/app.js
diff --git a/account/appaccount/actssetchecksyncenable/entry/src/main/js/default/i18n/en-US.json b/account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from account/appaccount/actssetchecksyncenable/entry/src/main/js/default/i18n/en-US.json
rename to account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/i18n/en-US.json
diff --git a/account/appaccount/actssetchecksyncenable/entry/src/main/js/default/i18n/zh-CN.json b/account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from account/appaccount/actssetchecksyncenable/entry/src/main/js/default/i18n/zh-CN.json
rename to account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/pages/index/index.css b/account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2334ecfa2c147f276998e82e2c35f62800cfb031
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/pages/index/index.css
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/pages/index/index.hml b/account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..58fdc144440ca578003fa3982fb8d0029cc2cdc7
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/pages/index/index.hml
@@ -0,0 +1,19 @@
+
+
+
+ {{title}}
+
+
diff --git a/account/appaccount/actssetchecksyncenable/entry/src/main/js/default/pages/index/index.js b/account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/pages/index/index.js
old mode 100755
new mode 100644
similarity index 71%
rename from account/appaccount/actssetchecksyncenable/entry/src/main/js/default/pages/index/index.js
rename to account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/pages/index/index.js
index 833a9bb4aa89f758ccc76f5f665d1783f1d68127..8406ae5685de38b44c93e31e36d151e91bd45765
--- a/account/appaccount/actssetchecksyncenable/entry/src/main/js/default/pages/index/index.js
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/MainAbility/pages/index/index.js
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
@@ -26,18 +25,7 @@ export default {
},
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() {
},
diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/app.js b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/i18n/en-US.json b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/i18n/zh-CN.json b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/pages/index/index.css b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2b45eb97c17e67ef5d63436aad8998113aa95d6d
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+.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;
+}
+.btn {
+ width: 50%;
+ height: 100px;
+ font-size: 40px;
+}
+
+@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
diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/pages/index/index.hml b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/pages/index/index.js b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/appaccount/actssetchecksyncenable/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/test/List.test.js b/account/appaccount/actssetchecksyncenable/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..05e8923741b667e1950d05116da8a76e39f61f05
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * 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 ActsSetCheckSyncEnable from './Syncenable.test.js'
+
+export default function testsuite() {
+ ActsSetCheckSyncEnable()
+}
\ No newline at end of file
diff --git a/account/appaccount/actssetchecksyncenable/src/main/js/test/Syncenable.test.js b/account/appaccount/actssetchecksyncenable/src/main/js/test/Syncenable.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..744c7eed203a6630db12471259bd5ad3b7c508bc
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/js/test/Syncenable.test.js
@@ -0,0 +1,575 @@
+/*
+ * 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 abilityAccessCtrl from '@ohos.abilityAccessCtrl'
+import account from '@ohos.account.appAccount'
+import bundle from '@ohos.bundle'
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+const TIMEOUT = 2000;
+const PERMISSION_USER_SET = 1;
+const PERMISSION_USER_NAME = "ohos.permission.DISTRIBUTED_DATASYNC";
+var tokenID = undefined;
+export default function ActsSetCheckSyncEnable() {
+ describe('ActsSetCheckSyncEnable', function () {
+ beforeAll(async function (done) {
+ console.debug("====>beforeAll start====");
+ var appInfo = await bundle.getApplicationInfo('com.example.actssetchecksyncenable', 0, 100);
+ tokenID = appInfo.accessTokenId;
+ console.debug("accessTokenId" + appInfo.accessTokenId + " bundleName:" + appInfo.bundleName);
+ var atManager = abilityAccessCtrl.createAtManager();
+ var result = await atManager.grantUserGrantedPermission(tokenID, PERMISSION_USER_NAME, PERMISSION_USER_SET);
+ console.debug("tokenId" + tokenID + " result:" + result);
+ sleep(TIMEOUT);
+ console.debug("====>beforeAll end====");
+ done();
+ })
+
+ function sleep(delay) {
+ var start = (new Date()).getTime();
+ while((new Date()).getTime() - start < delay) {
+ continue;
+ }
+ }
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_0100
+ * @tc.name : Check sync flag callback form
+ * @tc.desc : Get the synchronization flag of the account that has not set the synchronization flag
+ */
+ it('ActsSetCheckSyncEnable_0100', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_0100 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ appAccountManager.addAccount("syncenable_callback_notset", (err)=>{
+ console.debug("====>add account ActsSetCheckSyncEnable_0100 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.checkAppAccountSyncEnable("syncenable_callback_notset", (err, data)=>{
+ console.debug("====>checkAppAccountSyncEnable 0100 err:" + JSON.stringify(err));
+ console.debug("====>checkAppAccountSyncEnable 0100 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data).assertEqual(false);
+ appAccountManager.deleteAccount("syncenable_callback_notset", (err)=>{
+ console.debug("====>delete Account ActsSetCheckSyncEnable_0100 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsSetCheckSyncEnable_0100 end====");
+ done();
+ });
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_0200
+ * @tc.name : Check sync flag promise form
+ * @tc.desc : Get the synchronization flag of the account that has not set the synchronization flag
+ */
+ it('ActsSetCheckSyncEnable_0200', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_0200 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>add account ActsSetCheckSyncEnable_0200 start====");
+ try{
+ await appAccountManager.addAccount("syncenable_promise_notset");
+ }
+ catch(err){
+ console.error("====>add account ActsSetCheckSyncEnable_0200 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_0200 start====");
+ try{
+ var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_notset");
+ }
+ catch(err){
+ console.error("====>checkAppAccountSyncEnable 0200 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>checkAppAccountSyncEnable 0200 data:" + JSON.stringify(data));
+ expect(data).assertEqual(false);
+ console.debug("====>delete account ActsSetCheckSyncEnable_0200 start====");
+ try{
+ await appAccountManager.deleteAccount("syncenable_promise_notset");
+ }
+ catch(err){
+ console.error("====>delete account 0200 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>ActsSetCheckSyncEnable_0200 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_0300
+ * @tc.name : Check the set synchronization flag callback form
+ * @tc.desc : Check the synchronization flag after setting the synchronization flag to true for the account
+ */
+ it('ActsSetCheckSyncEnable_0300', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_0300 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ appAccountManager.addAccount("syncenable_callback_settrue", (err)=>{
+ console.debug("====>add account ActsSetCheckSyncEnable_0300 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.setAppAccountSyncEnable("syncenable_callback_settrue", true, (err)=>{
+ console.debug("====>setAppAccountSyncEnable 0300 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.checkAppAccountSyncEnable("syncenable_callback_settrue", (err, data)=>{
+ console.debug("====>checkAppAccountSyncEnable 0300 err:" + JSON.stringify(err));
+ console.debug("====>checkAppAccountSyncEnable 0300 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data).assertEqual(true);
+ appAccountManager.deleteAccount("syncenable_callback_settrue", (err)=>{
+ console.debug("====>delete Account ActsSetCheckSyncEnable_0300 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsSetCheckSyncEnable_0300 end====");
+ done();
+ });
+ })
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_0400
+ * @tc.name : Check the set synchronization flag promise form
+ * @tc.desc : Check the synchronization flag after setting the synchronization flag to true for the account
+ */
+ it('ActsSetCheckSyncEnable_0400', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_0400 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>add account ActsSetCheckSyncEnable_0400 start====");
+ try{
+ await appAccountManager.addAccount("syncenable_promise_settrue");
+ }
+ catch(err){
+ console.error("====>add account ActsSetCheckSyncEnable_0400 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>setAppAccountSyncEnable ActsSetCheckSyncEnable_0400 start====");
+ await appAccountManager.setAppAccountSyncEnable("syncenable_promise_settrue", true);
+ console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_0400 start====");
+ try{
+ var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_settrue");
+ }
+ catch(err){
+ console.error("====>checkAppAccountSyncEnable 0400 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>checkAppAccountSyncEnable 0400 data:" + JSON.stringify(data));
+ expect(data).assertEqual(true);
+ console.debug("====>delete account ActsSetCheckSyncEnable_0400 start====");
+ try{
+ await appAccountManager.deleteAccount("syncenable_promise_settrue");
+ }
+ catch(err){
+ console.error("====>delete account 0400 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>ActsSetCheckSyncEnable_0400 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_0500
+ * @tc.name : Check the set synchronization flag callback form
+ * @tc.desc : Check the synchronization flag after setting the synchronization flag to false for the account
+ */
+ it('ActsSetCheckSyncEnable_0500', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_0500 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ appAccountManager.addAccount("syncenable_callback_setfalse", (err)=>{
+ console.debug("====>add account ActsSetCheckSyncEnable_0500 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.setAppAccountSyncEnable("syncenable_callback_setfalse", false, (err)=>{
+ console.debug("====>setAppAccountSyncEnable 0500 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.checkAppAccountSyncEnable("syncenable_callback_setfalse", (err, data)=>{
+ console.debug("====>checkAppAccountSyncEnable 0500 err:" + JSON.stringify(err));
+ console.debug("====>checkAppAccountSyncEnable 0500 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data).assertEqual(false);
+ appAccountManager.deleteAccount("syncenable_callback_setfalse", (err)=>{
+ console.debug("====>delete Account ActsSetCheckSyncEnable_0500 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsSetCheckSyncEnable_0500 end====");
+ done();
+ });
+ })
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_0600
+ * @tc.name : Check the set synchronization flag promise form
+ * @tc.desc : Check the synchronization flag after setting the synchronization flag to false for the account
+ */
+ it('ActsSetCheckSyncEnable_0600', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_0600 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>add account ActsSetCheckSyncEnable_0600 start====");
+ try{
+ await appAccountManager.addAccount("syncenable_promise_setfalse");
+ }
+ catch(err){
+ console.error("====>add account ActsSetCheckSyncEnable_0600 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>setAppAccountSyncEnable ActsSetCheckSyncEnable_0600 start====");
+ await appAccountManager.setAppAccountSyncEnable("syncenable_promise_setfalse", false);
+ console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_0600 start====");
+ try{
+ var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_setfalse");
+ }
+ catch(err){
+ console.error("====>checkAppAccountSyncEnable 0600 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>checkAppAccountSyncEnable 0600 data:" + JSON.stringify(data));
+ expect(data).assertEqual(false);
+ console.debug("====>delete account ActsSetCheckSyncEnable_0600 start====");
+ try{
+ await appAccountManager.deleteAccount("syncenable_promise_setfalse");
+ }
+ catch(err){
+ console.error("====>delete account 0600 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>ActsSetCheckSyncEnable_0600 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_0700
+ * @tc.name : Check the set synchronization flag callback form
+ * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to false
+ * for the first time and true for the second time
+ */
+ it('ActsSetCheckSyncEnable_0700', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_0700 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ appAccountManager.addAccount("syncenable_callback_falsetrue", (err)=>{
+ console.debug("====>add account ActsSetCheckSyncEnable_0700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", false, (err)=>{
+ console.debug("====>setAppAccountSyncEnable first time 0700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", true, (err)=>{
+ console.debug("====>setAppAccountSyncEnable second time 0700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.checkAppAccountSyncEnable("syncenable_callback_falsetrue", (err, data)=>{
+ console.debug("====>checkAppAccountSyncEnable 0700 err:" + JSON.stringify(err));
+ console.debug("====>checkAppAccountSyncEnable 0700 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data).assertEqual(true);
+ appAccountManager.deleteAccount("syncenable_callback_falsetrue", (err)=>{
+ console.debug("====>delete Account 0700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsSetCheckSyncEnable_0700 end====");
+ done();
+ });
+ })
+ })
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_0800
+ * @tc.name : Check the set synchronization flag promise form
+ * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to false
+ * for the first time and true for the second time
+ */
+ it('ActsSetCheckSyncEnable_0800', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_0800 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>add account ActsSetCheckSyncEnable_0800 start====");
+ await appAccountManager.addAccount("syncenable_promise_truefalse");
+ console.debug("====>setAppAccountSyncEnable first time ActsSetCheckSyncEnable_0800 start====");
+ await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truefalse", false);
+ console.debug("====>setAppAccountSyncEnable second time ActsSetCheckSyncEnable_0800 start====");
+ await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truefalse", true);
+ console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_0800 start====");
+ try{
+ var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_truefalse");
+ }
+ catch(err){
+ console.error("====>checkAppAccountSyncEnable 0800 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>checkAppAccountSyncEnable 0800 data:" + JSON.stringify(data));
+ expect(data).assertEqual(true);
+ console.debug("====>delete account ActsSetCheckSyncEnable_0800 start====");
+ try{
+ await appAccountManager.deleteAccount("syncenable_promise_truefalse");
+ }
+ catch(err){
+ console.error("====>delete account 0800 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>ActsSetCheckSyncEnable_0800 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_0900
+ * @tc.name : Check the set synchronization flag callback form
+ * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true
+ * for the first time and false for the second time
+ */
+ it('ActsSetCheckSyncEnable_0900', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_0900 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ appAccountManager.addAccount("syncenable_callback_falsetrue", (err)=>{
+ console.debug("====>add account ActsSetCheckSyncEnable_0900 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", true, (err)=>{
+ console.debug("====>setAppAccountSyncEnable first time 0900 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.setAppAccountSyncEnable("syncenable_callback_falsetrue", false, (err)=>{
+ console.debug("====>setAppAccountSyncEnable second time 0900 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.checkAppAccountSyncEnable("syncenable_callback_falsetrue", (err, data)=>{
+ console.debug("====>checkAppAccountSyncEnable 0900 err:" + JSON.stringify(err));
+ console.debug("====>checkAppAccountSyncEnable 0900 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data).assertEqual(false);
+ appAccountManager.deleteAccount("syncenable_callback_falsetrue", (err)=>{
+ console.debug("====>delete Account 0900 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsSetCheckSyncEnable_0900 end====");
+ done();
+ });
+ })
+ })
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_1000
+ * @tc.name : Check the set synchronization flag promise form
+ * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true
+ * for the first time and false for the second time
+ */
+ it('ActsSetCheckSyncEnable_1000', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_1000 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>add account ActsSetCheckSyncEnable_1000 start====");
+ await appAccountManager.addAccount("syncenable_promise_truefalse");
+ console.debug("====>setAppAccountSyncEnable first time ActsSetCheckSyncEnable_1000 start====");
+ await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truefalse", true);
+ console.debug("====>setAppAccountSyncEnable second time ActsSetCheckSyncEnable_1000 start====");
+ await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truefalse", false);
+ console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_1000 start====");
+ try{
+ var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_truefalse");
+ }
+ catch(err){
+ console.error("====>checkAppAccountSyncEnable 1000 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>checkAppAccountSyncEnable 1000 data:" + JSON.stringify(data));
+ expect(data).assertEqual(false);
+ console.debug("====>delete account ActsSetCheckSyncEnable_1000 start====");
+ try{
+ await appAccountManager.deleteAccount("syncenable_promise_truefalse");
+ }
+ catch(err){
+ console.error("====>delete account 1000 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>ActsSetCheckSyncEnable_1000 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_1100
+ * @tc.name : Check the set synchronization flag callback form
+ * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true
+ * for the first time and true for the second time
+ */
+ it('ActsSetCheckSyncEnable_1100', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_1100 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ appAccountManager.addAccount("syncenable_callback_truetrue", (err)=>{
+ console.debug("====>add account ActsSetCheckSyncEnable_1100 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.setAppAccountSyncEnable("syncenable_callback_truetrue", true, (err)=>{
+ console.debug("====>setAppAccountSyncEnable first time 1100 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.setAppAccountSyncEnable("syncenable_callback_truetrue", true, (err)=>{
+ console.debug("====>setAppAccountSyncEnable second time 1100 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.checkAppAccountSyncEnable("syncenable_callback_truetrue", (err, data)=>{
+ console.debug("====>checkAppAccountSyncEnable 1100 err:" + JSON.stringify(err));
+ console.debug("====>checkAppAccountSyncEnable 1100 data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data).assertEqual(true);
+ appAccountManager.deleteAccount("syncenable_callback_truetrue", (err)=>{
+ console.debug("====>delete Account 1100 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsSetCheckSyncEnable_1100 end====");
+ done();
+ });
+ })
+ })
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_1200
+ * @tc.name : Check the set synchronization flag promise form
+ * @tc.desc : Check the synchronization flag after setting the synchronization flag for the account to true
+ * for the true time and true for the second time
+ */
+ it('ActsSetCheckSyncEnable_1200', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_1200 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>add account ActsSetCheckSyncEnable_1200 start====");
+ await appAccountManager.addAccount("syncenable_promise_truetrue");
+ console.debug("====>setAppAccountSyncEnable first time ActsSetCheckSyncEnable_1200 start====");
+ await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truetrue", true);
+ console.debug("====>setAppAccountSyncEnable second time ActsSetCheckSyncEnable_1200 start====");
+ await appAccountManager.setAppAccountSyncEnable("syncenable_promise_truetrue", true);
+ console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_1200 start====");
+ try{
+ var data = await appAccountManager.checkAppAccountSyncEnable("syncenable_promise_truetrue");
+ }
+ catch(err){
+ console.error("====>checkAppAccountSyncEnable 1200 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>checkAppAccountSyncEnable 1200 data:" + JSON.stringify(data));
+ expect(data).assertEqual(true);
+ console.debug("====>delete account ActsSetCheckSyncEnable_1200 start====");
+ try{
+ await appAccountManager.deleteAccount("syncenable_promise_truetrue");
+ }
+ catch(err){
+ console.error("====>delete account 1200 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>ActsSetCheckSyncEnable_1200 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_1300
+ * @tc.name : setAppAccountSyncEnable callback form
+ * @tc.desc : Set synchronization flag for non-existent account
+ */
+ it('ActsSetCheckSyncEnable_1300', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_1300 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>setAppAccountSyncEnable ActsSetCheckSyncEnable_1300 start====")
+ var accountNotExist = "syncenable_callback_notexist";
+ appAccountManager.setAppAccountSyncEnable(accountNotExist, true, (err)=>{
+ console.debug("====>setAppAccountSyncEnable 1300 err:" + JSON.stringify(err));
+ expect(err.code != 0).assertEqual(true);
+ console.debug("====>ActsSetCheckSyncEnable_1300 end====");
+ done();
+ });
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_1400
+ * @tc.name : setAppAccountSyncEnable promise form
+ * @tc.desc : Set synchronization flag for non-existent account
+ */
+ it('ActsSetCheckSyncEnable_1400', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_1400 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>setAppAccountSyncEnable ActsSetCheckSyncEnable_1400 start====")
+ var accountNotExist = "syncenable_promise_notexist";
+ try{
+ await appAccountManager.setAppAccountSyncEnable(accountNotExist, true);
+ }
+ catch(err){
+ console.debug("====>setAppAccountSyncEnable 1400 err:" + JSON.stringify(err));
+ expect(err.code != 0).assertEqual(true);
+ console.debug("====>ActsSetCheckSyncEnable_1400 end====");
+ done();
+ }
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_1500
+ * @tc.name : checkAppAccountSyncEnable callback form
+ * @tc.desc : Check synchronization flag for non-existent account
+ */
+ it('ActsSetCheckSyncEnable_1500', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_1500 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_1500 start====")
+ var accountNotExist = "syncenable_callback_notexist";
+ appAccountManager.checkAppAccountSyncEnable(accountNotExist, (err, data)=>{
+ console.debug("====>checkAppAccountSyncEnable 1500 err:" + JSON.stringify(err));
+ expect(err.code != 0).assertEqual(true);
+ console.debug("====>ActsSetCheckSyncEnable_1500 end====");
+ done();
+ });
+ });
+
+ /*
+ * @tc.number : ActsSetCheckSyncEnable_1600
+ * @tc.name : checkAppAccountSyncEnable promise form
+ * @tc.desc : Check synchronization flag for non-existent account
+ */
+ it('ActsSetCheckSyncEnable_1600', 0, async function (done) {
+ console.debug("====>ActsSetCheckSyncEnable_1600 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>checkAppAccountSyncEnable ActsSetCheckSyncEnable_1600 start====")
+ var accountNotExist = "syncenable_promise_notexist";
+ try{
+ await appAccountManager.checkAppAccountSyncEnable(accountNotExist);
+ }
+ catch(err){
+ console.debug("====>checkAppAccountSyncEnable 1600 err:" + JSON.stringify(err));
+ expect(err.code != 0).assertEqual(true);
+ console.debug("====>ActsSetCheckSyncEnable_1600 end====");
+ done();
+ }
+ });
+ })
+}
\ No newline at end of file
diff --git a/account/appaccount/actssetchecksyncenable/src/main/resources/base/element/string.json b/account/appaccount/actssetchecksyncenable/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..89f90a73a8b24448128dffdbcc82cd52cf23b287
--- /dev/null
+++ b/account/appaccount/actssetchecksyncenable/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ActsSetCheckSyncEnable"
+ },
+ {
+ "name": "mainability_description",
+ "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
diff --git a/account/appaccount/actssetchecksyncenable/entry/src/main/js/resources/base/media/icon.png b/account/appaccount/actssetchecksyncenable/src/main/resources/base/media/icon.png
similarity index 100%
rename from account/appaccount/actssetchecksyncenable/entry/src/main/js/resources/base/media/icon.png
rename to account/appaccount/actssetchecksyncenable/src/main/resources/base/media/icon.png
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/BUILD.gn b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/BUILD.gn
old mode 100755
new mode 100644
index bd5eb5c50e21fdd29492e042e78090d1cee16ad7..d4715915c84eef6893b37b23e9ebb8d09b9fc024
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/BUILD.gn
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/BUILD.gn
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsGetAllAccessibleAccountsTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsGetAllAccessibleAccountsTest") {
hap_name = "ActsGetAllAccessibleAccountsTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/Test.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/Test.json
old mode 100755
new mode 100644
index 5d4ffe786f92dff3cb890571c3d039541e3dc4df..6fb55ad4a9239f9da111387d444d334aaa30c26e
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/Test.json
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "60000",
- "package": "com.example.actsgetallaccessibleaccounts",
+ "bundle-name": "com.example.actsgetallaccessibleaccounts",
+ "package-name": "com.example.actsgetallaccessibleaccounts",
"shell-timeout": "60000"
},
"kits": [
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/pages/index/index.css b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/pages/index/index.css
deleted file mode 100755
index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/pages/index/index.hml b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/pages/index/index.hml
deleted file mode 100755
index c45422b42d0bf788a1c2c0eb299a981f07ce8613..0000000000000000000000000000000000000000
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{title}}
-
-
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/resources/base/element/string.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/resources/base/element/string.json
deleted file mode 100755
index 9df422fd35d93a0806182ffcfea798416104bb52..0000000000000000000000000000000000000000
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "ActsGetAllAccessibleAccounts"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/test/Getallaccessible.test.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/test/Getallaccessible.test.js
deleted file mode 100755
index 29f0b71f9c3f8c2944891c800bb99c08b660a30a..0000000000000000000000000000000000000000
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/test/Getallaccessible.test.js
+++ /dev/null
@@ -1,601 +0,0 @@
-/*
- * 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.appAccount'
-import featureAbility from '@ohos.ability.featureAbility'
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-
-const TIMEOUT = 2000;
-describe('ActsGetAllAccessibleAccounts', function () {
-
- /*
- * @tc.number : ActsGetAllAccessibleAccounts_0100
- * @tc.name : getAllAccessibleAccounts callback
- * @tc.desc : This application has not added an account and has not been authorized by other applications to
- * obtain authorization
- */
- it('ActsGetAllAccessibleAccounts_0100', 0, async function (done) {
- console.debug("====>ActsGetAllAccessibleAccounts_0100 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- appAccountManager.getAllAccessibleAccounts((err, data)=>{
- console.debug("====>getAllAccessibleAccounts 0100 err:" + JSON.stringify(err));
- console.debug("====>getAllAccessibleAccounts 0100 data:" + JSON.stringify(data));
- console.debug("====>getAllAccessibleAccounts 0100 data.length:" + data.length);
- expect(err.code).assertEqual(0);
- expect(data.length).assertEqual(0);
- console.debug("====>ActsGetAllAccessibleAccounts_0100 end====");
- done();
- });
- });
-
- /*
- * @tc.number : ActsGetAllAccessibleAccounts_0200
- * @tc.name : getAllAccessibleAccounts promise
- * @tc.desc : This application has not added an account and has not been authorized by other applications to
- * obtain authorization
- */
- it('ActsGetAllAccessibleAccounts_0200', 0, async function (done) {
- console.debug("====>ActsGetAllAccessibleAccounts_0200 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>getAllAccessibleAccounts 0300 start====");
- try{
- var data = await appAccountManager.getAllAccessibleAccounts();
- }
- catch(err){
- console.error("====>getAllAccessibleAccounts 0200 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccessibleAccounts 0200 data:" + JSON.stringify(data));
- console.debug("====>getAllAccessibleAccounts 0200 data.length:" + data.length);
- expect(data.length).assertEqual(0);
- console.debug("====>ActsGetAllAccessibleAccounts_0200 end====");
- done();
- });
-
- /*
- * @tc.number : ActsGetAllAccessibleAccounts_0300
- * @tc.name : getAllAccessibleAccounts callback
- * @tc.desc : This application gets authorization after adding a single account
- */
- it('ActsGetAllAccessibleAccounts_0300', 0, async function (done) {
- console.debug("====>ActsGetAllAccessibleAccounts_0300 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- appAccountManager.addAccount("accessibleAccount_callback_single", (err)=>{
- console.debug("====> add account ActsGetAllAccessibleAccounts_0300 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.getAllAccessibleAccounts((err, data)=>{
- console.debug("====>getAllAccessibleAccounts 0300 err:" + JSON.stringify(err));
- console.debug("====>getAllAccessibleAccounts 0300 data:" + JSON.stringify(data));
- console.debug("====>getAllAccessibleAccounts 0300 data.length:" + data.length);
- expect(err.code).assertEqual(0);
- expect(data.length).assertEqual(1);
- try{
- expect(data[0].name).assertEqual("accessibleAccount_callback_single");
- expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- }
- catch(err){
- console.error("====>getAllAccessibleAccounts check data 0300 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- appAccountManager.deleteAccount("accessibleAccount_callback_single", (err)=>{
- console.debug("====>delete Account ActsGetAllAccessibleAccounts_0300 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsGetAllAccessibleAccounts_0300 end====");
- done();
- })
- });
- });
- });
-
- /*
- * @tc.number : ActsGetAllAccessibleAccounts_0400
- * @tc.name : getAllAccessibleAccounts promise
- * @tc.desc : This application gets authorization after adding a single account
- */
- it('ActsGetAllAccessibleAccounts_0400', 0, async function (done) {
- console.debug("====>ActsGetAllAccessibleAccounts_0400 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- var selfBundle = "com.example.actsgetallaccessibleaccounts";
- console.debug("====>getAllAccounts for clean====");
- try{
- var acclist = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>account list length: " + acclist.length);
- if(acclist.length > 0){
- for(var i = 0;i < acclist.length; i++){
- await appAccountManager.deleteAccount(acclist[i].name);
- }
- }
- console.debug("====>add account ActsGetAllAccessibleAccounts_0400 start====");
- await appAccountManager.addAccount("accessibleAccount_promise_single");
- console.debug("====>getAllAccessibleAccounts 0400 start====");
- try{
- var data = await appAccountManager.getAllAccessibleAccounts();
- }
- catch(err){
- console.error("====>getAllAccessibleAccounts 0400 err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccessibleAccounts 0400 data:" + JSON.stringify(data));
- console.debug("====>getAllAccessibleAccounts 0400 data.length:" + data.length);
- try{
- expect(data[0].name).assertEqual("accessibleAccount_promise_single");
- expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- }
- catch(err){
- console.error("====>getAllAccessibleAccounts check data 0400 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- await appAccountManager.deleteAccount("accessibleAccount_promise_single");
- console.debug("====>ActsGetAllAccessibleAccounts_0400 end====");
- done();
- });
-
- /*
- * @tc.number : ActsGetAllAccessibleAccounts_0500
- * @tc.name : getAllAccessibleAccounts callback
- * @tc.desc : This application is added to obtain authorization after adding multiple application accounts
- */
- it('ActsGetAllAccessibleAccounts_0500', 0, async function (done) {
- console.debug("====>ActsGetAllAccessibleAccounts_0500 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- appAccountManager.addAccount("accessibleAccount_callback_first", (err)=>{
- console.debug("====>add account first time 0500 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.addAccount("accessibleAccount_callback_second", (err)=>{
- console.debug("====>add account second time 0500 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.addAccount("accessibleAccount_callback_third", (err)=>{
- console.debug("====>add account third time 0500 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.getAllAccessibleAccounts((err, data)=>{
- console.debug("====>getAllAccessibleAccounts 0500 err:" + JSON.stringify(err));
- console.debug("====>getAllAccessibleAccounts 0500 data:" + JSON.stringify(data));
- console.debug("====>getAllAccessibleAccounts 0500 data.length:" + data.length);
- expect(err.code).assertEqual(0);
- expect(data.length).assertEqual(3);
- try{
- expect(data[0].name).assertEqual("accessibleAccount_callback_first");
- expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- expect(data[1].name).assertEqual("accessibleAccount_callback_second");
- expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- expect(data[2].name).assertEqual("accessibleAccount_callback_third");
- expect(data[2].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- }
- catch(err){
- console.error("====>check data 0500 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- appAccountManager.deleteAccount("accessibleAccount_callback_first", (err)=>{
- console.debug("====>delete Account first 0500 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.deleteAccount("accessibleAccount_callback_second", (err)=>{
- console.debug("====>delete Account second 0500 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.deleteAccount("accessibleAccount_callback_third", (err)=>{
- console.debug("====>delete Account third 0500 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsGetAllAccessibleAccounts_0500 end====");
- done();
- })
- })
- })
- });
- })
- })
- });
- });
-
- /*
- * @tc.number : ActsGetAllAccessibleAccounts_0600
- * @tc.name : getAllAccessibleAccounts promise
- * @tc.desc : This application is added to obtain authorization after adding multiple application accounts
- */
- it('ActsGetAllAccessibleAccounts_0600', 0, async function (done) {
- console.debug("====>ActsGetAllAccessibleAccounts_0600 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>getAllAccounts for clean====");
- var selfBundle = "com.example.actsgetallaccessibleaccounts";
- try{
- var acclist = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>account list length: " + acclist.length);
- if(acclist.length > 0){
- for(var i = 0;i < acclist.length; i++){
- await appAccountManager.deleteAccount(acclist[i].name);
- }
- }
- console.debug("====>add first account 0600 start====");
- await appAccountManager.addAccount("accessibleAccount_promise_first");
- console.debug("====>add second account 0600 start====");
- await appAccountManager.addAccount("accessibleAccount_promise_second");
- console.debug("====>add third account 0600 start====");
- await appAccountManager.addAccount("accessibleAccount_promise_third");
- try{
- var data = await appAccountManager.getAllAccessibleAccounts();
- }
- catch(err){
- console.error("====>getAllAccessibleAccounts 0600 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccessibleAccounts 0600 data:" + JSON.stringify(data));
- expect(data.length).assertEqual(3);
- try{
- expect(data[0].name).assertEqual("accessibleAccount_promise_first");
- expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- expect(data[1].name).assertEqual("accessibleAccount_promise_second");
- expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- expect(data[2].name).assertEqual("accessibleAccount_promise_third");
- expect(data[2].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- }
- catch(err){
- console.error("====>check data 0600 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>delete first account 0600 start====");
- await appAccountManager.deleteAccount("accessibleAccount_promise_first");
- console.debug("====>delete second account 0600 start====");
- await appAccountManager.deleteAccount("accessibleAccount_promise_second");
- console.debug("====>delete third account 0600 start====");
- await appAccountManager.deleteAccount("accessibleAccount_promise_third");
- console.debug("====>ActsGetAllAccessibleAccounts_0600 end====");
- done();
- });
-
- /*
- * @tc.number : ActsGetAllAccessibleAccounts_0700
- * @tc.name : getAllAccessibleAccounts callback
- * @tc.desc : This application adds different application accounts three times in a row, and obtains
- * authorization after deleting the account added for the second time
- */
- it('ActsGetAllAccessibleAccounts_0700', 0, async function (done) {
- console.debug("====>ActsGetAllAccessibleAccounts_0700 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- appAccountManager.addAccount("accessibleAccount_callback_delete_first", (err)=>{
- console.debug("====>add first account 0700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.addAccount("accessibleAccount_callback_delete_second", (err)=>{
- console.debug("====>add second account 0700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.addAccount("accessibleAccount_callback_delete_third", (err)=>{
- console.debug("====>add third account 0700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.deleteAccount("accessibleAccount_callback_delete_second", (err)=>{
- console.debug("====>delete second account 0700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.getAllAccessibleAccounts((err, data)=>{
- console.debug("====>getAllAccessibleAccounts 0700 err:" + JSON.stringify(err));
- console.debug("====>getAllAccessibleAccounts 0700 data:" + JSON.stringify(data));
- console.debug("====>getAllAccessibleAccounts 0700 data.length:" + data.length);
- expect(err.code).assertEqual(0);
- expect(data.length).assertEqual(2);
- try{
- expect(data[0].name).assertEqual("accessibleAccount_callback_delete_first");
- expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- expect(data[1].name).assertEqual("accessibleAccount_callback_delete_third");
- expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- }
- catch(err){
- console.error("====>check data 0700 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- appAccountManager.deleteAccount("accessibleAccount_callback_delete_first", (err)=>{
- console.debug("====>delete first account 0700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.deleteAccount("accessibleAccount_callback_delete_third", (err)=>{
- console.debug("====>delete third account 0700 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsGetAllAccessibleAccounts_0700 end====");
- done();
- })
- })
- });
- })
- })
- })
- });
- });
-
- /*
- * @tc.number : ActsGetAllAccessibleAccounts_0800
- * @tc.name : getAllAccessibleAccounts promise
- * @tc.desc : This application adds different application accounts three times in a row, and obtains
- * authorization after deleting the account added for the second time
- */
- it('ActsGetAllAccessibleAccounts_0800', 0, async function (done) {
- console.debug("====>ActsGetAllAccessibleAccounts_0800 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>getAllAccounts for clean====");
- var selfBundle = "com.example.actsgetallaccessibleaccounts";
- try{
- var acclist = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>account list length: " + acclist.length);
- if(acclist.length > 0){
- for(var i = 0;i < acclist.length; i++){
- await appAccountManager.deleteAccount(acclist[i].name);
- }
- }
- console.debug("====>add first account 0800 start====");
- await appAccountManager.addAccount("accessibleAccount_promise_first");
- console.debug("====>add second account 0800 start====");
- await appAccountManager.addAccount("accessibleAccount_promise_second");
- console.debug("====>add third account 0800 start====");
- await appAccountManager.addAccount("accessibleAccount_promise_third");
- console.debug("====>delete second account 0800 start====");
- await appAccountManager.deleteAccount("accessibleAccount_promise_second");
- try{
- var data = await appAccountManager.getAllAccessibleAccounts();
- }
- catch(err){
- console.error("====>getAllAccessibleAccounts 0800 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccessibleAccounts 0800 data:" + JSON.stringify(data));
- expect(data.length).assertEqual(2);
- try{
- expect(data[0].name).assertEqual("accessibleAccount_promise_first");
- expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- expect(data[1].name).assertEqual("accessibleAccount_promise_third");
- expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- }
- catch(err){
- console.error("====>check data 0800 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>delete first account 0800 start====");
- await appAccountManager.deleteAccount("accessibleAccount_promise_first");
- console.debug("====>delete third account 0800 start====");
- await appAccountManager.deleteAccount("accessibleAccount_promise_third");
- console.debug("====>ActsGetAllAccessibleAccounts_0800 end====");
- done();
- });
-
- /*
- * @tc.number : ActsGetAllAccessibleAccounts_0900
- * @tc.name : getAllAccessibleAccounts callback
- * @tc.desc : This application adds different application accounts three times in a row, and then obtains
- * authorization multiple times
- */
- it('ActsGetAllAccessibleAccounts_0900', 0, async function (done) {
- console.debug("====>ActsGetAllAccessibleAccounts_0900 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- appAccountManager.addAccount("accessibleAccount_callback_multiple_first", (err)=>{
- console.debug("====>add first account 0900 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.addAccount("accessibleAccount_callback_multiple_second", (err)=>{
- console.debug("====>add third account 0900 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.getAllAccessibleAccounts((err, data)=>{
- console.debug("====>getAllAccessibleAccounts first 0900 err:" + JSON.stringify(err));
- console.debug("====>getAllAccessibleAccounts first 0900 data:" + JSON.stringify(data));
- console.debug("====>getAllAccessibleAccounts first 0900 data.length:" + data.length);
- expect(err.code).assertEqual(0);
- expect(data.length).assertEqual(2);
- try{
- expect(data[0].name).assertEqual("accessibleAccount_callback_multiple_first");
- expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- expect(data[1].name).assertEqual("accessibleAccount_callback_multiple_second");
- expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- }
- catch(err){
- console.error("====>check data first 0900 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- appAccountManager.getAllAccessibleAccounts((err, data)=>{
- console.debug("====>getAllAccessibleAccounts second 0900 err:" + JSON.stringify(err));
- console.debug("====>getAllAccessibleAccounts second 0900 data:" + JSON.stringify(data));
- console.debug("====>getAllAccessibleAccounts second 0900 data.length:" + data.length);
- expect(err.code).assertEqual(0);
- expect(data.length).assertEqual(2);
- try{
- expect(data[0].name).assertEqual("accessibleAccount_callback_multiple_first");
- expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- expect(data[1].name).assertEqual("accessibleAccount_callback_multiple_second");
- expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- }
- catch(err){
- console.error("====>check data second 0900 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- appAccountManager.deleteAccount("accessibleAccount_callback_multiple_first", (err)=>{
- console.debug("====>delete first account 0900 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- appAccountManager.deleteAccount("accessibleAccount_callback_multiple_second", (err)=>{
- console.debug("====>delete second account 0900 err:" + JSON.stringify(err));
- expect(err.code).assertEqual(0);
- console.debug("====>ActsGetAllAccessibleAccounts_0900 end====");
- done();
- })
- })
- })
- })
- })
- });
- });
-
- /*
- * @tc.number : ActsGetAllAccessibleAccounts_1000
- * @tc.name : getAllAccessibleAccounts promise
- * @tc.desc : This application adds different application accounts three times in a row, and then obtains
- * authorization multiple times
- */
- it('ActsGetAllAccessibleAccounts_1000', 0, async function (done) {
- console.debug("====>ActsGetAllAccessibleAccounts_1000 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>getAllAccounts for clean====");
- var selfBundle = "com.example.actsgetallaccessibleaccounts";
- try{
- var acclist = await appAccountManager.getAllAccounts(selfBundle);
- }
- catch(err){
- console.error("====>getAllAccounts err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>account list length: " + acclist.length);
- if(acclist.length > 0){
- for(var i = 0;i < acclist.length; i++){
- await appAccountManager.deleteAccount(acclist[i].name);
- }
- }
- console.debug("====>add first account 1000 start====");
- await appAccountManager.addAccount("accessibleAccount_promise_multiple_first");
- console.debug("====>add second account 1000 start====");
- await appAccountManager.addAccount("accessibleAccount_promise_multiple_second");
- console.debug("====>getAllAccessibleAccounts first 1000 start====");
- try{
- var data = await appAccountManager.getAllAccessibleAccounts();
- }
- catch(err){
- console.error("====>getAllAccessibleAccounts first 1000 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccessibleAccounts 1000 data:" + JSON.stringify(data));
- expect(data.length).assertEqual(2);
- try{
- expect(data[0].name).assertEqual("accessibleAccount_promise_multiple_first");
- expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- expect(data[1].name).assertEqual("accessibleAccount_promise_multiple_second");
- expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- }
- catch(err){
- console.error("====>check data 1000 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccessibleAccounts second 1000 start====");
- try{
- var dataTwo = await appAccountManager.getAllAccessibleAccounts();
- }
- catch(err){
- console.error("====>getAllAccessibleAccounts second 1000 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccessibleAccounts 1000 dataTwo:" + JSON.stringify(dataTwo));
- expect(data.length).assertEqual(2);
- try{
- expect(dataTwo[0].name).assertEqual("accessibleAccount_promise_multiple_first");
- expect(dataTwo[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- expect(dataTwo[1].name).assertEqual("accessibleAccount_promise_multiple_second");
- expect(dataTwo[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- }
- catch(err){
- console.error("====>check dataTwo 1000 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>delete first account 1000 start====");
- await appAccountManager.deleteAccount("accessibleAccount_promise_multiple_first");
- console.debug("====>delete second account 1000 start====");
- await appAccountManager.deleteAccount("accessibleAccount_promise_multiple_second");
- console.debug("====>ActsGetAllAccessibleAccounts_1000 end====");
- done();
- });
-
- /*
- * @tc.number : ActsGetAllAccessibleAccounts_1100
- * @tc.name : getAllAccessibleAccounts
- * @tc.desc : This application adds an account, other application authorizes an account to this application
- * and this application obtains authorization
- */
- it('ActsGetAllAccessibleAccounts_1100', 0, async function (done) {
- console.debug("====>ActsGetAllAccessibleAccounts_1100 start====");
- var appAccountManager = account.createAppAccountManager();
- console.debug("====>creat finish====");
- console.debug("====>add account 1100 start====");
- await appAccountManager.addAccount("accessibleAccount_this_application");
- console.debug("====>startAbility 1100 start====");
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.example.actsaccountsceneaccessible",
- abilityName: "com.example.actsaccountsceneaccessible.MainAbility",
- action: "action1",
- parameters:
- {},
- },
- },
- );
- setTimeout(async function(){
- console.debug("====>getAllAccessibleAccounts 1100 start====");
- try{
- var data = await appAccountManager.getAllAccessibleAccounts();
- }
- catch(err){
- console.error("====>getAllAccessibleAccounts 1100 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>getAllAccessibleAccounts 1100 data:" + JSON.stringify(data));
- expect(data.length).assertEqual(2);
- try{
- expect(data[0].name).assertEqual("account_name_scene_single");
- expect(data[0].owner).assertEqual("com.example.actsaccountsceneaccessible");
- expect(data[1].name).assertEqual("accessibleAccount_this_application");
- expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
- }
- catch(err){
- console.error("====>check data 1100 fail err:" + JSON.stringify(err));
- expect().assertFail();
- done();
- }
- console.debug("====>delete account 1100 start====");
- await appAccountManager.deleteAccount("accessibleAccount_this_application");
- console.debug("====>ActsGetAllAccessibleAccounts_1100 end====");
- done();
- }, TIMEOUT);
- });
-})
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/config.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/config.json
old mode 100755
new mode 100644
similarity index 53%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/config.json
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/config.json
index 6b3c6d02c8a795f74fc9d1cd11b5796a9d0c3d21..ab9f8fb4255b8f2077c367f9c199b9dff3e07e7a
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/config.json
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsgetallaccessibleaccounts",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -59,25 +61,42 @@
],
"abilities": [
{
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.actsgetallaccessibleaccounts.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "visible": true,
- "launchType": "standard"
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "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,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
}
- ],
+ ],
"js": [
{
"pages": [
@@ -88,7 +107,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/app.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/app.js
similarity index 100%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/app.js
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/app.js
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/i18n/en-US.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/i18n/en-US.json
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/i18n/en-US.json
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/i18n/zh-CN.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/i18n/zh-CN.json
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/pages/index/index.css b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2334ecfa2c147f276998e82e2c35f62800cfb031
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/pages/index/index.css
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/pages/index/index.hml b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..58fdc144440ca578003fa3982fb8d0029cc2cdc7
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/pages/index/index.hml
@@ -0,0 +1,19 @@
+
+
+
+ {{title}}
+
+
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/pages/index/index.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/pages/index/index.js
similarity index 69%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/pages/index/index.js
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/pages/index/index.js
index 5a876ba0a720d83d5e8b404671860ea95571dcd0..7ffbf87eadfca5fc7efc9873d5d6875ac40d68b2 100755
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/default/pages/index/index.js
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/MainAbility/pages/index/index.js
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
@@ -26,18 +25,6 @@ export default {
},
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() {
},
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/app.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/i18n/en-US.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/i18n/zh-CN.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/pages/index/index.css b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..1ba8e4e82ace01dad36c1279ea520b4903c57e8f
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
+
+
+@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
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/pages/index/index.hml b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/pages/index/index.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/test/Getallaccessible.test.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/test/Getallaccessible.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..98c2a602ac392cdde954ddf1efc17a50b26ee775
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/test/Getallaccessible.test.js
@@ -0,0 +1,603 @@
+/*
+ * 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.appAccount'
+import featureAbility from '@ohos.ability.featureAbility'
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+const TIMEOUT = 2000;
+export default function ActsGetAllAccessibleAccounts() {
+ describe('ActsGetAllAccessibleAccounts', function () {
+
+ /*
+ * @tc.number : ActsGetAllAccessibleAccounts_0100
+ * @tc.name : getAllAccessibleAccounts callback
+ * @tc.desc : This application has not added an account and has not been authorized by other applications to
+ * obtain authorization
+ */
+ it('ActsGetAllAccessibleAccounts_0100', 0, async function (done) {
+ console.debug("====>ActsGetAllAccessibleAccounts_0100 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ appAccountManager.getAllAccessibleAccounts((err, data)=>{
+ console.debug("====>getAllAccessibleAccounts 0100 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccessibleAccounts 0100 data:" + JSON.stringify(data));
+ console.debug("====>getAllAccessibleAccounts 0100 data.length:" + data.length);
+ expect(err.code).assertEqual(0);
+ expect(data.length).assertEqual(0);
+ console.debug("====>ActsGetAllAccessibleAccounts_0100 end====");
+ done();
+ });
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccessibleAccounts_0200
+ * @tc.name : getAllAccessibleAccounts promise
+ * @tc.desc : This application has not added an account and has not been authorized by other applications to
+ * obtain authorization
+ */
+ it('ActsGetAllAccessibleAccounts_0200', 0, async function (done) {
+ console.debug("====>ActsGetAllAccessibleAccounts_0200 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>getAllAccessibleAccounts 0300 start====");
+ try{
+ var data = await appAccountManager.getAllAccessibleAccounts();
+ }
+ catch(err){
+ console.error("====>getAllAccessibleAccounts 0200 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccessibleAccounts 0200 data:" + JSON.stringify(data));
+ console.debug("====>getAllAccessibleAccounts 0200 data.length:" + data.length);
+ expect(data.length).assertEqual(0);
+ console.debug("====>ActsGetAllAccessibleAccounts_0200 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccessibleAccounts_0300
+ * @tc.name : getAllAccessibleAccounts callback
+ * @tc.desc : This application gets authorization after adding a single account
+ */
+ it('ActsGetAllAccessibleAccounts_0300', 0, async function (done) {
+ console.debug("====>ActsGetAllAccessibleAccounts_0300 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ appAccountManager.addAccount("accessibleAccount_callback_single", (err)=>{
+ console.debug("====> add account ActsGetAllAccessibleAccounts_0300 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.getAllAccessibleAccounts((err, data)=>{
+ console.debug("====>getAllAccessibleAccounts 0300 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccessibleAccounts 0300 data:" + JSON.stringify(data));
+ console.debug("====>getAllAccessibleAccounts 0300 data.length:" + data.length);
+ expect(err.code).assertEqual(0);
+ expect(data.length).assertEqual(1);
+ try{
+ expect(data[0].name).assertEqual("accessibleAccount_callback_single");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ }
+ catch(err){
+ console.error("====>getAllAccessibleAccounts check data 0300 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ appAccountManager.deleteAccount("accessibleAccount_callback_single", (err)=>{
+ console.debug("====>delete Account ActsGetAllAccessibleAccounts_0300 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsGetAllAccessibleAccounts_0300 end====");
+ done();
+ })
+ });
+ });
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccessibleAccounts_0400
+ * @tc.name : getAllAccessibleAccounts promise
+ * @tc.desc : This application gets authorization after adding a single account
+ */
+ it('ActsGetAllAccessibleAccounts_0400', 0, async function (done) {
+ console.debug("====>ActsGetAllAccessibleAccounts_0400 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ var selfBundle = "com.example.actsgetallaccessibleaccounts";
+ console.debug("====>getAllAccounts for clean====");
+ try{
+ var acclist = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>account list length: " + acclist.length);
+ if(acclist.length > 0){
+ for(var i = 0;i < acclist.length; i++){
+ await appAccountManager.deleteAccount(acclist[i].name);
+ }
+ }
+ console.debug("====>add account ActsGetAllAccessibleAccounts_0400 start====");
+ await appAccountManager.addAccount("accessibleAccount_promise_single");
+ console.debug("====>getAllAccessibleAccounts 0400 start====");
+ try{
+ var data = await appAccountManager.getAllAccessibleAccounts();
+ }
+ catch(err){
+ console.error("====>getAllAccessibleAccounts 0400 err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccessibleAccounts 0400 data:" + JSON.stringify(data));
+ console.debug("====>getAllAccessibleAccounts 0400 data.length:" + data.length);
+ try{
+ expect(data[0].name).assertEqual("accessibleAccount_promise_single");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ }
+ catch(err){
+ console.error("====>getAllAccessibleAccounts check data 0400 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ await appAccountManager.deleteAccount("accessibleAccount_promise_single");
+ console.debug("====>ActsGetAllAccessibleAccounts_0400 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccessibleAccounts_0500
+ * @tc.name : getAllAccessibleAccounts callback
+ * @tc.desc : This application is added to obtain authorization after adding multiple application accounts
+ */
+ it('ActsGetAllAccessibleAccounts_0500', 0, async function (done) {
+ console.debug("====>ActsGetAllAccessibleAccounts_0500 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ appAccountManager.addAccount("accessibleAccount_callback_first", (err)=>{
+ console.debug("====>add account first time 0500 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.addAccount("accessibleAccount_callback_second", (err)=>{
+ console.debug("====>add account second time 0500 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.addAccount("accessibleAccount_callback_third", (err)=>{
+ console.debug("====>add account third time 0500 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.getAllAccessibleAccounts((err, data)=>{
+ console.debug("====>getAllAccessibleAccounts 0500 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccessibleAccounts 0500 data:" + JSON.stringify(data));
+ console.debug("====>getAllAccessibleAccounts 0500 data.length:" + data.length);
+ expect(err.code).assertEqual(0);
+ expect(data.length).assertEqual(3);
+ try{
+ expect(data[0].name).assertEqual("accessibleAccount_callback_first");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ expect(data[1].name).assertEqual("accessibleAccount_callback_second");
+ expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ expect(data[2].name).assertEqual("accessibleAccount_callback_third");
+ expect(data[2].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ }
+ catch(err){
+ console.error("====>check data 0500 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ appAccountManager.deleteAccount("accessibleAccount_callback_first", (err)=>{
+ console.debug("====>delete Account first 0500 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.deleteAccount("accessibleAccount_callback_second", (err)=>{
+ console.debug("====>delete Account second 0500 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.deleteAccount("accessibleAccount_callback_third", (err)=>{
+ console.debug("====>delete Account third 0500 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsGetAllAccessibleAccounts_0500 end====");
+ done();
+ })
+ })
+ })
+ });
+ })
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccessibleAccounts_0600
+ * @tc.name : getAllAccessibleAccounts promise
+ * @tc.desc : This application is added to obtain authorization after adding multiple application accounts
+ */
+ it('ActsGetAllAccessibleAccounts_0600', 0, async function (done) {
+ console.debug("====>ActsGetAllAccessibleAccounts_0600 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>getAllAccounts for clean====");
+ var selfBundle = "com.example.actsgetallaccessibleaccounts";
+ try{
+ var acclist = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>account list length: " + acclist.length);
+ if(acclist.length > 0){
+ for(var i = 0;i < acclist.length; i++){
+ await appAccountManager.deleteAccount(acclist[i].name);
+ }
+ }
+ console.debug("====>add first account 0600 start====");
+ await appAccountManager.addAccount("accessibleAccount_promise_first");
+ console.debug("====>add second account 0600 start====");
+ await appAccountManager.addAccount("accessibleAccount_promise_second");
+ console.debug("====>add third account 0600 start====");
+ await appAccountManager.addAccount("accessibleAccount_promise_third");
+ try{
+ var data = await appAccountManager.getAllAccessibleAccounts();
+ }
+ catch(err){
+ console.error("====>getAllAccessibleAccounts 0600 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccessibleAccounts 0600 data:" + JSON.stringify(data));
+ expect(data.length).assertEqual(3);
+ try{
+ expect(data[0].name).assertEqual("accessibleAccount_promise_first");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ expect(data[1].name).assertEqual("accessibleAccount_promise_second");
+ expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ expect(data[2].name).assertEqual("accessibleAccount_promise_third");
+ expect(data[2].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ }
+ catch(err){
+ console.error("====>check data 0600 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>delete first account 0600 start====");
+ await appAccountManager.deleteAccount("accessibleAccount_promise_first");
+ console.debug("====>delete second account 0600 start====");
+ await appAccountManager.deleteAccount("accessibleAccount_promise_second");
+ console.debug("====>delete third account 0600 start====");
+ await appAccountManager.deleteAccount("accessibleAccount_promise_third");
+ console.debug("====>ActsGetAllAccessibleAccounts_0600 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccessibleAccounts_0700
+ * @tc.name : getAllAccessibleAccounts callback
+ * @tc.desc : This application adds different application accounts three times in a row, and obtains
+ * authorization after deleting the account added for the second time
+ */
+ it('ActsGetAllAccessibleAccounts_0700', 0, async function (done) {
+ console.debug("====>ActsGetAllAccessibleAccounts_0700 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ appAccountManager.addAccount("accessibleAccount_callback_delete_first", (err)=>{
+ console.debug("====>add first account 0700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.addAccount("accessibleAccount_callback_delete_second", (err)=>{
+ console.debug("====>add second account 0700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.addAccount("accessibleAccount_callback_delete_third", (err)=>{
+ console.debug("====>add third account 0700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.deleteAccount("accessibleAccount_callback_delete_second", (err)=>{
+ console.debug("====>delete second account 0700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.getAllAccessibleAccounts((err, data)=>{
+ console.debug("====>getAllAccessibleAccounts 0700 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccessibleAccounts 0700 data:" + JSON.stringify(data));
+ console.debug("====>getAllAccessibleAccounts 0700 data.length:" + data.length);
+ expect(err.code).assertEqual(0);
+ expect(data.length).assertEqual(2);
+ try{
+ expect(data[0].name).assertEqual("accessibleAccount_callback_delete_first");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ expect(data[1].name).assertEqual("accessibleAccount_callback_delete_third");
+ expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ }
+ catch(err){
+ console.error("====>check data 0700 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ appAccountManager.deleteAccount("accessibleAccount_callback_delete_first", (err)=>{
+ console.debug("====>delete first account 0700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.deleteAccount("accessibleAccount_callback_delete_third", (err)=>{
+ console.debug("====>delete third account 0700 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsGetAllAccessibleAccounts_0700 end====");
+ done();
+ })
+ })
+ });
+ })
+ })
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccessibleAccounts_0800
+ * @tc.name : getAllAccessibleAccounts promise
+ * @tc.desc : This application adds different application accounts three times in a row, and obtains
+ * authorization after deleting the account added for the second time
+ */
+ it('ActsGetAllAccessibleAccounts_0800', 0, async function (done) {
+ console.debug("====>ActsGetAllAccessibleAccounts_0800 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>getAllAccounts for clean====");
+ var selfBundle = "com.example.actsgetallaccessibleaccounts";
+ try{
+ var acclist = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>account list length: " + acclist.length);
+ if(acclist.length > 0){
+ for(var i = 0;i < acclist.length; i++){
+ await appAccountManager.deleteAccount(acclist[i].name);
+ }
+ }
+ console.debug("====>add first account 0800 start====");
+ await appAccountManager.addAccount("accessibleAccount_promise_first");
+ console.debug("====>add second account 0800 start====");
+ await appAccountManager.addAccount("accessibleAccount_promise_second");
+ console.debug("====>add third account 0800 start====");
+ await appAccountManager.addAccount("accessibleAccount_promise_third");
+ console.debug("====>delete second account 0800 start====");
+ await appAccountManager.deleteAccount("accessibleAccount_promise_second");
+ try{
+ var data = await appAccountManager.getAllAccessibleAccounts();
+ }
+ catch(err){
+ console.error("====>getAllAccessibleAccounts 0800 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccessibleAccounts 0800 data:" + JSON.stringify(data));
+ expect(data.length).assertEqual(2);
+ try{
+ expect(data[0].name).assertEqual("accessibleAccount_promise_first");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ expect(data[1].name).assertEqual("accessibleAccount_promise_third");
+ expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ }
+ catch(err){
+ console.error("====>check data 0800 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>delete first account 0800 start====");
+ await appAccountManager.deleteAccount("accessibleAccount_promise_first");
+ console.debug("====>delete third account 0800 start====");
+ await appAccountManager.deleteAccount("accessibleAccount_promise_third");
+ console.debug("====>ActsGetAllAccessibleAccounts_0800 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccessibleAccounts_0900
+ * @tc.name : getAllAccessibleAccounts callback
+ * @tc.desc : This application adds different application accounts three times in a row, and then obtains
+ * authorization multiple times
+ */
+ it('ActsGetAllAccessibleAccounts_0900', 0, async function (done) {
+ console.debug("====>ActsGetAllAccessibleAccounts_0900 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ appAccountManager.addAccount("accessibleAccount_callback_multiple_first", (err)=>{
+ console.debug("====>add first account 0900 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.addAccount("accessibleAccount_callback_multiple_second", (err)=>{
+ console.debug("====>add third account 0900 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.getAllAccessibleAccounts((err, data)=>{
+ console.debug("====>getAllAccessibleAccounts first 0900 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccessibleAccounts first 0900 data:" + JSON.stringify(data));
+ console.debug("====>getAllAccessibleAccounts first 0900 data.length:" + data.length);
+ expect(err.code).assertEqual(0);
+ expect(data.length).assertEqual(2);
+ try{
+ expect(data[0].name).assertEqual("accessibleAccount_callback_multiple_first");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ expect(data[1].name).assertEqual("accessibleAccount_callback_multiple_second");
+ expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ }
+ catch(err){
+ console.error("====>check data first 0900 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ appAccountManager.getAllAccessibleAccounts((err, data)=>{
+ console.debug("====>getAllAccessibleAccounts second 0900 err:" + JSON.stringify(err));
+ console.debug("====>getAllAccessibleAccounts second 0900 data:" + JSON.stringify(data));
+ console.debug("====>getAllAccessibleAccounts second 0900 data.length:" + data.length);
+ expect(err.code).assertEqual(0);
+ expect(data.length).assertEqual(2);
+ try{
+ expect(data[0].name).assertEqual("accessibleAccount_callback_multiple_first");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ expect(data[1].name).assertEqual("accessibleAccount_callback_multiple_second");
+ expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ }
+ catch(err){
+ console.error("====>check data second 0900 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ appAccountManager.deleteAccount("accessibleAccount_callback_multiple_first", (err)=>{
+ console.debug("====>delete first account 0900 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ appAccountManager.deleteAccount("accessibleAccount_callback_multiple_second", (err)=>{
+ console.debug("====>delete second account 0900 err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsGetAllAccessibleAccounts_0900 end====");
+ done();
+ })
+ })
+ })
+ })
+ })
+ });
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccessibleAccounts_1000
+ * @tc.name : getAllAccessibleAccounts promise
+ * @tc.desc : This application adds different application accounts three times in a row, and then obtains
+ * authorization multiple times
+ */
+ it('ActsGetAllAccessibleAccounts_1000', 0, async function (done) {
+ console.debug("====>ActsGetAllAccessibleAccounts_1000 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>getAllAccounts for clean====");
+ var selfBundle = "com.example.actsgetallaccessibleaccounts";
+ try{
+ var acclist = await appAccountManager.getAllAccounts(selfBundle);
+ }
+ catch(err){
+ console.error("====>getAllAccounts err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>account list length: " + acclist.length);
+ if(acclist.length > 0){
+ for(var i = 0;i < acclist.length; i++){
+ await appAccountManager.deleteAccount(acclist[i].name);
+ }
+ }
+ console.debug("====>add first account 1000 start====");
+ await appAccountManager.addAccount("accessibleAccount_promise_multiple_first");
+ console.debug("====>add second account 1000 start====");
+ await appAccountManager.addAccount("accessibleAccount_promise_multiple_second");
+ console.debug("====>getAllAccessibleAccounts first 1000 start====");
+ try{
+ var data = await appAccountManager.getAllAccessibleAccounts();
+ }
+ catch(err){
+ console.error("====>getAllAccessibleAccounts first 1000 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccessibleAccounts 1000 data:" + JSON.stringify(data));
+ expect(data.length).assertEqual(2);
+ try{
+ expect(data[0].name).assertEqual("accessibleAccount_promise_multiple_first");
+ expect(data[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ expect(data[1].name).assertEqual("accessibleAccount_promise_multiple_second");
+ expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ }
+ catch(err){
+ console.error("====>check data 1000 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccessibleAccounts second 1000 start====");
+ try{
+ var dataTwo = await appAccountManager.getAllAccessibleAccounts();
+ }
+ catch(err){
+ console.error("====>getAllAccessibleAccounts second 1000 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccessibleAccounts 1000 dataTwo:" + JSON.stringify(dataTwo));
+ expect(data.length).assertEqual(2);
+ try{
+ expect(dataTwo[0].name).assertEqual("accessibleAccount_promise_multiple_first");
+ expect(dataTwo[0].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ expect(dataTwo[1].name).assertEqual("accessibleAccount_promise_multiple_second");
+ expect(dataTwo[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ }
+ catch(err){
+ console.error("====>check dataTwo 1000 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>delete first account 1000 start====");
+ await appAccountManager.deleteAccount("accessibleAccount_promise_multiple_first");
+ console.debug("====>delete second account 1000 start====");
+ await appAccountManager.deleteAccount("accessibleAccount_promise_multiple_second");
+ console.debug("====>ActsGetAllAccessibleAccounts_1000 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsGetAllAccessibleAccounts_1100
+ * @tc.name : getAllAccessibleAccounts
+ * @tc.desc : This application adds an account, other application authorizes an account to this application
+ * and this application obtains authorization
+ */
+ it('ActsGetAllAccessibleAccounts_1100', 0, async function (done) {
+ console.debug("====>ActsGetAllAccessibleAccounts_1100 start====");
+ var appAccountManager = account.createAppAccountManager();
+ console.debug("====>creat finish====");
+ console.debug("====>add account 1100 start====");
+ await appAccountManager.addAccount("accessibleAccount_this_application");
+ console.debug("====>startAbility 1100 start====");
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.example.actsaccountsceneaccessible",
+ abilityName: "com.example.actsaccountsceneaccessible.MainAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ },
+ );
+ setTimeout(async function(){
+ console.debug("====>getAllAccessibleAccounts 1100 start====");
+ try{
+ var data = await appAccountManager.getAllAccessibleAccounts();
+ }
+ catch(err){
+ console.error("====>getAllAccessibleAccounts 1100 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>getAllAccessibleAccounts 1100 data:" + JSON.stringify(data));
+ expect(data.length).assertEqual(2);
+ try{
+ expect(data[0].name).assertEqual("account_name_scene_single");
+ expect(data[0].owner).assertEqual("com.example.actsaccountsceneaccessible");
+ expect(data[1].name).assertEqual("accessibleAccount_this_application");
+ expect(data[1].owner).assertEqual("com.example.actsgetallaccessibleaccounts");
+ }
+ catch(err){
+ console.error("====>check data 1100 fail err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>delete account 1100 start====");
+ await appAccountManager.deleteAccount("accessibleAccount_this_application");
+ console.debug("====>ActsGetAllAccessibleAccounts_1100 end====");
+ done();
+ }, TIMEOUT);
+ });
+ })
+}
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/test/List.test.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..31116b121a79588c735cfdbb13140ca9a17bdece
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * 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 ActsGetAllAccessibleAccounts from './Getallaccessible.test.js'
+
+export default function testsuite() {
+ ActsGetAllAccessibleAccounts()
+}
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/resources/base/element/string.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..b8c402107250a58e8ea8b91a03c84ad0c91af068
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ActsGetAllAccessibleAccounts"
+ },
+ {
+ "name": "mainability_description",
+ "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
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/resources/base/media/icon.png b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/resources/base/media/icon.png
similarity index 100%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/entry/src/main/js/resources/base/media/icon.png
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/resources/base/media/icon.png
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/BUILD.gn b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/BUILD.gn
old mode 100755
new mode 100644
index 2ccd7f0f29a5015aeca1cd3c533c7d085fae902c..18df6bf1491733c06d562f90e8b903fa99a396b4
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/BUILD.gn
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/BUILD.gn
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsGetAllAccessibleMultipleTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsGetAllAccessibleMultipleTest") {
hap_name = "ActsGetAllAccessibleMultipleTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/Test.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/Test.json
old mode 100755
new mode 100644
index 368cc37534f087d6cf1bf703996968060eadf175..1e685b5a2ec82b7b232bd44cf24374c85940e20e
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/Test.json
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "60000",
- "package": "com.example.actsgetallaccessiblemultiple",
+ "bundle-name": "com.example.actsgetallaccessiblemultiple",
+ "package-name": "com.example.actsgetallaccessiblemultiple",
"shell-timeout": "60000"
},
"kits": [
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/pages/index/index.css b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/pages/index/index.css
deleted file mode 100755
index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,9 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/pages/index/index.hml b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/pages/index/index.hml
deleted file mode 100755
index c45422b42d0bf788a1c2c0eb299a981f07ce8613..0000000000000000000000000000000000000000
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- {{title}}
-
-
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/resources/base/element/string.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/resources/base/element/string.json
deleted file mode 100755
index 1835ed9344ce3ded8e53ef4267311fb1f07254bc..0000000000000000000000000000000000000000
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/resources/base/element/string.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "string": [
- {
- "name": "app_name",
- "value": "ActsGetAllAccessibleMultiple"
- },
- {
- "name": "mainability_description",
- "value": "JS_Phone_Empty Feature Ability"
- }
- ]
-}
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/test/Getmultiple.test.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/test/Getmultiple.test.js
deleted file mode 100755
index 47e0a82c7dc8b623a0d6a1d67f1f8f19d90d1bd5..0000000000000000000000000000000000000000
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/test/Getmultiple.test.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * 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.appAccount'
-import featureAbility from '@ohos.ability.featureAbility'
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-
-const TIMEOUT = 5000;
-describe('ActsGetAllAccessibleMultiple', function () {
- beforeAll(async function (done) {
- console.debug("====>startAbility first start====");
- await featureAbility.startAbility(
- {
- want:
- {
- deviceId: "",
- bundleName: "com.example.actsaccountaccessiblefirst",
- abilityName: "com.example.actsaccountaccessiblefirst.MainAbility",
- action: "action1",
- parameters:
- {},
- },
- },
- );
- 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
- * @tc.desc : This application adds multiple account, other applications authorizes multiple accounts to this
- * application and this application obtains authorization
- */
- 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====");
- await appAccountManager.addAccount("accessibleAccount_this_application_first");
- console.debug("====>add second account 0100 start====");
- await appAccountManager.addAccount("accessibleAccount_this_application_second");
- console.debug("====>add third account 0100 start====");
- await appAccountManager.addAccount("accessibleAccount_this_application_third");
- 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);
- 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
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/test/List.test.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/test/List.test.js
deleted file mode 100755
index 8d14530a57213b2cb91c030c960702328ef95a1a..0000000000000000000000000000000000000000
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/test/List.test.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * 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('./Getmultiple.test.js')
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/config.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/config.json
old mode 100755
new mode 100644
similarity index 53%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/config.json
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/config.json
index 9292314f6ec020c09fe65d40e0ab5098fd4a1a69..ae92671ab59bf880e98bde100618bfac61ba5ec0
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/config.json
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/config.json
@@ -15,7 +15,9 @@
"deviceConfig": {},
"module": {
"package": "com.example.actsgetallaccessiblemultiple",
- "name": ".MyApplication",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "srcPath":"",
"deviceType": [
"phone"
],
@@ -59,25 +61,42 @@
],
"abilities": [
{
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.actsgetallaccessiblemultiple.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:app_name",
- "type": "page",
- "visible": true,
- "launchType": "standard"
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "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,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
}
- ],
+ ],
"js": [
{
"pages": [
@@ -88,7 +107,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
}
- ]
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ }
}
}
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/app.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/app.js
similarity index 100%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/app.js
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/app.js
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/i18n/en-US.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/i18n/en-US.json
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/i18n/en-US.json
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/i18n/zh-CN.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/i18n/zh-CN.json
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/pages/index/index.css b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..2334ecfa2c147f276998e82e2c35f62800cfb031
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/pages/index/index.css
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/pages/index/index.hml b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..58fdc144440ca578003fa3982fb8d0029cc2cdc7
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/pages/index/index.hml
@@ -0,0 +1,19 @@
+
+
+
+ {{title}}
+
+
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/pages/index/index.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/pages/index/index.js
similarity index 68%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/pages/index/index.js
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/pages/index/index.js
index 39daa07dd32edf8d3db972d4fdd7f1584f67c18f..c4ec231829b3b39bbd75ff2411792dd9f3a4bc6e 100755
--- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/default/pages/index/index.js
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/MainAbility/pages/index/index.js
@@ -12,8 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import {Core, ExpectExtend} from 'deccjsunit/index'
-
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
@@ -26,19 +24,6 @@ export default {
},
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 = 20000;
- configService.setConfig(this)
-
- require('../../../test/List.test')
- core.execute()
},
onReady() {
},
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/app.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/i18n/en-US.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/i18n/zh-CN.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/pages/index/index.css b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..1ba8e4e82ace01dad36c1279ea520b4903c57e8f
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
+
+
+@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
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/pages/index/index.hml b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/pages/index/index.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/test/Getmultiple.test.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/test/Getmultiple.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..3f206507bbcd3123bbaebd4d70175cae60395326
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/test/Getmultiple.test.js
@@ -0,0 +1,130 @@
+/*
+ * 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.appAccount'
+import featureAbility from '@ohos.ability.featureAbility'
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+const TIMEOUT = 5000;
+export default function ActsGetAllAccessibleMultiple() {
+ describe('ActsGetAllAccessibleMultiple', function () {
+ beforeAll(async function (done) {
+ console.debug("====>startAbility first start====");
+ await featureAbility.startAbility(
+ {
+ want:
+ {
+ deviceId: "",
+ bundleName: "com.example.actsaccountaccessiblefirst",
+ abilityName: "com.example.actsaccountaccessiblefirst.MainAbility",
+ action: "action1",
+ parameters:
+ {},
+ },
+ },
+ );
+ 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
+ * @tc.desc : This application adds multiple account, other applications authorizes multiple accounts to this
+ * application and this application obtains authorization
+ */
+ 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====");
+ await appAccountManager.addAccount("accessibleAccount_this_application_first");
+ console.debug("====>add second account 0100 start====");
+ await appAccountManager.addAccount("accessibleAccount_this_application_second");
+ console.debug("====>add third account 0100 start====");
+ await appAccountManager.addAccount("accessibleAccount_this_application_third");
+ 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);
+ 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
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/test/List.test.js b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..8e3c24929372dae95f4df0aaed50f0b83bf6ab46
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/js/test/List.test.js
@@ -0,0 +1,19 @@
+/*
+ * 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 ActsGetAllAccessibleMultiple from './Getmultiple.test.js'
+
+export default function testsuite() {
+ ActsGetAllAccessibleMultiple()
+}
\ No newline at end of file
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/resources/base/element/string.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..e2244febf6ffbfb2333c2c3ac0b78ae972b2bf1f
--- /dev/null
+++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ActsGetAllAccessibleMultiple"
+ },
+ {
+ "name": "mainability_description",
+ "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
diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/resources/base/media/icon.png b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/resources/base/media/icon.png
similarity index 100%
rename from account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/entry/src/main/js/resources/base/media/icon.png
rename to account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/resources/base/media/icon.png
diff --git a/account/osaccount/actsosaccountthirdpartytest/BUILD.gn b/account/osaccount/actsosaccountthirdpartytest/BUILD.gn
old mode 100755
new mode 100644
index 3a9095a448d2f961217e03eee65088ac5f04822c..943c29304526bc6dc40ea9b01d960236884b7afd
--- a/account/osaccount/actsosaccountthirdpartytest/BUILD.gn
+++ b/account/osaccount/actsosaccountthirdpartytest/BUILD.gn
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsOsAccountThirdPartyTest") {
- hap_profile = "./entry/src/main/config.json"
+ hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
@@ -23,9 +23,12 @@ ohos_js_hap_suite("ActsOsAccountThirdPartyTest") {
hap_name = "ActsOsAccountThirdPartyTest"
}
ohos_js_assets("hjs_demo_js_assets") {
- source_dir = "./entry/src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
+
ohos_resources("hjs_demo_resources") {
- sources = [ "./entry/src/main/js/resources" ]
- hap_profile = "./entry/src/main/config.json"
+ sources = [ "./src/main/resources" ]
+ hap_profile = "./src/main/config.json"
}
diff --git a/account/osaccount/actsosaccountthirdpartytest/Test.json b/account/osaccount/actsosaccountthirdpartytest/Test.json
old mode 100755
new mode 100644
index 3be64f7ae8ad799c9533dd44adf0e1c8a4f3c55a..72697e7e100c9ea232a9945f82065d26c7bf3328
--- a/account/osaccount/actsosaccountthirdpartytest/Test.json
+++ b/account/osaccount/actsosaccountthirdpartytest/Test.json
@@ -1,9 +1,10 @@
{
"description": "Configuration for hjunit demo Tests",
"driver": {
- "type": "JSUnitTest",
+ "type": "OHJSUnitTest",
"test-timeout": "300000",
- "package": "com.example.actsosaccountthirdpartytest",
+ "bundle-name": "com.example.actsosaccountthirdpartytest",
+ "package-name": "com.example.actsosaccountthirdpartytest",
"shell-timeout": "60000"
},
"kits": [
diff --git a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/config.json b/account/osaccount/actsosaccountthirdpartytest/entry/src/main/config.json
deleted file mode 100755
index eadb59a2523d4dff7e17936983b2767312db3977..0000000000000000000000000000000000000000
--- a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/config.json
+++ /dev/null
@@ -1,83 +0,0 @@
-{
- "app": {
- "bundleName": "com.example.actsosaccountthirdpartytest",
- "vendor": "example",
- "version": {
- "code": 1,
- "name": "1.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 5,
- "releaseType": "Beta1"
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.actsosaccountthirdpartytest",
- "name": ".MyApplication",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry"
- },
- "defPermissions": [
- {
- "availableScope": [],
- "grantMode": "system_grant",
- "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS"
- },
- {
- "availableScope": [],
- "grantMode": "system_grant",
- "name": "ohos.permission.DISTRIBUTED_DATASYNC"
- }
- ],
- "reqPermissions": [
- {
- "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS",
- "reason": "ceshi"
- },
- {
- "name": "ohos.permission.DISTRIBUTED_DATASYNC",
- "reason": "ceshi"
- }
- ],
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.actsosaccountthirdpartytest.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
diff --git a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.css b/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.css
deleted file mode 100755
index 6724ec055a554cf3f9c7be83780c30df2274875b..0000000000000000000000000000000000000000
--- a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.css
+++ /dev/null
@@ -1,12 +0,0 @@
-.container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
-}
-
-.title {
- font-size: 100px;
-}
-.titleST {
- font-size: 32px;
-}
\ No newline at end of file
diff --git a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.hml b/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.hml
deleted file mode 100755
index 718ac61d26ea06296527a29ad23d4e6f761865a6..0000000000000000000000000000000000000000
--- a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.hml
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/MainAbility/pages/index/index.js
similarity index 68%
rename from account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.js
rename to account/osaccount/actsosaccountthirdpartytest/src/main/js/MainAbility/pages/index/index.js
index 671e280834b6fb3f62c354c3c3a12754f8e0259a..64488943fe3d142b456a2e06bb1c370280cb16f5 100755
--- a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.js
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/MainAbility/pages/index/index.js
@@ -13,7 +13,6 @@
* 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')
@@ -27,19 +26,6 @@ export default {
},
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 = 120000;
- configService.setConfig(this);
-
- require('../../../test/List.test');
- core.execute();
},
onReady() {
},
diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/app.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..cdc31f3dcf031e2f6a7665d9653e53bb649e21c5
--- /dev/null
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/app.js
@@ -0,0 +1,31 @@
+/*
+ * 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");
+ }
+};
diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/i18n/en-US.json b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/i18n/zh-CN.json b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/pages/index/index.css b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..1ba8e4e82ace01dad36c1279ea520b4903c57e8f
--- /dev/null
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+.container {
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.title {
+ font-size: 100px;
+}
+
+
+@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
diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/pages/index/index.hml b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..61ea59d936e5a2971f1ea3d179c44a7f3f596c54
--- /dev/null
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,21 @@
+
+
+
+
+ {{ $t('strings.hello') }} {{title}}
+
+
+
diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/pages/index/index.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/pages/index/index.js
new file mode 100644
index 0000000000000000000000000000000000000000..88b083a7f6b979019d6a2c5ad20b19c5fd43286b
--- /dev/null
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestAbility/pages/index/index.js
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5fa8620ca77d381f20b65a903b833e6e3378c97
--- /dev/null
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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);
+ })
+ }
+};
diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/List.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/List.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..714b5ea8f578803b64958c698e402815bf128caa
--- /dev/null
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/List.test.js
@@ -0,0 +1,20 @@
+/*
+ * 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 ActsOsAccountThirdPartyTest_third_2 from './OsAccountGet.test.js'
+import ActsOsAccountThirdPartyTest_third_1 from './OsAccountIs.test.js'
+export default function testsuite() {
+ ActsOsAccountThirdPartyTest_third_2()
+ ActsOsAccountThirdPartyTest_third_1()
+}
\ No newline at end of file
diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..fc9fc6bde2ffe450a6a52a2219f9f3f4265c4fc2
--- /dev/null
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js
@@ -0,0 +1,471 @@
+/*
+ * 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 osaccount from '@ohos.account.osAccount'
+import bundle from '@ohos.bundle'
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+const ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR = 4653057;
+export default function ActsOsAccountThirdPartyTest_third_2() {
+ describe('ActsOsAccountThirdPartyTest_third_2', function () {
+
+ /*
+ * @tc.number : ActsOsAccountGetIdFormUid_0100
+ * @tc.name : getOsAccountLocalIdFromUid callback
+ * @tc.desc : Verify that the user localId is obtained by uid
+ */
+ it('ActsOsAccountGetIdFormUid_0100', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetIdFormUid_0100 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var bundleName = "com.example.actsosaccountthirdpartytest";
+ var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
+ var uid = bundleInfo.uid;
+ console.debug("====>obtained uid:" + uid);
+ osAccountManager.getOsAccountLocalIdFromUid(uid, (err, localId)=>{
+ console.debug("====>get localId err: " + JSON.stringify(err));
+ console.debug("====>localId obtained by uid:" + localId);
+ expect(err.code).assertEqual(0);
+ expect(localId).assertEqual(100);
+ console.debug("====>ActsOsAccountGetIdFormUid_0100 end====");
+ done();
+ });
+ });
+
+ /*
+ * @tc.number : ActsOsAccountGetIdFormUid_0200
+ * @tc.name : getOsAccountLocalIdFromUid promise
+ * @tc.desc : Verify that the user localId is obtained by uid
+ */
+ it('ActsOsAccountGetIdFormUid_0200', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetIdFormUid_0200 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var bundleName = "com.example.actsosaccountthirdpartytest";
+ var bundleInfo = await bundle.getBundleInfo(bundleName, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES);
+ var uid = bundleInfo.uid;
+ console.debug("====>obtained uid:" + uid);
+ var localId = await osAccountManager.getOsAccountLocalIdFromUid(uid);
+ console.debug("====>localId obtained by uid:" + localId);
+ expect(localId).assertEqual(100);
+ console.debug("====>ActsOsAccountGetIdFormUid_0200 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsOsAccountGetIdFormUid_0300
+ * @tc.name : getOsAccountLocalIdFromUid callback
+ * @tc.desc : Authentication failed to query user by uid -1
+ */
+ it('ActsOsAccountGetIdFormUid_0300', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetIdFormUid_0300 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var incorrectUid = -1;
+ osAccountManager.getOsAccountLocalIdFromUid(incorrectUid, (err, localId)=>{
+ console.debug("====>get localId err: " + JSON.stringify(err));
+ console.debug("====>localId obtained by uid:" + localId);
+ expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR);
+ expect(localId).assertEqual(0);
+ console.debug("====>ActsOsAccountGetIdFormUid_0300 end====");
+ done();
+ });
+ });
+
+ /*
+ * @tc.number : ActsOsAccountGetIdFormUid_0400
+ * @tc.name : getOsAccountLocalIdFromUid promise
+ * @tc.desc : Authentication failed to query user by uid -1
+ */
+ it('ActsOsAccountGetIdFormUid_0400', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetIdFormUid_0400 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var incorrectUid = -1;
+ try{
+ await osAccountManager.getOsAccountLocalIdFromUid(incorrectUid);
+ }catch(err){
+ console.debug("====>get localId by uid err:" +JSON.stringify(err));
+ expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR);
+ console.debug("====>ActsOsAccountGetIdFormUid_0400 end====");
+ done();
+ }
+ });
+
+ /*
+ * @tc.number : ActsOsAccountGetIdFormUid_0500
+ * @tc.name : getOsAccountLocalIdFromUid callback
+ * @tc.desc : Authentication failed to query user by uid 2147483648
+ */
+ it('ActsOsAccountGetIdFormUid_0500', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetIdFormUid_0500 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var incorrectUid = 2147483648;
+ osAccountManager.getOsAccountLocalIdFromUid(incorrectUid, (err, localId)=>{
+ console.debug("====>get localId err: " + JSON.stringify(err));
+ console.debug("====>localId obtained by uid:" + localId);
+ expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR);
+ expect(localId).assertEqual(0);
+ console.debug("====>ActsOsAccountGetIdFormUid_0500 end====");
+ done();
+ });
+ });
+
+ /*
+ * @tc.number : ActsOsAccountGetIdFormUid_0600
+ * @tc.name : getOsAccountLocalIdFromUid promise
+ * @tc.desc : Authentication failed to query user by uid 2147483648
+ */
+ it('ActsOsAccountGetIdFormUid_0600', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetIdFormUid_0600 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var incorrectUid = 2147483648;
+ try{
+ await osAccountManager.getOsAccountLocalIdFromUid(incorrectUid);
+ }catch(err){
+ console.debug("====>get localId by uid err:" +JSON.stringify(err));
+ expect(err.code).assertEqual(ERR_OS_ACCOUNT_SERVICE_MANAGER_BAD_UID_ERR);
+ console.debug("====>ActsOsAccountGetIdFormUid_0600 end====");
+ done();
+ }
+ });
+
+ /*
+ * @tc.number : ActsOsAccountGetIdFormProcess_0100
+ * @tc.name : getOsAccountLocalIdFromProcess callback
+ * @tc.desc : Verify that the user localId obtained from the current process uid
+ */
+ it('ActsOsAccountGetIdFormProcess_0100', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetIdFormProcess_0100 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ osAccountManager.getOsAccountLocalIdFromProcess((err, localId)=>{
+ console.debug("====>get localId err: " + JSON.stringify(err));
+ console.debug("====>localId obtained by process:" + localId);
+ expect(err.code).assertEqual(0);
+ expect(localId).assertEqual(100);
+ console.debug("====>ActsOsAccountGetIdFormProcess_0100 end====");
+ done();
+ });
+ });
+
+ /*
+ * @tc.number : ActsOsAccountGetIdFormProcess_0200
+ * @tc.name : getOsAccountLocalIdFromProcess promise
+ * @tc.desc : Verify that the user localId obtained from the current process uid
+ */
+ it('ActsOsAccountGetIdFormProcess_0200', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetIdFormProcess_0200 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var localId = await osAccountManager.getOsAccountLocalIdFromProcess();
+ console.debug("====>localId obtained by process:" + localId);
+ expect(localId).assertEqual(100);
+ console.debug("====>ActsOsAccountGetIdFormProcess_0200 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsOsAccountGetTypeFormProcess_0100
+ * @tc.name : getOsAccountTypeFromProcess callback
+ * @tc.desc : Verify that the user type obtained from the current process uid
+ */
+ it('ActsOsAccountGetTypeFormProcess_0100', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetTypeFormProcess_0100 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ osAccountManager.getOsAccountTypeFromProcess((err, accountType)=>{
+ console.debug("====>get type err: " + JSON.stringify(err));
+ console.debug("====>type obtained by process:" + JSON.stringify(accountType));
+ expect(err.code).assertEqual(0);
+ expect(accountType.ADMIN).assertEqual(0);
+ console.debug("====>ActsOsAccountGetTypeFormProcess_0100 end====");
+ done();
+ });
+ });
+
+ /*
+ * @tc.number : ActsOsAccountGetTypeFormProcess_0200
+ * @tc.name : getOsAccountTypeFromProcess promise
+ * @tc.desc : Verify that the user type obtained from the current process uid
+ */
+ it('ActsOsAccountGetTypeFormProcess_0200', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetTypeFormProcess_0200 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var accountType = await osAccountManager.getOsAccountTypeFromProcess();
+ console.debug("====>type obtained by process:" + JSON.stringify(accountType));
+ expect(accountType.ADMIN).assertEqual(0);
+ console.debug("====>ActsOsAccountGetTypeFormProcess_0200 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsOsAccountLocalIdSerial_0100
+ * @tc.name : getSerialNumberByOsAccountLocalId callback
+ * @tc.desc : Verify query serialNumber by 100 user and query 100 user by serialNumber
+ */
+ it('ActsOsAccountLocalIdSerial_0100', 0, async function (done) {
+ console.debug("====>ActsOsAccountLocalIdSerial_0100 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ osAccountManager.getSerialNumberByOsAccountLocalId(100, (err, serialNumber)=>{
+ console.debug("====>ger serialNumber err:" + JSON.stringify(err));
+ console.debug("====>get serialNumber:" + serialNumber + " by localId: 100" );
+ expect(err.code).assertEqual(0);
+ var serialNumberStr = serialNumber.toString();
+ var serialIntercept = serialNumberStr.substring(8);
+ console.debug("====>truncate the last eight characters: " + serialIntercept);
+ expect(serialIntercept).assertEqual("00000001");
+ osAccountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{
+ console.debug("====>ger localId err:" + JSON.stringify(err));
+ console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber);
+ expect(err.code).assertEqual(0);
+ expect(localId).assertEqual(100);
+ console.debug("====>ActsOsAccountLocalIdSerial_0100 end====");
+ done();
+ })
+ })
+ });
+
+ /*
+ * @tc.number : ActsOsAccountLocalIdSerial_0200
+ * @tc.name : getSerialNumberByOsAccountLocalId promise
+ * @tc.desc : Verify query serialNumber by 100 user and query 100 user by serialNumber
+ */
+ it('ActsOsAccountLocalIdSerial_0200', 0, async function (done) {
+ console.debug("====>ActsOsAccountLocalIdSerial_0200 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var serialNumber = await osAccountManager.getSerialNumberByOsAccountLocalId(100);
+ console.debug("====>get serialNumber:" + serialNumber + " by localId: 100" );
+ var serialNumberStr = serialNumber.toString();
+ var serialIntercept = serialNumberStr.substring(8);
+ console.debug("====>truncate the last eight characters: " + serialIntercept);
+ expect(serialIntercept).assertEqual("00000001");
+ var localId = await osAccountManager.getOsAccountLocalIdBySerialNumber(serialNumber);
+ console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber);
+ expect(localId).assertEqual(100);
+ console.debug("====>ActsOsAccountLocalIdSerial_0200 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsOsAccountLocalIdSerial_0300
+ * @tc.name : getOsAccountLocalIdBySerialNumber callback
+ * @tc.desc : Verify query serialNumber by 0 user and query 0 user by serialNumber
+ */
+ it('ActsOsAccountLocalIdSerial_0300', 0, async function (done) {
+ console.debug("====>ActsOsAccountLocalIdSerial_0300 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ osAccountManager.getSerialNumberByOsAccountLocalId(0, (err, serialNumber)=>{
+ console.debug("====>ger serialNumber err:" + JSON.stringify(err));
+ console.debug("====>get serialNumber:" + serialNumber + " by localId: 0" );
+ expect(err.code).assertEqual(0);
+ var serialNumberStr = serialNumber.toString();
+ var serialIntercept = serialNumberStr.substring(8);
+ console.debug("====>truncate the last eight characters: " + serialIntercept);
+ expect(serialIntercept).assertEqual("00000000");
+ osAccountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{
+ console.debug("====>ger localId err:" + JSON.stringify(err));
+ console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber);
+ expect(err.code).assertEqual(0);
+ expect(localId).assertEqual(0);
+ console.debug("====>ActsOsAccountLocalIdSerial_0300 end====");
+ done();
+ })
+ })
+ });
+
+ /*
+ * @tc.number : ActsOsAccountLocalIdSerial_0400
+ * @tc.name : getOsAccountLocalIdBySerialNumber promise
+ * @tc.desc : Verify query serialNumber by 0 user and query 0 user by serialNumber
+ */
+ it('ActsOsAccountLocalIdSerial_0400', 0, async function (done) {
+ console.debug("====>ActsOsAccountLocalIdSerial_0400 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var serialNumber = await osAccountManager.getSerialNumberByOsAccountLocalId(0);
+ console.debug("====>get serialNumber:" + serialNumber + " by localId: 0" );
+ var serialNumberStr = serialNumber.toString();
+ var serialIntercept = serialNumberStr.substring(8);
+ console.debug("====>truncate the last eight characters: " + serialIntercept);
+ expect(serialIntercept).assertEqual("00000000");
+ var localId = await osAccountManager.getOsAccountLocalIdBySerialNumber(serialNumber);
+ console.debug("====>get localId:" + localId + " by serialNumber: " + serialNumber);
+ expect(localId).assertEqual(0);
+ console.debug("====>ActsOsAccountLocalIdSerial_0400 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsOsAccountLocalIdSerial_0500
+ * @tc.name : getSerialNumberByOsAccountLocalId callback
+ * @tc.desc : Verify the query for the newly created user serialNumber and query the owning user through the
+ * serialNumber
+ */
+ it('ActsOsAccountLocalIdSerial_0500', 0, async function (done) {
+ console.debug("====>ActsOsAccountLocalIdSerial_0500 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var localId;
+ osAccountManager.createOsAccount("osAccountNameIdSerialA", osaccount.OsAccountType.NORMAL, (err, data)=>{
+ console.debug("====>create os account err: " + JSON.stringify(err));
+ console.debug("====>create os account OsAccountInfo: " + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data.localName).assertEqual("osAccountNameIdSerialA");
+ localId = data.localId;
+ osAccountManager.getSerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{
+ console.debug("====>queryOsAccountById err:" + JSON.stringify(err));
+ console.debug("====>get serialNumber:" + serialNumber + " by localId: " + localId);
+ expect(err.code).assertEqual(0);
+ osAccountManager.getOsAccountLocalIdBySerialNumber(serialNumber, (err, getlocalId)=>{
+ console.debug("====>ger localId err:" + JSON.stringify(err));
+ console.debug("====>get localId:" + getlocalId + " by serialNumber: " + serialNumber);
+ expect(err.code).assertEqual(0);
+ expect(getlocalId).assertEqual(localId);
+ osAccountManager.removeOsAccount(localId, (err)=>{
+ console.debug("====>remove localId: " + localId + " err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsOsAccountLocalIdSerial_0500 end====");
+ done();
+ })
+ })
+ })
+ })
+ });
+
+ /*
+ * @tc.number : ActsOsAccountLocalIdSerial_0600
+ * @tc.name : getOsAccountLocalIdBySerialNumber promise
+ * @tc.desc : Verify the query for the newly created user serialNumber and query the owning user through the
+ * serialNumber
+ */
+ it('ActsOsAccountLocalIdSerial_0600', 0, async function (done) {
+ console.debug("====>ActsOsAccountLocalIdSerial_0600 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var localId;
+ var OsAccountInfo = await osAccountManager.createOsAccount("accountIdSerialB", osaccount.OsAccountType.NORMAL);
+ console.debug("====>create os account OsAccountInfo: " + JSON.stringify(OsAccountInfo));
+ expect(OsAccountInfo.localName).assertEqual("accountIdSerialB");
+ localId = OsAccountInfo.localId;
+ var serialNumber = await osAccountManager.getSerialNumberByOsAccountLocalId(localId);
+ console.debug("====>get serialNumber:" + serialNumber + " by localId: " + localId);
+ var getlocalId = await osAccountManager.getOsAccountLocalIdBySerialNumber(serialNumber);
+ console.debug("====>get localId:" + getlocalId + " by serialNumber: " + serialNumber);
+ expect(getlocalId).assertEqual(localId);
+ await osAccountManager.removeOsAccount(localId);
+ console.debug("====>ActsOsAccountLocalIdSerial_0600 end====");
+ done();
+ });
+
+ /*
+ * @tc.number : ActsOsAccountGetCount_0100
+ * @tc.name : getCreatedOsAccountsCount callback
+ * @tc.desc : Verify to obtain the number os all os accounts created
+ */
+ it('ActsOsAccountGetCount_0100', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetCount_0100 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var obtainCount = 0;
+ var localIdFir;
+ var localIdSec;
+ osAccountManager.getCreatedOsAccountsCount((err, data)=>{
+ console.debug("====>obtains the number of all os accounts created err:" + JSON.stringify(err));
+ console.debug("====>obtains the number of all os accounts created data:" + data);
+ expect(err.code).assertEqual(0);
+ obtainCount = data;
+ osAccountManager.createOsAccount("osAccountNameIdSerialE", osaccount.OsAccountType.NORMAL, (err, data)=>{
+ console.debug("====>create first os account err: " + JSON.stringify(err));
+ console.debug("====>create first os account OsAccountInfo: " + JSON.stringify(data));
+ localIdFir = data.localId;
+ expect(err.code).assertEqual(0);
+ expect(data.localName).assertEqual("osAccountNameIdSerialE");
+ osAccountManager.createOsAccount("osAccountIdSerialF", osaccount.OsAccountType.NORMAL, (err, data)=>{
+ console.debug("====>create second os account err: " + JSON.stringify(err));
+ console.debug("====>create second os account OsAccountInfo: " + JSON.stringify(data));
+ localIdSec = data.localId;
+ expect(err.code).assertEqual(0);
+ expect(data.localName).assertEqual("osAccountIdSerialF");
+ osAccountManager.getCreatedOsAccountsCount((err, count)=>{
+ console.debug("====>obtains the number of all os accounts created err:" + JSON.stringify(err));
+ console.debug("====>obtains the number of all os accounts created count:" + count);
+ expect(err.code).assertEqual(0);
+ count = count - 2;
+ expect(count).assertEqual(obtainCount);
+ osAccountManager.removeOsAccount(localIdFir, (err)=>{
+ console.debug("====>remove localId: " + localIdFir + " err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ osAccountManager.getCreatedOsAccountsCount((err, data)=>{
+ console.debug("====>obtains the number accounts created err:" + JSON.stringify(err));
+ console.debug("====>obtains the number accounts created data:" + data);
+ expect(err.code).assertEqual(0);
+ data = data - 1;
+ expect(data).assertEqual(obtainCount);
+ osAccountManager.removeOsAccount(localIdSec, (err)=>{
+ console.debug("====>remove localId: " + localIdSec + " err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ console.debug("====>ActsOsAccountGetCount_0100 end====");
+ done();
+ })
+ })
+ })
+ })
+ })
+ })
+ })
+ })
+
+ /*
+ * @tc.number : ActsOsAccountGetCount_0200
+ * @tc.name : getCreatedOsAccountsCount promise
+ * @tc.desc : Verify to obtain the number os all os accounts created
+ */
+ it('ActsOsAccountGetCount_0200', 0, async function (done) {
+ console.debug("====>ActsOsAccountGetCount_0200 start====");
+ var osAccountManager = osaccount.getAccountManager();
+ console.debug("====>get AccountManager finish====");
+ var obtainCount = await osAccountManager.getCreatedOsAccountsCount();
+ console.debug("====>obtains the number of all os accounts created:" + obtainCount);
+ var osAccountFir = await osAccountManager.createOsAccount("osAccountIdSerialG", osaccount.OsAccountType.NORMAL);
+ console.debug("====>create first os account OsAccountInfo: " + JSON.stringify(osAccountFir));
+ var localIdFir = osAccountFir.localId;
+ expect(osAccountFir.localName).assertEqual("osAccountIdSerialG");
+ var osAccountSec = await osAccountManager.createOsAccount("osAccountIdSerialH", osaccount.OsAccountType.NORMAL);
+ console.debug("====>create second os account OsAccountInfo: " + JSON.stringify(osAccountSec));
+ var localIdSec = osAccountSec.localId;
+ expect(osAccountSec.localName).assertEqual("osAccountIdSerialH");
+ var countFir = await osAccountManager.getCreatedOsAccountsCount();
+ console.debug("====>obtains the number of all os accounts created count:" + countFir);
+ countFir = countFir - 2;
+ expect(countFir).assertEqual(obtainCount);
+ await osAccountManager.removeOsAccount(localIdFir);
+ console.debug("====>remove localId: " + localIdFir);
+ var countSec = await osAccountManager.getCreatedOsAccountsCount();
+ console.debug("====>obtains the number accounts created count:" + countSec);
+ countSec = countSec - 1;
+ expect(countSec).assertEqual(obtainCount);
+ await osAccountManager.removeOsAccount(localIdSec);
+ console.debug("====>remove localId: " + localIdSec);
+ console.debug("====>ActsOsAccountGetCount_0200 end====");
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js
new file mode 100755
index 0000000000000000000000000000000000000000..9f1904166e9acaf2ac7c210b39e4fc19468330bd
--- /dev/null
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js
@@ -0,0 +1,507 @@
+/*
+ * 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 osAccount from '@ohos.account.osAccount'
+import distributedAccount from '@ohos.account.distributedAccount'
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
+
+const TIMEOUT = 1000;
+const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR = 4587542;
+const ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR = 4587545;
+export default function ActsOsAccountThirdPartyTest_third_1() {
+ describe('ActsOsAccountThirdPartyTest_third_1', function () {
+
+ /*
+ * @tc.number : ActsOsAccountDeviceId_0100
+ * @tc.name : getDistributedVirtualDeviceId callback
+ * @tc.desc : get distributed virtual device ID
+ */
+ it('ActsOsAccountDeviceId_0100', 0, async function(done){
+ console.debug("====>ActsOsAccountDeviceId_0100 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ const deviceId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5';
+ const accountAbility = distributedAccount.getDistributedAccountAbility();
+ accountAbility.updateOsAccountDistributedInfo(
+ {
+ name: 'ZhangSan',
+ id: '12345',
+ event: "Ohos.account.event.LOGIN"
+ }, (err)=>{
+ console.debug("====>update distributedInfo err:" + JSON.stringify(err));
+ AccountManager.getDistributedVirtualDeviceId((err, id)=>{
+ console.debug("====>getDistributedVirtualDeviceId err:" + JSON.stringify(err));
+ console.debug("====>getDistributedVirtualDeviceId deviceId:" + id);
+ expect(err.code).assertEqual(0);
+ expect(id).assertEqual(deviceId);
+ console.debug("====>ActsOsAccountDeviceId_0100 end====");
+ done();
+ })
+ })
+ })
+
+ /*
+ * @tc.number : ActsOsAccountDeviceId_0200
+ * @tc.name : getDistributedVirtualDeviceId promise
+ * @tc.desc : get distributed virtual device ID
+ */
+ it('ActsOsAccountDeviceId_0200', 0, async function(done){
+ console.debug("====>ActsOsAccountDeviceId_0200 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ const deviceId = '5994471ABB01112AFCC18159F6CC74B4F511B99806DA59B3CAF5A9C173CACFC5';
+ const accountAbility = distributedAccount.getDistributedAccountAbility();
+ accountAbility.updateOsAccountDistributedInfo(
+ {
+ name: 'ZhangSan',
+ id: '12345',
+ event: "Ohos.account.event.LOGIN"
+ }, async (err)=>{
+ console.debug("====>update distributedInfo err:" + JSON.stringify(err));
+ console.debug("====>getDistributedVirtualDeviceId start====");
+ var id = await AccountManager.getDistributedVirtualDeviceId();
+ console.debug("====>getDistributedVirtualDeviceId:" + id);
+ expect(id).assertEqual(deviceId);
+ console.debug("====>ActsOsAccountDeviceId_0200 end====");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsActived_0100
+ * @tc.name : isOsAccountActived callback
+ * @tc.desc : Verify query 0 user status is true
+ */
+ it('ActsOsAccountIsActived_0100', 0, async function(done){
+ console.debug("====>ActsOsAccountIsActived_0100 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ AccountManager.isOsAccountActived(0, (err, isActived)=>{
+ console.debug("====>isOsAccountActived err:" + JSON.stringify(err));
+ console.debug("====>isOsAccountActived isActived:" + isActived);
+ expect(err.code).assertEqual(0);
+ expect(isActived).assertEqual(true);
+ console.debug("====>ActsOsAccountIsActived_0100 end");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsActived_0200
+ * @tc.name : isOsAccountActived promise
+ * @tc.desc : Verify query 0 user status is true
+ */
+ it('ActsOsAccountIsActived_0200', 0, async function(done){
+ console.debug("====>ActsOsAccountIsActived_0200 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ try{
+ var isActived = await AccountManager.isOsAccountActived(0);
+ }
+ catch(err){
+ console.debug("====>catch isOsAccountActived err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>isOsAccountActived:" + isActived);
+ expect(isActived).assertEqual(true);
+ console.debug("====>ActsOsAccountIsActived_0200 end");
+ done();
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsActived_0300
+ * @tc.name : isOsAccountActived callback
+ * @tc.desc : Authentication failed to query the active status of the user that does not exist
+ */
+ it('ActsOsAccountIsActived_0300', 0, async function(done){
+ console.debug("====>ActsOsAccountIsActived_0300 start");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var nonExistLocalId = 1000;
+ AccountManager.isOsAccountActived(nonExistLocalId, (err)=>{
+ console.debug("====>isOsAccountActived err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR);
+ console.debug("====>ActsOsAccountIsActived_0300 end");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsActived_0400
+ * @tc.name : isOsAccountActived promise
+ * @tc.desc : Authentication failed to query the active status of the user that does not exist
+ */
+ it('ActsOsAccountIsActived_0400', 0, async function(done){
+ console.debug("====>ActsOsAccountIsActived_0400 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var nonExistLocalId = 1000;
+ try{
+ await AccountManager.isOsAccountActived(nonExistLocalId);
+ }
+ catch(err){
+ console.debug("====>isOsAccountActived err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_ACTIVED_ERROR);
+ console.debug("====>ActsOsAccountIsActived_0400 end");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsActived_0500
+ * @tc.name : isOsAccountActived callback
+ * @tc.desc : Verify that the query active state is not received with parameter type mismatch
+ */
+ it('ActsOsAccountIsActived_0500', 0, async function(done){
+ console.debug("====>ActsOsAccountIsActived_0500 start");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var localIdStr = "100";
+ function funcIsActived(err, data){
+ console.debug("====>error received callback====");
+ console.debug("====>receive isOsAccountActived err: " + JSON.stringify(err));
+ console.debug("====>receive isOsAccountActived data: " + JSON.stringify(data));
+ expect().assertFail();
+ done();
+ }
+ AccountManager.isOsAccountActived(localIdStr, funcIsActived);
+ setTimeout(()=>{
+ console.debug("====>ActsOsAccountIsActived_0500 end====");
+ done();
+ }, TIMEOUT);
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsActived_0600
+ * @tc.name : isOsAccountActived promise
+ * @tc.desc : Verify that the query active state is not received with parameter type mismatch
+ */
+ it('ActsOsAccountIsActived_0600', 0, async function(done){
+ console.debug("====>ActsOsAccountIsActived_0600 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var localIdStr = "100";
+ var isActived = await AccountManager.isOsAccountActived(localIdStr);
+ console.debug("====>get active status is: " + isActived);
+ expect(isActived).assertEqual(null);
+ console.debug("====>ActsOsAccountIsActived_0600 end====");
+ done();
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsActived_0700
+ * @tc.name : isOsAccountActived callback
+ * @tc.desc : Verify that the query active state is not received with parameter undefined
+ */
+ it('ActsOsAccountIsActived_0700', 0, async function(done){
+ console.debug("====>ActsOsAccountIsActived_0700 start");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ function funcIsActived(err, data){
+ console.debug("====>error received callback====");
+ console.debug("====>receive isOsAccountActived err: " + JSON.stringify(err));
+ console.debug("====>receive isOsAccountActived data: " + JSON.stringify(data));
+ expect().assertFail();
+ done();
+ }
+ AccountManager.isOsAccountActived(undefined, funcIsActived);
+ setTimeout(()=>{
+ console.debug("====>ActsOsAccountIsActived_0700 end====");
+ done();
+ }, TIMEOUT);
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsActived_0800
+ * @tc.name : isOsAccountActived promise
+ * @tc.desc : Verify that the query active state is not received with parameter undefined
+ */
+ it('ActsOsAccountIsActived_0800', 0, async function(done){
+ console.debug("====>ActsOsAccountIsActived_0800 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var isActived = await AccountManager.isOsAccountActived(undefined);
+ console.debug("====>get active status is: " + isActived);
+ expect(isActived).assertEqual(null);
+ console.debug("====>ActsOsAccountIsActived_0800 end====");
+ done();
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsMulty_0100
+ * @tc.name : isMultiOsAccountEnable callback
+ * @tc.desc : Check whether the function of supporting multiple os account is enabled
+ */
+ it('ActsOsAccountIsMulty_0100', 0, async function(done){
+ console.debug("====>ActsOsAccountIsMulty_0100 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ AccountManager.isMultiOsAccountEnable((err, data)=>{
+ console.debug("====>isMultiOsAccountEnable err:" + JSON.stringify(err));
+ console.debug("====>isMultiOsAccountEnable data:" + data);
+ expect(err.code).assertEqual(0);
+ expect(data).assertEqual(true);
+ console.debug("====>ActsOsAccountIsMulty_0100 end====");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsMulty_0200
+ * @tc.name : isMultiOsAccountEnable promise
+ * @tc.desc : Check whether the function of supporting multiple os account is enabled
+ */
+ it('ActsOsAccountIsMulty_0200', 0, async function(done){
+ console.debug("====>ActsOsAccountIsMulty_0200 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ try{
+ var data = await AccountManager.isMultiOsAccountEnable();
+ }
+ catch(err){
+ console.debug("====>catch isMultiOsAccountEnable err:" + JSON.stringify(err));
+ expect().assertFail();
+ done();
+ }
+ console.debug("====>isMultiOsAccountEnable data:" + JSON.stringify(data));
+ expect(data).assertEqual(true);
+ console.debug("====>ActsOsAccountIsMulty_0200 end====");
+ done();
+ })
+
+ /*
+ * @tc.number : ActsOsAccountVerified_0100
+ * @tc.name : isOsAccountVerified callback
+ * @tc.desc : Verify that the initial state query is unlocked to false
+ */
+ it('ActsOsAccountVerified_0100', 0, async function(done){
+ console.debug("====>isOsAccountVerified_0100 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ AccountManager.isOsAccountVerified((err, data)=>{
+ console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
+ console.debug("====>isOsAccountVerified data:" + data);
+ expect(err.code).assertEqual(0);
+ expect(data).assertEqual(false);
+ console.debug("====>ActsOsAccountVerified_0100 end====");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number : ActsOsAccountVerified_0200
+ * @tc.name : isOsAccountVerified promise
+ * @tc.desc : Verify that the initial state query is unlocked to false
+ */
+ it('ActsOsAccountVerified_0200', 0, async function(done){
+ console.debug("====>isOsAccountVerified_0200 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var isVerified = await AccountManager.isOsAccountVerified();
+ console.debug("====>isOsAccountVerified data:" + isVerified);
+ expect(isVerified).assertEqual(false);
+ console.debug("====>ActsOsAccountVerified_0200 end====");
+ done();
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsVerified_0300
+ * @tc.name : isOsAccountVerified callback
+ * @tc.desc : Verify that the initial state query 0 user is unlocked to false
+ */
+ it('ActsOsAccountIsVerified_0300', 0, async function(done){
+ console.debug("====>ActsOsAccountIsVerified_0300 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ AccountManager.isOsAccountVerified(0, (err, data)=>{
+ console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(0);
+ expect(data).assertFalse();
+ console.debug("====>ActsOsAccountIsVerified_0300 end====");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsVerified_0400
+ * @tc.name : isOsAccountVerified promise
+ * @tc.desc : Verify that the initial state query 0 user is unlocked to false
+ */
+ it('ActsOsAccountIsVerified_0400', 0, async function(done){
+ console.debug("====>ActsOsAccountIsVerified_0400 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var isVerified = await AccountManager.isOsAccountVerified(0);
+ expect(isVerified).assertFalse();
+ console.debug("====>ActsOsAccountIsVerified_0400 end====");
+ done();
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsVerified_0500
+ * @tc.name : isOsAccountVerified callback
+ * @tc.desc : Verify query "100" user is unlocked failed
+ */
+ it('ActsOsAccountIsVerified_0500', 0, async function(done){
+ console.debug("====>ActsOsAccountIsVerified_0500 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var localIdStr = "100";
+ function funcIsVerified(err, data){
+ console.debug("====>error received callback====");
+ console.debug("====>receive isOsAccountVerified err: " + JSON.stringify(err));
+ console.debug("====>receive isOsAccountVerified data: " + JSON.stringify(data));
+ expect().assertFail();
+ done();
+ }
+ AccountManager.isOsAccountVerified(localIdStr, funcIsVerified);
+ setTimeout(()=>{
+ console.debug("====>ActsOsAccountIsVerified_0500 end====");
+ done();
+ }, TIMEOUT);
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsVerified_0600
+ * @tc.name : isOsAccountVerified promise
+ * @tc.desc : Verify query "100" user is unlocked failed
+ */
+ it('ActsOsAccountIsVerified_0600', 0, async function(done){
+ console.debug("====>ActsOsAccountIsVerified_0600 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var localIdStr = "100";
+ var isVerified = await AccountManager.isOsAccountVerified(localIdStr);
+ console.debug("====>get verified status is: " + isVerified);
+ expect(isVerified).assertEqual(null);
+ console.debug("====>ActsOsAccountIsVerified_0600 end====");
+ done();
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsVerified_0700
+ * @tc.name : isOsAccountVerified callback
+ * @tc.desc : Verify query undefined user is unlocked failed
+ */
+ it('ActsOsAccountIsVerified_0700', 0, async function(done){
+ console.debug("====>ActsOsAccountIsVerified_0700 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var localIdUndefined = undefined;
+ function funcIsVerified(err, data){
+ console.debug("====>error received callback====");
+ console.debug("====>receive isOsAccountVerified err: " + JSON.stringify(err));
+ console.debug("====>receive isOsAccountVerified data: " + JSON.stringify(data));
+ expect().assertFail();
+ done();
+ }
+ AccountManager.isOsAccountVerified(localIdUndefined, funcIsVerified);
+ setTimeout(()=>{
+ console.debug("====>ActsOsAccountIsVerified_0700 end====");
+ done();
+ }, TIMEOUT);
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsVerified_0800
+ * @tc.name : isOsAccountVerified promise
+ * @tc.desc : Verify query undefined user is unlocked failed
+ */
+ it('ActsOsAccountIsVerified_0800', 0, async function(done){
+ console.debug("====>ActsOsAccountIsVerified_0800 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var localIdUndefined = undefined;
+ var isVerified = await AccountManager.isOsAccountVerified(localIdUndefined);
+ console.debug("====>get verified status is: " + isVerified);
+ expect(isVerified).assertEqual(null);
+ console.debug("====>ActsOsAccountIsVerified_0800 end====");
+ done();
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsVerified_0900
+ * @tc.name : isOsAccountVerified callback
+ * @tc.desc : Verify query does not exist user unlock failed
+ */
+ it('ActsOsAccountIsVerified_0900', 0, async function(done){
+ console.debug("====>ActsOsAccountIsVerified_0900 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var osAccountLocalId = 1000;
+ AccountManager.isOsAccountVerified(osAccountLocalId, (err)=>{
+ console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR);
+ console.debug("====>ActsOsAccountIsVerified_0900 end====");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsVerified_1000
+ * @tc.name : isOsAccountVerified promise
+ * @tc.desc : Verify query does not exist user unlock failed
+ */
+ it('ActsOsAccountIsVerified_1000', 0, async function(done){
+ console.debug("====>ActsOsAccountIsVerified_1000 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var osAccountLocalId = 1000;
+ try{
+ await AccountManager.isOsAccountVerified(osAccountLocalId);
+ }
+ catch(err){
+ console.debug("====>isOsAccountVerified err:" + JSON.stringify(err));
+ expect(err.code).assertEqual(ERR_OSACCOUNT_KIT_IS_OS_ACCOUNT_VERIFIED_ERROR);
+ console.debug("====>ActsOsAccountIsVerified_1000 end====");
+ done();
+ }
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsTest_0100
+ * @tc.name : isTestOsAccount callback
+ * @tc.desc : check whether this OS account is a test OS account
+ */
+ it('ActsOsAccountIsTest_0100', 0, async function(done){
+ console.debug("====>ActsOsAccountIsTest_0100 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ AccountManager.isTestOsAccount((err, data)=>{
+ console.debug("====>isTestOsAccount err:" + JSON.stringify(err));
+ console.debug("====>isTestOsAccount data:" + JSON.stringify(data));
+ expect(err.code).assertEqual(0);
+ expect(data).assertEqual(false);
+ console.debug("====>ActsOsAccountIsTest_0100 end====");
+ done();
+ })
+ })
+
+ /*
+ * @tc.number : ActsOsAccountIsTest_0200
+ * @tc.name : isTestOsAccount promise
+ * @tc.desc : check whether this OS account is a test OS account
+ */
+ it('ActsOsAccountIsTest_0200', 0, async function(done){
+ console.debug("====>ActsOsAccountIsTest_0200 start====");
+ var AccountManager = osAccount.getAccountManager();
+ console.debug("====>get os AccountManager finish====");
+ var isTest = await AccountManager.isTestOsAccount();
+ expect(isTest).assertFalse();
+ console.debug("====>ActsOsAccountIsTest_0200 end====");
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/resources/base/element/string.json b/account/osaccount/actsosaccountthirdpartytest/src/main/resources/base/element/string.json
new file mode 100755
index 0000000000000000000000000000000000000000..5a685e30cae1638fb9c5fd966b9ab40b6b80b341
--- /dev/null
+++ b/account/osaccount/actsosaccountthirdpartytest/src/main/resources/base/element/string.json
@@ -0,0 +1,28 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ActsAccountTest"
+ },
+ {
+ "name": "mainability_description",
+ "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
diff --git a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/resources/base/media/icon.png b/account/osaccount/actsosaccountthirdpartytest/src/main/resources/base/media/icon.png
similarity index 100%
rename from account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/resources/base/media/icon.png
rename to account/osaccount/actsosaccountthirdpartytest/src/main/resources/base/media/icon.png