提交 d661dc77 编写于 作者: Y yaocui

update

Signed-off-by: Nyaocui <yaocui2@h-partners.com>
上级 6440cfd4
...@@ -730,14 +730,13 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -730,14 +730,13 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
function setSystemBarPropertiesFun(tempWnd, systemBarProperties) { function setSystemBarPropertiesFun(tempWnd, systemBarProperties) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
tempWnd.setSystemBarProperties(systemBarProperties, (err, data) => { tempWnd.setSystemBarProperties(systemBarProperties, (err) => {
if (err && err.code) { if (err && err.code) {
reject(null) reject(err)
} else { } else {
console.log(msgStr + 'tempWnd.setSystemBarProperties ' + JSON.stringify(systemBarProperties) + ' success'); console.log(msgStr + 'tempWnd.setSystemBarProperties ' + JSON.stringify(systemBarProperties) + ' success');
resolve(true) resolve(true)
} }
}) })
}) })
} }
...@@ -762,8 +761,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -762,8 +761,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
}; };
await setSystemBarPropertiesFun(tempWnd, systemBarProperties).catch((err) => { await setSystemBarPropertiesFun(tempWnd, systemBarProperties).catch((err) => {
console.info(msgStr + 'setSystemBarProperties error : ' + JSON.stringify(err)); console.info(msgStr + 'setSystemBarProperties error : ' + JSON.stringify(err));
if(err.code!==801){
expect().assertFail(); expect().assertFail();
done(); done();
}
}); });
} }
done(); done();
...@@ -907,7 +908,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -907,7 +908,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
tempWnd.setSystemBarProperties(systemBarProperties, (err, data) => { tempWnd.setSystemBarProperties(systemBarProperties, (err, data) => {
console.log(msgStr + 'tempWnd.setSystemBarProperties err' + JSON.stringify(err)); console.log(msgStr + 'tempWnd.setSystemBarProperties err' + JSON.stringify(err));
console.log(msgStr + 'tempWnd.setSystemBarProperties data' + JSON.stringify(data)); console.log(msgStr + 'tempWnd.setSystemBarProperties data' + JSON.stringify(data));
if (err && err.code) { if (err.code && err.code!==801) {
try { try {
expect(TRUE_FLAG).assertFail(); expect(TRUE_FLAG).assertFail();
} catch (error) { } catch (error) {
...@@ -1003,7 +1004,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) ...@@ -1003,7 +1004,7 @@ export default function windowCallbackTest(context, windowStage, abilityStorage)
tempWnd.setSystemBarProperties(systemBarProperties, (err, data) => { tempWnd.setSystemBarProperties(systemBarProperties, (err, data) => {
console.log(msgStr + 'tempWnd.setSystemBarProperties err' + JSON.stringify(err)); console.log(msgStr + 'tempWnd.setSystemBarProperties err' + JSON.stringify(err));
console.log(msgStr + 'tempWnd.setSystemBarProperties data' + JSON.stringify(data)); console.log(msgStr + 'tempWnd.setSystemBarProperties data' + JSON.stringify(data));
if (err && err.code) { if (err.code && err.code!==801) {
try { try {
expect(TRUE_FLAG).assertFail(); expect(TRUE_FLAG).assertFail();
} catch (error) { } catch (error) {
......
...@@ -774,7 +774,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -774,7 +774,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success'); console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success');
}, (err) => { }, (err) => {
console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err)); console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err));
if(err.code!==801){
expect(TRUE_FLAG).assertFail(); expect(TRUE_FLAG).assertFail();
done();
}
}) })
} }
}) })
...@@ -872,7 +875,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -872,7 +875,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success'); console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success');
}, (err) => { }, (err) => {
console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err)); console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err));
if(err.code!==801){
expect(TRUE_FLAG).assertFail(); expect(TRUE_FLAG).assertFail();
done();
}
}) })
} }
}) })
...@@ -947,8 +953,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) ...@@ -947,8 +953,10 @@ export default function windowPromiseTest(context, windowStage, abilityStorage)
console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success'); console.log(msgStr + 'tempWnd.setSystemBarProperties ' + tempColor + ' success');
}, (err) => { }, (err) => {
console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err)); console.log(msgStr + 'tempWnd.setSystemBarProperties failed, err : ' + JSON.stringify(err));
if(err.code!==801){
expect(TRUE_FLAG).assertFail(); expect(TRUE_FLAG).assertFail();
done(); done();
}
}) })
} }
}) })
......
...@@ -162,8 +162,10 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -162,8 +162,10 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
} }
}).catch(err => { }).catch(err => {
console.info('setWindowSystemBarPropertiesTest1 error : ' + JSON.stringify(err)); console.info('setWindowSystemBarPropertiesTest1 error : ' + JSON.stringify(err));
if(err.code!==801){
expect().assertFail() expect().assertFail()
done(); done();
}
}) })
} }
}) })
...@@ -272,8 +274,10 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -272,8 +274,10 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
} }
}).catch(err => { }).catch(err => {
console.info('setWindowSystemBarPropertiesTest2 error : ' + JSON.stringify(err)); console.info('setWindowSystemBarPropertiesTest2 error : ' + JSON.stringify(err));
if(err.code!==801){
expect().assertFail() expect().assertFail()
done(); done();
}
}) })
} }
}) })
...@@ -352,8 +356,10 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -352,8 +356,10 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
} }
}).catch(err => { }).catch(err => {
console.info('setWindowSystemBarPropertiesTest3 error : ' + JSON.stringify(err)); console.info('setWindowSystemBarPropertiesTest3 error : ' + JSON.stringify(err));
if(err.code!==801){
expect().assertFail() expect().assertFail()
done(); done();
}
}) })
} }
}) })
...@@ -377,14 +383,21 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -377,14 +383,21 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
try { try {
tempWnd.setWindowSystemBarProperties(SystemBarProperties, (err) => { tempWnd.setWindowSystemBarProperties(SystemBarProperties, (err) => {
console.info('Succeeded in setting the system bar properties.' + JSON.stringify(err)); console.info('Succeeded in setting the system bar properties.' + JSON.stringify(err));
if (err.code) { if (err.code && err.code!==801) {
try { try {
expect(err.code).assertEqual(401); expect(err.code).assertEqual(401);
} catch (error) { } catch (error) {
console.info(`tempWnd.setWindowSystemBarProperties catch error: ${JSON.stringify(error)}`) console.info(`tempWnd.setWindowSystemBarProperties catch error: ${JSON.stringify(error)}`)
} }
done() done()
} else { } else if(err.code && err.code==801){
try {
expect(TRUE_FLAG).assertTrue();
} catch (error) {
console.info(`tempWnd.setWindowSystemBarProperties catch error: ${JSON.stringify(error)}`)
}
done();
}else {
console.info('Succeeded in setting the system bar properties.'); console.info('Succeeded in setting the system bar properties.');
try { try {
expect(TRUE_FLAG).assertTrue(); expect(TRUE_FLAG).assertTrue();
...@@ -396,9 +409,14 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit ...@@ -396,9 +409,14 @@ export default function windowRefactorInterfaceTest(context, windowStage, abilit
}); });
} catch (exception) { } catch (exception) {
console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(exception)); console.error('Failed to set the system bar properties. Cause: ' + JSON.stringify(exception));
if(exception.code && exception.code==801){
expect(TRUE_FLAG).assertTrue();
done()
} else {
expect(exception.code).assertEqual(401); expect(exception.code).assertEqual(401);
done() done()
} }
}
; ;
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册