• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
15import { TraceRow } from '../../../../src/trace/component/trace/base/TraceRow';
16import { Rect } from '../../../../src/trace/component/trace/timer-shaft/Rect';
17import {
18  AppStartupRender,
19  AppStartupStruct,
20} from '../../../../src/trace/database/ui-worker/ProcedureWorkerAppStartup';
21jest.mock('../../../../src/trace/database/ui-worker/ProcedureWorker', () => {
22  return {};
23});
24
25describe('ProcedureWorkerAppStartup Test', () => {
26  it('AppStartupStructTest01', () => {
27    const data = {
28      frame: {
29        x: 20,
30        y: 20,
31        width: 9,
32        height: 3,
33      },
34      dur: 1,
35      value: 'aa',
36      startTs: 12,
37      pid: 1,
38      process: 'null',
39      itid: 12,
40      endItid: 13,
41      tid: 1,
42      startName: '23',
43      stepName: 'st',
44    };
45    const canvas = document.createElement('canvas');
46    canvas.width = 1;
47    canvas.height = 1;
48    const ctx = canvas.getContext('2d');
49    expect(AppStartupStruct.draw(ctx, data)).toBeUndefined();
50  });
51
52  it('AppStartupStructTest02', () => {
53    expect(AppStartupStruct.getStartupName(12)).toBe('Unknown Start Step');
54  });
55  it('AppStartupStructTest03', () => {
56    expect(AppStartupStruct).not.toBeUndefined();
57  });
58  it('AppStartupStructTest04', () => {
59    let canvas = document.createElement('canvas') as HTMLCanvasElement;
60    let context = canvas.getContext('2d');
61    const data = {
62      useCache: true,
63      appStartupContext: context,
64      type: '',
65    };
66    let appStartupRender = new AppStartupRender();
67    expect(appStartupRender.renderMainThread(data, new TraceRow())).toBeUndefined();
68  });
69});
70