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//@ts-ignore 16import {memoryAbility,MemoryAbilityMonitorStruct} from "../../../dist/trace/database/ProcedureWorkerMemoryAbility.js"; 17 18describe('ProcedureWorkerMemoryAbility Test', ()=>{ 19 20 it('ProcedureWorkerMemoryAbilityTest01',()=>{ 21 const data = { 22 frame:{ 23 width:10, 24 height:10, 25 x:1, 26 y:1, 27 }, 28 cpu:1, 29 startNs:1, 30 value:1, 31 } 32 const canvas = document.createElement('canvas'); 33 canvas.width = 1; 34 canvas.height = 1; 35 const ctx = canvas.getContext('2d'); 36 expect(MemoryAbilityMonitorStruct.draw(ctx,data)).toBeUndefined(); 37 }); 38 39 it('ProcedureWorkerMemoryAbilityTest02', function () { 40 let dataList = new Array(); 41 dataList.push({startNS: 0, dur: 10, frame: {x:0, y:9, width:10, height:10}}) 42 dataList.push({startNS: 1, dur: 2}) 43 memoryAbility(dataList, new Set(), 1, 8, 3, "") 44 }); 45})