"use strict";
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Object.defineProperty(exports, "__esModule", { value: true });
const performance_helpers_js_1 = require("../../../e2e/helpers/performance-helpers.js");
const report_js_1 = require("../../report/report.js");
async function timeFixture(fixture, devToolsPage, inspectedPage) {
    await (0, performance_helpers_js_1.navigateToPerformanceTab)(undefined, devToolsPage, inspectedPage);
    await devToolsPage.waitFor('.widget.panel.timeline');
    return await (0, performance_helpers_js_1.uploadTraceFile)(devToolsPage, `front_end/panels/timeline/fixtures/traces/${fixture}.gz`);
}
describe('Performance panel trace load performance', () => {
    // Flaky test
    describe.skip('[crbug.com/497965839] Large CPU profile load benchmark', function () {
        const RUNS = 10;
        this.timeout(40_000);
        for (let run = 1; run <= RUNS; run++) {
            it('run large cpu profile benchmark', async ({ devToolsPage, inspectedPage }) => {
                await devToolsPage.reload();
                const duration = await timeFixture('large-profile.cpuprofile', devToolsPage, inspectedPage);
                // Ensure only 2 decimal places.
                const timeTaken = Number(duration.toFixed(2));
                report_js_1.measurements.LargeCPULoad.push(timeTaken);
            });
        }
    });
    describe('Large DOM trace load benchmark', function () {
        const RUNS = 10;
        this.timeout(8_000);
        for (let run = 1; run <= RUNS; run++) {
            it('run large dom trace load benchmark', async ({ devToolsPage, inspectedPage }) => {
                await devToolsPage.reload();
                const duration = await timeFixture('dom-size-long.json', devToolsPage, inspectedPage);
                // Ensure only 2 decimal places.
                const timeTaken = Number(duration.toFixed(2));
                report_js_1.measurements.LargeDOMTraceLoad.push(timeTaken);
            });
        }
    });
});
//# sourceMappingURL=trace-load.test.js.map