未验证 提交 e3dcb010 编写于 作者: O openharmony_ci 提交者: Gitee

!6875 修改媒体子系统xts用例签名权限

Merge pull request !6875 from FULIZHONG/monthly_20221018
...@@ -16,14 +16,35 @@ ...@@ -16,14 +16,35 @@
import resourceManager from '@ohos.resourceManager'; import resourceManager from '@ohos.resourceManager';
import {expect} from 'deccjsunit/index' import {expect} from 'deccjsunit/index'
import router from '@system.router' import router from '@system.router'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import mediaLibrary from '@ohos.multimedia.mediaLibrary' import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import fileio from '@ohos.fileio' import fileio from '@ohos.fileio'
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
import { UiDriver, BY, PointerMatrix } from '@ohos.uitest'
const context = featureAbility.getContext(); 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 // File operation
export async function getFileDescriptor(fileName) { export async function getFileDescriptor(fileName) {
let fileDescriptor = undefined; let fileDescriptor = undefined;
...@@ -205,22 +226,3 @@ export async function closeFd(fileAsset, fdNumber) { ...@@ -205,22 +226,3 @@ export async function closeFd(fileAsset, fdNumber) {
console.info('[mediaLibrary] case fileAsset is null'); 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") { ...@@ -25,7 +25,9 @@ ohos_js_hap_suite("audio_recorder_js_hap") {
part_name = "multimedia_player_framework" part_name = "multimedia_player_framework"
} }
ohos_js_assets("audio_recorder_js_assets") { 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") { ohos_resources("audio_recorder_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
......
{ {
"description": "Configuration for audioRecorder Tests", "description": "Configuration for audioRecorder Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "1000000", "test-timeout": "1000000",
"package": "ohos.acts.multimedia.audio.audiorecorder", "shell-timeout": "1000000",
"shell-timeout": "60000" "testcase-timeout": 60000,
}, "bundle-name": "ohos.acts.multimedia.audio.audiorecorder",
"kits": [ "package-name": "ohos.acts.multimedia.audio.audiorecorder"
{ },
"type": "ShellKit", "kits": [
"run-command": [ {
"rm -rf /storage/media/100/local/files/Audios/audio_*", "type": "ShellKit",
"power-shell setmode 602" "run-command": [
], "rm -rf /storage/media/100/local/files/Audios/audio_*",
"teardown-command":[ "rm -rf /storage/media/100/local/files/Videos/audio_*",
"power-shell setmode 600" "param set persist.ace.testmode.enabled 1",
] "power-shell setmode 602"
}, ],
{ "teardown-command":[
"test-file-name": [ "power-shell setmode 600"
"ActsAudioRecorderJsTest.hap" ]
], },
"type": "AppInstallKit", {
"cleanup-apps": true "test-file-name": [
} "ActsAudioRecorderJsTest.hap"
] ],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
} }
\ No newline at end of file
{ {
"app": { "app": {
"apiVersion": { "apiVersion": {
"compatible": 6, "compatible": 6,
"releaseType": "Beta1", "releaseType": "Beta1",
"target": 7 "target": 7
}, },
"vendor": "acts", "vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audiorecorder", "bundleName": "ohos.acts.multimedia.audio.audiorecorder",
"version": { "version": {
"code": 1000000, "code": 1000000,
"name": "1.0.0" "name": "1.0.0"
} }
}, },
"deviceConfig": { "deviceConfig": {
"default": { "default": {
"debug": true "debug": true
} }
}, },
"module": { "module": {
"abilities": [ "abilities": [
{ {
"iconId": 16777218, "skills": [
"skills": [ {
{ "entities": [
"entities": [ "entity.system.home"
"entity.system.home" ],
], "actions": [
"actions": [ "action.system.home"
"action.system.home" ]
] }
} ],
], "orientation": "unspecified",
"descriptionId": 16777217, "formsEnabled": false,
"visible": true, "name": ".MainAbility",
"labelId": 16777216, "srcLanguage": "js",
"icon": "$media:icon", "srcPath": "MainAbility",
"name": "ohos.acts.multimedia.audio.audiorecorder.MainAbility", "icon": "$media:icon",
"description": "$string:mainability_description", "description": "$string:MainAbility_desc",
"label": "$string:entry_MainAbility", "label": "$string:MainAbility_label",
"type": "page", "type": "page",
"homeAbility": true, "visible": true,
"launchType": "standard" "launchType": "standard"
} },
], {
"deviceType": [ "orientation": "unspecified",
"tablet", "formsEnabled": false,
"default", "name": ".TestAbility",
"default", "srcLanguage": "js",
"tablet", "srcPath": "TestAbility",
"tv", "icon": "$media:icon",
"wearable" "description": "$string:TestAbility_desc",
], "label": "$string:TestAbility_label",
"reqPermissions": [ "type": "page",
{ "visible": true,
"name" : "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", "launchType": "standard"
"reason" : "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" }
}, ],
{ "deviceType": [
"name" : "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS", "tablet",
"reason" : "use ohos.permission.REVOKE_SENSITIVE_PERMISSIONS" "default",
}, "default",
{ "tablet",
"name" : "ohos.permission.MICROPHONE", "tv",
"reason" : "use ohos.permission.MICROPHONE" "wearable"
}, ],
{ "reqPermissions": [
"name" : "ohos.permission.MEDIA_LOCATION", {
"reason" : "use ohos.permission.MEDIA_LOCATION" "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
}, "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
{ },
"name" : "ohos.permission.READ_MEDIA", {
"reason" : "use ohos.permission.READ_MEDIA" "name": "ohos.permission.MICROPHONE",
}, "reason": "use ohos.permission.MICROPHONE"
{ },
"name" : "ohos.permission.WRITE_MEDIA", {
"reason" : "use ohos.permission.WRITE_MEDIA" "name": "ohos.permission.MEDIA_LOCATION",
} "reason": "use ohos.permission.MEDIA_LOCATION"
], },
"mainAbility": "ohos.acts.multimedia.audio.audiorecorder.MainAbility", {
"distro": { "name": "ohos.permission.READ_MEDIA",
"moduleType": "entry", "reason": "use ohos.permission.READ_MEDIA"
"installationFree": false, },
"deliveryWithInstall": true, {
"moduleName": "entry" "name": "ohos.permission.WRITE_MEDIA",
}, "reason": "use ohos.permission.WRITE_MEDIA"
"package": "ohos.acts.multimedia.audio.audiorecorder", }
"name": ".MyApplication", ],
"js": [ "mainAbility": ".MainAbility",
{ "distro": {
"pages": [ "moduleType": "entry",
"pages/index/index" "installationFree": false,
], "deliveryWithInstall": true,
"name": "default", "moduleName": "entry"
"window": { },
"designWidth": 720, "package": "ohos.acts.multimedia.audio.audiorecorder",
"autoDesignWidth": true "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. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info('AceApplication onCreate'); console.info('AceApplication onCreate');
}, },
onDestroy() { onDestroy() {
console.info('AceApplication onDestroy'); console.info('AceApplication onDestroy');
} }
}; };
{ {
"strings": { "strings": {
"hello": "Hello", "hello": "Hello",
"world": "World" "world": "World"
} }
} }
\ No newline at end of file
{ {
"strings": { "strings": {
"hello": "您好", "hello": "您好",
"world": "世界" "world": "世界"
} }
} }
\ No newline at end of file
/* /*
* Copyright (C) 2022 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
.container { .container {
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.title { .title {
font-size: 40px; font-size: 40px;
color: #000000; color: #000000;
opacity: 0.9; opacity: 0.9;
} }
@media screen and (device-type: tablet) and (orientation: landscape) { @media screen and (device-type: tablet) and (orientation: landscape) {
.title { .title {
font-size: 100px; font-size: 100px;
} }
} }
@media screen and (device-type: wearable) { @media screen and (device-type: wearable) {
.title { .title {
font-size: 28px; font-size: 28px;
color: #FFFFFF; color: #FFFFFF;
} }
} }
@media screen and (device-type: tv) { @media screen and (device-type: tv) {
.container { .container {
background-image: url("/common/images/Wallpaper.png"); background-image: url("/common/images/Wallpaper.png");
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
} }
.title { .title {
font-size: 100px; font-size: 100px;
color: #FFFFFF; color: #FFFFFF;
} }
} }
@media screen and (device-type: phone) and (orientation: landscape) { @media screen and (device-type: phone) and (orientation: landscape) {
.title { .title {
font-size: 60px; font-size: 60px;
} }
} }
<!-- <!--
Copyright (c) 2022 Huawei Device Co., Ltd. Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<div class="container"> <div class="container">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{ title }} {{ $t('strings.hello') }} {{ title }}
</text> </text>
</div> </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 @@ ...@@ -16,69 +16,72 @@
import media from '@ohos.multimedia.media' import media from '@ohos.multimedia.media'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('AudioRecorderEnumTest', function () { export default function AudioRecorderEnumTest() {
beforeAll(function() { describe('AudioRecorderEnumTest', function () {
console.info('beforeAll case'); 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. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import RecorderLocalTestAudioFUNC from './RecorderLocalTestAudioFUNC.test.js'
require('./RecorderLocalTestAudioFUNC.test.js') import RecorderLocalTestAudioAPI from './RecorderLocalTestAudioAPI.test.js'
require('./RecorderLocalTestAudioAPI.test.js') import AudioRecorderEnumTest from './AudioRecorderEnumTest.test.js'
require('./AudioRecorderEnumTest.test.js') export default function testsuite() {
\ No newline at end of file RecorderLocalTestAudioFUNC()
RecorderLocalTestAudioAPI()
AudioRecorderEnumTest()
}
{ {
"string": [ "string": [
{ {
"name": "entry_MainAbility", "name": "entry_MainAbility",
"value": "entry_MainAbility" "value": "entry_MainAbility"
}, },
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Empty Ability" "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 @@ ...@@ -12,9 +12,13 @@
{ {
"type": "ShellKit", "type": "ShellKit",
"run-command": [ "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": [ "test-file-name": [
......
...@@ -57,8 +57,8 @@ ...@@ -57,8 +57,8 @@
} }
], ],
"deviceType": [ "deviceType": [
"tablet", "tablet",
"default", "default",
"default", "default",
"tablet", "tablet",
"tv", "tv",
...@@ -69,10 +69,6 @@ ...@@ -69,10 +69,6 @@
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason": "use 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", "name": "ohos.permission.MICROPHONE",
"reason": "use ohos.permission.MICROPHONE" "reason": "use ohos.permission.MICROPHONE"
......
...@@ -17,6 +17,7 @@ import media from '@ohos.multimedia.media' ...@@ -17,6 +17,7 @@ import media from '@ohos.multimedia.media'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl' import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle' import bundle from '@ohos.bundle'
import mediaLibrary from '@ohos.multimedia.mediaLibrary' import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import * as mediaTestBase from '../../../../../MediaTestBase.js';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
export default function AudioRecorderFormatCompatibilityTest() { export default function AudioRecorderFormatCompatibilityTest() {
...@@ -59,7 +60,14 @@ describe('AudioRecorderFormatCompatibilityTest', function () { ...@@ -59,7 +60,14 @@ describe('AudioRecorderFormatCompatibilityTest', function () {
} }
beforeAll(async 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'); console.info('beforeAll case');
}) })
...@@ -76,41 +84,6 @@ describe('AudioRecorderFormatCompatibilityTest', function () { ...@@ -76,41 +84,6 @@ describe('AudioRecorderFormatCompatibilityTest', function () {
console.info('afterAll case'); 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) { async function getFd(pathName) {
let displayName = pathName; let displayName = pathName;
const mediaTest = mediaLibrary.getMediaLibrary(); const mediaTest = mediaLibrary.getMediaLibrary();
......
...@@ -57,8 +57,8 @@ ...@@ -57,8 +57,8 @@
} }
], ],
"deviceType": [ "deviceType": [
"tablet", "tablet",
"default", "default",
"default", "default",
"tablet", "tablet",
"tv", "tv",
......
...@@ -12,8 +12,10 @@ ...@@ -12,8 +12,10 @@
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("video_recorder_js_hap") { ohos_js_hap_suite("video_recorder_js_hap") {
hap_profile = "./src/main/config.json" hap_profile = "./src/main/config.json"
js2abc = true
deps = [ deps = [
":video_recorder_js_assets", ":video_recorder_js_assets",
":video_recorder_resources", ":video_recorder_resources",
...@@ -32,7 +34,9 @@ ohos_js_hap_suite("video_recorder_js_hap") { ...@@ -32,7 +34,9 @@ ohos_js_hap_suite("video_recorder_js_hap") {
# subsystem_name = "xts" # subsystem_name = "xts"
} }
ohos_js_assets("video_recorder_js_assets") { 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") { ohos_resources("video_recorder_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
......
{ {
"description": "Configuration for videoRecorder Tests", "description": "Configuration for videoRecorder Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "2000000", "test-timeout": "1000000",
"package": "ohos.acts.multimedia.video.videorecorder", "shell-timeout": "1000000",
"shell-timeout": "60000" "testcase-timeout": 60000,
}, "bundle-name": "ohos.acts.multimedia.video.videorecorder",
"kits": [ "package-name": "ohos.acts.multimedia.video.videorecorder"
{ },
"type": "ShellKit", "kits": [
"run-command": [ {
"rm -rf /storage/media/100/local/files/Videos/*", "test-file-name": [
"power-shell setmode 602" "ActsVideoRecorderJsTest.hap"
], ],
"teardown-command":[ "type": "AppInstallKit",
"power-shell setmode 600" "cleanup-apps": true
] },
}, {
{ "type": "ShellKit",
"test-file-name": [ "run-command": [
"ActsVideoRecorderJsTest.hap" "rm -rf /storage/media/100/local/files/Videos/*",
], "param set persist.ace.testmode.enabled 1",
"type": "AppInstallKit", "power-shell setmode 602"
"cleanup-apps": true ],
} "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.
先完成此消息的编辑!
想要评论请 注册