提交 b1d3d4b3 编写于 作者: L lwx1121892

<audio规范性整改>

Signed-off-by: Nlwx1121892 <liuxueqi3@huawei.com>
上级 5c3e32cc
......@@ -2,7 +2,7 @@
"description": "Configuration for audio manager Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "5500000",
"test-timeout": "1500000",
"package": "ohos.acts.multimedia.audio.audiocapturer",
"shell-timeout": "60000"
},
......
......@@ -2,7 +2,7 @@
"description": "Configuration for audio manager Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "5500000",
"test-timeout": "1500000",
"package": "ohos.acts.multimedia.audio.audiocapturerchangeInfo",
"shell-timeout": "60000"
},
......
......@@ -2,7 +2,7 @@
"description": "Configuration for audio manager Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "5500000",
"test-timeout": "1500000",
"package": "ohos.acts.multimedia.audio.audioeventmanagement",
"shell-timeout": "60000"
},
......
......@@ -19,8 +19,8 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
describe('audioEventManagement', function () {
console.info('AudioFrameworkTest: Create AudioManger Object JS Framework');
let audioManager = null;
var deviceRoleValue = null;
var deviceTypeValue = null;
let deviceRoleValue = null;
let deviceTypeValue = null;
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
......@@ -34,8 +34,8 @@ describe('audioEventManagement', function () {
}
}
function displayDeviceProp(value, index, array) {
var devRoleName;
var devTypeName;
let devRoleName;
let devTypeName;
if (value.deviceRole == 1) {
devRoleName = 'INPUT_DEVICE';
}
......@@ -100,10 +100,8 @@ describe('audioEventManagement', function () {
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0100', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
const promise = audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG)
promise.then(function (value) {
const PROMISE = audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG)
PROMISE.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
......@@ -116,7 +114,7 @@ describe('audioEventManagement', function () {
expect(false).assertTrue();
}
});
await promise;
await PROMISE;
done();
})
......@@ -129,11 +127,8 @@ describe('audioEventManagement', function () {
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_OUTPUT_ENUM_0100', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
const promise = audioManager.getDevices(1)
promise.then(function (value) {
const PROMISE = audioManager.getDevices(1)
PROMISE.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null) {
......@@ -145,7 +140,7 @@ describe('audioEventManagement', function () {
expect(false).assertTrue();
}
});
await promise;
await PROMISE;
done();
})
......@@ -158,10 +153,8 @@ describe('audioEventManagement', function () {
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_INPUT_0100', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
const promise = audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG);
promise.then(function (value) {
const PROMISE = audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG);
PROMISE.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
if (deviceTypeValue != null && deviceRoleValue != null) {
......@@ -173,7 +166,7 @@ describe('audioEventManagement', function () {
expect(false).assertTrue();
}
});
await promise;
await PROMISE;
done();
})
......@@ -186,10 +179,8 @@ describe('audioEventManagement', function () {
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_INTPUT_ENUM_0100', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
const promise = audioManager.getDevices(2);
promise.then(function (value) {
const PROMISE = audioManager.getDevices(2);
PROMISE.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG');
value.forEach(displayDeviceProp);
......@@ -202,7 +193,7 @@ describe('audioEventManagement', function () {
expect(false).assertTrue();
}
});
await promise;
await PROMISE;
done();
})
......@@ -215,10 +206,8 @@ describe('audioEventManagement', function () {
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_ALL_0100', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
const promise = audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG);
promise.then(function (value) {
const PROMISE = audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG);
PROMISE.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG');
value.forEach(displayDeviceProp);
......@@ -231,7 +220,7 @@ describe('audioEventManagement', function () {
expect(false).assertTrue();
}
});
await promise;
await PROMISE;
done();
})
......@@ -244,10 +233,8 @@ describe('audioEventManagement', function () {
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_ALL_ENUM_0100', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
const promise = audioManager.getDevices(3);
promise.then(function (value) {
const PROMISE = audioManager.getDevices(3);
PROMISE.then(function (value) {
console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG');
value.forEach(displayDeviceProp);
......@@ -260,7 +247,7 @@ describe('audioEventManagement', function () {
expect(false).assertTrue();
}
});
await promise;
await PROMISE;
done();
})
......@@ -273,8 +260,6 @@ describe('audioEventManagement', function () {
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_OUTPUT_0100', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value) => {
console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG');
if (err) {
......@@ -306,8 +291,6 @@ describe('audioEventManagement', function () {
*@tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_OUTPUT_ENUM_0100', 2, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
audioManager.getDevices(1, (err, value) => {
console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG');
if (err) {
......@@ -339,8 +322,6 @@ describe('audioEventManagement', function () {
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_INPUT_0100', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG, (err, value) => {
console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG');
if (err) {
......@@ -373,8 +354,6 @@ describe('audioEventManagement', function () {
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_INPUT_ENUM_0100', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
audioManager.getDevices(2, (err, value) => {
console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG');
if (err) {
......@@ -407,8 +386,6 @@ describe('audioEventManagement', function () {
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_ALL_0100', 0, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG, (err, value) => {
console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG');
if (err) {
......@@ -440,8 +417,6 @@ describe('audioEventManagement', function () {
*@tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_ALL_ENUM_0100', 2, async function (done) {
deviceRoleValue = null;
deviceTypeValue = null;
audioManager.getDevices(3, (err, value) => {
console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG');
if (err) {
......@@ -756,6 +731,4 @@ describe('audioEventManagement', function () {
await sleep(50);
done();
})
})
\ No newline at end of file
......@@ -2,7 +2,7 @@
"description": "Configuration for audio manager Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "5500000",
"test-timeout": "1500000",
"package": "ohos.acts.multimedia.audio.audiorendererchangeInfo",
"shell-timeout": "60000"
},
......
......@@ -2,7 +2,7 @@
"description": "Configuration for audio manager Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "5500000",
"test-timeout": "1500000",
"package": "ohos.acts.multimedia.audio.audiomanager",
"shell-timeout": "60000"
},
......
......@@ -2,7 +2,7 @@
"description": "Configuration for audio manager Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "5500000",
"test-timeout": "1500000",
"package": "ohos.acts.multimedia.audio.audiorenderer",
"shell-timeout": "60000"
},
......
......@@ -2,7 +2,7 @@
"description": "Configuration for audio manager Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "5500000",
"test-timeout": "550000",
"package": "ohos.acts.multimedia.audio.audiovoip",
"shell-timeout": "60000"
},
......
......@@ -22,12 +22,12 @@ import * as audioTestBase from '../../../../../AudioTestBase'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
describe('audioVoip', function () {
var mediaDir;
let mediaDir;
let fdRead;
let readpath;
let fdPath;
let filePath;
const audioManager = audio.getAudioManager();
const AUDIOMANAGER = audio.getAudioManager();
console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework');
beforeAll(async function () {
......@@ -99,10 +99,10 @@ describe('audioVoip', function () {
}
async function playbackPromise(AudioRendererOptions, pathName) {
var resultFlag = 'new';
let resultFlag = 'new';
console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function');
var audioRen;
let audioRen;
await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) {
audioRen = data;
console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS');
......@@ -157,7 +157,7 @@ describe('audioVoip', function () {
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state);
var bufferSize;
let bufferSize;
await audioRen.getBufferSize().then(async function (data) {
console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data);
bufferSize = data;
......@@ -185,7 +185,7 @@ describe('audioVoip', function () {
console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen);
await audioRen.write(buf);
if (rlen > (totalSize / 2)) {
await audioManager.getAudioScene().then(async function (data) {
await AUDIOMANAGER.getAudioScene().then(async function (data) {
console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : ' + data);
}).catch((err) => {
console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message);
......@@ -235,10 +235,10 @@ describe('audioVoip', function () {
async function recPromise(AudioCapturerOptions, fpath) {
var resultFlag = 'new';
let resultFlag = 'new';
console.info('AudioFrameworkRecLog: Promise : Audio Recording Function');
var audioCap;
let audioCap;
await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) {
audioCap = data;
......@@ -305,10 +305,10 @@ describe('audioVoip', function () {
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state);
var bufferSize = await audioCap.getBufferSize();
let bufferSize = await audioCap.getBufferSize();
console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize);
var fd = fileio.openSync(fpath, 0o102, 0o777);
let fd = fileio.openSync(fpath, 0o102, 0o777);
if (fd !== null) {
console.info('AudioFrameworkRecLog: file fd created');
}
......@@ -328,13 +328,13 @@ describe('audioVoip', function () {
return resultFlag;
}
await sleep(100);
var numBuffersToCapture = 45;
let numBuffersToCapture = 45;
while (numBuffersToCapture) {
console.info('AudioFrameworkRecLog: ---------READ BUFFER---------');
var buffer = await audioCap.read(bufferSize, true);
let buffer = await audioCap.read(bufferSize, true);
await sleep(50);
console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------');
var number = fileio.writeSync(fd, buffer);
let number = fileio.writeSync(fd, buffer);
console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number);
await sleep(50);
numBuffersToCapture--;
......@@ -376,26 +376,26 @@ describe('audioVoip', function () {
*/
it('SUB_MULTIMEDIA_AUDIO_VOIP_PLAY_0100', 2, async function (done) {
var AudioStreamInfo = {
let AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 0
}
var AudioRendererOptions = {
let AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
await getFdRead("StarWars10s-1C-44100-2SW.wav");
var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
let resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag);
expect(resultFlag).assertTrue();
......@@ -413,25 +413,25 @@ describe('audioVoip', function () {
*/
it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_0100', 2, async function (done) {
var AudioStreamInfo = {
let AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioCapturerInfo = {
let AudioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION,
capturerFlags: 0
}
var AudioCapturerOptions = {
let AudioCapturerOptions = {
streamInfo: AudioStreamInfo,
capturerInfo: AudioCapturerInfo
}
await getAbilityInfo("capture_js-44100-2C-16B.pcm");
var resultFlag = await recPromise(AudioCapturerOptions, mediaDir);
let resultFlag = await recPromise(AudioCapturerOptions, mediaDir);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag);
expect(resultFlag).assertTrue();
......@@ -448,37 +448,37 @@ describe('audioVoip', function () {
*/
it('SUB_MULTIMEDIA_AUDIO_VOIP_RECPLAY_0100', 2, async function (done) {
var AudioStreamInfoCap = {
let AudioStreamInfoCap = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioCapturerInfo = {
let AudioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION,
capturerFlags: 0
}
var AudioCapturerOptions = {
let AudioCapturerOptions = {
streamInfo: AudioStreamInfoCap,
capturerInfo: AudioCapturerInfo
}
var AudioStreamInfoRen = {
let AudioStreamInfoRen = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
let AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 0
}
var AudioRendererOptions = {
let AudioRendererOptions = {
streamInfo: AudioStreamInfoRen,
rendererInfo: AudioRendererInfo
}
......@@ -489,7 +489,7 @@ describe('audioVoip', function () {
readpath = 'StarWars10s-1C-44100-2SW.wav';
await getFdRead(readpath);
var resultFlag = await playbackPromise(AudioRendererOptions, readpath);
let resultFlag = await playbackPromise(AudioRendererOptions, readpath);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag);
expect(resultFlag).assertTrue();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册