1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { paramMock } from "../utils" 17import { ExtensionContextClass } from "./application/abilityContext" 18import { ResultSetMock } from "./ohos_data_dataShare" 19 20export function mockDataShareExtensionAbility() { 21 const DataShareExtensionAbilityClass = class DataShareExtensionAbility { 22 constructor() { 23 console.warn('application.DataShareExtensionAbility interface mocked in the Previewer. How this interface works on' + 24 ' the Previewer may be different from that on a real device.'); 25 this.context = new ExtensionContextClass(); 26 this.onCreate = function () { 27 console.warn("application.DataShareExtensionAbility.onCreate interface mocked in the Previewer. How this interface works on the Previewer" + 28 " may be different from that on a real device.") 29 }; 30 this.getFileTypes = function () { 31 console.warn("application.DataShareExtensionAbility.getFileTypes interface mocked in the Previewer. How this interface works on the Previewer" + 32 " may be different from that on a real device.") 33 return [paramMock.paramStringMock]; 34 }; 35 this.insert = function () { 36 console.warn("application.DataShareExtensionAbility.insert interface mocked in the Previewer. How this interface works on the Previewer" + 37 " may be different from that on a real device.") 38 return paramMock.paramNumberMock; 39 }; 40 this.update = function () { 41 console.warn("application.DataShareExtensionAbility.update interface mocked in the Previewer. How this interface works on the Previewer" + 42 " may be different from that on a real device.") 43 return paramMock.paramNumberMock; 44 }; 45 this.delete = function () { 46 console.warn("application.DataShareExtensionAbility.delete interface mocked in the Previewer. How this interface works on the Previewer" + 47 " may be different from that on a real device.") 48 return paramMock.paramNumberMock; 49 }; 50 this.query = function () { 51 console.warn("application.DataShareExtensionAbility.query interface mocked in the Previewer. How this interface works on the Previewer" + 52 " may be different from that on a real device.") 53 return ResultSetMock; 54 }; 55 this.getType = function () { 56 console.warn("application.DataShareExtensionAbility.getType interface mocked in the Previewer. How this interface works on the Previewer" + 57 " may be different from that on a real device.") 58 return paramMock.paramStringMock; 59 }; 60 this.batchInsert = function () { 61 console.warn("application.DataShareExtensionAbility.batchInsert interface mocked in the Previewer. How this interface works on the Previewer" + 62 " may be different from that on a real device.") 63 return paramMock.paramNumberMock; 64 }; 65 this.normalizeUri = function () { 66 console.warn("application.DataShareExtensionAbility.normalizeUri interface mocked in the Previewer. How this interface works on the Previewer" + 67 " may be different from that on a real device.") 68 return paramMock.paramStringMock; 69 }; 70 this.denormalizeUri = function () { 71 console.warn("application.DataShareExtensionAbility.denormalizeUri interface mocked in the Previewer. How this interface works on the Previewer" + 72 " may be different from that on a real device.") 73 return paramMock.paramStringMock; 74 }; 75 } 76 } 77 return new DataShareExtensionAbilityClass(); 78} 79