未验证 提交 3df00c5f 编写于 作者: O openharmony_ci 提交者: Gitee

!8636 【Account】【Master】Xts execution time sequence problem

Merge pull request !8636 from zhaimengchao/master
...@@ -55,8 +55,7 @@ export default function ActsAccountOnOff() { ...@@ -55,8 +55,7 @@ export default function ActsAccountOnOff() {
* the credential * the credential
*/ */
it('ActsAccountOnOff_0300', 0, async function (done) { it('ActsAccountOnOff_0300', 0, async function (done) {
testInit(); await testInit();
await sleep(500);
console.debug("====>ActsAccountOnOff_0300 start===="); console.debug("====>ActsAccountOnOff_0300 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish"); console.debug("====>creat appAccountManager finish");
...@@ -72,26 +71,27 @@ export default function ActsAccountOnOff() { ...@@ -72,26 +71,27 @@ export default function ActsAccountOnOff() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
done(); done();
} }
function subscriberCallback(err, data){ async function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0300 data:" + JSON.stringify(data)); console.debug("====>subscriberCallback 0300 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_change_setcredential"); expect(data.event).assertEqual("account_on_change_setcredential");
expect(data.data).assertEqual("SUCCESS"); expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback); commonevent.unsubscribe(subscriber, unSubscriberCallback);
await sleep(1000)
appAccountManager.removeAccount("onoff_setcredential", removeAccountCallback); appAccountManager.removeAccount("onoff_setcredential", removeAccountCallback);
} }
async function publishCallback(err){ async function publishCallback(err){
console.debug("====>publish call back err:" + JSON.stringify(err)); console.debug("====>publish call back err:" + JSON.stringify(err));
await sleep(500) await sleep(500)
console.debug("====>setCredential start===="); console.debug("====>setCredential start====");
try{ try{
await appAccountManager.setCredential("onoff_setcredential", "credentialType", "credential"); await appAccountManager.setCredential("onoff_setcredential", "credentialType", "credential");
} }
catch(err){ catch(err){
console.error("====>setCredential fail err:" + JSON.stringify(err)); console.error("====>setCredential fail err:" + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
done(); done();
} }
console.debug("====>setCredential finish===="); console.debug("====>setCredential finish====");
} }
var commonEventSubscribeInfo = { var commonEventSubscribeInfo = {
events: ["account_on_change_setcredential"] events: ["account_on_change_setcredential"]
...@@ -106,7 +106,7 @@ export default function ActsAccountOnOff() { ...@@ -106,7 +106,7 @@ export default function ActsAccountOnOff() {
var commonEventPublishData = { var commonEventPublishData = {
code: 9 code: 9
} }
await sleep(1000) await sleep(500)
console.debug("====>publish event account_on_change 0300===="); console.debug("====>publish event account_on_change 0300====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}); });
...@@ -118,8 +118,7 @@ export default function ActsAccountOnOff() { ...@@ -118,8 +118,7 @@ export default function ActsAccountOnOff() {
* authorized account * authorized account
*/ */
it('ActsAccountOnOff_0400', 0, async function (done) { it('ActsAccountOnOff_0400', 0, async function (done) {
testInit(); await testInit();
await sleep(500);
console.debug("====>ActsAccountOnOff_0400 start===="); console.debug("====>ActsAccountOnOff_0400 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish"); console.debug("====>creat appAccountManager finish");
...@@ -139,26 +138,27 @@ export default function ActsAccountOnOff() { ...@@ -139,26 +138,27 @@ export default function ActsAccountOnOff() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
done(); done();
} }
function subscriberCallback(err, data){ async function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0400 data:" + JSON.stringify(data)); console.debug("====>subscriberCallback 0400 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_remove_another"); expect(data.event).assertEqual("account_on_remove_another");
expect(data.data).assertEqual("SUCCESS"); expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback); commonevent.unsubscribe(subscriber, unSubscriberCallback);
await sleep(1000)
appAccountManager.removeAccount("onoff_removeFir", removeAccountCallback); appAccountManager.removeAccount("onoff_removeFir", removeAccountCallback);
} }
async function publishCallback(err){ async function publishCallback(err){
console.debug("====>publish call back err:" + JSON.stringify(err)); console.debug("====>publish call back err:" + JSON.stringify(err));
await sleep(500) await sleep(500)
console.debug("====>removeAccount start===="); console.debug("====>removeAccount start====");
try{ try{
await appAccountManager.removeAccount("onoff_removeSec"); await appAccountManager.removeAccount("onoff_removeSec");
} }
catch(err){ catch(err){
console.error("====>removeAccount fail err:" + JSON.stringify(err)); console.error("====>removeAccount fail err:" + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
done(); done();
} }
console.debug("====>removeAccount finish===="); console.debug("====>removeAccount finish====");
} }
var commonEventSubscribeInfo = { var commonEventSubscribeInfo = {
events: ["account_on_remove_another"] events: ["account_on_remove_another"]
...@@ -173,9 +173,9 @@ export default function ActsAccountOnOff() { ...@@ -173,9 +173,9 @@ export default function ActsAccountOnOff() {
var commonEventPublishData = { var commonEventPublishData = {
code: 10 code: 10
} }
await sleep(1000) await sleep(500)
console.debug("====>publish event account_on_change 0400===="); console.debug("====>publish event account_on_change 0400====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}); });
/* /*
...@@ -185,8 +185,7 @@ export default function ActsAccountOnOff() { ...@@ -185,8 +185,7 @@ export default function ActsAccountOnOff() {
* the only authorized account * the only authorized account
*/ */
it('ActsAccountOnOff_0500', 0, async function (done) { it('ActsAccountOnOff_0500', 0, async function (done) {
testInit(); await testInit();
await sleep(500);
console.debug("====>ActsAccountOnOff_0500 start===="); console.debug("====>ActsAccountOnOff_0500 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish"); console.debug("====>creat appAccountManager finish");
...@@ -197,26 +196,31 @@ export default function ActsAccountOnOff() { ...@@ -197,26 +196,31 @@ export default function ActsAccountOnOff() {
function unSubscriberCallback(err){ function unSubscriberCallback(err){
console.debug("====>unsubscribe 0500 err:" + JSON.stringify(err)); console.debug("====>unsubscribe 0500 err:" + JSON.stringify(err));
} }
function subscriberCallback(err, data){ function removeAccountCallback(err){
console.debug("====>remove account 0500 err:" + JSON.stringify(err));
done();
}
async function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0500 data:" + JSON.stringify(data)); console.debug("====>subscriberCallback 0500 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_change_remove"); expect(data.event).assertEqual("account_on_change_remove");
expect(data.data).assertEqual("SUCCESS"); expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback); commonevent.unsubscribe(subscriber, unSubscriberCallback);
done(); await sleep(1000)
appAccountManager.removeAccount("onoff_remove", removeAccountCallback);
} }
async function publishCallback(err){ async function publishCallback(err){
console.debug("====>publish call back err:" + JSON.stringify(err)); console.debug("====>publish call back err:" + JSON.stringify(err));
await sleep(500) await sleep(500)
console.debug("====>removeAccount start===="); console.debug("====>removeAccount start====");
try{ try{
await appAccountManager.removeAccount("onoff_remove"); await appAccountManager.removeAccount("onoff_remove");
} }
catch(err){ catch(err){
console.error("====>removeAccount fail err:" + JSON.stringify(err)); console.error("====>removeAccount fail err:" + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
done(); done();
} }
console.debug("====>removeAccount finish===="); console.debug("====>removeAccount finish====");
} }
var commonEventSubscribeInfo = { var commonEventSubscribeInfo = {
events: ["account_on_change_remove"] events: ["account_on_change_remove"]
...@@ -231,9 +235,9 @@ export default function ActsAccountOnOff() { ...@@ -231,9 +235,9 @@ export default function ActsAccountOnOff() {
var commonEventPublishData = { var commonEventPublishData = {
code: 11 code: 11
} }
await sleep(1000) await sleep(500)
console.debug("====>publish event account_on_change 0500===="); console.debug("====>publish event account_on_change 0500====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}); });
/* /*
...@@ -243,8 +247,7 @@ export default function ActsAccountOnOff() { ...@@ -243,8 +247,7 @@ export default function ActsAccountOnOff() {
* authorized account * authorized account
*/ */
it('ActsAccountOnOff_0600', 0, async function (done) { it('ActsAccountOnOff_0600', 0, async function (done) {
testInit(); await testInit();
await sleep(500);
console.debug("====>ActsAccountOnOff_0600 start===="); console.debug("====>ActsAccountOnOff_0600 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish"); console.debug("====>creat appAccountManager finish");
...@@ -268,26 +271,27 @@ export default function ActsAccountOnOff() { ...@@ -268,26 +271,27 @@ export default function ActsAccountOnOff() {
done(); done();
}); });
} }
function subscriberCallback(err, data){ async function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0600 data:" + JSON.stringify(data)); console.debug("====>subscriberCallback 0600 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_set_another_disable"); expect(data.event).assertEqual("account_on_set_another_disable");
expect(data.data).assertEqual("SUCCESS"); expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback); commonevent.unsubscribe(subscriber, unSubscriberCallback);
await sleep(1000)
appAccountManager.removeAccount("onoff_disableFir", removeAccountCallback); appAccountManager.removeAccount("onoff_disableFir", removeAccountCallback);
} }
async function publishCallback(err){ async function publishCallback(err){
console.debug("====>publish call back err:" + JSON.stringify(err)); console.debug("====>publish call back err:" + JSON.stringify(err));
await sleep(500) await sleep(500)
console.debug("====>disableAppAccess start===="); console.debug("====>disableAppAccess start====");
try{ try{
await appAccountManager.setAppAccess("onoff_disableSec", "com.example.actsaccountsceneonoff", false); await appAccountManager.setAppAccess("onoff_disableSec", "com.example.actsaccountsceneonoff", false);
} }
catch(err){ catch(err){
console.error("====>disableAppAccess fail err:" + JSON.stringify(err)); console.error("====>disableAppAccess fail err:" + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
done(); done();
} }
console.debug("====>disableAppAccess finish===="); console.debug("====>disableAppAccess finish====");
} }
var commonEventSubscribeInfo = { var commonEventSubscribeInfo = {
events: ["account_on_set_another_disable"] events: ["account_on_set_another_disable"]
...@@ -302,9 +306,9 @@ export default function ActsAccountOnOff() { ...@@ -302,9 +306,9 @@ export default function ActsAccountOnOff() {
var commonEventPublishData = { var commonEventPublishData = {
code: 12 code: 12
} }
await sleep(1000) await sleep(500)
console.debug("====>publish event account_on_change 0600===="); console.debug("====>publish event account_on_change 0600====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}); });
}) })
......
...@@ -59,8 +59,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -59,8 +59,7 @@ export default function ActsAccountChangeOnOff() {
* the additional information * the additional information
*/ */
it('ActsAccountChangeOnOff_0100', 0, async function (done) { it('ActsAccountChangeOnOff_0100', 0, async function (done) {
testInit(); await testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0100 start===="); console.debug("====>ActsAccountChangeOnOff_0100 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish"); console.debug("====>creat appAccountManager finish");
...@@ -81,11 +80,12 @@ export default function ActsAccountChangeOnOff() { ...@@ -81,11 +80,12 @@ export default function ActsAccountChangeOnOff() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
appAccountManager.deleteAccount("changeonoff_extra", deleteAccountCallback); appAccountManager.deleteAccount("changeonoff_extra", deleteAccountCallback);
} }
function subscriberCallback(err, data){ async function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0100 data:" + JSON.stringify(data)); console.debug("====>subscriberCallback 0100 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_change_extra"); expect(data.event).assertEqual("account_on_change_extra");
expect(data.data).assertEqual("SUCCESS"); expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback); commonevent.unsubscribe(subscriber, unSubscriberCallback);
await sleep(1000)
appAccountManager.disableAppAccess("changeonoff_extra", "com.example.actsaccountsceneonoff", disCallback); appAccountManager.disableAppAccess("changeonoff_extra", "com.example.actsaccountsceneonoff", disCallback);
} }
function publishCallback(err){ function publishCallback(err){
...@@ -119,7 +119,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -119,7 +119,7 @@ export default function ActsAccountChangeOnOff() {
setTimeout(function (){ setTimeout(function (){
console.debug("====>publish event account_on_change 0100===="); console.debug("====>publish event account_on_change 0100====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}, 1000); }, 500);
}); });
/* /*
...@@ -129,8 +129,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -129,8 +129,7 @@ export default function ActsAccountChangeOnOff() {
* the associatal data * the associatal data
*/ */
it('ActsAccountChangeOnOff_0200', 0, async function (done) { it('ActsAccountChangeOnOff_0200', 0, async function (done) {
testInit(); await testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0200 start===="); console.debug("====>ActsAccountChangeOnOff_0200 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish"); console.debug("====>creat appAccountManager finish");
...@@ -146,11 +145,12 @@ export default function ActsAccountChangeOnOff() { ...@@ -146,11 +145,12 @@ export default function ActsAccountChangeOnOff() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
done(); done();
} }
function subscriberCallback(err, data){ async function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0200 data:" + JSON.stringify(data)); console.debug("====>subscriberCallback 0200 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_change_associatedata"); expect(data.event).assertEqual("account_on_change_associatedata");
expect(data.data).assertEqual("SUCCESS"); expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback); commonevent.unsubscribe(subscriber, unSubscriberCallback);
await sleep(1000)
appAccountManager.deleteAccount("onoff_associatedata", deleteAccountCallback); appAccountManager.deleteAccount("onoff_associatedata", deleteAccountCallback);
} }
function publishCallback(err){ function publishCallback(err){
...@@ -184,7 +184,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -184,7 +184,7 @@ export default function ActsAccountChangeOnOff() {
setTimeout(function (){ setTimeout(function (){
console.debug("====>publish event account_on_change 0200===="); console.debug("====>publish event account_on_change 0200====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}, 1000); }, 500);
}); });
/* /*
...@@ -194,8 +194,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -194,8 +194,7 @@ export default function ActsAccountChangeOnOff() {
* the credential * the credential
*/ */
it('ActsAccountChangeOnOff_0300', 0, async function (done) { it('ActsAccountChangeOnOff_0300', 0, async function (done) {
testInit(); await testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0300 start===="); console.debug("====>ActsAccountChangeOnOff_0300 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish"); console.debug("====>creat appAccountManager finish");
...@@ -211,11 +210,12 @@ export default function ActsAccountChangeOnOff() { ...@@ -211,11 +210,12 @@ export default function ActsAccountChangeOnOff() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
done(); done();
} }
function subscriberCallback(err, data){ async function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0300 data:" + JSON.stringify(data)); console.debug("====>subscriberCallback 0300 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_change_credential"); expect(data.event).assertEqual("account_on_change_credential");
expect(data.data).assertEqual("SUCCESS"); expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback); commonevent.unsubscribe(subscriber, unSubscriberCallback);
await sleep(1000)
appAccountManager.deleteAccount("onoff_credential", deleteAccountCallback); appAccountManager.deleteAccount("onoff_credential", deleteAccountCallback);
} }
function publishCallback(err){ function publishCallback(err){
...@@ -249,7 +249,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -249,7 +249,7 @@ export default function ActsAccountChangeOnOff() {
setTimeout(function (){ setTimeout(function (){
console.debug("====>publish event account_on_change 0300===="); console.debug("====>publish event account_on_change 0300====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}, 1000); }, 500);
}); });
/* /*
...@@ -259,8 +259,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -259,8 +259,7 @@ export default function ActsAccountChangeOnOff() {
* authorized account * authorized account
*/ */
it('ActsAccountChangeOnOff_0400', 0, async function (done) { it('ActsAccountChangeOnOff_0400', 0, async function (done) {
testInit(); await testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0400 start===="); console.debug("====>ActsAccountChangeOnOff_0400 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish"); console.debug("====>creat appAccountManager finish");
...@@ -280,11 +279,12 @@ export default function ActsAccountChangeOnOff() { ...@@ -280,11 +279,12 @@ export default function ActsAccountChangeOnOff() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
done(); done();
} }
function subscriberCallback(err, data){ async function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0400 data:" + JSON.stringify(data)); console.debug("====>subscriberCallback 0400 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_delete_another"); expect(data.event).assertEqual("account_on_delete_another");
expect(data.data).assertEqual("SUCCESS"); expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback); commonevent.unsubscribe(subscriber, unSubscriberCallback);
await sleep(1000)
appAccountManager.deleteAccount("onoff_deleteFir", deleteAccountCallback); appAccountManager.deleteAccount("onoff_deleteFir", deleteAccountCallback);
} }
function publishCallback(err){ function publishCallback(err){
...@@ -318,7 +318,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -318,7 +318,7 @@ export default function ActsAccountChangeOnOff() {
setTimeout(function (){ setTimeout(function (){
console.debug("====>publish event account_on_change 0400===="); console.debug("====>publish event account_on_change 0400====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}, 1000); }, 500);
}); });
/* /*
...@@ -328,8 +328,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -328,8 +328,7 @@ export default function ActsAccountChangeOnOff() {
* the only authorized account * the only authorized account
*/ */
it('ActsAccountChangeOnOff_0500', 0, async function (done) { it('ActsAccountChangeOnOff_0500', 0, async function (done) {
testInit(); await testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0500 start===="); console.debug("====>ActsAccountChangeOnOff_0500 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish"); console.debug("====>creat appAccountManager finish");
...@@ -340,12 +339,17 @@ export default function ActsAccountChangeOnOff() { ...@@ -340,12 +339,17 @@ export default function ActsAccountChangeOnOff() {
function unSubscriberCallback(err){ function unSubscriberCallback(err){
console.debug("====>unsubscribe 0500 err:" + JSON.stringify(err)); console.debug("====>unsubscribe 0500 err:" + JSON.stringify(err));
} }
function subscriberCallback(err, data){ function deleteAccountCallback(err){
console.debug("====>delete account 0500 err:" + JSON.stringify(err));
done();
}
async function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0500 data:" + JSON.stringify(data)); console.debug("====>subscriberCallback 0500 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_change_delete"); expect(data.event).assertEqual("account_on_change_delete");
expect(data.data).assertEqual("SUCCESS"); expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback); commonevent.unsubscribe(subscriber, unSubscriberCallback);
done(); await sleep(1000)
appAccountManager.deleteAccount("onoff_delete", deleteAccountCallback);
} }
function publishCallback(err){ function publishCallback(err){
console.debug("====>publish call back err:" + JSON.stringify(err)); console.debug("====>publish call back err:" + JSON.stringify(err));
...@@ -355,7 +359,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -355,7 +359,7 @@ export default function ActsAccountChangeOnOff() {
await appAccountManager.deleteAccount("onoff_delete"); await appAccountManager.deleteAccount("onoff_delete");
} }
catch(err){ catch(err){
console.error("====>deleteAccount fail err:" + JSON.stringify(err)); console.error("====>deleteAccount fail err:" + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
done(); done();
} }
...@@ -378,7 +382,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -378,7 +382,7 @@ export default function ActsAccountChangeOnOff() {
setTimeout(function (){ setTimeout(function (){
console.debug("====>publish event account_on_change 0500===="); console.debug("====>publish event account_on_change 0500====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}, 1000); }, 500);
}); });
/* /*
...@@ -388,8 +392,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -388,8 +392,7 @@ export default function ActsAccountChangeOnOff() {
* authorized account * authorized account
*/ */
it('ActsAccountChangeOnOff_0600', 0, async function (done) { it('ActsAccountChangeOnOff_0600', 0, async function (done) {
testInit(); await testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0600 start===="); console.debug("====>ActsAccountChangeOnOff_0600 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish"); console.debug("====>creat appAccountManager finish");
...@@ -413,11 +416,12 @@ export default function ActsAccountChangeOnOff() { ...@@ -413,11 +416,12 @@ export default function ActsAccountChangeOnOff() {
done(); done();
}); });
} }
function subscriberCallback(err, data){ async function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0600 data:" + JSON.stringify(data)); console.debug("====>subscriberCallback 0600 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_disable_another"); expect(data.event).assertEqual("account_on_disable_another");
expect(data.data).assertEqual("SUCCESS"); expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback); commonevent.unsubscribe(subscriber, unSubscriberCallback);
await sleep(1000)
appAccountManager.deleteAccount("onoff_enableFir", deleteAccountCallback); appAccountManager.deleteAccount("onoff_enableFir", deleteAccountCallback);
} }
function publishCallback(err){ function publishCallback(err){
...@@ -451,7 +455,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -451,7 +455,7 @@ export default function ActsAccountChangeOnOff() {
setTimeout(function (){ setTimeout(function (){
console.debug("====>publish event account_on_change 0600===="); console.debug("====>publish event account_on_change 0600====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}, 1000); }, 500);
}); });
/* /*
...@@ -461,8 +465,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -461,8 +465,7 @@ export default function ActsAccountChangeOnOff() {
* the only authorized account * the only authorized account
*/ */
it('ActsAccountChangeOnOff_0700', 0, async function (done) { it('ActsAccountChangeOnOff_0700', 0, async function (done) {
testInit(); await testInit();
await sleep(1000);
console.debug("====>ActsAccountChangeOnOff_0700 start===="); console.debug("====>ActsAccountChangeOnOff_0700 start====");
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
console.debug("====>creat appAccountManager finish"); console.debug("====>creat appAccountManager finish");
...@@ -478,11 +481,12 @@ export default function ActsAccountChangeOnOff() { ...@@ -478,11 +481,12 @@ export default function ActsAccountChangeOnOff() {
expect(err).assertEqual(null); expect(err).assertEqual(null);
done(); done();
} }
function subscriberCallback(err, data){ async function subscriberCallback(err, data){
console.debug("====>subscriberCallback 0700 data:" + JSON.stringify(data)); console.debug("====>subscriberCallback 0700 data:" + JSON.stringify(data));
expect(data.event).assertEqual("account_on_change_disable"); expect(data.event).assertEqual("account_on_change_disable");
expect(data.data).assertEqual("SUCCESS"); expect(data.data).assertEqual("SUCCESS");
commonevent.unsubscribe(subscriber, unSubscriberCallback); commonevent.unsubscribe(subscriber, unSubscriberCallback);
await sleep(1000)
appAccountManager.deleteAccount("onoff_disable", deleteAccountCallback); appAccountManager.deleteAccount("onoff_disable", deleteAccountCallback);
} }
function publishCallback(err){ function publishCallback(err){
...@@ -516,7 +520,7 @@ export default function ActsAccountChangeOnOff() { ...@@ -516,7 +520,7 @@ export default function ActsAccountChangeOnOff() {
setTimeout(function (){ setTimeout(function (){
console.debug("====>publish event account_on_change 0700===="); console.debug("====>publish event account_on_change 0700====");
commonevent.publish("account_on_change", commonEventPublishData, publishCallback); commonevent.publish("account_on_change", commonEventPublishData, publishCallback);
}, 1000); }, 500);
}); });
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册