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

!3136 XTS错误用例下库

Merge pull request !3136 from chengxingzhen/OpenHarmony-3.1-Release
......@@ -1127,236 +1127,6 @@ describe('ActsFeatureAbilityTest', function () {
);
})
/**
* @tc.number: ACTS_StartAbilityForResult_0100
* @tc.name: StartAbilityForResult : Start other ability for result.
* @tc.desc: Check the return value of the interface (by Promise)
*/
it('ACTS_StartAbilityForResult_0100', 0, async function (done) {
var promise = await featureAbility.startAbilityForResult(
{
want:
{
action: "action.system.home",
entities: ["entity.system.home"],
type: "MIMETYPE",
options: {
// indicates the grant to perform read operations on the URI
authReadUriPermission: true,
// indicates the grant to perform write operations on the URI
authWriteUriPermission: true,
// support forward intent result to origin ability
abilityForwardResult: true,
// used for marking the ability start-up is triggered by continuation
abilityContinuation: true,
// specifies whether a component does not belong to ohos
notOhosComponent: true,
// specifies whether an ability is started
abilityFormEnabled: true,
// indicates the grant for possible persisting on the URI.
authPersistableUriPermission: true,
// indicates the grant for possible persisting on the URI.
authPrefixUriPermission: true,
// support distributed scheduling system start up multiple devices
abilitySliceMultiDevice: true,
// indicates that an ability using the service template is started regardless of whether the
// host application has been started.
startForegroundAbility: true,
// install the specified ability if it's not installed.
installOnDemand: true,
// return result to origin ability slice
abilitySliceForwardResult: true,
// install the specified ability with background mode if it's not installed.
installWithBackgroundMode: true
},
deviceId: "",
bundleName: "com.example.startabilityforresult",
abilityName: "com.example.startabilityforresult.MainAbility",
uri: ""
}
}
);
console.info('====> ACTS_StartAbilityForResult_0100 start ability=====>' + JSON.stringify(promise))
checkOnAbilityResult(promise);
done();
})
function checkOnAbilityResult(data) {
expect(typeof (data)).assertEqual("object");
expect(typeof (data.resultCode)).assertEqual("number");
expect(typeof (data.want.action)).assertEqual("string");
expect(Array.isArray(data.want.entities)).assertEqual(true);
expect(typeof (data.want.type)).assertEqual("string");
expect(typeof (data.want.deviceId)).assertEqual("string");
expect(typeof (data.want.bundleName)).assertEqual("string");
expect(typeof (data.want.abilityName)).assertEqual("string");
expect(typeof (data.want.uri)).assertEqual("string");
console.info('featureAbilityTest onAbilityResult asyncCallback success : *************');
console.info('resultCode : ' + data.resultCode);
console.info('want.action : ' + data.want.action);
console.info('want.entities.length : ' + data.want.entities.length);
for (var j = 0; j < data.want.entities.length; j++) {
console.info('want.entities : ' + data.want.entities[j]);
}
console.info('want.type : ' + data.want.type);
console.info('want.bundleName : ' + data.want.bundleName);
console.info('want.abilityName : ' + data.want.abilityName);
console.info('want.uri : ' + data.want.uri);
}
/**
* @tc.number: ACTS_HasWindowFocus_0200
* @tc.name: HasWindowFocus : Checks whether the main window of this ability has window focus
* @tc.desc: Check the return value of the interface (by Promise)
*/
it('ACTS_HasWindowFocus_0200', 0, async function (done) {
console.info('====>ACTS_HasWindowFocus_0200 start=====>')
featureAbility.startAbility(
{
want:
{
bundleName: "com.example.getcallingbundlepromisetest",
abilityName: "com.example.getcallingbundlepromisetest.MainAbility",
},
}, (err, data)=>{
console.info('====>ACTS_HasWindowFocus_0200 startAbility err: '+ JSON.stringify(err))
setTimeout(async function () {
console.info('====>ACTS_HasWindowFocus_0200 =====>')
var info = await featureAbility.hasWindowFocus();
console.info('====>ACTS_HasWindowFocus_0200 info ' + info);
expect(info).assertEqual(false);
done();
}, TIMEOUT)
}
);
})
/**
* @tc.number: ACTS_HasWindowFocus_0400
* @tc.name: HasWindowFocus : Checks whether the main window of this ability has window focus
* @tc.desc: Check the return value of the interface (by AsyncCallback)
*/
it('ACTS_HasWindowFocus_0400', 0, async function (done) {
console.info('====>ACTS_HasWindowFocus_0400 start=====>')
featureAbility.startAbility(
{
want:
{
bundleName: "com.example.getcallingbundlepromisetest",
abilityName: "com.example.getcallingbundlepromisetest.MainAbility",
},
}, (err, data)=>{
console.info('====>ACTS_HasWindowFocus_0400 startAbility err: '+ JSON.stringify(err))
setTimeout(async function () {
console.info('====> ACTS_HasWindowFocus_0400 =====>')
featureAbility.hasWindowFocus(
(error, data)=>{
console.log("ACTS_HasWindowFocus_0400 asyncCallback code: " + error.code + " data: " + data)
expect(error.code).assertEqual(0);
expect(data).assertEqual(false);
done();
});
}, TIMEOUT)
}
);
})
/**
* @tc.number: ACTS_TerminateAbility_0100
* @tc.name: TerminateAbility : Destroys ability
* @tc.desc: Check the return value of the interface (by Promise)
*/
it('ACTS_TerminateAbility_0100', 0, async function (done) {
var Subscriber;
let id;
let events = new Map();
function SubscribeCallBack(err, data) {
clearTimeout(id);
events.set(data.event, 0);
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
if (events.size > 1) {
checkResult();
} else {
expect(events.has("ACTS_TerminateAbility_0100_CommonEvent") ||
events.has("ACTS_TerminateAbility_0100_Return")).assertTrue();
}
}
commonEvent.createSubscriber(subscriberInfo_ACTS_TerminateAbility_0100).then(async (data) => {
console.debug("====>Create Subscriber====>");
Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBack);
})
function UnSubscribeCallback() {
console.debug("====>UnSubscribe CallBack====>");
done();
}
function timeout() {
expect().assertFail();
console.debug('ACTS_TerminateAbility_0100=====timeout======');
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
done();
}
function checkResult() {
console.debug('==========ACTS_TerminateAbility_0100==========checkResult');
expect(events.has("ACTS_TerminateAbility_0100_CommonEvent")).assertTrue();
expect(events.has("ACTS_TerminateAbility_0100_Return")).assertTrue();
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback)
done();
}
id = setTimeout(timeout, START_ABILITY_TIMEOUT);
var promise = featureAbility.startAbility(
{
want:
{
action: "action.system.home",
entities: ["entity.system.home"],
type: "MIMETYPE",
options: {
// indicates the grant to perform read operations on the URI
authReadUriPermission: true,
// indicates the grant to perform write operations on the URI
authWriteUriPermission: true,
// support forward intent result to origin ability
abilityForwardResult: true,
// used for marking the ability start-up is triggered by continuation
abilityContinuation: true,
// specifies whether a component does not belong to ohos
notOhosComponent: true,
// specifies whether an ability is started
abilityFormEnabled: true,
// indicates the grant for possible persisting on the URI.
authPersistableUriPermission: true,
// indicates the grant for possible persisting on the URI.
authPrefixUriPermission: true,
// support distributed scheduling system start up multiple devices
abilitySliceMultiDevice: true,
// indicates that an ability using the service template is started regardless of whether the
// host application has been started.
startForegroundAbility: true,
// install the specified ability if it's not installed.
installOnDemand: true,
// return result to origin ability slice
abilitySliceForwardResult: true,
// install the specified ability with background mode if it's not installed.
installWithBackgroundMode: true
},
deviceId: "",
bundleName: "com.example.terminateabilitytest",
abilityName: "com.example.terminateabilitytest.MainAbility",
uri: ""
},
}
);
expect(typeof (promise)).assertEqual("object");
})
/**
* @tc.number: ACTS_TerminateAbility_0200
* @tc.name: TerminateAbility : Destroys ability
......
......@@ -62,29 +62,6 @@ describe('ConnectAbilityTest', function () {
})
})
/*
* @tc.number: SUB_AA_JsApi_StartAbility_0500
* @tc.name: testAbility0500.
* @tc.desc: startAbility-want-configuration bundleName and abilityName+deviceId error.
*/
it("SUB_AA_JsApi_StartAbility_0500", 0, async function (done) {
let parameter = {
'want': {
'deviceId': '123123',
'bundleName': bundleName,
'abilityName': mainAbilityName
}
}
await featureAbility.startAbility(parameter).then((data) => {
console.log('testAbility0500 data: ' + JSON.stringify(data))
expect().assertFail()
}).catch((error) => {
console.log('testAbility0500 error: ' + JSON.stringify(error))
expect(errCode2).assertEqual(error.code)
})
done()
})
/*
* @tc.number: SUB_AA_JsApi_Ability_0400
* @tc.name: testAbility0400.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册