• 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 */
15
16import { SpFpsChart } from '../../../../src/trace/component/chart/SpFpsChart';
17import { SpChartManager } from '../../../../src/trace/component/chart/SpChartManager';
18
19const sqlit = require('../../../../src/trace/database/SqlLite');
20jest.mock('../../../../src/trace/database/SqlLite');
21jest.mock('../../../../src/trace/database/ui-worker/ProcedureWorker', () => {
22  return {};
23});
24
25window.ResizeObserver =
26  window.ResizeObserver ||
27  jest.fn().mockImplementation(() => ({
28    disconnect: jest.fn(),
29    observe: jest.fn(),
30    unobserve: jest.fn(),
31  }));
32describe('spFpsChart Test', () => {
33  let spFpsChart = new SpFpsChart(new SpChartManager());
34  let fpsMock = sqlit.getFps;
35  fpsMock.mockResolvedValue([
36    { startNS: 0, fps: 1 },
37    { startNS: 2, fps: 3 },
38  ]);
39
40  it('spFpsChart01', function () {
41    expect(spFpsChart.init()).toBeDefined();
42  });
43});
44