mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-07-19 14:33:33 -04:00
aa
Signed-off-by: liuyanzhi <liuyanzhi3@huawei.com> Change-Id: Id9a1af1d63f1f379d23b2c061e7dca7bb4edcbec
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
import { paramMock } from "../utils"
|
||||
import { RemoteObjectClass } from "./applicationServiceExtension"
|
||||
import { RemoteObjectClass } from "./applicationServiceExtensionAbility"
|
||||
|
||||
const ApplicationInfoMock = {
|
||||
name: '[PC preview] unknow name',
|
||||
|
||||
+36
-15
@@ -90,7 +90,7 @@ export const RemoteObjectClass = class RemoteObject {
|
||||
};
|
||||
}
|
||||
}
|
||||
export function mockServiceExtension() {
|
||||
export function mockServiceExtensionAbility() {
|
||||
const IRemoteBrokerMock = {
|
||||
asObject: function () {
|
||||
console.warn("IRemoteBroker.asObject interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
@@ -135,10 +135,22 @@ export function mockServiceExtension() {
|
||||
const serviceExtensionContextClass = class serviceExtensionContext extends ExtensionContextClass {
|
||||
constructor() {
|
||||
super();
|
||||
console.warn('ServiceExtension.serviceExtensionContext.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
console.warn('ServiceExtensionAbility.serviceExtensionContext.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.startAbility = function (...args) {
|
||||
console.warn("ServiceExtension.serviceExtensionContext.startAbility interface mocked in the Previewer." +
|
||||
console.warn("ServiceExtensionAbility.serviceExtensionContext.startAbility interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (len > 0 && typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
};
|
||||
this.startAbilityWithAccount = function (...args) {
|
||||
console.warn("ServiceExtensionAbility.serviceExtensionContext.startAbilityWithAccount interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (len > 0 && typeof args[len - 1] === 'function') {
|
||||
@@ -150,7 +162,7 @@ export function mockServiceExtension() {
|
||||
}
|
||||
};
|
||||
this.terminateSelf = function (...args) {
|
||||
console.warn("ServiceExtension.serviceExtensionContext.terminateSelf interface mocked in the Previewer." +
|
||||
console.warn("ServiceExtensionAbility.serviceExtensionContext.terminateSelf interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (len > 0 && typeof args[len - 1] === 'function') {
|
||||
@@ -162,12 +174,17 @@ export function mockServiceExtension() {
|
||||
}
|
||||
};
|
||||
this.connectAbility = function (...args) {
|
||||
console.warn("ServiceExtension.serviceExtensionContext.connectAbility interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
console.warn("ServiceExtensionAbility.serviceExtensionContext.connectAbility interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
};
|
||||
this.connectAbilityWithAccount = function (...args) {
|
||||
console.warn("ServiceExtensionAbility.serviceExtensionContext.connectAbilityWithAccount interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock
|
||||
};
|
||||
this.disconnectAbility = function (...args) {
|
||||
console.warn("ServiceExtension.serviceExtensionContext.disconnectAbility interface mocked in the Previewer." +
|
||||
console.warn("ServiceExtensionAbility.serviceExtensionContext.disconnectAbility interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (len > 0 && typeof args[len - 1] === 'function') {
|
||||
@@ -180,37 +197,41 @@ export function mockServiceExtension() {
|
||||
}
|
||||
}
|
||||
}
|
||||
const ServiceExtensionClass = class ServiceExtension {
|
||||
const ServiceExtensionAbilityClass = class ServiceExtensionAbility {
|
||||
constructor() {
|
||||
console.warn('application.ServiceExtension.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
console.warn('application.ServiceExtensionAbility.constructor interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.context = new serviceExtensionContextClass();
|
||||
this.onCreate = function (...args) {
|
||||
console.warn("application.ServiceExtension.onCreate interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
console.warn("application.ServiceExtensionAbility.onCreate interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.onDestroy = function () {
|
||||
console.warn("application.ServiceExtension.onDestroy interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
console.warn("application.ServiceExtensionAbility.onDestroy interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.onRequest = function (...args) {
|
||||
console.warn("application.ServiceExtension.onRequest interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
console.warn("application.ServiceExtensionAbility.onRequest interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.onConnect = function (...args) {
|
||||
console.warn("application.ServiceExtension.onConnect interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
console.warn("application.ServiceExtensionAbility.onConnect interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return new RemoteObjectClass();
|
||||
};
|
||||
this.onDisconnect = function (...args) {
|
||||
console.warn("application.ServiceExtension.onDisconnect interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
console.warn("application.ServiceExtensionAbility.onDisconnect interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.onReconnect = function (...args) {
|
||||
console.warn("application.ServiceExtension.onReconnect interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
console.warn("application.ServiceExtensionAbility.onReconnect interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.onConfigurationUpdated = function (...args) {
|
||||
console.warn("application.ServiceExtensionAbility.onConfigurationUpdated interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
}
|
||||
}
|
||||
return new ServiceExtensionClass();
|
||||
return new ServiceExtensionAbilityClass();
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
import { mockSystemParameter } from './systemParameter'
|
||||
import { mockAbility } from './applicationAbility'
|
||||
import { mockFormExtension } from './applicationFormExtension'
|
||||
import { mockServiceExtension } from './applicationServiceExtension'
|
||||
import { mockServiceExtensionAbility } from './applicationServiceExtensionAbility'
|
||||
import { mockAbilityStage } from './applicationAbilityStage'
|
||||
import { mockFormBindingData } from './applicationFormBindingData'
|
||||
import { mockAbilityManager } from './applicationAbilityManager'
|
||||
@@ -100,8 +100,8 @@ export function mockRequireNapiFun() {
|
||||
return mockAbility();
|
||||
case "application.FormExtension":
|
||||
return mockFormExtension();
|
||||
case "application.ServiceExtension":
|
||||
return mockServiceExtension();
|
||||
case "application.ServiceExtensionAbility":
|
||||
return mockServiceExtensionAbility();
|
||||
case "application.AbilityStage":
|
||||
return mockAbilityStage();
|
||||
case "application.formBindingData":
|
||||
|
||||
Reference in New Issue
Block a user