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

!4135 媒体XTS与HMOS对齐整改

Merge pull request !4135 from liuxueqi/OpenHarmony-3.1-Release
......@@ -22,10 +22,11 @@ import bundle from '@ohos.bundle';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import featureAbility from '@ohos.ability.featureAbility'
import resourceManager from '@ohos.resourceManager';
import account from '@ohos.account.osAccount'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
describe('audioCall', function () {
describe('audioCall', async function () {
var mediaDir;
let fdRead;
let readpath;
......@@ -38,7 +39,8 @@ describe('audioCall', function () {
const audioManagerRec = audio.getAudioManager();
console.info('AudioFrameworkRecLog: Create AudioManger Object JS Framework');
let userId = await account.getAccountManager().getOsAccountLocalldFromProcess();
console.info('userId :' + userId);
/*async function getPathName(){
var path1 = '/data/accounts/account_0/appdata/';
var packageName;
......@@ -135,7 +137,7 @@ describe('audioCall', function () {
});
}
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, 100);
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, userId);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
......@@ -436,7 +438,7 @@ describe('audioCall', function () {
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
rendererFlags: 0
}
var AudioRendererOptions = {
......@@ -526,7 +528,7 @@ describe('audioCall', function () {
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
rendererFlags: 0
}
var AudioRendererOptions = {
......
......@@ -23,8 +23,9 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import featureAbility from '@ohos.ability.featureAbility'
import resourceManager from '@ohos.resourceManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
import account from '@ohos.account.osAccount'
describe('audioRenderer_audo2', function () {
describe('audioRenderer_audo2',async function () {
var mediaDir;
let fdRead;
let readpath;
......@@ -53,7 +54,8 @@ describe('audioRenderer_audo2', function () {
const audioManagerRec = audio.getAudioManager();
console.info('AudioFrameworkRecLog: Create AudioManger Object JS Framework');
let userId = await account.getAccountManager().getOsAccountLocalldFromProcess();
console.info('userId :'+userId);
beforeAll(async function () {
await applyPermission();
console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level');
......@@ -131,7 +133,7 @@ describe('audioRenderer_audo2', function () {
}
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, 100);
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, userId);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
......@@ -447,7 +449,7 @@ describe('audioRenderer_audo2', function () {
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
rendererFlags: 0
}
var AudioRendererOptions = {
......@@ -537,7 +539,7 @@ describe('audioRenderer_audo2', function () {
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
rendererFlags: 0
}
var AudioRendererOptions = {
......
......@@ -13,57 +13,58 @@
* limitations under the License.
*/
import { describe, beforeAll,afterAll, it, expect } from 'deccjsunit/index';
import { describe, beforeAll, afterAll, it, expect } from 'deccjsunit/index';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import bundle from '@ohos.bundle';
describe("get_permission", function () {
/**
* @tc.number SUB_DF_GRANT_USER_GRANTED_PERMISSION_0000
* @tc.name grant_user_granted_permission_async_000
* @tc.desc Test grantUserGrantedPermission() interfaces, grant permission.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it("grant_user_granted_permission_async_000", 0, async function (done) {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, 100);
let tokenID = appInfo.accessTokenId;
let atManager = abilityAccessCtrl.createAtManager();
let result1 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MEDIA_LOCATION",1);
let result2 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_MEDIA",1);
let result3 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.WRITE_MEDIA",1);
let result4 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",1);
let result5 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",1);
let result6 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MICROPHONE",1);
let result7 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.ACCESS_NOTIFICATION_POLICY",1);
let result8 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MODIFY_AUDIO_SETTINGS",1);
let isGranted1 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MEDIA_LOCATION");
let isGranted2 = await atManager.verifyAccessToken(tokenID, "ohos.permission.READ_MEDIA");
let isGranted3 = await atManager.verifyAccessToken(tokenID, "ohos.permission.WRITE_MEDIA");
let isGranted4 = await atManager.verifyAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
let isGranted5 = await atManager.verifyAccessToken(tokenID, "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS");
let isGranted6 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MICROPHONE");
let isGranted7 = await atManager.verifyAccessToken(tokenID, "ohos.permission.ACCESS_NOTIFICATION_POLICY");
let isGranted8 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MODIFY_AUDIO_SETTINGS");
console.info("AudioManagerLog: Perm1:"+result1);
console.info("AudioManagerLog: Perm2:"+result2);
console.info("AudioManagerLog: Perm3:"+result3);
console.info("AudioManagerLog: Perm1G:"+isGranted1);
console.info("AudioManagerLog: Perm2G:"+isGranted2);
console.info("AudioManagerLog: Perm3G:"+isGranted3);
console.info("AudioManagerLog: Perm4:"+result4);
console.info("AudioManagerLog: Perm5:"+result5);
console.info("AudioManagerLog: Perm6:"+result6);
console.info("AudioManagerLog: Perm4G:"+isGranted4);
console.info("AudioManagerLog: Perm5G:"+isGranted5);
console.info("AudioManagerLog: Perm6G:"+isGranted6);
console.info("AudioManagerLog: Perm7:"+result7);
console.info("AudioManagerLog: Perm8:"+result8);
console.info("AudioManagerLog: Perm7G:"+isGranted7);
console.info("AudioManagerLog: Perm8G:"+isGranted8);
done();
});
import account from '@ohos.account.osAccount'
describe("get_permission", async function () {
let userId = await account.getAccountManager().getOsAccountLocalldFromProcess();
console.info('userId :' + userId);
/**
* @tc.number SUB_DF_GRANT_USER_GRANTED_PERMISSION_0000
* @tc.name grant_user_granted_permission_async_000
* @tc.desc Test grantUserGrantedPermission() interfaces, grant permission.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it("grant_user_granted_permission_async_000", 0, async function (done) {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, userId);
let tokenID = appInfo.accessTokenId;
let atManager = abilityAccessCtrl.createAtManager();
let result1 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MEDIA_LOCATION", 1);
let result2 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_MEDIA", 1);
let result3 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.WRITE_MEDIA", 1);
let result4 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", 1);
let result5 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS", 1);
let result6 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MICROPHONE", 1);
let result7 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.ACCESS_NOTIFICATION_POLICY", 1);
let result8 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MODIFY_AUDIO_SETTINGS", 1);
let isGranted1 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MEDIA_LOCATION");
let isGranted2 = await atManager.verifyAccessToken(tokenID, "ohos.permission.READ_MEDIA");
let isGranted3 = await atManager.verifyAccessToken(tokenID, "ohos.permission.WRITE_MEDIA");
let isGranted4 = await atManager.verifyAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
let isGranted5 = await atManager.verifyAccessToken(tokenID, "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS");
let isGranted6 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MICROPHONE");
let isGranted7 = await atManager.verifyAccessToken(tokenID, "ohos.permission.ACCESS_NOTIFICATION_POLICY");
let isGranted8 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MODIFY_AUDIO_SETTINGS");
console.info("AudioManagerLog: Perm1:" + result1);
console.info("AudioManagerLog: Perm2:" + result2);
console.info("AudioManagerLog: Perm3:" + result3);
console.info("AudioManagerLog: Perm1G:" + isGranted1);
console.info("AudioManagerLog: Perm2G:" + isGranted2);
console.info("AudioManagerLog: Perm3G:" + isGranted3);
console.info("AudioManagerLog: Perm4:" + result4);
console.info("AudioManagerLog: Perm5:" + result5);
console.info("AudioManagerLog: Perm6:" + result6);
console.info("AudioManagerLog: Perm4G:" + isGranted4);
console.info("AudioManagerLog: Perm5G:" + isGranted5);
console.info("AudioManagerLog: Perm6G:" + isGranted6);
console.info("AudioManagerLog: Perm7:" + result7);
console.info("AudioManagerLog: Perm8:" + result8);
console.info("AudioManagerLog: Perm7G:" + isGranted7);
console.info("AudioManagerLog: Perm8G:" + isGranted8);
done();
});
});
\ No newline at end of file
......@@ -18,8 +18,9 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import account from '@ohos.account.osAccount'
describe('RecorderLocalTestAudioFUNC', function () {
describe('RecorderLocalTestAudioFUNC', async function () {
let audioRecorder = media.createAudioRecorder();
const END_STATE = 0;
const PRE_STATE = 1;
......@@ -48,7 +49,8 @@ describe('RecorderLocalTestAudioFUNC', function () {
uri : 'file:///data/accounts/account_0/appdata/appdata/recorder/test.m4a',
location : { latitude : 1, longitude : 1 },
}
let userId = await account.getAccountManager().getOsAccountLocalldFromProcess();
console.info('userId :' + userId);
function sleep(time) {
for(let t = Date.now();Date.now() - t <= time;);
}
......@@ -80,7 +82,7 @@ describe('RecorderLocalTestAudioFUNC', function () {
})
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiorecorder', 0, 100);
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiorecorder', 0, userId);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
......
......@@ -19,8 +19,9 @@ import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'
import bundle from '@ohos.bundle'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import account from '@ohos.account.osAccount'
describe('VideoRecorderFuncCallbackTest', function () {
describe('VideoRecorderFuncCallbackTest', async function () {
const RECORDER_TIME = 3000;
const PAUSE_TIME = 1000;
const END_EVENT = 'end';
......@@ -90,7 +91,8 @@ describe('VideoRecorderFuncCallbackTest', function () {
function sleep(time) {
for(let t = Date.now();Date.now() - t <= time;);
}
let userId = await account.getAccountManager().getOsAccountLocalldFromProcess();
console.info('userId :' + userId);
beforeAll(async function () {
await initCamera();
await applyPermission();
......@@ -112,7 +114,7 @@ describe('VideoRecorderFuncCallbackTest', function () {
})
async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.video.videorecorder', 0, 100);
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.video.videorecorder', 0, userId);
let atManager = abilityAccessCtrl.createAtManager();
if (atManager != null) {
let tokenID = appInfo.accessTokenId;
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import image from '@ohos.multimedia.image';
import featureAbility from '@ohos.ability.featureAbility';
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility';
import fileio from '@ohos.fileio';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility'
import fileio from '@ohos.fileio';
import {describe, it, expect} from 'deccjsunit/index';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility';
import fileio from '@ohos.fileio';
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
......
......@@ -13,28 +13,30 @@
* limitations under the License.
*/
import { describe, beforeAll,afterAll, it, expect } from 'deccjsunit/index';
import { describe, beforeAll, afterAll, it, expect } from 'deccjsunit/index';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import bundle from '@ohos.bundle';
import account from '@ohos.account.osAccount'
describe("get_permission", function () {
/**
* @tc.number SUB_DF_GRANT_USER_GRANTED_PERMISSION_0000
* @tc.name grant_user_granted_permission_async_000
* @tc.desc Test grantUserGrantedPermission() interfaces, grant permission.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
describe("get_permission", async function () {
let userId = await account.getAccountManager().getOsAccountLocalldFromProcess();
console.info('userId :' + userId);
/**
* @tc.number SUB_DF_GRANT_USER_GRANTED_PERMISSION_0000
* @tc.name grant_user_granted_permission_async_000
* @tc.desc Test grantUserGrantedPermission() interfaces, grant permission.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it("grant_user_granted_permission_async_000", 0, async function (done) {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.mediaLibrary', 0, 100);
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.mediaLibrary', 0, userId);
let tokenID = appInfo.accessTokenId;
let atManager = abilityAccessCtrl.createAtManager();
let result1 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MEDIA_LOCATION",1);
let result2 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_MEDIA",1);
let result3 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.WRITE_MEDIA",1);
let result1 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MEDIA_LOCATION", 1);
let result2 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_MEDIA", 1);
let result3 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.WRITE_MEDIA", 1);
let isGranted1 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MEDIA_LOCATION");
let isGranted2 = await atManager.verifyAccessToken(tokenID, "ohos.permission.READ_MEDIA");
let isGranted3 = await atManager.verifyAccessToken(tokenID, "ohos.permission.WRITE_MEDIA");
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import mediaLibrary from '@ohos.multimedia.medialibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import featureAbility from '@ohos.ability.featureAbility';
import fileio from '@ohos.fileio';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册