HilogdomainonJstest.js 2.3 KB
Newer Older
1
15929983503 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import hilog from '@ohos.hilog'

export default function HilogdomainonJstest() {
describe('HilogdomainonJstest', function () {

    /**
    * run before testClass
    */
    beforeAll(function () {
        console.info('beforeAll called');
    })

    /**
    * run after testClass
    */
    afterAll(function () {
        console.info('afterAll called');
    })

    /**
     * @tc.number DFX_DFT_Hilog_Domain_White_0500
     * @tc.name 验证启用domain白名单,type为LOG_APP,domain id有效,日志正常打印
     * @tc.desc The log tool can read valid app log types when domain on.
     */
    it('testHilogJsApi05', 2, function () {
        console.info('testHilogJsApi01 start');
        try{
            hilog.error(0xffff, "HILOGTEST", "%{public}s", ['hilogJs0100'])
        } catch (error){
            console.log(`testHilogJsApi05 got an error: ${JSON.stringify(error)}`)
            expect().assertFail()
        }
        console.info('testHilogJsApi05 end');
    })

    /**
     * @tc.number DFX_DFT_Hilog_Domain_White_0600
     * @tc.name 验证启用domain白名单,type为LOG_APP,domain id无效(在白名单内),无日志打印
     * @tc.desc The log tool can't read white app log types when domain on.
     */
    it('testHilogJsApi06', 2, function () {
        console.info('testHilogJsApi02 start');
        try{
            hilog.error(0xD003200, "HILOGTEST", "%{public}s", ['hilogJs0200'])
        } catch (error){
            console.log(`testHilogJsApi06 got an error: ${JSON.stringify(error)}`)
            expect().assertFail()
        }
        console.info('testHilogJsApi06 end');
    })
})
}