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

!6891 audio&camera签名文件更改回合monthly分支

Merge pull request !6891 from 秦莉文/monthly_20221018
...@@ -25,7 +25,9 @@ ohos_js_hap_suite("audio_capturer_js_hap") { ...@@ -25,7 +25,9 @@ ohos_js_hap_suite("audio_capturer_js_hap") {
part_name = "multimedia_audio_framework" part_name = "multimedia_audio_framework"
} }
ohos_js_assets("audio_capturer_js_assets") { ohos_js_assets("audio_capturer_js_assets") {
source_dir = "./src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("audio_capturer_resources") { ohos_resources("audio_capturer_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
......
{ {
"description": "Configuration for audio manager Tests", "description": "Configuration for audio manager Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "1500000", "test-timeout": "1500000",
"package": "ohos.acts.multimedia.audio.audiocapturer", "bundle-name": "ohos.acts.multimedia.audio.audiocapturer",
"package-name": "ohos.acts.multimedia.audio.audiocapturer",
"shell-timeout": "60000" "shell-timeout": "60000"
}, },
"kits": [ "kits": [
...@@ -41,7 +42,6 @@ ...@@ -41,7 +42,6 @@
"./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", "./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", "./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/" "./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/"
] ]
} }
] ]
......
{ {
"app": { "app": {
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audiocapturer", "bundleName": "ohos.acts.multimedia.audio.audiocapturer",
"vendor": "example",
"version": { "version": {
"code": 1000000, "code": 1,
"name": "1.0.0" "name": "1.0"
}
}, },
"deviceConfig": { "apiVersion": {
"default": { "compatible": 5,
"debug": true "target": 5,
"releaseType": "Beta1"
} }
}, },
"deviceConfig": {},
"module": { "module": {
"package": "ohos.acts.multimedia.audio.audiocapturer",
"name": ".entry",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"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.MANAGE_AUDIO_CONFIG",
"reason": "use ohos.permission.MANAGE_AUDIO_CONFIG"
}
],
"abilities": [ "abilities": [
{ {
"iconId": 16777218,
"skills": [ "skills": [
{ {
"entities": [ "entities": [
...@@ -31,35 +52,32 @@ ...@@ -31,35 +52,32 @@
] ]
} }
], ],
"descriptionId": 16777217, "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, "visible": true,
"labelId": 16777216, "launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon", "icon": "$media:icon",
"name": "ohos.acts.multimedia.audio.audiocapturer.MainAbility", "description": "$string:TestAbility_desc",
"description": "$string:mainability_description", "label": "$string:TestAbility_label",
"label": "$string:entry_MainAbility",
"type": "page", "type": "page",
"homeAbility": true, "visible": true,
"launchType": "standard" "launchType": "standard"
} }
], ],
"deviceType": [
"tablet",
"default",
"phone",
"tablet",
"tv",
"wearable"
],
"mainAbility": "ohos.acts.multimedia.audio.audiocapturer.MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.multimedia.audio.audiocapturer",
"name": ".MyApplication",
"js": [ "js": [
{ {
"pages": [ "pages": [
...@@ -68,24 +86,25 @@ ...@@ -68,24 +86,25 @@
"name": "default", "name": "default",
"window": { "window": {
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": true "autoDesignWidth": false
} }
}
],
"reqPermissions": [
{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
}, },
{ {
"name": "ohos.permission.MICROPHONE", "pages": [
"reason": "use ohos.permission.MICROPHONE" "pages/index/index"
}, ],
{ "name": ".TestAbility",
"name": "ohos.permission.MANAGE_AUDIO_CONFIG", "window": {
"reason": "use ohos.permission.MANAGE_AUDIO_CONFIG" "designWidth": 720,
"autoDesignWidth": false
} }
}
] ],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* 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">
Hello, World!
{{ $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.
*/
import file from '@system.file'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
/*
* 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 { .container {
display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
left: 0px;
top: 0px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.title { .title {
font-size: 40px; font-size: 60px;
color: #000000; text-align: center;
opacity: 0.9; width: 100%;
} height: 40%;
margin: 10px;
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
} }
@media screen and (device-type: wearable) { @media screen and (device-type: phone) and (orientation: landscape) {
.title { .title {
font-size: 28px; font-size: 60px;
color: #FFFFFF;
} }
} }
@media screen and (device-type: tv) { @media screen and (device-type: tablet) and (orientation: landscape) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title { .title {
font-size: 100px; font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
} }
} }
\ No newline at end of file
/* /*
* Copyright (C) 2021 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
...@@ -14,10 +14,13 @@ ...@@ -14,10 +14,13 @@
*/ */
export default { export default {
onCreate() { data: {
console.info('AceApplication onCreate'); title: ""
}, },
onDestroy() { onInit() {
console.info('AceApplication onDestroy'); 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) 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 {Core, ExpectExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
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
...@@ -15,11 +15,12 @@ ...@@ -15,11 +15,12 @@
import audio from '@ohos.multimedia.audio'; import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility';
import * as audioTestBase from '../../../../../AudioTestBase' import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from '@ohos/hypium';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix } from '@ohos.uitest'
export default function audioCapturer() {
describe('audioCapturer', function () { describe('audioCapturer', function () {
let Tag = 'AudioCpaturer'; let Tag = 'AudioCpaturer';
let dirPath; let dirPath;
let bufferSize; let bufferSize;
...@@ -45,8 +46,6 @@ describe('audioCapturer', function () { ...@@ -45,8 +46,6 @@ describe('audioCapturer', function () {
const GET_STREAMINFO_EVENT = 'getStreamInfo'; const GET_STREAMINFO_EVENT = 'getStreamInfo';
const GET_AUDIOSCENE_EVENT = 'getAudioScene'; const GET_AUDIOSCENE_EVENT = 'getAudioScene';
const ERROR_EVENT = 'error'; const ERROR_EVENT = 'error';
let stringParameter = "invalid_parameter";
let numberParameter = 999999;
let eventEmitter = new events.EventEmitter(); let eventEmitter = new events.EventEmitter();
function sleep(ms) { function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
...@@ -371,10 +370,10 @@ describe('audioCapturer', function () { ...@@ -371,10 +370,10 @@ describe('audioCapturer', function () {
toNextStep(audioCap, steps, done); toNextStep(audioCap, steps, done);
} }
catch (error) { catch (error) {
if (error.code == 401){ if (error.code == 401) {
markReachState = 'invalid_failure'; markReachState = 'invalid_failure';
toNextStep(audioCap, steps, done); toNextStep(audioCap, steps, done);
}else{ } else {
console.info("err" + error.code); console.info("err" + error.code);
toNextStep(audioCap, steps, done); toNextStep(audioCap, steps, done);
} }
...@@ -405,10 +404,10 @@ describe('audioCapturer', function () { ...@@ -405,10 +404,10 @@ describe('audioCapturer', function () {
toNextStep(audioCap, steps, done); toNextStep(audioCap, steps, done);
} }
catch (error) { catch (error) {
if (error.code == 401){ if (error.code == 401) {
markReachState = 'invalid_failure'; markReachState = 'invalid_failure';
toNextStep(audioCap, steps, done); toNextStep(audioCap, steps, done);
}else{ } else {
console.info("err" + error.code); console.info("err" + error.code);
toNextStep(audioCap, steps, done); toNextStep(audioCap, steps, done);
} }
...@@ -442,15 +441,30 @@ describe('audioCapturer', function () { ...@@ -442,15 +441,30 @@ describe('audioCapturer', function () {
} }
const AUDIOMANAGERREC = audio.getAudioManager(); const AUDIOMANAGERREC = audio.getAudioManager();
console.info(`${Tag} AudioFrameworkRecLog: Create AudioManger Object JS Framework`); console.info(`${Tag} AudioFrameworkRecLog: Create AudioManger Object JS Framework`);
async function getPermission() {
let permissions = ['ohos.permission.MICROPHONE'];
featureAbility.getContext().requestPermissionsFromUser(permissions, 0, (data) => {
console.info("request success" + JSON.stringify(data));
})
}
async function driveFn() {
console.info(`come in driveFn`)
let driver = await UiDriver.create()
console.info(`driver is ${JSON.stringify(driver)}`)
await sleep(2000)
console.info(`UiDriver start`)
let button = await driver.findComponent(BY.text('允许'))
console.info(`button is ${JSON.stringify(button)}`)
await sleep(5000)
await button.click()
}
beforeAll(async function () { beforeAll(async function () {
console.info(`${Tag} AudioFrameworkTest: beforeAll: Prerequisites at the test suite level`); await getPermission();
let permissionName1 = 'ohos.permission.MICROPHONE'; sleep(2000)
let permissionName2 = 'ohos.permission.MANAGE_AUDIO_CONFIG'; await driveFn();
let permissionNameList = [permissionName1, permissionName2]; console.info('TestLog: Start Testing AudioFrameworkTest Interfaces');
let appName = 'ohos.acts.multimedia.audio.audiocapturer';
await audioTestBase.applyPermission(appName, permissionNameList);
await sleep(100);
console.info(`${Tag} AudioFrameworkTest: beforeAll: END`);
}) })
beforeEach(async function () { beforeEach(async function () {
...@@ -466,9 +480,6 @@ describe('audioCapturer', function () { ...@@ -466,9 +480,6 @@ describe('audioCapturer', function () {
console.info(`${Tag} AudioFrameworkTest: afterAll: Test suite-level cleanup condition`); console.info(`${Tag} AudioFrameworkTest: afterAll: Test suite-level cleanup condition`);
}) })
async function recPromise(AudioCapturerOptions, done) { async function recPromise(AudioCapturerOptions, done) {
let audioCap; let audioCap;
try { try {
...@@ -1942,68 +1953,6 @@ describe('audioCapturer', function () { ...@@ -1942,68 +1953,6 @@ describe('audioCapturer', function () {
done(); done();
}) })
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_READ_WRITE_0200
*@tc.name : AudioCapturer-GET_AUDIO_TIME
*@tc.desc : AudioCapturer GET_AUDIO_TIME
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_READ_WRITE_0200', 2, async function (done) {
await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm");
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
}
let AudioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags: 0
}
let AudioCapturerOptions = {
streamInfo: AudioStreamInfo,
capturerInfo: AudioCapturerInfo
}
let audioCapPromise;
try {
audioCapPromise = await audio.createAudioCapturer(AudioCapturerOptions);
console.log(`${Tag} createAudioCapturer ok`);
} catch (err) {
console.log(`${Tag} createAudioCapturer err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
return done();
}
try {
await audioCapPromise.start();
console.log(`${Tag} start ok`);
let audioTime = await audioCapPromise.getAudioTime();
console.log(`${Tag} audioTime: ${JSON.stringify(audioTime)}`);
expect(audioTime).assertLarger(0);
await audioCapPromise.read(stringParameter, true);
} catch (err) {
if (err.code == 6800101) {
console.log(`audioVolumeManager on : PASS : message:${err.message}`);
expect(true).assertTrue();
}else {
console.log(`audioVolumeManager on : FAIL : message:${err.message}`);
expect(false).assertTrue();
}
}
try {
await audioCapPromise.release();
} catch (err) {
console.log(`${Tag} err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
done();
})
/** /**
*@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100 *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100
*@tc.name : AudioCapturer-GET_AUDIO_TIME *@tc.name : AudioCapturer-GET_AUDIO_TIME
...@@ -2104,62 +2053,6 @@ describe('audioCapturer', function () { ...@@ -2104,62 +2053,6 @@ describe('audioCapturer', function () {
done(); done();
}) })
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100
*@tc.name : AudioCapturer-GET_AUDIO_TIME
*@tc.desc : AudioCapturer GET_AUDIO_TIME
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100', 2, async function (done) {
await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm");
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
}
let AudioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags: 0
}
let AudioCapturerOptions = {
streamInfo: AudioStreamInfo,
capturerInfo: AudioCapturerInfo
}
let audioCapPromise;
try {
audioCapPromise = await audio.createAudioCapturer(AudioCapturerOptions);
console.log(`${Tag} createAudioCapturer ok`);
} catch (err) {
console.log(`${Tag} createAudioCapturer err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
return done();
}
try {
await audioCapPromise.stop();
} catch (err) {
if (err.code == 6800301) {
console.log(`${Tag} stop error code : PASS : message:${err.message}`);
expect(true).assertTrue();
}else {
console.log(`${Tag} stop error code : FAIL : message:${err.message}`);
expect(false).assertTrue();
}
}
try {
await audioCapPromise.release();
} catch (err) {
console.log(`${Tag} err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
done();
})
/** /**
*@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_GET_AUDIO_TIME_0100 *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_GET_AUDIO_TIME_0100
*@tc.name : AudioCapturer-GET_AUDIO_TIME *@tc.name : AudioCapturer-GET_AUDIO_TIME
...@@ -2244,9 +2137,17 @@ describe('audioCapturer', function () { ...@@ -2244,9 +2137,17 @@ describe('audioCapturer', function () {
return done(); return done();
} }
try {
await audioCapPromise.start();
console.log(`${Tag} start ok`);
} catch (err) {
console.log(`${Tag} start err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
try { try {
await audioCapPromise.stop(); await audioCapPromise.stop();
console.log(`${Tag} stop ok`); console.log(`${Tag} stop ok`);
expect(true).assertTrue();
} catch (err) { } catch (err) {
console.log(`${Tag} stop err: ${JSON.stringify(err)}`); console.log(`${Tag} stop err: ${JSON.stringify(err)}`);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -2559,108 +2460,6 @@ describe('audioCapturer', function () { ...@@ -2559,108 +2460,6 @@ describe('audioCapturer', function () {
done(); done();
}) })
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0100
*@tc.name : AudioRec-Set1
*@tc.desc : record audio with parameter set 1
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0100', 2, async function (done) {
let audioStreamInfo44100 = {
samplingRate: 44100,
channels: 1,
sampleFormat: 1,
encodingType: 0,
};
let audioCapturerInfo44100 = {
source: 0,
capturerFlags: 0
}
let AudioCapturerOptions = {
streamInfo: audioStreamInfo44100,
capturerInfo: audioCapturerInfo44100,
}
let audioCap;
try {
audioCap = await audio.createAudioCapturer(AudioCapturerOptions);
} catch (err) {
console.log(`${Tag} createAudioCapturer err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
return done();
}
try {
let audioParamsGet = await audioCap.getAudioStreamId();
console.info(`${Tag} SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0100: Capturer CapturerInfo: ${JSON.stringify(audioParamsGet)}`);
} catch (err) {
console.log(`${Tag} SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0100 err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
try {
await audioCap.release();
} catch (err) {
console.log(`${Tag} SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0100 err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
done();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0200
*@tc.name : AudioRec-Set1
*@tc.desc : record audio with parameter set 1
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 2
*/
it('SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0200', 2, async function (done) {
let audioStreamInfo44100 = {
samplingRate: 44100,
channels: 1,
sampleFormat: 1,
encodingType: 0,
};
let audioCapturerInfo44100 = {
source: 0,
capturerFlags: 0
}
let AudioCapturerOptions = {
streamInfo: audioStreamInfo44100,
capturerInfo: audioCapturerInfo44100,
}
let audioCap;
try {
audioCap = await audio.createAudioCapturer(AudioCapturerOptions);
} catch (err) {
console.log(`${Tag} createAudioCapturer err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
return done();
}
await audioCap.getAudioStreamId((err, data) => {
if (err) {
console.info(`${TagFrmwkRender}: SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0200 CALLBACK: error: ${err.message}`);
expect(false).assertTrue();
done();
return;
}
console.info(`${TagFrmwkRender}:SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0200 CALLBACK: SUCCESS ${data}`);
expect(true).assertTrue();
done();
})
try {
await audioCap.release();
} catch (err) {
console.log(`${Tag} SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_StreamId_ENUM_0200 err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
done();
})
/** /**
*@tc.number : SUB_MULTIMEDIA_AUDIO_REC_VOICE_CHAT_PR_ENUM_AUDIO_STREAM_INFO_INVALID_0100 *@tc.number : SUB_MULTIMEDIA_AUDIO_REC_VOICE_CHAT_PR_ENUM_AUDIO_STREAM_INFO_INVALID_0100
*@tc.name : AudioRec-Set1 *@tc.name : AudioRec-Set1
...@@ -2685,13 +2484,8 @@ describe('audioCapturer', function () { ...@@ -2685,13 +2484,8 @@ describe('audioCapturer', function () {
capturerInfo: audioCapturerInfo44100, capturerInfo: audioCapturerInfo44100,
} }
await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(function (data) { await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(function (data) {
if (data == undefined) {
console.info(`${Tag} AudioFrameworkRecLog: AudioCapturer Created : Unsuccess : ${JSON.stringify(data)}`);
expect(true).assertTrue();
} else {
console.info(`${Tag} AudioFrameworkRecLog: AudioCapturer Created : Success: ${JSON.stringify(data)}`); console.info(`${Tag} AudioFrameworkRecLog: AudioCapturer Created : Success: ${JSON.stringify(data)}`);
expect(false).assertTrue(); expect(false).assertTrue();
}
}).catch((err) => { }).catch((err) => {
console.info(`${Tag} AudioFrameworkRecLog: AudioCapturer Created : ERROR : ${JSON.stringify(err.message)}`); console.info(`${Tag} AudioFrameworkRecLog: AudioCapturer Created : ERROR : ${JSON.stringify(err.message)}`);
expect(true).assertTrue(); expect(true).assertTrue();
...@@ -3238,4 +3032,90 @@ describe('audioCapturer', function () { ...@@ -3238,4 +3032,90 @@ describe('audioCapturer', function () {
let mySteps = [CREATE_EVENT, AudioCapturerOptions, PERIODR_REACH_EVENT, periodReachParam, START_EVENT, GET_BUFFERSIZE_EVENT, READ_EVENT, OFF_PERIODR_REACH_EVENT, RELEASE_EVENT, END_EVENT]; let mySteps = [CREATE_EVENT, AudioCapturerOptions, PERIODR_REACH_EVENT, periodReachParam, START_EVENT, GET_BUFFERSIZE_EVENT, READ_EVENT, OFF_PERIODR_REACH_EVENT, RELEASE_EVENT, END_EVENT];
eventEmitter.emit(mySteps[0], audioCap, mySteps, done); eventEmitter.emit(mySteps[0], audioCap, mySteps, done);
}) })
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_CAPTURER_GET_AUDIO_STREAM_ID_0100
*@tc.name : AudioCapturer - getAudioStreamId
*@tc.desc : AudioCapturer - getAudioStreamId
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_CAPTURER_GET_AUDIO_STREAM_ID_0100', 0, async function (done) {
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
}
let AudioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags: 0
}
let AudioCapturerOptions = {
streamInfo: AudioStreamInfo,
capturerInfo: AudioCapturerInfo
}
let audioCapPromise;
try {
audioCapPromise = await audio.createAudioCapturer(AudioCapturerOptions);
await audioCapPromise.getAudioStreamId((err, data) => {
if (err) {
console.info(`${Tag}: getAudioStreamId : ERROR : code: ${err.code}, mesage: ${err.message}`);
expect(false).assertTrue();
} else {
expect(true).assertTrue();
console.info(`${Tag}: getAudioStreamId : Converted: ${data}`);
}
});
await audioCapPromise.release();
} catch (err) {
console.log(`${Tag} err: ${JSON.stringify(err)}`);
expect(false).assertTrue();
}
done();
})
/**
*@tc.number : SUB_MULTIMEDIA_AUDIO_CAPTURER_GET_AUDIO_STREAM_ID_0200
*@tc.name : AudioCapturer - getAudioStreamId
*@tc.desc : AudioCapturer - getAudioStreamId
*@tc.size : MEDIUM
*@tc.type : Function
*@tc.level : Level 0
*/
it('SUB_MULTIMEDIA_AUDIO_CAPTURER_GET_AUDIO_STREAM_ID_0200', 0, async function (done) {
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
}
let AudioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags: 0
}
let AudioCapturerOptions = {
streamInfo: AudioStreamInfo,
capturerInfo: AudioCapturerInfo
}
try {
let audioCapPromise = await audio.createAudioCapturer(AudioCapturerOptions);
await audioCapPromise.getAudioStreamId().then((data) => {
expect(true).assertTrue();
console.info(`${Tag}: getAudioStreamId : Converted: ${data}`);
}).catch((err) => {
expect(true).assertTrue();
console.error(`${Tag}: getAudioStreamId : ERROR : ${err}`);
});
await audioCapPromise.release();
} catch (err) {
console.log(`${Tag} error code: ${err.code} ,message:${err.message}`);
expect(false).assertTrue();
}
done();
})
})
}
\ No newline at end of file
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
require('./AudioCapturer.test.js') import audioCapturer from './AudioCapturer.test.js'
export default function testsuite() {
audioCapturer()
}
{ {
"string": [ "string": [
{ {
"name": "entry_MainAbility", "name": "app_name",
"value": "entry_MainAbility" "value": "JsHelloWorld"
}, },
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Empty Ability" "value": "hap sample empty page"
},
{
"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
...@@ -25,7 +25,9 @@ ohos_js_hap_suite("audio_capturerchangeInfo_js_hap") { ...@@ -25,7 +25,9 @@ ohos_js_hap_suite("audio_capturerchangeInfo_js_hap") {
part_name = "multimedia_audio_framework" part_name = "multimedia_audio_framework"
} }
ohos_js_assets("audio_capturerchangeInfo_js_assets") { ohos_js_assets("audio_capturerchangeInfo_js_assets") {
source_dir = "./src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("audio_capturerchangeInfo_resources") { ohos_resources("audio_capturerchangeInfo_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
......
{ {
"description": "Configuration for audio manager Tests", "description": "Configuration for audio manager Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "1500000", "test-timeout": "1500000",
"package": "ohos.acts.multimedia.audio.audiocapturerchangeInfo", "bundle-name": "ohos.acts.multimedia.audio.audiocapturerchangeInfo",
"package-name": "ohos.acts.multimedia.audio.audiocapturerchangeInfo",
"shell-timeout": "60000" "shell-timeout": "60000"
}, },
"kits": [ "kits": [
......
{ {
"app": { "app": {
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audiocapturerchangeInfo", "bundleName": "ohos.acts.multimedia.audio.audiocapturerchangeInfo",
"vendor": "example",
"version": { "version": {
"code": 1000000, "code": 1,
"name": "1.0.0" "name": "1.0"
}
}, },
"deviceConfig": { "apiVersion": {
"default": { "compatible": 5,
"debug": true "target": 5,
"releaseType": "Beta1"
} }
}, },
"deviceConfig": {},
"module": { "module": {
"package": "ohos.acts.multimedia.audio.audiocapturerchangeInfo",
"name": ".entry",
"deviceType": [
"tablet",
"default",
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry"
},
"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.MANAGE_AUDIO_CONFIG",
"reason": "use ohos.permission.MANAGE_AUDIO_CONFIG"
}
],
"abilities": [ "abilities": [
{ {
"iconId": 16777218,
"skills": [ "skills": [
{ {
"entities": [ "entities": [
...@@ -31,35 +52,32 @@ ...@@ -31,35 +52,32 @@
] ]
} }
], ],
"descriptionId": 16777217, "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, "visible": true,
"labelId": 16777216, "launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon", "icon": "$media:icon",
"name": "ohos.acts.multimedia.audio.audiocapturerchangeInfo.MainAbility", "description": "$string:TestAbility_desc",
"description": "$string:mainability_description", "label": "$string:TestAbility_label",
"label": "$string:entry_MainAbility",
"type": "page", "type": "page",
"homeAbility": true, "visible": true,
"launchType": "standard" "launchType": "standard"
} }
], ],
"deviceType": [
"tablet",
"default",
"phone",
"tablet",
"tv",
"wearable"
],
"mainAbility": "ohos.acts.multimedia.audio.audiocapturerchangeInfo.MainAbility",
"distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true,
"moduleName": "entry"
},
"package": "ohos.acts.multimedia.audio.audiocapturerchangeInfo",
"name": ".MyApplication",
"js": [ "js": [
{ {
"pages": [ "pages": [
...@@ -68,24 +86,25 @@ ...@@ -68,24 +86,25 @@
"name": "default", "name": "default",
"window": { "window": {
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": true "autoDesignWidth": false
} }
}
],
"reqPermissions": [
{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",
"reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
}, },
{ {
"name": "ohos.permission.MICROPHONE", "pages": [
"reason": "use ohos.permission.MICROPHONE" "pages/index/index"
}, ],
{ "name": ".TestAbility",
"name": "ohos.permission.MANAGE_AUDIO_CONFIG", "window": {
"reason": "use ohos.permission.MANAGE_AUDIO_CONFIG" "designWidth": 720,
"autoDesignWidth": false
} }
}
] ],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* 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">
Hello, World!
{{ $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.
*/
import file from '@system.file'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
/*
* 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 { .container {
display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
left: 0px;
top: 0px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.title { .title {
font-size: 40px; font-size: 60px;
color: #000000; text-align: center;
opacity: 0.9; width: 100%;
} height: 40%;
margin: 10px;
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
} }
@media screen and (device-type: wearable) { @media screen and (device-type: phone) and (orientation: landscape) {
.title { .title {
font-size: 28px; font-size: 60px;
color: #FFFFFF;
} }
} }
@media screen and (device-type: tv) { @media screen and (device-type: tablet) and (orientation: landscape) {
.container {
background-image: url("/common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title { .title {
font-size: 100px; font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
} }
} }
\ No newline at end of file
/* /*
* Copyright (C) 2021 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
...@@ -14,10 +14,13 @@ ...@@ -14,10 +14,13 @@
*/ */
export default { export default {
onCreate() { data: {
console.info('AceApplication onCreate'); title: ""
}, },
onDestroy() { onInit() {
console.info('AceApplication onDestroy'); 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) 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 {Core, ExpectExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
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
...@@ -14,9 +14,11 @@ ...@@ -14,9 +14,11 @@
*/ */
import audio from '@ohos.multimedia.audio'; import audio from '@ohos.multimedia.audio';
import * as audioTestBase from '../../../../../AudioTestBase' import featureAbility from '@ohos.ability.featureAbility';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from '@ohos/hypium';
import { UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix } from '@ohos.uitest'
export default function audioCapturerChange() {
describe('audioCapturerChange', function () { describe('audioCapturerChange', function () {
let audioStreamManager; let audioStreamManager;
let audioStreamManagerCB; let audioStreamManagerCB;
...@@ -25,20 +27,35 @@ describe('audioCapturerChange', function () { ...@@ -25,20 +27,35 @@ describe('audioCapturerChange', function () {
const audioManager = audio.getAudioManager(); const audioManager = audio.getAudioManager();
console.info(`${Tag}: Create AudioManger Object JS Framework`); console.info(`${Tag}: Create AudioManger Object JS Framework`);
async function getPermission() {
let permissions = ['ohos.permission.MICROPHONE'];
featureAbility.getContext().requestPermissionsFromUser(permissions, 0, (data) => {
console.info("request success" + JSON.stringify(data));
})
}
async function driveFn() {
console.info(`come in driveFn`)
let driver = await UiDriver.create()
console.info(`driver is ${JSON.stringify(driver)}`)
await sleep(2000)
console.info(`UiDriver start`)
let button = await driver.findComponent(BY.text('允许'))
console.info(`button is ${JSON.stringify(button)}`)
await sleep(5000)
await button.click()
}
beforeAll(async function () { beforeAll(async function () {
console.info(`AudioFrameworkTest: beforeAll: Prerequisites at the test suite level`); await getPermission();
let permissionName1 = 'ohos.permission.MICROPHONE'; sleep(2000)
let permissionName2 = 'ohos.permission.MANAGE_AUDIO_CONFIG'; await driveFn();
let permissionNameList = [permissionName1,permissionName2]; await sleep(5000);
let appName = 'ohos.acts.multimedia.audio.audiocapturerchangeInfo';
await audioTestBase.applyPermission(appName, permissionNameList);
await sleep(100);
console.info(`AudioFrameworkTest: beforeAll: END`);
await sleep(100);
audioStreamManager = audioManager.getStreamManager(); audioStreamManager = audioManager.getStreamManager();
audioStreamManagerCB = audioManager.getStreamManager(); audioStreamManagerCB = audioManager.getStreamManager();
await sleep(1000); console.info('TestLog: Start Testing AudioFrameworkTest Interfaces');
console.info(`${Tag}: beforeAll: END`);
}) })
beforeEach(async function () { beforeEach(async function () {
...@@ -1624,3 +1641,4 @@ describe('audioCapturerChange', function () { ...@@ -1624,3 +1641,4 @@ describe('audioCapturerChange', function () {
}) })
}) })
}
\ No newline at end of file
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
* limitations under the License. * limitations under the License.
*/ */
require('./AudioCapturerChangeInfo.test.js') import audioCapturerChange from './AudioCapturerChangeInfo.test.js'
export default function testsuite() {
audioCapturerChange()
}
{ {
"string": [ "string": [
{ {
"name": "entry_MainAbility", "name": "app_name",
"value": "entry_MainAbility" "value": "JsHelloWorld"
}, },
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Empty Ability" "value": "hap sample empty page"
},
{
"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
...@@ -25,10 +25,10 @@ describe('audioRendererChange', function () { ...@@ -25,10 +25,10 @@ describe('audioRendererChange', function () {
console.info(`${Tag} : Create AudioManger Object JS Framework`); console.info(`${Tag} : Create AudioManger Object JS Framework`);
beforeAll(async function () { beforeAll(async function () {
audioStreamManager = AUDIOMANAGER.getStreamManager(); audioStreamManager = AUDIOMANAGER.getStreamManager();
audioStreamManagerCB = AUDIOMANAGER.getStreamManager(); audioStreamManagerCB = AUDIOMANAGER.getStreamManager();
await sleep(1000); await sleep(1000);
console.info(`${Tag} : beforeAll: Prerequisites at the test suite level`); console.info(`${Tag} : beforeAll: Prerequisites at the test suite level`);
}) })
......
/*
* 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 abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import bundle from '@ohos.bundle';
import account from '@ohos.account.osAccount';
// apply permission for test hap
export async function applyPermission(applictionName, permissionNames) {
let userId = await account.getAccountManager().getOsAccountLocalIdFromProcess();
console.info(`userid is :${userId}`)
let appInfo = await bundle.getApplicationInfo(applictionName, 0, userId);
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
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
{ {
"type": "ShellKit", "type": "ShellKit",
"run-command": [ "run-command": [
"hilog -Q pidoff",
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiointerrupt/haps/entry/files/", "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiointerrupt/haps/entry/files/",
"mkdir -p /data/app/el2/100/base/com.example.audiorenderinterrupt/haps/entry/files/", "mkdir -p /data/app/el2/100/base/com.example.audiorenderinterrupt/haps/entry/files/",
"chmod 777 -R /data/app/el2/100/base/ohos.acts.multimedia.audio.audiointerrupt/haps/entry", "chmod 777 -R /data/app/el2/100/base/ohos.acts.multimedia.audio.audiointerrupt/haps/entry",
......
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
} }
], ],
"deviceType": [ "deviceType": [
"default", "tablet",
"tablet" "default"
], ],
"mainAbility": "ohos.acts.multimedia.audio.audiointerrupt.MainAbility", "mainAbility": "ohos.acts.multimedia.audio.audiointerrupt.MainAbility",
"distro": { "distro": {
...@@ -67,52 +67,6 @@ ...@@ -67,52 +67,6 @@
"autoDesignWidth": true "autoDesignWidth": true
} }
} }
],
"reqPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "use ohos.permission.GET_BUNDLE_INFO"
},
{
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED",
"reason": "use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
},
{
"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.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"
},
{
"name": "ohos.permission.MICROPHONE",
"reason": "use ohos.permission.MICROPHONE"
},
{
"name": "ohos.permission.ACCESS_NOTIFICATION_POLICY",
"reason": "use ohos.permission.ACCESS_NOTIFICATION_POLICY"
},
{
"name": "ohos.permission.MODIFY_AUDIO_SETTINGS",
"reason": "use ohos.permission.MODIFY_AUDIO_SETTINGS"
},
{
"name": "ohos.permission.MANAGE_AUDIO_CONFIG",
"reason": "use ohos.permission.MANAGE_AUDIO_CONFIG"
}
] ]
} }
} }
\ No newline at end of file
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
"name": ".entry", "name": ".entry",
"mainAbility": ".MainAbility", "mainAbility": ".MainAbility",
"deviceType": [ "deviceType": [
"default", "tablet",
"tablet" "default"
], ],
"distro": { "distro": {
"deliveryWithInstall": true, "deliveryWithInstall": true,
......
...@@ -25,7 +25,9 @@ ohos_js_hap_suite("audio_manager_js_hap") { ...@@ -25,7 +25,9 @@ ohos_js_hap_suite("audio_manager_js_hap") {
part_name = "multimedia_audio_framework" part_name = "multimedia_audio_framework"
} }
ohos_js_assets("audio_manager_js_assets") { ohos_js_assets("audio_manager_js_assets") {
source_dir = "./src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("audio_manager_resources") { ohos_resources("audio_manager_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
......
{ {
"description": "Configuration for audio manager Tests", "description": "Configuration for audio manager Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "1500000", "test-timeout": "1500000",
"package": "ohos.acts.multimedia.audio.audiomanager", "bundle-name": "ohos.acts.multimedia.audio.audiomanager",
"package-name": "ohos.acts.multimedia.audio.audiomanager",
"shell-timeout": "60000" "shell-timeout": "60000"
}, },
"kits": [ "kits": [
......
{ {
"app": { "app": {
"apiVersion": {
"compatible": 6,
"releaseType": "Beta1",
"target": 7
},
"vendor": "acts",
"bundleName": "ohos.acts.multimedia.audio.audiomanager", "bundleName": "ohos.acts.multimedia.audio.audiomanager",
"vendor": "example",
"version": { "version": {
"code": 1000000, "code": 1,
"name": "1.0.0" "name": "1.0"
}
}, },
"deviceConfig": { "apiVersion": {
"default": { "compatible": 5,
"debug": true "target": 5,
"releaseType": "Beta1"
} }
}, },
"deviceConfig": {},
"module": { "module": {
"abilities": [ "package": "ohos.acts.multimedia.audio.audiomanager",
{ "name": ".entry",
"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.audiomanager.MainAbility",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"homeAbility": true,
"launchType": "standard"
}
],
"deviceType": [ "deviceType": [
"tablet", "tablet",
"default", "default",
"phone", "phone"
"tablet",
"tv",
"wearable"
], ],
"mainAbility": "ohos.acts.multimedia.audio.audiomanager.MainAbility",
"distro": { "distro": {
"moduleType": "entry",
"installationFree": false,
"deliveryWithInstall": true, "deliveryWithInstall": true,
"moduleName": "entry" "moduleName": "entry",
"moduleType": "entry"
}, },
"package": "ohos.acts.multimedia.audio.audiomanager",
"name": ".MyApplication",
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
],
"reqPermissions": [ "reqPermissions": [
{ {
...@@ -94,6 +48,72 @@ ...@@ -94,6 +48,72 @@
"name": "ohos.permission.MANAGE_AUDIO_CONFIG", "name": "ohos.permission.MANAGE_AUDIO_CONFIG",
"reason": "use ohos.permission.MANAGE_AUDIO_CONFIG" "reason": "use ohos.permission.MANAGE_AUDIO_CONFIG"
} }
],
"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"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"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.
*/
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* 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">
Hello, World!
{{ $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.
*/
import file from '@system.file'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
},
onReady() {
},
}
/*
* 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
/*
* 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) 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 {Core, ExpectExtend} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
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
...@@ -13,5 +13,12 @@ ...@@ -13,5 +13,12 @@
* limitations under the License. * limitations under the License.
*/ */
require('./AudioFramework.test.js') import audioFramework from './AudioFramework.test.js'
require('./AudioManagerApi9.test.js') import audioManagerApi9 from './AudioManagerApi9.test.js'
export default function testsuite() {
audioFramework()
audioManagerApi9()
}
{ {
"string": [ "string": [
{ {
"name": "entry_MainAbility", "name": "app_name",
"value": "entry_MainAbility" "value": "JsHelloWorld"
}, },
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Empty Ability" "value": "hap sample empty page"
},
{
"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
...@@ -25,7 +25,9 @@ ohos_js_hap_suite("audio_voip_js_hap") { ...@@ -25,7 +25,9 @@ ohos_js_hap_suite("audio_voip_js_hap") {
part_name = "multimedia_audio_framework" part_name = "multimedia_audio_framework"
} }
ohos_js_assets("audio_voip_js_assets") { ohos_js_assets("audio_voip_js_assets") {
source_dir = "./src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("audio_voip_resources") { ohos_resources("audio_voip_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册