提交 d96806ae 编写于 作者: Y yangzk

IssueNo: #I5X5NZ

Description: 适配ServiceExtensionAbility
Sig: SIG_ApplicationFramework
Feature or Bugfix: Feature
Binary Source: No
Signed-off-by: Nyangzk <yangzhongkai@huawei.com>
Change-Id: I2249e8978ab7dafc6b7128f23471b27147763f82
上级 53f7f9a3
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import FormExtension from '@ohos.application.FormExtension';
import FormExtension from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
import commonEvent from '@ohos.commonEvent';
......
......@@ -19,9 +19,10 @@ import FormInfo from '@ohos.application.formInfo';
import formInfoNew from '@ohos.app.form.formInfo';
import formError from '@ohos.application.formError';
import formHost from '@ohos.application.formHost';
import errorManager from '@ohos.application.errorManager';
import abilityConstant from '@ohos.application.AbilityConstant'
import errorManager from '@ohos.app.ability.errorManager';
import abilityConstant from '@ohos.app.ability.AbilityConstant'
import appManager from '@ohos.application.appManager'
import appManagerNew from '@ohos.app.ability.appManager'
import applicationContext from '@ohos.application.context'
import commonEvent from '@ohos.commonEvent';
import ability from '@ohos.ability.ability';
......@@ -453,23 +454,12 @@ export default function ApiCoverTest() {
expect("ohos.extra.param.key.form_name").assertEqual(FormInfo.FormParam.NAME_KEY)
expect("ohos.extra.param.key.form_temporary").assertEqual(FormInfo.FormParam.TEMPORARY_KEY)
expect("ohos.extra.param.key.form_identity").assertEqual(FormInfo.FormParam.IDENTITY_KEY)
expect("ohos.extra.param.key.bundle_name").assertEqual(FormInfo.FormParam.BUNDLE_NAME_KEY)
expect("ohos.extra.param.key.ability_name").assertEqual(FormInfo.FormParam.ABILITY_NAME_KEY)
expect(0).assertEqual(FormInfo.FormState.DEFAULT)
expect(1).assertEqual(FormInfo.FormState.READY)
expect(-1).assertEqual(FormInfo.FormState.UNKNOWN)
expect(0).assertEqual(FormInfo.ColorMode.MODE_DARK)
expect(1).assertEqual(FormInfo.ColorMode.MODE_LIGHT)
console.info("SUB_AA_Form_provider_TestFormInfo_0100:" + FormInfo.FormDimension.Dimension_2_1);
expect(1).assertEqual(FormInfo.FormDimension.Dimension_1_2)
expect(2).assertEqual(FormInfo.FormDimension.Dimension_2_2)
expect(3).assertEqual(FormInfo.FormDimension.Dimension_2_4)
expect(4).assertEqual(FormInfo.FormDimension.Dimension_4_4)
expect(5).assertEqual(FormInfo.FormDimension.Dimension_2_1)
expect(1).assertEqual(FormInfo.FormType.JS);
expect(2).assertEqual(FormInfo.FormType.eTS);
expect(1).assertEqual(FormInfo.VisibilityType.FORM_VISIBLE);
expect(2).assertEqual(FormInfo.VisibilityType.FORM_INVISIBLE);
done();
});
......@@ -528,9 +518,9 @@ export default function ApiCoverTest() {
console.info("SUB_AA_ReisterErrorObserver_0100" + JSON.stringify(errMessage));
}
}
let errCodeId = errorManager.registerErrorObserver(errorObserver)
let errCodeId = errorManager.on("error", errorObserver)
expect(errCodeId).assertEqual(0)
errorManager.unregisterErrorObserver(errCodeId).then((data)=>{
errorManager.off("error", errCodeId).then((data)=>{
expect(data).assertEqual(undefined)
done();
}).catch((err)=>{
......@@ -539,26 +529,6 @@ export default function ApiCoverTest() {
})
});
/*
* @tc.number SUB_AA_ReisterErrorObserver_0200
* @tc.name Test unregisterErrorObserver with error number.
* @tc.desc Function test
* @tc.level 3
*/
it('SUB_AA_ReisterErrorObserver_0200', 0, async function (done) {
errorManager.unregisterErrorObserver(-1, (err, data)=>{
console.info("SUB_AA_ReisterErrorObserver_0200:" + JSON.stringify(err) + " " + JSON.stringify(data));
console.info("SUB_AA_ReisterErrorObserver_0200:" + typeof(err.code));
if(err.code != 0){
expect(err.code).assertEqual(-2)
done()
}else{
expect().assertFail()
done();
}
})
});
/*
* @tc.number SUB_AA_Test_AbilityConstant_0100
* @tc.name Test abilityConstant.
......@@ -584,7 +554,7 @@ export default function ApiCoverTest() {
it('SUB_AA_Test_ProcessRunningInformation_0100', 0, async function (done) {
let processRunningInformation:appManager.ProcessRunningInformation;
let process;
appManager.getProcessRunningInformation().then((processRunningInformations)=>{
appManagerNew.getProcessRunningInformation().then((processRunningInformations)=>{
console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(processRunningInformations));
for(let i = 0; i < processRunningInformations.length; i++){
console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(processRunningInformations[i]));
......@@ -611,7 +581,7 @@ export default function ApiCoverTest() {
*/
it('SUB_AA_Test_ProcessRunningInformation_0200', 0, async function (done) {
let process;
appManager.getProcessRunningInformation((error, processRunningInformations)=>{
appManagerNew.getProcessRunningInformation((error, processRunningInformations)=>{
if(error.code == 0){
console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(processRunningInformations));
for(let i = 0; i < processRunningInformations.length; i++){
......@@ -687,7 +657,7 @@ export default function ApiCoverTest() {
*/
it('SUB_AA_FMS_AcquireForm_0100', 0, async function (done) {
let subscriber = null
let formExtensionContext:applicationContext.FormExtensionContext
let formExtensionContext:common.FormExtensionContext
let pacMap:ability.PacMap
let subscribeInfo = {
events: ["Form_StartAbility"]
......
......@@ -13,8 +13,8 @@
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import formProvider from '@ohos.application.formProvider';
import formInfo from '@ohos.application.formInfo';
import formProvider from '@ohos.app.form.formProvider';
import formInfo from '@ohos.app.form.formInfo';
import formError from '@ohos.application.formError';
let module1FormInfo: formInfo.FormInfo = {
......@@ -59,6 +59,7 @@ let module2FormInfo: formInfo.FormInfo = {
customizeData: {}
}
const ERR_ADD_INVALID_PARAM = 401;
var expectResult = Array();
expectResult.push(module1FormInfo);
expectResult.push(module2FormInfo);
......@@ -75,7 +76,7 @@ export default function abilityTest() {
formProvider.getFormsInfo((err, value) => {
console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err));
console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value));
expect(err.code).assertEqual(0);
expect(err).assertEqual(null);
expect(value.length).assertEqual(2);
checkResultArray(expectResult, value)
done();
......@@ -124,12 +125,18 @@ export default function abilityTest() {
*/
it('SUB_AA_OpenHarmony_ProviderGetForsInfo_0400', 0, async function (done) {
console.info("SUB_AA_OpenHarmony_ProviderGetForsInfo_0400");
formProvider.getFormsInfo(undefined, function(err, value) {
try {
formProvider.getFormsInfo(undefined, function(err, value) {
console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err));
console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value));
expect().assertFail();
done();
})
} catch (err) {
console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err));
console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value));
expect(err.code).assertEqual(formError.FormError.ERR_ADD_INVALID_PARAM);
expect(err.code).assertEqual(ERR_ADD_INVALID_PARAM);
done();
});
}
});
/**
......@@ -143,7 +150,7 @@ export default function abilityTest() {
formProvider.getFormsInfo(filter, function(err, value) {
console.info("formProvider::GetFormsInfoTest: " + JSON.stringify(err));
console.info("formProvider::GetFormsInfoTest: " + JSON.stringify(value));
expect(err.code).assertEqual(0);
expect(err).assertEqual(null);
expect(value.length).assertEqual(2);
checkResultArray(expectResult, value);
done();
......@@ -163,7 +170,7 @@ export default function abilityTest() {
formProvider.getFormsInfo(filter, function(err, value) {
console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err));
console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value));
expect(err.code).assertEqual(0);
expect(err).assertEqual(null);
expect(value.length).assertEqual(2);
checkResultArray(expectResult, value);
done();
......@@ -183,7 +190,7 @@ export default function abilityTest() {
formProvider.getFormsInfo(filter, function(err, value) {
console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err));
console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value));
expect(err.code).assertEqual(0);
expect(err).assertEqual(null);
expect(value.length).assertEqual(2);
checkResultArray(expectResult, value);
done();
......@@ -203,7 +210,7 @@ export default function abilityTest() {
formProvider.getFormsInfo(filter, function(err, value) {
console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err));
console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value));
expect(err.code).assertEqual(0);
expect(err).assertEqual(null);
expect(value.length).assertEqual(0);
done();
});
......@@ -222,7 +229,7 @@ export default function abilityTest() {
formProvider.getFormsInfo(filter, function(err, value) {
console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err));
console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value));
expect(err.code).assertEqual(0);
expect(err).assertEqual(null);
expect(value.length).assertEqual(1);
checkResult(module1FormInfo, value[0]);
done();
......@@ -241,7 +248,7 @@ export default function abilityTest() {
formProvider.getFormsInfo(filter, function(err, value) {
console.info("formProvider::GetFormsInfoTest err: " + JSON.stringify(err));
console.info("formProvider::GetFormsInfoTest value: " + JSON.stringify(value));
expect(err.code).assertEqual(0);
expect(err).assertEqual(null);
expect(value.length).assertEqual(0);
done();
});
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import FormExtension from '@ohos.application.FormExtension';
import FormExtension from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import FormExtension from '@ohos.application.FormExtension';
import FormExtension from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
......
......@@ -20,7 +20,7 @@ import rpc from '@ohos.rpc';
import featureAbility from '@ohos.ability.featureAbility';
import wantConstant from '@ohos.ability.wantConstant'
import Prompt from '@system.prompt';
import abilityManager from '@ohos.application.abilityManager';
import abilityManager from '@ohos.app.ability.abilityManager';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
......
......@@ -19,7 +19,7 @@ import ability from '@ohos.application.Ability'
import rpc from '@ohos.rpc';
import wantConstant from '@ohos.ability.wantConstant'
import Prompt from '@system.prompt';
import abilityManager from '@ohos.application.abilityManager';
import abilityManager from '@ohos.app.ability.abilityManager';
export default function StartAbilityForResult(abilityContext) {
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import FormExtension from '@ohos.application.FormExtension';
import FormExtension from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
......
......@@ -21,7 +21,7 @@ import ability from '@ohos.application.Ability'
import rpc from '@ohos.rpc';
import wantConstant from '@ohos.ability.wantConstant'
import Prompt from '@system.prompt';
import abilityManager from '@ohos.application.abilityManager';
import abilityManager from '@ohos.app.ability.abilityManager';
import commonEvent from '@ohos.commonEvent';
const SYSTEM_INNER_ERROR = 16000050
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import FormExtension from '@ohos.application.FormExtension';
import FormExtension from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.application.formBindingData';
export default class ServiceAbility extends FormExtension {
......
import FormExtension from '@ohos.application.FormExtension';
import FormExtension from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
......
import FormExtension from '@ohos.application.FormExtension';
import FormExtension from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
......
import FormExtension from '@ohos.application.FormExtension';
import FormExtension from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
......
import FormExtension from '@ohos.application.FormExtension';
import FormExtension from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
......
import FormExtension from '@ohos.application.FormExtension';
import FormExtension from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
......
import FormExtension from '@ohos.application.FormExtension';
import FormExtension from '@ohos.app.form.FormExtensionAbility';
import formBindingData from '@ohos.application.formBindingData';
import formInfo from '@ohos.application.formInfo';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import Ability from '@ohos.app.ability.UIAbility'
import dataShare from '@ohos.data.dataShare'
import rpc from "@ohos.rpc";
......@@ -111,7 +111,7 @@ export default class MainAbility extends Ability {
console.log("[ttt] [DataShareTest] <<Consumer>> MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context;
let context = this.context;
dseConnectionId = context.connectAbility(dseWant, dseConnect);
dseConnectionId = context.connectServiceExtensionAbility(dseWant, dseConnect);
globalThis.connectDataShareExtAbility = (async () => {
console.log("[ttt] [DataShareTest] <<Consumer>> connectDataShareExtAbility begin");
await dataShare.createDataShareHelper(globalThis.abilityContext, dseUri, (err,data)=>{
......@@ -122,7 +122,7 @@ export default class MainAbility extends Ability {
console.info("[ttt] [DataShareTest] <<Consumer>> ----- 3 -----, err = " + err);
console.info("[ttt] [DataShareTest] <<Consumer>> ----- 4 -----, JSON.stringify(err) = " + JSON.stringify(err));
});
dseConnectionId = await context.connectAbility(dseWant, dseConnect);
dseConnectionId = await context.connectServiceExtensionAbility(dseWant, dseConnect);
})
windowStage.setUIContent(this.context, "MainAbility/pages/index", null)
}
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import Ability from '@ohos.app.ability.UIAbility'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
......
import hilog from '@ohos.hilog';
import AbilityStage from "@ohos.application.AbilityStage"
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
......
......@@ -2,7 +2,7 @@ import hilog from '@ohos.hilog';
import Window from '@ohos.window';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
import Ability from '@ohos.application.Ability';
import Ability from '@ohos.app.ability.UIAbility';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
export default class MainAbility extends Ability {
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import AbilityStage from "@ohos.application.AbilityStage"
import AbilityStage from "@ohos.app.ability.AbilityStage"
export default class MyAbilityStage extends AbilityStage {
onCreate() {
......
......@@ -15,7 +15,7 @@
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
import Ability from '@ohos.application.Ability'
import Ability from '@ohos.app.ability.UIAbility'
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册