提交 0c4a0cd5 编写于 作者: F fulizhong

modify files Signed-off-by: FULIZHONG<fulizhong1@huawei.com>

Signed-off-by: Nfulizhong <fulizhong@huawei.com>
上级 52b6cf01
......@@ -16,14 +16,35 @@
import resourceManager from '@ohos.resourceManager';
import {expect} from 'deccjsunit/index'
import router from '@system.router'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import fileio from '@ohos.fileio'
import featureAbility from '@ohos.ability.featureAbility'
import { UiDriver, BY, PointerMatrix } from '@ohos.uitest'
const context = featureAbility.getContext();
export async function getPermission(permissionNames) {
featureAbility.getContext().requestPermissionsFromUser(permissionNames, 0, async (data) => {
console.info("case request success" + JSON.stringify(data));
})
}
export async function driveFn(num) {
console.info(`case come in driveFn 111`)
let driver = await UiDriver.create()
console.info(`case come in driveFn 222`)
console.info(`driver is ${JSON.stringify(driver)}`)
await msleepAsync(2000)
console.info(`UiDriver start`)
for (let i = 0; i < num; i++) {
let button = await driver.findComponent(BY.text('允许'))
console.info(`button is ${JSON.stringify(button)}`)
await msleepAsync(2000)
await button.click()
}
await msleepAsync(2000)
}
// File operation
export async function getFileDescriptor(fileName) {
let fileDescriptor = undefined;
......@@ -205,22 +226,3 @@ export async function closeFd(fileAsset, fdNumber) {
console.info('[mediaLibrary] case fileAsset is null');
}
}
// apply permission for test hap
export async function applyPermission(applictionName, permissionNames) {
let appInfo = await bundle.getApplicationInfo(applictionName, 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
for (let i = 0; i < permissionNames.length; i++) {
await atManager.grantUserGrantedPermission(tokenID, permissionNames[i], 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.info('[permission] case grantUserGrantedPermission failed :' + err);
});
}
} else {
console.info('[permission] case apply permission failed, createAtManager failed');
}
}
\ No newline at end of file
......@@ -25,7 +25,9 @@ ohos_js_hap_suite("audio_recorder_js_hap") {
part_name = "multimedia_player_framework"
}
ohos_js_assets("audio_recorder_js_assets") {
source_dir = "./src/main/js/default"
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("audio_recorder_resources") {
sources = [ "./src/main/resources" ]
......
{
"description": "Configuration for audioRecorder Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "1000000",
"package": "ohos.acts.multimedia.audio.audiorecorder",
"shell-timeout": "60000"
},
"kits": [
{
"type": "ShellKit",
"run-command": [
"rm -rf /storage/media/100/local/files/Audios/audio_*",
"power-shell setmode 602"
],
"teardown-command":[
"power-shell setmode 600"
]
},
{
"test-file-name": [
"ActsAudioRecorderJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
{
"description": "Configuration for audioRecorder Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "1000000",
"shell-timeout": "1000000",
"testcase-timeout": 60000,
"bundle-name": "ohos.acts.multimedia.audio.audiorecorder",
"package-name": "ohos.acts.multimedia.audio.audiorecorder"
},
"kits": [
{
"type": "ShellKit",
"run-command": [
"rm -rf /storage/media/100/local/files/Audios/audio_*",
"rm -rf /storage/media/100/local/files/Videos/audio_*",
"param set persist.ace.testmode.enabled 1",
"power-shell setmode 602"
],
"teardown-command":[
"power-shell setmode 600"
]
},
{
"test-file-name": [
"ActsAudioRecorderJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
{
"app": {
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audiorecorder",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"debug": true
}
},
"module": {
"abilities": [
{
"iconId": 16777218,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"descriptionId": 16777217,
"visible": true,
"labelId": 16777216,
"icon": "$media:icon",
"name": "ohos.acts.multimedia.audio.audiorecorder.MainAbility",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"homeAbility": true,
"launchType": "standard"
}
],
"deviceType": [
"tablet",
"default",
"default",
"tablet",
"tv",
"wearable"
],
"reqPermissions": [
{
"name" : "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason" : "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name" : "ohos.permission.MICROPHONE",
"reason" : "use ohos.permission.MICROPHONE"
},
{
"name" : "ohos.permission.MEDIA_LOCATION",
"reason" : "use ohos.permission.MEDIA_LOCATION"
},
{
"name" : "ohos.permission.READ_MEDIA",
"reason" : "use ohos.permission.READ_MEDIA"
},
{
"name" : "ohos.permission.WRITE_MEDIA",
"reason" : "use ohos.permission.WRITE_MEDIA"
}
],
"mainAbility": "ohos.acts.multimedia.audio.audiorecorder.MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.multimedia.audio.audiorecorder",
"name": ".MyApplication",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
{
"app": {
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audiorecorder",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {
"default": {
"debug": true
}
},
"module": {
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"deviceType": [
"tablet",
"default",
"default",
"tablet",
"tv",
"wearable"
],
"reqPermissions": [
{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name": "ohos.permission.MICROPHONE",
"reason": "use ohos.permission.MICROPHONE"
},
{
"name": "ohos.permission.MEDIA_LOCATION",
"reason": "use ohos.permission.MEDIA_LOCATION"
},
{
"name": "ohos.permission.READ_MEDIA",
"reason": "use ohos.permission.READ_MEDIA"
},
{
"name": "ohos.permission.WRITE_MEDIA",
"reason": "use ohos.permission.WRITE_MEDIA"
}
],
"mainAbility": ".MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.multimedia.audio.audiorecorder",
"name": ".entry",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"srcPath": ""
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
/*
* Copyright (C) 2022 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
{
"strings": {
"hello": "您好",
"world": "世界"
}
{
"strings": {
"hello": "您好",
"world": "世界"
}
}
\ No newline at end of file
/*
* Copyright (C) 2022 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
/*
* Copyright (C) 2022 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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
width: 100%;
height: 100%;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<!--
Copyright (c) 2022 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.
-->
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
<!--
Copyright (c) 2022 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.
-->
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2022 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.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2022 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.
*/
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
/*
* Copyright (C) 2022 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 * as mediaTestBase from '../../../../../../../MediaTestBase.js';
import {Core, ExpectExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
async onShow() {
console.info('onShow finish')
let applictionName = 'ohos.acts.multimedia.audio.audiorecorder';
let permissionName1 = 'ohos.permission.MICROPHONE';
let permissionName2 = 'ohos.permission.MEDIA_LOCATION';
let permissionName3 = 'ohos.permission.READ_MEDIA';
let permissionName4 = 'ohos.permission.WRITE_MEDIA';
let permissionNames = new Array(permissionName1, permissionName2, permissionName3,
permissionName4);
await mediaTestBase.applyPermission(applictionName, permissionNames);
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
this.timeout = 60000
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
......@@ -16,69 +16,72 @@
import media from '@ohos.multimedia.media'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('AudioRecorderEnumTest', function () {
beforeAll(function() {
console.info('beforeAll case');
export default function AudioRecorderEnumTest() {
describe('AudioRecorderEnumTest', function () {
beforeAll(function() {
console.info('beforeAll case');
})
beforeEach(function() {
console.info('beforeEach case');
})
afterEach(function() {
console.info('afterEach case');
})
afterAll(function() {
console.info('afterAll case');
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_ENUM_AUDIO_OUTPUT_FORMAT_0100
* @tc.name : AudioOutputFormat
* @tc.desc : AudioOutputFormat Enumeration test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_ENUM_AUDIO_OUTPUT_FORMAT_0100', 0, async function (done) {
expect(media.AudioOutputFormat.DEFAULT).assertEqual(0);
expect(media.AudioOutputFormat.MPEG_4).assertEqual(2);
expect(media.AudioOutputFormat.AMR_NB).assertEqual(3);
expect(media.AudioOutputFormat.AMR_WB).assertEqual(4);
expect(media.AudioOutputFormat.AAC_ADTS).assertEqual(6);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_ENUM_AUDIO_ENCODER_0100
* @tc.name : AudioOutputFormat
* @tc.desc : AudioOutputFormat Enumeration test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_ENUM_AUDIO_ENCODER_0100', 0, async function (done) {
expect(media.AudioEncoder.DEFAULT).assertEqual(0);
expect(media.AudioEncoder.AMR_NB).assertEqual(1);
expect(media.AudioEncoder.AMR_WB).assertEqual(2);
expect(media.AudioEncoder.AAC_LC).assertEqual(3);
expect(media.AudioEncoder.HE_AAC).assertEqual(4);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_DECODER_ENUM_CODECMIMETYPE_0100
* @tc.name : CodecMimeType
* @tc.desc : Test Enumerate CodecMimeType
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_AUDIO_DECODER_ENUM_CODECMIMETYPE_0100', 0, async function (done) {
expect(media.CodecMimeType.AUDIO_AAC).assertEqual('audio/mp4a-latm');
expect(media.CodecMimeType.AUDIO_VORBIS).assertEqual('audio/vorbis');
expect(media.CodecMimeType.AUDIO_FLAC).assertEqual('audio/flac');
done();
})
})
}
beforeEach(function() {
console.info('beforeEach case');
})
afterEach(function() {
console.info('afterEach case');
})
afterAll(function() {
console.info('afterAll case');
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_ENUM_AUDIO_OUTPUT_FORMAT_0100
* @tc.name : AudioOutputFormat
* @tc.desc : AudioOutputFormat Enumeration test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_ENUM_AUDIO_OUTPUT_FORMAT_0100', 0, async function (done) {
expect(media.AudioOutputFormat.DEFAULT).assertEqual(0);
expect(media.AudioOutputFormat.MPEG_4).assertEqual(2);
expect(media.AudioOutputFormat.AMR_NB).assertEqual(3);
expect(media.AudioOutputFormat.AMR_WB).assertEqual(4);
expect(media.AudioOutputFormat.AAC_ADTS).assertEqual(6);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_ENUM_AUDIO_ENCODER_0100
* @tc.name : AudioOutputFormat
* @tc.desc : AudioOutputFormat Enumeration test
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_ENUM_AUDIO_ENCODER_0100', 0, async function (done) {
expect(media.AudioEncoder.DEFAULT).assertEqual(0);
expect(media.AudioEncoder.AMR_NB).assertEqual(1);
expect(media.AudioEncoder.AMR_WB).assertEqual(2);
expect(media.AudioEncoder.AAC_LC).assertEqual(3);
expect(media.AudioEncoder.HE_AAC).assertEqual(4);
done();
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_DECODER_ENUM_CODECMIMETYPE_0100
* @tc.name : CodecMimeType
* @tc.desc : Test Enumerate CodecMimeType
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level0
*/
it('SUB_MULTIMEDIA_MEDIA_AUDIO_DECODER_ENUM_CODECMIMETYPE_0100', 0, async function (done) {
expect(media.CodecMimeType.AUDIO_AAC).assertEqual('audio/mp4a-latm');
expect(media.CodecMimeType.AUDIO_VORBIS).assertEqual('audio/vorbis');
expect(media.CodecMimeType.AUDIO_FLAC).assertEqual('audio/flac');
done();
})
})
\ No newline at end of file
/*
* Copyright (C) 2022 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.
*/
require('./RecorderLocalTestAudioFUNC.test.js')
require('./RecorderLocalTestAudioAPI.test.js')
require('./AudioRecorderEnumTest.test.js')
\ No newline at end of file
/*
* Copyright (C) 2022 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 RecorderLocalTestAudioFUNC from './RecorderLocalTestAudioFUNC.test.js'
import RecorderLocalTestAudioAPI from './RecorderLocalTestAudioAPI.test.js'
import AudioRecorderEnumTest from './AudioRecorderEnumTest.test.js'
export default function testsuite() {
RecorderLocalTestAudioFUNC()
RecorderLocalTestAudioAPI()
AudioRecorderEnumTest()
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
}
]
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "JS_Empty Ability"
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
......@@ -12,9 +12,13 @@
{
"type": "ShellKit",
"run-command": [
"rm -rf /storage/media/100/local/files/Videos/COMPATIBILITY*"
"rm -rf /storage/media/100/local/files/Audios/COMPATIBILITY*",
"param set persist.ace.testmode.enabled 1",
"power-shell setmode 602"
],
"teardown-command": []
"teardown-command": [
"power-shell setmode 600"
]
},
{
"test-file-name": [
......
......@@ -57,8 +57,8 @@
}
],
"deviceType": [
"tablet",
"default",
"tablet",
"default",
"default",
"tablet",
"tv",
......@@ -69,10 +69,6 @@
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},
{
"name": "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"
},
{
"name": "ohos.permission.MICROPHONE",
"reason": "use ohos.permission.MICROPHONE"
......
......@@ -17,6 +17,7 @@ import media from '@ohos.multimedia.media'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import * as mediaTestBase from '../../../../../MediaTestBase.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function AudioRecorderFormatCompatibilityTest() {
......@@ -59,7 +60,14 @@ describe('AudioRecorderFormatCompatibilityTest', function () {
}
beforeAll(async function () {
await applyPermission();
let permissionName1 = 'ohos.permission.MICROPHONE';
let permissionName2 = 'ohos.permission.MEDIA_LOCATION';
let permissionName3 = 'ohos.permission.READ_MEDIA';
let permissionName4 = 'ohos.permission.WRITE_MEDIA';
let permissionNames = [permissionName1, permissionName2, permissionName3, permissionName4];
await mediaTestBase.getPermission(permissionNames);
await mediaTestBase.msleepAsync(2000);
await mediaTestBase.driveFn(2);
console.info('beforeAll case');
})
......@@ -76,41 +84,6 @@ describe('AudioRecorderFormatCompatibilityTest', function () {
console.info('afterAll case');
})
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.recorderformat', 0, 100);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
console.info('[permission] case accessTokenID is ' + tokenID);
let permissionName1 = 'ohos.permission.MICROPHONE';
let permissionName2 = 'ohos.permission.MEDIA_LOCATION';
let permissionName3 = 'ohos.permission.READ_MEDIA';
let permissionName4 = 'ohos.permission.WRITE_MEDIA';
await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.error('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.error('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.error('[permission] case grantUserGrantedPermission failed :' + err);
});
await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => {
console.info('[permission] case grantUserGrantedPermission success :' + result);
}).catch((err) => {
console.error('[permission] case grantUserGrantedPermission failed :' + err);
});
} else {
console.error('[permission] case apply permission failed, createAtManager failed');
}
}
async function getFd(pathName) {
let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary();
......
......@@ -57,8 +57,8 @@
}
],
"deviceType": [
"tablet",
"default",
"tablet",
"default",
"default",
"tablet",
"tv",
......
......@@ -12,8 +12,10 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("video_recorder_js_hap") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":video_recorder_js_assets",
":video_recorder_resources",
......@@ -32,7 +34,9 @@ ohos_js_hap_suite("video_recorder_js_hap") {
# subsystem_name = "xts"
}
ohos_js_assets("video_recorder_js_assets") {
source_dir = "./src/main/js/default"
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("video_recorder_resources") {
sources = [ "./src/main/resources" ]
......
{
"description": "Configuration for videoRecorder Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "2000000",
"package": "ohos.acts.multimedia.video.videorecorder",
"shell-timeout": "60000"
},
"kits": [
{
"type": "ShellKit",
"run-command": [
"rm -rf /storage/media/100/local/files/Videos/*",
"power-shell setmode 602"
],
"teardown-command":[
"power-shell setmode 600"
]
},
{
"test-file-name": [
"ActsVideoRecorderJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
{
"description": "Configuration for videoRecorder Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "1000000",
"shell-timeout": "1000000",
"testcase-timeout": 60000,
"bundle-name": "ohos.acts.multimedia.video.videorecorder",
"package-name": "ohos.acts.multimedia.video.videorecorder"
},
"kits": [
{
"test-file-name": [
"ActsVideoRecorderJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"rm -rf /storage/media/100/local/files/Videos/*",
"param set persist.ace.testmode.enabled 1",
"power-shell setmode 602"
],
"teardown-command":[
"power-shell setmode 600"
],
"cleanup-apps": true
}
]
}
\ No newline at end of file
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册