diff --git a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.js b/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.js index b9985ba2022bcb57b2bc33926c08533ff42162ee..5b71efd0c9fee4fe7a0fe14b8aa1b9dd4c3b1186 100755 --- a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.js +++ b/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/default/pages/index/index.js @@ -35,7 +35,7 @@ export default { core.init() const configService = core.getDefaultService('config') - this.timeout = 40000; + this.timeout = 60000; configService.setConfig(this) require('../../../test/List.test') diff --git a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/test/OsAccountIs.test.js b/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/test/OsAccountIs.test.js index fc5d54571dbfe5435ca882b65bfece4dd7bd3c08..d3b30bd949ea3e6973c502c265ec269192769a08 100755 --- a/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/test/OsAccountIs.test.js +++ b/account/osaccount/actsosaccountthirdpartytest/entry/src/main/js/test/OsAccountIs.test.js @@ -13,6 +13,7 @@ * 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 'deccjsunit/index' const TIMEOUT = 1000; @@ -29,13 +30,23 @@ describe('ActsOsAccountThirdPartyTest', function () { console.debug("====>ActsOsAccountDeviceId_0100 start===="); var AccountManager = osAccount.getAccountManager(); console.debug("====>get os AccountManager finish===="); - AccountManager.getDistributedVirtualDeviceId((err, deviceId)=>{ - console.debug("====>getDistributedVirtualDeviceId err:" + JSON.stringify(err)); - console.debug("====>getDistributedVirtualDeviceId deviceId:" + deviceId); - expect(err.code).assertEqual(0); - expect(deviceId).assertEqual(""); - console.debug("====>ActsOsAccountDeviceId_0100 end===="); - done(); + const deviceId = '169C610CEF7F8310D78763C7DD8D28F0668D9FB8B1A3659CEF8F6BC3D9B39E17'; + 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(); + }) }) }) @@ -48,18 +59,22 @@ describe('ActsOsAccountThirdPartyTest', function () { console.debug("====>ActsOsAccountDeviceId_0200 start===="); var AccountManager = osAccount.getAccountManager(); console.debug("====>get os AccountManager finish===="); - try{ - var deviceId = await AccountManager.getDistributedVirtualDeviceId(); - } - catch(err){ - console.error("====>catch getDistributedVirtualDeviceId err:" + JSON.stringify(err)); - expect().assertFail(); + const deviceId = '169C610CEF7F8310D78763C7DD8D28F0668D9FB8B1A3659CEF8F6BC3D9B39E17'; + 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(); - } - console.debug("====>getDistributedVirtualDeviceId:" + deviceId); - expect(deviceId).assertEqual(""); - console.debug("====>ActsOsAccountDeviceId_0200 end===="); - done(); + }) }) /*