Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8af4e5c7
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8af4e5c7
编写于
8月 09, 2022
作者:
L
lwx1121892
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<audio修改>
Signed-off-by:
N
lwx1121892
<
liuxueqi3@huawei.com
>
上级
b3bcad2e
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
12 addition
and
162 deletion
+12
-162
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js
..._standard/audioManager/src/main/js/test/AudioCall.test.js
+0
-39
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturerChangeInfo.test.js
...oManager/src/main/js/test/AudioCapturerChangeInfo.test.js
+0
-3
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioEventManagement.test.js
...udioManager/src/main/js/test/AudioEventManagement.test.js
+0
-12
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js
...ndard/audioManager/src/main/js/test/AudioRenderer.test.js
+0
-32
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRendererChangeInfo.test.js
...oManager/src/main/js/test/AudioRendererChangeInfo.test.js
+0
-36
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioVOIP.test.js
..._standard/audioManager/src/main/js/test/AudioVOIP.test.js
+0
-37
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/getPermission.test.js
...ndard/audioManager/src/main/js/test/getPermission.test.js
+12
-3
未找到文件。
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js
浏览文件 @
8af4e5c7
...
...
@@ -16,10 +16,6 @@
import
audio
from
'
@ohos.multimedia.audio
'
;
import
fileio
from
'
@ohos.fileio
'
;
import
ability_featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
app
from
'
@system.app
'
;
import
bundle
from
'
@ohos.bundle
'
;
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
resourceManager
from
'
@ohos.resourceManager
'
;
...
...
@@ -36,12 +32,7 @@ describe('audioCall', function () {
const
audioManager
=
audio
.
getAudioManager
();
console
.
info
(
'
AudioFrameworkRenderLog: Create AudioManger Object JS Framework
'
);
const
audioManagerRec
=
audio
.
getAudioManager
();
console
.
info
(
'
AudioFrameworkRecLog: Create AudioManger Object JS Framework
'
);
beforeAll
(
async
function
()
{
await
applyPermission
();
console
.
info
(
'
AudioFrameworkTest: beforeAll: Prerequisites at the test suite level
'
);
//mediaDir = '/data/storage/el2/base/haps/entry/cache';
})
...
...
@@ -106,36 +97,6 @@ describe('audioCall', function () {
});
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.multimedia.audio.audiomanager
'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case accessTokenID is
'
+
tokenID
);
let
permissionName1
=
'
ohos.permission.MEDIA_LOCATION
'
;
let
permissionName2
=
'
ohos.permission.READ_MEDIA
'
;
let
permissionName3
=
'
ohos.permission.WRITE_MEDIA
'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
}
else
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case apply permission failed, createAtManager failed
'
);
}
}
async
function
playbackPromise
(
AudioRendererOptions
,
pathName
,
AudioScene
)
{
resultFlagRen
=
'
new
'
;
console
.
info
(
'
AudioFrameworkRenderLog: Promise : Audio Playback Function
'
);
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturerChangeInfo.test.js
浏览文件 @
8af4e5c7
...
...
@@ -14,12 +14,9 @@
*/
import
audio
from
'
@ohos.multimedia.audio
'
;
import
fileio
from
'
@ohos.fileio
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
describe
(
'
audioCapturerChange
'
,
function
()
{
var
audioCapCallBack
;
var
audioStreamManager
;
var
audioStreamManagerCB
;
var
dirPath
;
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioEventManagement.test.js
浏览文件 @
8af4e5c7
...
...
@@ -14,8 +14,6 @@
*/
import
audio
from
'
@ohos.multimedia.audio
'
;
import
fileio
from
'
@ohos.fileio
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
describe
(
'
audioEM
'
,
function
()
{
...
...
@@ -23,16 +21,6 @@ describe('audioEM', function () {
const
audioManager
=
audio
.
getAudioManager
();
var
deviceRoleValue
=
null
;
var
deviceTypeValue
=
null
;
var
volErrorMesg
=
'
Error, Operation not supported or Failed
'
;
var
audioMedia
=
3
;
var
audioRingtone
=
2
;
var
minVol
=
0
;
var
maxVol
=
15
;
var
lowVol
=
5
;
var
highVol
=
14
;
var
outOfRangeVol
=
28
;
var
longValue
=
'
28374837458743875804735081439085918459801437584738967509184509813904850914375904790589104801843
'
;
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js
浏览文件 @
8af4e5c7
...
...
@@ -15,8 +15,6 @@
import
audio
from
'
@ohos.multimedia.audio
'
;
import
fileio
from
'
@ohos.fileio
'
;
import
bundle
from
'
@ohos.bundle
'
;
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
;
import
resourceManager
from
'
@ohos.resourceManager
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
...
...
@@ -31,7 +29,6 @@ describe('audioRenderer', function () {
let
filePath
;
beforeAll
(
async
function
()
{
await
applyPermission
();
console
.
info
(
'
AudioFrameworkRenderLog: beforeAll: Prerequisites at the test suite level
'
);
})
...
...
@@ -84,35 +81,6 @@ describe('audioRenderer', function () {
});
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.multimedia.audio.audiomanager
'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case accessTokenID is
'
+
tokenID
);
let
permissionName1
=
'
ohos.permission.MEDIA_LOCATION
'
;
let
permissionName2
=
'
ohos.permission.READ_MEDIA
'
;
let
permissionName3
=
'
ohos.permission.WRITE_MEDIA
'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
}
else
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case apply permission failed, createAtManager failed
'
);
}
}
async
function
playbackPromise
(
AudioRendererOptions
,
pathName
,
AudioScene
)
{
var
resultFlag
=
'
new
'
;
console
.
info
(
'
AudioFrameworkRenderLog: Promise : Audio Playback Function
'
);
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRendererChangeInfo.test.js
浏览文件 @
8af4e5c7
...
...
@@ -14,12 +14,6 @@
*/
import
audio
from
'
@ohos.multimedia.audio
'
;
import
fileio
from
'
@ohos.fileio
'
;
import
app
from
'
@system.app
'
;
import
bundle
from
'
@ohos.bundle
'
;
import
abilityAccessCtrl
from
'
@ohos.abilityAccessCtrl
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
ability_featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
resourceManager
from
'
@ohos.resourceManager
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
...
...
@@ -28,13 +22,11 @@ describe('audioRendererChange', function () {
var
audioStreamManager
;
var
audioStreamManagerCB
;
let
fdRead
;
let
readpath
;
var
Tag
=
"
AFRenLog :
"
;
const
audioManager
=
audio
.
getAudioManager
();
console
.
info
(
Tag
+
'
Create AudioManger Object JS Framework
'
);
beforeAll
(
async
function
()
{
await
applyPermission
();
await
audioManager
.
getStreamManager
().
then
(
async
function
(
data
)
{
audioStreamManager
=
data
;
console
.
info
(
Tag
+
'
Get AudioStream Manager : Success
'
);
...
...
@@ -106,34 +98,6 @@ describe('audioRendererChange', function () {
}
})
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.multimedia.audio.audiomanager
'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
Tag
+
'
[permission] case accessTokenID is
'
+
tokenID
);
let
permissionName1
=
'
ohos.permission.MEDIA_LOCATION
'
;
let
permissionName2
=
'
ohos.permission.READ_MEDIA
'
;
let
permissionName3
=
'
ohos.permission.WRITE_MEDIA
'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
).
then
((
result
)
=>
{
console
.
info
(
Tag
+
'
[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
).
then
((
result
)
=>
{
console
.
info
(
Tag
+
'
[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
).
then
((
result
)
=>
{
console
.
info
(
Tag
+
'
[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
Tag
+
'
[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
}
else
{
console
.
info
(
Tag
+
'
[permission] case apply permission failed, createAtManager failed
'
);
}
}
/* *
* @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_001
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioVOIP.test.js
浏览文件 @
8af4e5c7
...
...
@@ -16,10 +16,6 @@
import
audio
from
'
@ohos.multimedia.audio
'
;
import
fileio
from
'
@ohos.fileio
'
;
import
ability_featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
app
from
'
@system.app
'
;
import
bundle
from
'
@ohos.bundle
'
;
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
'
;
...
...
@@ -33,11 +29,7 @@ describe('audioVoip', function () {
const
audioManager
=
audio
.
getAudioManager
();
console
.
info
(
'
AudioFrameworkRenderLog: Create AudioManger Object JS Framework
'
);
const
audioManagerRec
=
audio
.
getAudioManager
();
console
.
info
(
'
AudioFrameworkRecLog: Create AudioManger Object JS Framework
'
);
beforeAll
(
async
function
()
{
await
applyPermission
();
console
.
info
(
'
AudioFrameworkTest: beforeAll: Prerequisites at the test suite level
'
);
//mediaDir = '/data/storage/el2/base/haps/entry/cache';
})
...
...
@@ -100,35 +92,6 @@ describe('audioVoip', function () {
});
}
async
function
applyPermission
()
{
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.multimedia.audio.audiomanager
'
,
0
,
100
);
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
if
(
atManager
!=
null
)
{
let
tokenID
=
appInfo
.
accessTokenId
;
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case accessTokenID is
'
+
tokenID
);
let
permissionName1
=
'
ohos.permission.MEDIA_LOCATION
'
;
let
permissionName2
=
'
ohos.permission.READ_MEDIA
'
;
let
permissionName3
=
'
ohos.permission.WRITE_MEDIA
'
;
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName1
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName2
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
permissionName3
,
1
).
then
((
result
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission success :
'
+
result
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case grantUserGrantedPermission failed :
'
+
err
);
});
}
else
{
console
.
info
(
'
AudioFrameworkRenderLog:[permission] case apply permission failed, createAtManager failed
'
);
}
}
async
function
playbackPromise
(
AudioRendererOptions
,
pathName
,
AudioScene
)
{
var
resultFlag
=
'
new
'
;
console
.
info
(
'
AudioFrameworkRenderLog: Promise : Audio Playback Function
'
);
...
...
multimedia/audio/audio_js_standard/audioManager/src/main/js/test/getPermission.test.js
浏览文件 @
8af4e5c7
...
...
@@ -16,9 +16,17 @@
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
()
{
let
userId
;
async
function
getUserId
()
{
await
account
.
getAccountManager
().
getOsAccountLocalIdFromProcess
().
then
(
account
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess userid ==========
"
+
account
);
userId
=
account
;
}).
catch
(
err
=>
{
console
.
info
(
"
getOsAccountLocalIdFromProcess err ==========
"
+
JSON
.
stringify
(
err
));
})
}
/**
* @tc.number SUB_DF_GRANT_USER_GRANTED_PERMISSION_0000
* @tc.name grant_user_granted_permission_async_000
...
...
@@ -29,7 +37,8 @@ describe("get_permission", function () {
* @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
);
await
getUserId
();
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
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录