106f6ba60Sopenharmony_ci/*
206f6ba60Sopenharmony_ci * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
306f6ba60Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
406f6ba60Sopenharmony_ci * you may not use this file except in compliance with the License.
506f6ba60Sopenharmony_ci * You may obtain a copy of the License at
606f6ba60Sopenharmony_ci *
706f6ba60Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
806f6ba60Sopenharmony_ci *
906f6ba60Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1006f6ba60Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1106f6ba60Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1206f6ba60Sopenharmony_ci * See the License for the specific language governing permissions and
1306f6ba60Sopenharmony_ci * limitations under the License.
1406f6ba60Sopenharmony_ci */
1506f6ba60Sopenharmony_ciimport hidebug from '@ohos.hidebug'
1606f6ba60Sopenharmony_ciimport fs from '@ohos.file.fs'
1706f6ba60Sopenharmony_ciimport process from '@ohos.process'
1806f6ba60Sopenharmony_ciimport featureAbility from '@ohos.ability.featureAbility'
1906f6ba60Sopenharmony_ci
2006f6ba60Sopenharmony_ciimport {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
2106f6ba60Sopenharmony_ci
2206f6ba60Sopenharmony_cidescribe("HidebugJsTest", function () {
2306f6ba60Sopenharmony_ci    beforeAll(function() {
2406f6ba60Sopenharmony_ci        /*
2506f6ba60Sopenharmony_ci         * @tc.setup: setup invoked before all testcases
2606f6ba60Sopenharmony_ci         */
2706f6ba60Sopenharmony_ci         console.info('HidebugJsTest beforeAll called')
2806f6ba60Sopenharmony_ci    })
2906f6ba60Sopenharmony_ci
3006f6ba60Sopenharmony_ci    afterAll(function() {
3106f6ba60Sopenharmony_ci        /*
3206f6ba60Sopenharmony_ci         * @tc.teardown: teardown invoked after all testcases
3306f6ba60Sopenharmony_ci         */
3406f6ba60Sopenharmony_ci         console.info('HidebugJsTest afterAll called')
3506f6ba60Sopenharmony_ci    })
3606f6ba60Sopenharmony_ci
3706f6ba60Sopenharmony_ci    beforeEach(function() {
3806f6ba60Sopenharmony_ci        /*
3906f6ba60Sopenharmony_ci         * @tc.setup: setup invoked before each testcases
4006f6ba60Sopenharmony_ci         */
4106f6ba60Sopenharmony_ci         console.info('HidebugJsTest beforeEach called')
4206f6ba60Sopenharmony_ci    })
4306f6ba60Sopenharmony_ci
4406f6ba60Sopenharmony_ci    afterEach(function() {
4506f6ba60Sopenharmony_ci        /*
4606f6ba60Sopenharmony_ci         * @tc.teardown: teardown invoked after each testcases
4706f6ba60Sopenharmony_ci         */
4806f6ba60Sopenharmony_ci         console.info('HidebugJsTest afterEach called')
4906f6ba60Sopenharmony_ci    })
5006f6ba60Sopenharmony_ci
5106f6ba60Sopenharmony_ci    async function msleep(time) {
5206f6ba60Sopenharmony_ci        let promise = new Promise((resolve, reject) => {
5306f6ba60Sopenharmony_ci            setTimeout(() => resolve("done!"), time)
5406f6ba60Sopenharmony_ci        });
5506f6ba60Sopenharmony_ci        let result = await promise;
5606f6ba60Sopenharmony_ci    }
5706f6ba60Sopenharmony_ci
5806f6ba60Sopenharmony_ci    /**
5906f6ba60Sopenharmony_ci     * test
6006f6ba60Sopenharmony_ci     *
6106f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_001
6206f6ba60Sopenharmony_ci     * @tc.desc: 检测cpuProfiler采集的cpuprofiler数据是否含有js napi callframe信息
6306f6ba60Sopenharmony_ci     * @tc.type: FUNC
6406f6ba60Sopenharmony_ci     * @tc.require: issueI5NXHX
6506f6ba60Sopenharmony_ci     */
6606f6ba60Sopenharmony_ci    it('HidebugJsTest_001', 0, function () {
6706f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_001----------------------------------");
6806f6ba60Sopenharmony_ci        try {
6906f6ba60Sopenharmony_ci            let timestamp = Date.now();
7006f6ba60Sopenharmony_ci            let filename = "cpuprofiler_" + timestamp.toString();
7106f6ba60Sopenharmony_ci            hidebug.startProfiling(filename);
7206f6ba60Sopenharmony_ci            for (let i = 0; i < 3; i++) {
7306f6ba60Sopenharmony_ci                hidebug.getSharedDirty();
7406f6ba60Sopenharmony_ci            }
7506f6ba60Sopenharmony_ci            hidebug.stopProfiling();
7606f6ba60Sopenharmony_ci            let path = "/proc/self/root/data/storage/el2/base/files/" + filename + ".json";
7706f6ba60Sopenharmony_ci            let data = fs.readTextSync(path);
7806f6ba60Sopenharmony_ci            if (data.includes("napi")) {
7906f6ba60Sopenharmony_ci                expect(true).assertTrue();
8006f6ba60Sopenharmony_ci            } else {
8106f6ba60Sopenharmony_ci                expect(false).assertTrue();
8206f6ba60Sopenharmony_ci            }
8306f6ba60Sopenharmony_ci        } catch (err) {
8406f6ba60Sopenharmony_ci            console.error('HidebugJsTest_001 has failed for ' + err);
8506f6ba60Sopenharmony_ci            expect(false).assertTrue();
8606f6ba60Sopenharmony_ci        }
8706f6ba60Sopenharmony_ci    })
8806f6ba60Sopenharmony_ci
8906f6ba60Sopenharmony_ci    /**
9006f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_002
9106f6ba60Sopenharmony_ci     * @tc.desc: startJsCpuProfiling/stopJsCpuProfiling的正常测试, startProfiling/stopProfiling的更新版本
9206f6ba60Sopenharmony_ci     * @tc.type: FUNC
9306f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
9406f6ba60Sopenharmony_ci     */
9506f6ba60Sopenharmony_ci     it('HidebugJsTest_002', 0, function () {
9606f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_002----------------------------------");
9706f6ba60Sopenharmony_ci        try {
9806f6ba60Sopenharmony_ci            let timestamp = Date.now();
9906f6ba60Sopenharmony_ci            let filename = "cpuprofiler_" + timestamp.toString();
10006f6ba60Sopenharmony_ci            hidebug.startJsCpuProfiling(filename);
10106f6ba60Sopenharmony_ci            for (let i = 0; i < 3; i++) {
10206f6ba60Sopenharmony_ci                hidebug.getSharedDirty();
10306f6ba60Sopenharmony_ci            }
10406f6ba60Sopenharmony_ci            hidebug.stopJsCpuProfiling();
10506f6ba60Sopenharmony_ci            let path = "/proc/self/root/data/storage/el2/base/files/" + filename + ".json";
10606f6ba60Sopenharmony_ci            let data = fs.readTextSync(path);
10706f6ba60Sopenharmony_ci            if (data.includes("napi")) {
10806f6ba60Sopenharmony_ci                expect(true).assertTrue();
10906f6ba60Sopenharmony_ci            } else {
11006f6ba60Sopenharmony_ci                expect(false).assertTrue();
11106f6ba60Sopenharmony_ci            }
11206f6ba60Sopenharmony_ci        } catch (err) {
11306f6ba60Sopenharmony_ci            console.error('HidebugJsTest_002 has failed for ' + err);
11406f6ba60Sopenharmony_ci            expect(false).assertTrue();
11506f6ba60Sopenharmony_ci        }
11606f6ba60Sopenharmony_ci    })
11706f6ba60Sopenharmony_ci
11806f6ba60Sopenharmony_ci    /**
11906f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_003
12006f6ba60Sopenharmony_ci     * @tc.desc: startJsCpuProfiling/stopJsCpuProfiling的异常测试, startProfiling/stopProfiling的更新版本
12106f6ba60Sopenharmony_ci     * @tc.type: FUNC
12206f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
12306f6ba60Sopenharmony_ci     */
12406f6ba60Sopenharmony_ci     it('HidebugJsTest_003', 0, function () {
12506f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_003----------------------------------");
12606f6ba60Sopenharmony_ci        try {
12706f6ba60Sopenharmony_ci            hidebug.startJsCpuProfiling();
12806f6ba60Sopenharmony_ci            for (let i = 0; i < 3; i++) {
12906f6ba60Sopenharmony_ci                hidebug.getSharedDirty();
13006f6ba60Sopenharmony_ci            }
13106f6ba60Sopenharmony_ci            hidebug.stopJsCpuProfiling();
13206f6ba60Sopenharmony_ci        } catch (error) {
13306f6ba60Sopenharmony_ci            console.info(error.code);
13406f6ba60Sopenharmony_ci            console.info(error.message);
13506f6ba60Sopenharmony_ci            expect(error.code === "401").assertTrue();
13606f6ba60Sopenharmony_ci        }
13706f6ba60Sopenharmony_ci    })
13806f6ba60Sopenharmony_ci
13906f6ba60Sopenharmony_ci    /**
14006f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_004
14106f6ba60Sopenharmony_ci     * @tc.desc: dumpJsHeapData的正常测试, dumpHeapData的更新版本
14206f6ba60Sopenharmony_ci     * @tc.type: FUNC
14306f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
14406f6ba60Sopenharmony_ci     */
14506f6ba60Sopenharmony_ci     it('HidebugJsTest_004', 0, function () {
14606f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_004----------------------------------");
14706f6ba60Sopenharmony_ci        try {
14806f6ba60Sopenharmony_ci            hidebug.dumpJsHeapData("heapData");
14906f6ba60Sopenharmony_ci            expect(true).assertTrue();
15006f6ba60Sopenharmony_ci        } catch (error) {
15106f6ba60Sopenharmony_ci            console.info(error.code);
15206f6ba60Sopenharmony_ci            console.info(error.message);
15306f6ba60Sopenharmony_ci        }
15406f6ba60Sopenharmony_ci    })
15506f6ba60Sopenharmony_ci
15606f6ba60Sopenharmony_ci    /**
15706f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_005
15806f6ba60Sopenharmony_ci     * @tc.desc: dumpJsHeapData的异常测试, dumpHeapData的更新版本
15906f6ba60Sopenharmony_ci     * @tc.type: FUNC
16006f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
16106f6ba60Sopenharmony_ci     */
16206f6ba60Sopenharmony_ci     it('HidebugJsTest_005', 0, function () {
16306f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_005----------------------------------");
16406f6ba60Sopenharmony_ci        try {
16506f6ba60Sopenharmony_ci            hidebug.dumpJsHeapData();
16606f6ba60Sopenharmony_ci        } catch (error) {
16706f6ba60Sopenharmony_ci            console.info(error.code);
16806f6ba60Sopenharmony_ci            console.info(error.message);
16906f6ba60Sopenharmony_ci            expect(error.code === "401").assertTrue();
17006f6ba60Sopenharmony_ci        }
17106f6ba60Sopenharmony_ci    })
17206f6ba60Sopenharmony_ci
17306f6ba60Sopenharmony_ci    /**
17406f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_006
17506f6ba60Sopenharmony_ci     * @tc.desc: getServiceDump的正常测试
17606f6ba60Sopenharmony_ci     * @tc.type: FUNC
17706f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
17806f6ba60Sopenharmony_ci     */
17906f6ba60Sopenharmony_ci     it('HidebugJsTest_006', 0, function () {
18006f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_006----------------------------------");
18106f6ba60Sopenharmony_ci        let context = featureAbility.getContext();
18206f6ba60Sopenharmony_ci        context.getFilesDir().then((data) => {
18306f6ba60Sopenharmony_ci            const path = data + "/serviceInfo1.txt";
18406f6ba60Sopenharmony_ci            console.info("output path: " + path);
18506f6ba60Sopenharmony_ci            let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
18606f6ba60Sopenharmony_ci            const serviceId = 10;
18706f6ba60Sopenharmony_ci            const args = new Array("allInfo");
18806f6ba60Sopenharmony_ci            try {
18906f6ba60Sopenharmony_ci              hidebug.getServiceDump(serviceId, file.fd, args);
19006f6ba60Sopenharmony_ci              expect(true).assertTrue();
19106f6ba60Sopenharmony_ci            } catch (error) {
19206f6ba60Sopenharmony_ci              console.info(error.code);
19306f6ba60Sopenharmony_ci              console.info(error.message);
19406f6ba60Sopenharmony_ci            }
19506f6ba60Sopenharmony_ci            fs.closeSync(file);
19606f6ba60Sopenharmony_ci        })
19706f6ba60Sopenharmony_ci    })
19806f6ba60Sopenharmony_ci
19906f6ba60Sopenharmony_ci    /**
20006f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_007
20106f6ba60Sopenharmony_ci     * @tc.desc: getServiceDump的异常测试,参数错误
20206f6ba60Sopenharmony_ci     * @tc.type: FUNC
20306f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
20406f6ba60Sopenharmony_ci     */
20506f6ba60Sopenharmony_ci     it('HidebugJsTest_007', 0, function () {
20606f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_007----------------------------------");
20706f6ba60Sopenharmony_ci        let context = featureAbility.getContext();
20806f6ba60Sopenharmony_ci        context.getFilesDir().then((data) => {
20906f6ba60Sopenharmony_ci            const path = data + "/serviceInfo2.txt";
21006f6ba60Sopenharmony_ci            console.info("output path: " + path);
21106f6ba60Sopenharmony_ci            let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
21206f6ba60Sopenharmony_ci            const serviceId = 10;
21306f6ba60Sopenharmony_ci            const args = new Array("allInfo");
21406f6ba60Sopenharmony_ci            try {
21506f6ba60Sopenharmony_ci                hidebug.getServiceDump(serviceId);
21606f6ba60Sopenharmony_ci            } catch (error) {
21706f6ba60Sopenharmony_ci              console.info(error.code);
21806f6ba60Sopenharmony_ci              console.info(error.message);
21906f6ba60Sopenharmony_ci              expect(error.code === "401").assertTrue();
22006f6ba60Sopenharmony_ci            }
22106f6ba60Sopenharmony_ci            fs.closeSync(file);
22206f6ba60Sopenharmony_ci        })
22306f6ba60Sopenharmony_ci    })
22406f6ba60Sopenharmony_ci
22506f6ba60Sopenharmony_ci    /**
22606f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_008
22706f6ba60Sopenharmony_ci     * @tc.desc: getServiceDump的异常测试,查询system ability失败
22806f6ba60Sopenharmony_ci     * @tc.type: FUNC
22906f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
23006f6ba60Sopenharmony_ci     */
23106f6ba60Sopenharmony_ci     it('HidebugJsTest_008', 0, function () {
23206f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_008----------------------------------");
23306f6ba60Sopenharmony_ci        let context = featureAbility.getContext();
23406f6ba60Sopenharmony_ci        context.getFilesDir().then((data) => {
23506f6ba60Sopenharmony_ci            const path = data + "/serviceInfo3.txt";
23606f6ba60Sopenharmony_ci            console.info("output path: " + path);
23706f6ba60Sopenharmony_ci            let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
23806f6ba60Sopenharmony_ci            const serviceId = -10;
23906f6ba60Sopenharmony_ci            const args = new Array("allInfo");
24006f6ba60Sopenharmony_ci            try {
24106f6ba60Sopenharmony_ci                hidebug.getServiceDump(serviceId, file.fd, args);
24206f6ba60Sopenharmony_ci            } catch (error) {
24306f6ba60Sopenharmony_ci              console.info(error.code);
24406f6ba60Sopenharmony_ci              console.info(error.message);
24506f6ba60Sopenharmony_ci              expect(error.code === "11400101").assertTrue();
24606f6ba60Sopenharmony_ci            }
24706f6ba60Sopenharmony_ci            fs.closeSync(file);
24806f6ba60Sopenharmony_ci        })
24906f6ba60Sopenharmony_ci    })
25006f6ba60Sopenharmony_ci
25106f6ba60Sopenharmony_ci        /**
25206f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_009
25306f6ba60Sopenharmony_ci     * @tc.desc: getAppNativeMemInfo的正常测试, getVss()/getPss()/getSharedDirty()/getPrivateDirty()的更新版本
25406f6ba60Sopenharmony_ci     * @tc.type: FUNC
25506f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
25606f6ba60Sopenharmony_ci     */
25706f6ba60Sopenharmony_ci        it('HidebugJsTest_009', 0, function () {
25806f6ba60Sopenharmony_ci            console.info("---------------------------HidebugJsTest_009----------------------------------");
25906f6ba60Sopenharmony_ci            try {
26006f6ba60Sopenharmony_ci                let nativeMemInfo = hidebug.getAppNativeMemInfo();
26106f6ba60Sopenharmony_ci                expect(nativeMemInfo.pss >= 0).assertTrue();
26206f6ba60Sopenharmony_ci                expect(nativeMemInfo.vss >= 0).assertTrue();
26306f6ba60Sopenharmony_ci                expect(nativeMemInfo.rss >= 0).assertTrue();
26406f6ba60Sopenharmony_ci                expect(nativeMemInfo.sharedDirty >= 0).assertTrue();
26506f6ba60Sopenharmony_ci                expect(nativeMemInfo.privateDirty >= 0).assertTrue();
26606f6ba60Sopenharmony_ci                expect(nativeMemInfo.sharedClean >= 0).assertTrue();
26706f6ba60Sopenharmony_ci                expect(nativeMemInfo.privateClean >= 0).assertTrue();
26806f6ba60Sopenharmony_ci            } catch (error) {
26906f6ba60Sopenharmony_ci                console.info(error.code);
27006f6ba60Sopenharmony_ci                console.info(error.message);
27106f6ba60Sopenharmony_ci                expect(false).assertTrue();
27206f6ba60Sopenharmony_ci            }
27306f6ba60Sopenharmony_ci        })
27406f6ba60Sopenharmony_ci
27506f6ba60Sopenharmony_ci        /**
27606f6ba60Sopenharmony_ci         * @tc.name: HidebugJsTest_010
27706f6ba60Sopenharmony_ci         * @tc.desc: getSystemMemInfo()的正常测试
27806f6ba60Sopenharmony_ci         * @tc.type: FUNC
27906f6ba60Sopenharmony_ci         * @tc.require: issueI5VY8L
28006f6ba60Sopenharmony_ci         */
28106f6ba60Sopenharmony_ci        it('HidebugJsTest_010', 0, function () {
28206f6ba60Sopenharmony_ci            console.info("---------------------------HidebugJsTest_010----------------------------------");
28306f6ba60Sopenharmony_ci            try {
28406f6ba60Sopenharmony_ci                let systemMemInfo = hidebug.getSystemMemInfo();
28506f6ba60Sopenharmony_ci                expect(systemMemInfo.totalMem >= 0).assertTrue();
28606f6ba60Sopenharmony_ci                expect(systemMemInfo.freeMem >= 0).assertTrue();
28706f6ba60Sopenharmony_ci                expect(systemMemInfo.availableMem >= 0).assertTrue();
28806f6ba60Sopenharmony_ci            } catch (error) {
28906f6ba60Sopenharmony_ci                console.info(error.code);
29006f6ba60Sopenharmony_ci                console.info(error.message);
29106f6ba60Sopenharmony_ci                expect(false).assertTrue();
29206f6ba60Sopenharmony_ci            }
29306f6ba60Sopenharmony_ci        })
29406f6ba60Sopenharmony_ci
29506f6ba60Sopenharmony_ci    /**
29606f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_011
29706f6ba60Sopenharmony_ci     * @tc.desc: getSystemCpuUsage的正常测试,查询system cpu usage
29806f6ba60Sopenharmony_ci     * @tc.type: FUNC
29906f6ba60Sopenharmony_ci     * @tc.require: issueI90Z36
30006f6ba60Sopenharmony_ci     */
30106f6ba60Sopenharmony_ci    it('HidebugJsTest_011', 0, function () {
30206f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_011----------------------------------");
30306f6ba60Sopenharmony_ci        try {
30406f6ba60Sopenharmony_ci            let sysCpuUsage = hidebug.getSystemCpuUsage();
30506f6ba60Sopenharmony_ci            expect(sysCpuUsage >= 0 && sysCpuUsage <= 1).assertTrue();
30606f6ba60Sopenharmony_ci        } catch (error) {
30706f6ba60Sopenharmony_ci            console.info(error.code);
30806f6ba60Sopenharmony_ci            console.info(error.message);
30906f6ba60Sopenharmony_ci            expect(false).assertTrue();
31006f6ba60Sopenharmony_ci        }
31106f6ba60Sopenharmony_ci    })
31206f6ba60Sopenharmony_ci
31306f6ba60Sopenharmony_ci    /**
31406f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_012
31506f6ba60Sopenharmony_ci     * @tc.desc: getAppMemoryLimit正常测试
31606f6ba60Sopenharmony_ci     * @tc.type: FUNC
31706f6ba60Sopenharmony_ci     * @tc.require: issueI8ZX7S
31806f6ba60Sopenharmony_ci     */
31906f6ba60Sopenharmony_ci    it('HidebugJsTest_012', 0, function () {
32006f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_012----------------------------------");
32106f6ba60Sopenharmony_ci        try {
32206f6ba60Sopenharmony_ci            let temp = hidebug.getAppMemoryLimit();
32306f6ba60Sopenharmony_ci            expect(temp.rssLimit >= BigInt(0)).assertTrue();
32406f6ba60Sopenharmony_ci            expect(temp.vssLimit >= BigInt(0)).assertTrue();
32506f6ba60Sopenharmony_ci            expect(temp.vmHeapLimit >= BigInt(0)).assertTrue();
32606f6ba60Sopenharmony_ci            expect(temp.vmTotalHeapSize >= BigInt(0)).assertTrue();
32706f6ba60Sopenharmony_ci        } catch (error) {
32806f6ba60Sopenharmony_ci            expect().assertFail();
32906f6ba60Sopenharmony_ci        }
33006f6ba60Sopenharmony_ci    })
33106f6ba60Sopenharmony_ci
33206f6ba60Sopenharmony_ci    /**
33306f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_013
33406f6ba60Sopenharmony_ci     * @tc.desc: getAppVMMemoryInfo正常测试
33506f6ba60Sopenharmony_ci     * @tc.type: FUNC
33606f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
33706f6ba60Sopenharmony_ci     */
33806f6ba60Sopenharmony_ci    it('HidebugJsTest_013', 0, function () {
33906f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_013----------------------------------");
34006f6ba60Sopenharmony_ci        try {
34106f6ba60Sopenharmony_ci            let result = hidebug.getAppVMMemoryInfo();
34206f6ba60Sopenharmony_ci            expect(result.allArraySize >= 0 && result.totalHeap >= 0 && result.heapUsed >= 0).assertTrue();
34306f6ba60Sopenharmony_ci        } catch (error) {
34406f6ba60Sopenharmony_ci            console.info(error.code);
34506f6ba60Sopenharmony_ci            console.info(error.message);
34606f6ba60Sopenharmony_ci            expect(false).assertTrue();
34706f6ba60Sopenharmony_ci        }
34806f6ba60Sopenharmony_ci    })
34906f6ba60Sopenharmony_ci
35006f6ba60Sopenharmony_ci    /**
35106f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_014
35206f6ba60Sopenharmony_ci     * @tc.desc: getAppThreadCpuUsage正常测试
35306f6ba60Sopenharmony_ci     * @tc.type: FUNC
35406f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
35506f6ba60Sopenharmony_ci     */
35606f6ba60Sopenharmony_ci    it('HidebugJsTest_014', 0, function () {
35706f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_014----------------------------------");
35806f6ba60Sopenharmony_ci        try {
35906f6ba60Sopenharmony_ci            let appThreadCpuUsage = hidebug.getAppThreadCpuUsage();
36006f6ba60Sopenharmony_ci            expect(appThreadCpuUsage.length >= 0).assertTrue();
36106f6ba60Sopenharmony_ci        } catch (error) {
36206f6ba60Sopenharmony_ci            console.info(error.code);
36306f6ba60Sopenharmony_ci            console.info(error.message);
36406f6ba60Sopenharmony_ci            expect(false).assertTrue();
36506f6ba60Sopenharmony_ci        }
36606f6ba60Sopenharmony_ci    })
36706f6ba60Sopenharmony_ci
36806f6ba60Sopenharmony_ci    /**
36906f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_015
37006f6ba60Sopenharmony_ci     * @tc.desc: StartAppTraceCapture正常测试
37106f6ba60Sopenharmony_ci     * @tc.type: FUNC
37206f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
37306f6ba60Sopenharmony_ci     */
37406f6ba60Sopenharmony_ci    it('HidebugJsTest_015', 0, function () {
37506f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_015----------------------------------");
37606f6ba60Sopenharmony_ci        try {
37706f6ba60Sopenharmony_ci            let tags = [hidebug.tags.ABILITY_MANAGER];
37806f6ba60Sopenharmony_ci            let flag = hidebug.TraceFlag.MAIN_THREAD;
37906f6ba60Sopenharmony_ci            let limitSize = 1024 * 1024;
38006f6ba60Sopenharmony_ci            let fileName = hidebug.startAppTraceCapture(tags, flag, limitSize);
38106f6ba60Sopenharmony_ci            for (let i = 0; i < 3; i++) {
38206f6ba60Sopenharmony_ci                hidebug.getSharedDirty();
38306f6ba60Sopenharmony_ci            }
38406f6ba60Sopenharmony_ci            hidebug.stopAppTraceCapture();
38506f6ba60Sopenharmony_ci            expect(fileName.length > 0).assertTrue();
38606f6ba60Sopenharmony_ci        } catch (error) {
38706f6ba60Sopenharmony_ci            console.info(error.code);
38806f6ba60Sopenharmony_ci            console.info(error.message);
38906f6ba60Sopenharmony_ci            expect(false).assertTrue();
39006f6ba60Sopenharmony_ci        }
39106f6ba60Sopenharmony_ci    })
39206f6ba60Sopenharmony_ci
39306f6ba60Sopenharmony_ci    /**
39406f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_016
39506f6ba60Sopenharmony_ci     * @tc.desc: getVMRuntimeStats测试
39606f6ba60Sopenharmony_ci     * @tc.type: FUNC
39706f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
39806f6ba60Sopenharmony_ci     */
39906f6ba60Sopenharmony_ci    it('HidebugJsTest_016', 0, function () {
40006f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_016----------------------------------");
40106f6ba60Sopenharmony_ci        try {
40206f6ba60Sopenharmony_ci            let runtimeStats = hidebug.getVMRuntimeStats();
40306f6ba60Sopenharmony_ci            expect(runtimeStats["ark.gc.gc-count"] >= 0).assertTrue();
40406f6ba60Sopenharmony_ci            expect(runtimeStats["ark.gc.gc-time"] >= 0).assertTrue();
40506f6ba60Sopenharmony_ci            expect(runtimeStats["ark.gc.gc-bytes-allocated"] >= 0).assertTrue();
40606f6ba60Sopenharmony_ci            expect(runtimeStats["ark.gc.gc-bytes-freed"] >= 0).assertTrue();
40706f6ba60Sopenharmony_ci            expect(runtimeStats["ark.gc.fullgc-longtime-count"] >= 0).assertTrue();
40806f6ba60Sopenharmony_ci            expect(runtimeStats["others"] === undefined).assertTrue();
40906f6ba60Sopenharmony_ci        } catch (error) {
41006f6ba60Sopenharmony_ci            console.info(error.code);
41106f6ba60Sopenharmony_ci            console.info(error.message);
41206f6ba60Sopenharmony_ci            expect(false).assertTrue();
41306f6ba60Sopenharmony_ci        }
41406f6ba60Sopenharmony_ci    })
41506f6ba60Sopenharmony_ci
41606f6ba60Sopenharmony_ci    /**
41706f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_017
41806f6ba60Sopenharmony_ci     * @tc.desc: getVMRuntimeStat正常测试
41906f6ba60Sopenharmony_ci     * @tc.type: FUNC
42006f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
42106f6ba60Sopenharmony_ci     */
42206f6ba60Sopenharmony_ci    it('HidebugJsTest_017', 0, function () {
42306f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_017----------------------------------");
42406f6ba60Sopenharmony_ci        try {
42506f6ba60Sopenharmony_ci            let gcCount = hidebug.getVMRuntimeStat("ark.gc.gc-count");
42606f6ba60Sopenharmony_ci            let gcTime = hidebug.getVMRuntimeStat("ark.gc.gc-time");
42706f6ba60Sopenharmony_ci            let gcBytesAllocated = hidebug.getVMRuntimeStat("ark.gc.gc-bytes-allocated");
42806f6ba60Sopenharmony_ci            let gcBytesFreed = hidebug.getVMRuntimeStat("ark.gc.gc-bytes-freed");
42906f6ba60Sopenharmony_ci            let fullGcLongTimeCount = hidebug.getVMRuntimeStat("ark.gc.fullgc-longtime-count");
43006f6ba60Sopenharmony_ci            expect(gcCount >= 0).assertTrue();
43106f6ba60Sopenharmony_ci            expect(gcTime >= 0).assertTrue();
43206f6ba60Sopenharmony_ci            expect(gcBytesAllocated >= 0).assertTrue();
43306f6ba60Sopenharmony_ci            expect(gcBytesFreed >= 0).assertTrue();
43406f6ba60Sopenharmony_ci            expect(fullGcLongTimeCount >= 0).assertTrue();
43506f6ba60Sopenharmony_ci        } catch (error) {
43606f6ba60Sopenharmony_ci            console.info(error.code);
43706f6ba60Sopenharmony_ci            console.info(error.message);
43806f6ba60Sopenharmony_ci            expect(false).assertTrue();
43906f6ba60Sopenharmony_ci        }
44006f6ba60Sopenharmony_ci    })
44106f6ba60Sopenharmony_ci
44206f6ba60Sopenharmony_ci    /**
44306f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_018
44406f6ba60Sopenharmony_ci     * @tc.desc: getVMRuntimeStat参数异常测试
44506f6ba60Sopenharmony_ci     * @tc.type: FUNC
44606f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
44706f6ba60Sopenharmony_ci     */
44806f6ba60Sopenharmony_ci    it('HidebugJsTest_018', 0, function () {
44906f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_018----------------------------------");
45006f6ba60Sopenharmony_ci        try {
45106f6ba60Sopenharmony_ci            hidebug.getVMRuntimeStat("others");
45206f6ba60Sopenharmony_ci            expect(false).assertTrue();
45306f6ba60Sopenharmony_ci        } catch (error) {
45406f6ba60Sopenharmony_ci            expect(error.code === "401").assertTrue();
45506f6ba60Sopenharmony_ci            expect(error.message === "Invalid parameter, unknown property.").assertTrue();
45606f6ba60Sopenharmony_ci        }
45706f6ba60Sopenharmony_ci    })
45806f6ba60Sopenharmony_ci
45906f6ba60Sopenharmony_ci    /**
46006f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_019
46106f6ba60Sopenharmony_ci     * @tc.desc: setAppResourceLimit正常测试
46206f6ba60Sopenharmony_ci     * @tc.type: FUNC
46306f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
46406f6ba60Sopenharmony_ci     */
46506f6ba60Sopenharmony_ci    it('HidebugJsTest_019', 0, function () {
46606f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_019----------------------------------");
46706f6ba60Sopenharmony_ci        try {
46806f6ba60Sopenharmony_ci            let type = "js_heap";
46906f6ba60Sopenharmony_ci            let value = 85;
47006f6ba60Sopenharmony_ci            let enabledDebugLog = false;
47106f6ba60Sopenharmony_ci            hidebug.setAppResourceLimit(type, value, enabledDebugLog);
47206f6ba60Sopenharmony_ci        } catch (error) {
47306f6ba60Sopenharmony_ci            console.info(error.code);
47406f6ba60Sopenharmony_ci            expect(error.code === "401").assertTrue();
47506f6ba60Sopenharmony_ci        }
47606f6ba60Sopenharmony_ci    })
47706f6ba60Sopenharmony_ci
47806f6ba60Sopenharmony_ci    /**
47906f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_020
48006f6ba60Sopenharmony_ci     * @tc.desc: StartAppTraceCapture错误传参测试
48106f6ba60Sopenharmony_ci     * @tc.type: FUNC
48206f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
48306f6ba60Sopenharmony_ci     */
48406f6ba60Sopenharmony_ci    it('HidebugJsTest_020', 0, function () {
48506f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_020----------------------------------");
48606f6ba60Sopenharmony_ci        try {
48706f6ba60Sopenharmony_ci            let tags = [hidebug.tags.ABILITY_MANAGER];
48806f6ba60Sopenharmony_ci            let flag = 123;
48906f6ba60Sopenharmony_ci            let limitSize = 1024 * 1024;
49006f6ba60Sopenharmony_ci            let fileName = hidebug.startAppTraceCapture(tags, flag, limitSize);
49106f6ba60Sopenharmony_ci            for (let i = 0; i < 3; i++) {
49206f6ba60Sopenharmony_ci                hidebug.getSharedDirty();
49306f6ba60Sopenharmony_ci            }
49406f6ba60Sopenharmony_ci            hidebug.stopAppTraceCapture();
49506f6ba60Sopenharmony_ci            expect().assertFail();
49606f6ba60Sopenharmony_ci        } catch (error) {
49706f6ba60Sopenharmony_ci            console.info(error.code);
49806f6ba60Sopenharmony_ci            console.info(error.message);
49906f6ba60Sopenharmony_ci            expect(error.code === "401").assertTrue();
50006f6ba60Sopenharmony_ci        }
50106f6ba60Sopenharmony_ci    })
50206f6ba60Sopenharmony_ci
50306f6ba60Sopenharmony_ci    /**
50406f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_021
50506f6ba60Sopenharmony_ci     * @tc.desc: StartAppTraceCapture重复启动测试
50606f6ba60Sopenharmony_ci     * @tc.type: FUNC
50706f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
50806f6ba60Sopenharmony_ci     */
50906f6ba60Sopenharmony_ci    it('HidebugJsTest_021', 0, function () {
51006f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_021----------------------------------");
51106f6ba60Sopenharmony_ci        let fileName = "";
51206f6ba60Sopenharmony_ci        try {
51306f6ba60Sopenharmony_ci            let tags = [hidebug.tags.ABILITY_MANAGER];
51406f6ba60Sopenharmony_ci            let flag = hidebug.TraceFlag.MAIN_THREAD;
51506f6ba60Sopenharmony_ci            let limitSize = 1024 * 1024;
51606f6ba60Sopenharmony_ci            fileName = hidebug.startAppTraceCapture(tags, flag, limitSize);
51706f6ba60Sopenharmony_ci            for (let i = 0; i < 3; i++) {
51806f6ba60Sopenharmony_ci                hidebug.getSharedDirty();
51906f6ba60Sopenharmony_ci            }
52006f6ba60Sopenharmony_ci            fileName = hidebug.startAppTraceCapture(tags, flag, limitSize);
52106f6ba60Sopenharmony_ci            hidebug.stopAppTraceCapture();
52206f6ba60Sopenharmony_ci            expect().assertFail();
52306f6ba60Sopenharmony_ci        } catch (error) {
52406f6ba60Sopenharmony_ci            console.info(error.code);
52506f6ba60Sopenharmony_ci            console.info(error.message);
52606f6ba60Sopenharmony_ci            if (fileName.length > 0) {
52706f6ba60Sopenharmony_ci                hidebug.stopAppTraceCapture();
52806f6ba60Sopenharmony_ci            }
52906f6ba60Sopenharmony_ci            expect(error.code === "11400102").assertTrue();
53006f6ba60Sopenharmony_ci        }
53106f6ba60Sopenharmony_ci    })
53206f6ba60Sopenharmony_ci
53306f6ba60Sopenharmony_ci    /**
53406f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_022
53506f6ba60Sopenharmony_ci     * @tc.desc: StartAppTraceCapture未启动直接关闭测试
53606f6ba60Sopenharmony_ci     * @tc.type: FUNC
53706f6ba60Sopenharmony_ci     * @tc.require: issueI5VY8L
53806f6ba60Sopenharmony_ci     */
53906f6ba60Sopenharmony_ci    it('HidebugJsTest_022', 0, function () {
54006f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_022----------------------------------");
54106f6ba60Sopenharmony_ci        try {
54206f6ba60Sopenharmony_ci            hidebug.stopAppTraceCapture();
54306f6ba60Sopenharmony_ci            expect().assertFail();
54406f6ba60Sopenharmony_ci        } catch (error) {
54506f6ba60Sopenharmony_ci            console.info(error.code);
54606f6ba60Sopenharmony_ci            console.info(error.message);
54706f6ba60Sopenharmony_ci            expect(error.code === "11400105").assertTrue();
54806f6ba60Sopenharmony_ci        }
54906f6ba60Sopenharmony_ci    })
55006f6ba60Sopenharmony_ci
55106f6ba60Sopenharmony_ci    /**
55206f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_023
55306f6ba60Sopenharmony_ci     * @tc.desc: getSharedDirty测试
55406f6ba60Sopenharmony_ci     * @tc.type: FUNC
55506f6ba60Sopenharmony_ci     */
55606f6ba60Sopenharmony_ci    it('HidebugJsTest_023', 0, function () {
55706f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_023----------------------------------");
55806f6ba60Sopenharmony_ci        try {
55906f6ba60Sopenharmony_ci            let sharedDirty = hidebug.getSharedDirty();
56006f6ba60Sopenharmony_ci            expect(sharedDirty >= 0).assertTrue();
56106f6ba60Sopenharmony_ci        } catch (error) {
56206f6ba60Sopenharmony_ci            console.info(error.code);
56306f6ba60Sopenharmony_ci            console.info(error.message);
56406f6ba60Sopenharmony_ci            expect(false).assertTrue();
56506f6ba60Sopenharmony_ci        }
56606f6ba60Sopenharmony_ci    })
56706f6ba60Sopenharmony_ci
56806f6ba60Sopenharmony_ci    /**
56906f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_024
57006f6ba60Sopenharmony_ci     * @tc.desc: getPrivateDirty测试
57106f6ba60Sopenharmony_ci     * @tc.type: FUNC
57206f6ba60Sopenharmony_ci     */
57306f6ba60Sopenharmony_ci    it('HidebugJsTest_024', 0, function () {
57406f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_024----------------------------------");
57506f6ba60Sopenharmony_ci        try {
57606f6ba60Sopenharmony_ci            let privateDirty = hidebug.getPrivateDirty();
57706f6ba60Sopenharmony_ci            expect(privateDirty >= 0).assertTrue();
57806f6ba60Sopenharmony_ci        } catch (error) {
57906f6ba60Sopenharmony_ci            console.info(error.code);
58006f6ba60Sopenharmony_ci            console.info(error.message);
58106f6ba60Sopenharmony_ci            expect(false).assertTrue();
58206f6ba60Sopenharmony_ci        }
58306f6ba60Sopenharmony_ci    })
58406f6ba60Sopenharmony_ci
58506f6ba60Sopenharmony_ci    /**
58606f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_025
58706f6ba60Sopenharmony_ci     * @tc.desc: getPss测试
58806f6ba60Sopenharmony_ci     * @tc.type: FUNC
58906f6ba60Sopenharmony_ci     */
59006f6ba60Sopenharmony_ci    it('HidebugJsTest_025', 0, function () {
59106f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_025----------------------------------");
59206f6ba60Sopenharmony_ci        try {
59306f6ba60Sopenharmony_ci            let pss = hidebug.getPss();
59406f6ba60Sopenharmony_ci            expect(pss >= 0).assertTrue();
59506f6ba60Sopenharmony_ci        } catch (error) {
59606f6ba60Sopenharmony_ci            console.info(error.code);
59706f6ba60Sopenharmony_ci            console.info(error.message);
59806f6ba60Sopenharmony_ci            expect(false).assertTrue();
59906f6ba60Sopenharmony_ci        }
60006f6ba60Sopenharmony_ci    })
60106f6ba60Sopenharmony_ci
60206f6ba60Sopenharmony_ci    /**
60306f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_026
60406f6ba60Sopenharmony_ci     * @tc.desc: getVss测试
60506f6ba60Sopenharmony_ci     * @tc.type: FUNC
60606f6ba60Sopenharmony_ci     */
60706f6ba60Sopenharmony_ci    it('HidebugJsTest_026', 0, function () {
60806f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_026----------------------------------");
60906f6ba60Sopenharmony_ci        try {
61006f6ba60Sopenharmony_ci            let vss = hidebug.getVss();
61106f6ba60Sopenharmony_ci            expect(vss >= 0).assertTrue();
61206f6ba60Sopenharmony_ci        } catch (error) {
61306f6ba60Sopenharmony_ci            console.info(error.code);
61406f6ba60Sopenharmony_ci            console.info(error.message);
61506f6ba60Sopenharmony_ci            expect(false).assertTrue();
61606f6ba60Sopenharmony_ci        }
61706f6ba60Sopenharmony_ci    })
61806f6ba60Sopenharmony_ci
61906f6ba60Sopenharmony_ci    /**
62006f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_027
62106f6ba60Sopenharmony_ci     * @tc.desc: getCpuUsage测试
62206f6ba60Sopenharmony_ci     * @tc.type: FUNC
62306f6ba60Sopenharmony_ci     */
62406f6ba60Sopenharmony_ci    it('HidebugJsTest_027', 0, function () {
62506f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_027----------------------------------");
62606f6ba60Sopenharmony_ci        try {
62706f6ba60Sopenharmony_ci            let cpuUsage = hidebug.getCpuUsage();
62806f6ba60Sopenharmony_ci            expect(cpuUsage >= 0).assertTrue();
62906f6ba60Sopenharmony_ci        } catch (error) {
63006f6ba60Sopenharmony_ci            console.info(error.code);
63106f6ba60Sopenharmony_ci            console.info(error.message);
63206f6ba60Sopenharmony_ci            expect(false).assertTrue();
63306f6ba60Sopenharmony_ci        }
63406f6ba60Sopenharmony_ci    })
63506f6ba60Sopenharmony_ci
63606f6ba60Sopenharmony_ci    /**
63706f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_028
63806f6ba60Sopenharmony_ci     * @tc.desc: getNativeHeapSize测试
63906f6ba60Sopenharmony_ci     * @tc.type: FUNC
64006f6ba60Sopenharmony_ci     */
64106f6ba60Sopenharmony_ci    it('HidebugJsTest_028', 0, function () {
64206f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_028----------------------------------");
64306f6ba60Sopenharmony_ci        try {
64406f6ba60Sopenharmony_ci            let nativeHeapSize = hidebug.getNativeHeapSize();
64506f6ba60Sopenharmony_ci            expect(nativeHeapSize >= 0).assertTrue();
64606f6ba60Sopenharmony_ci        } catch (error) {
64706f6ba60Sopenharmony_ci            console.info(error.code);
64806f6ba60Sopenharmony_ci            console.info(error.message);
64906f6ba60Sopenharmony_ci            expect(false).assertTrue();
65006f6ba60Sopenharmony_ci        }
65106f6ba60Sopenharmony_ci    })
65206f6ba60Sopenharmony_ci
65306f6ba60Sopenharmony_ci    /**
65406f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_029
65506f6ba60Sopenharmony_ci     * @tc.desc: getNativeHeapAllocatedSize测试
65606f6ba60Sopenharmony_ci     * @tc.type: FUNC
65706f6ba60Sopenharmony_ci     */
65806f6ba60Sopenharmony_ci    it('HidebugJsTest_029', 0, function () {
65906f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_029----------------------------------");
66006f6ba60Sopenharmony_ci        try {
66106f6ba60Sopenharmony_ci            let nativeHeapAllocatedSize = hidebug.getNativeHeapAllocatedSize();
66206f6ba60Sopenharmony_ci            expect(nativeHeapAllocatedSize >= 0).assertTrue();
66306f6ba60Sopenharmony_ci        } catch (error) {
66406f6ba60Sopenharmony_ci            console.info(error.code);
66506f6ba60Sopenharmony_ci            console.info(error.message);
66606f6ba60Sopenharmony_ci            expect(false).assertTrue();
66706f6ba60Sopenharmony_ci        }
66806f6ba60Sopenharmony_ci    })
66906f6ba60Sopenharmony_ci
67006f6ba60Sopenharmony_ci    /**
67106f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_030
67206f6ba60Sopenharmony_ci     * @tc.desc: getNativeHeapFreeSize测试
67306f6ba60Sopenharmony_ci     * @tc.type: FUNC
67406f6ba60Sopenharmony_ci     */
67506f6ba60Sopenharmony_ci    it('HidebugJsTest_030', 0, function () {
67606f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_030----------------------------------");
67706f6ba60Sopenharmony_ci        try {
67806f6ba60Sopenharmony_ci            let nativeHeapFreeSize = hidebug.getNativeHeapFreeSize();
67906f6ba60Sopenharmony_ci            expect(nativeHeapFreeSize >= 0).assertTrue();
68006f6ba60Sopenharmony_ci        } catch (error) {
68106f6ba60Sopenharmony_ci            console.info(error.code);
68206f6ba60Sopenharmony_ci            console.info(error.message);
68306f6ba60Sopenharmony_ci            expect(false).assertTrue();
68406f6ba60Sopenharmony_ci        }
68506f6ba60Sopenharmony_ci    })
68606f6ba60Sopenharmony_ci
68706f6ba60Sopenharmony_ci    /**
68806f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_031
68906f6ba60Sopenharmony_ci     * @tc.desc: startProfiling启动两次
69006f6ba60Sopenharmony_ci     * @tc.type: FUNC
69106f6ba60Sopenharmony_ci     */
69206f6ba60Sopenharmony_ci    it('HidebugJsTest_031', 0, async function () {
69306f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_031----------------------------------");
69406f6ba60Sopenharmony_ci        try {
69506f6ba60Sopenharmony_ci            let timestamp1 = Date.now();
69606f6ba60Sopenharmony_ci            let filename1 = "cpuprofiler_" + timestamp1.toString();
69706f6ba60Sopenharmony_ci            hidebug.startProfiling(filename1);
69806f6ba60Sopenharmony_ci            await msleep(1000);
69906f6ba60Sopenharmony_ci            hidebug.stopProfiling();
70006f6ba60Sopenharmony_ci            let path1 = "/proc/self/root/data/storage/el2/base/files/" + filename1 + ".json";
70106f6ba60Sopenharmony_ci            expect(fs.accessSync(path1)).assertTrue();
70206f6ba60Sopenharmony_ci
70306f6ba60Sopenharmony_ci            let timestamp2 = Date.now();
70406f6ba60Sopenharmony_ci            let filename2 = "cpuprofiler_" + timestamp2.toString();
70506f6ba60Sopenharmony_ci            hidebug.startProfiling(filename2);
70606f6ba60Sopenharmony_ci            await msleep(1000);
70706f6ba60Sopenharmony_ci            hidebug.stopProfiling();
70806f6ba60Sopenharmony_ci            let path2 = "/proc/self/root/data/storage/el2/base/files/" + filename2 + ".json";
70906f6ba60Sopenharmony_ci            expect(fs.accessSync(path2)).assertTrue();
71006f6ba60Sopenharmony_ci        } catch (err) {
71106f6ba60Sopenharmony_ci            console.info(error.code);
71206f6ba60Sopenharmony_ci            console.info(error.message);
71306f6ba60Sopenharmony_ci            expect(false).assertTrue();
71406f6ba60Sopenharmony_ci        }
71506f6ba60Sopenharmony_ci    })
71606f6ba60Sopenharmony_ci
71706f6ba60Sopenharmony_ci    /**
71806f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_032
71906f6ba60Sopenharmony_ci     * @tc.desc: startJsCpuProfiling启动两次
72006f6ba60Sopenharmony_ci     * @tc.type: FUNC
72106f6ba60Sopenharmony_ci     */
72206f6ba60Sopenharmony_ci    it('HidebugJsTest_032', 0, async function () {
72306f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_032----------------------------------");
72406f6ba60Sopenharmony_ci        try {
72506f6ba60Sopenharmony_ci            let timestamp1 = Date.now();
72606f6ba60Sopenharmony_ci            let filename1 = "cpuprofiler_" + timestamp1.toString();
72706f6ba60Sopenharmony_ci            hidebug.startJsCpuProfiling(filename1);
72806f6ba60Sopenharmony_ci            await msleep(1000);
72906f6ba60Sopenharmony_ci            hidebug.stopJsCpuProfiling();
73006f6ba60Sopenharmony_ci            let path1 = "/proc/self/root/data/storage/el2/base/files/" + filename1 + ".json";
73106f6ba60Sopenharmony_ci            expect(fs.accessSync(path1)).assertTrue();
73206f6ba60Sopenharmony_ci
73306f6ba60Sopenharmony_ci            let timestamp2 = Date.now();
73406f6ba60Sopenharmony_ci            let filename2 = "cpuprofiler_" + timestamp2.toString();
73506f6ba60Sopenharmony_ci            hidebug.startJsCpuProfiling(filename2);
73606f6ba60Sopenharmony_ci            await msleep(1000);
73706f6ba60Sopenharmony_ci            hidebug.stopJsCpuProfiling();
73806f6ba60Sopenharmony_ci            let path2 = "/proc/self/root/data/storage/el2/base/files/" + filename2 + ".json";
73906f6ba60Sopenharmony_ci            expect(fs.accessSync(path2)).assertTrue();
74006f6ba60Sopenharmony_ci        } catch (err) {
74106f6ba60Sopenharmony_ci            console.info(error.code);
74206f6ba60Sopenharmony_ci            console.info(error.message);
74306f6ba60Sopenharmony_ci            expect(false).assertTrue();
74406f6ba60Sopenharmony_ci        }
74506f6ba60Sopenharmony_ci    })
74606f6ba60Sopenharmony_ci
74706f6ba60Sopenharmony_ci    /**
74806f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_033
74906f6ba60Sopenharmony_ci     * @tc.desc: isDebugState,未连接调试状态下
75006f6ba60Sopenharmony_ci     * @tc.type: FUNC
75106f6ba60Sopenharmony_ci     * @tc.require: issueIAC8K0
75206f6ba60Sopenharmony_ci     */
75306f6ba60Sopenharmony_ci    it('HidebugJsTest_033', 0, function () {
75406f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_033----------------------------------");
75506f6ba60Sopenharmony_ci        try {
75606f6ba60Sopenharmony_ci            let result = hidebug.isDebugState();
75706f6ba60Sopenharmony_ci            expect(result).assertFalse();
75806f6ba60Sopenharmony_ci        } catch (error) {
75906f6ba60Sopenharmony_ci            console.info(error.code);
76006f6ba60Sopenharmony_ci            console.info(error.message);
76106f6ba60Sopenharmony_ci        }
76206f6ba60Sopenharmony_ci    })
76306f6ba60Sopenharmony_ci
76406f6ba60Sopenharmony_ci    /**
76506f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_034
76606f6ba60Sopenharmony_ci     * @tc.desc: getGraphicsMemory
76706f6ba60Sopenharmony_ci     * @tc.type: FUNC
76806f6ba60Sopenharmony_ci     */
76906f6ba60Sopenharmony_ci    it('HidebugJsTest_034', 0, async function () {
77006f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_034----------------------------------");
77106f6ba60Sopenharmony_ci        try {
77206f6ba60Sopenharmony_ci            let graphicMemory = await hidebug.getGraphicsMemory();
77306f6ba60Sopenharmony_ci            expect(graphicMemory >= 0).assertTrue();
77406f6ba60Sopenharmony_ci        } catch (err) {
77506f6ba60Sopenharmony_ci            console.info(error.code);
77606f6ba60Sopenharmony_ci            console.info(error.message);
77706f6ba60Sopenharmony_ci            expect(false).assertTrue();
77806f6ba60Sopenharmony_ci        }
77906f6ba60Sopenharmony_ci    })
78006f6ba60Sopenharmony_ci
78106f6ba60Sopenharmony_ci    /**
78206f6ba60Sopenharmony_ci     * @tc.name: HidebugJsTest_035
78306f6ba60Sopenharmony_ci     * @tc.desc: getGraphicsMemorySync
78406f6ba60Sopenharmony_ci     * @tc.type: FUNC
78506f6ba60Sopenharmony_ci     */
78606f6ba60Sopenharmony_ci    it('HidebugJsTest_035', 0, function () {
78706f6ba60Sopenharmony_ci        console.info("---------------------------HidebugJsTest_035----------------------------------");
78806f6ba60Sopenharmony_ci        try {
78906f6ba60Sopenharmony_ci            let graphicMemory = hidebug.getGraphicsMemorySync();
79006f6ba60Sopenharmony_ci            expect(graphicMemory >= 0).assertTrue();
79106f6ba60Sopenharmony_ci        } catch (err) {
79206f6ba60Sopenharmony_ci            console.info(error.code);
79306f6ba60Sopenharmony_ci            console.info(error.message);
79406f6ba60Sopenharmony_ci            expect(false).assertTrue();
79506f6ba60Sopenharmony_ci        }
79606f6ba60Sopenharmony_ci    })
79706f6ba60Sopenharmony_ci})
798