Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0f6a939d
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看板
提交
0f6a939d
编写于
1月 31, 2023
作者:
L
lwx1121892
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
<引入方法修改>
Signed-off-by:
N
lwx1121892
<
liuxueqi3@huawei.com
>
上级
13d4e6b0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
16 addition
and
149 deletion
+16
-149
multimedia/media/media_js_standard/MediaTestBase.js
multimedia/media/media_js_standard/MediaTestBase.js
+12
-1
multimedia/media/media_js_standard/MediaTestBaseAV.js
multimedia/media/media_js_standard/MediaTestBaseAV.js
+0
-144
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerHlsFuncTest.test.js
...layer/entry/src/main/ets/test/AVPlayerHlsFuncTest.test.js
+1
-1
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerHttpCompatibilityTest.test.ets
.../src/main/ets/test/AVPlayerHttpCompatibilityTest.test.ets
+1
-1
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerHttpSeekTest.test.ets
...yer/entry/src/main/ets/test/AVPlayerHttpSeekTest.test.ets
+1
-1
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerLocalTest.test.js
...vPlayer/entry/src/main/ets/test/AVPlayerLocalTest.test.js
+1
-1
未找到文件。
multimedia/media/media_js_standard/MediaTestBase.js
浏览文件 @
0f6a939d
...
...
@@ -112,6 +112,12 @@ export function printError(error, done) {
done
();
}
export
function
assertErr
(
opera
,
err
,
done
)
{
console
.
info
(
`case
${
opera
}
error,errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
}
// callback function for promise call back error
export
function
failureCallback
(
error
)
{
expect
().
assertFail
();
...
...
@@ -130,7 +136,12 @@ export function checkDescription(actualDescription, descriptionKey, descriptionV
console
.
info
(
'
case key is
'
+
descriptionKey
[
i
]);
console
.
info
(
'
case actual value is
'
+
property
);
console
.
info
(
'
case hope value is
'
+
descriptionValue
[
i
]);
expect
(
property
).
assertEqual
(
descriptionValue
[
i
]);
if
(
descriptionKey
[
i
]
==
'
codec_mime
'
)
{
expect
(
property
).
assertEqual
(
CODECMIMEVALUE
[
descriptionValue
[
i
]]);
}
else
{
expect
(
property
).
assertEqual
(
descriptionValue
[
i
]);
}
}
}
...
...
multimedia/media/media_js_standard/MediaTestBaseAV.js
已删除
100644 → 0
浏览文件 @
13d4e6b0
/*
* 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
featureAbility
from
'
@ohos.ability.featureAbility
'
import
{
UiDriver
,
BY
,
PointerMatrix
}
from
'
@ohos.uitest
'
const
CODECMIMEVALUE
=
[
'
video/avc
'
,
'
audio/mp4a-latm
'
,
'
audio/mpeg
'
]
export
async
function
getPermission
(
permissionNames
)
{
featureAbility
.
getContext
().
requestPermissionsFromUser
(
permissionNames
,
0
,
async
(
data
)
=>
{
console
.
info
(
"
case request success
"
+
JSON
.
stringify
(
data
));
})
}
export
async
function
driveFn
(
num
)
{
console
.
info
(
`case come in driveFn 111`
);
let
driver
=
UiDriver
.
create
();
console
.
info
(
`case come in driveFn 222`
);
console
.
info
(
`driver is
${
JSON
.
stringify
(
driver
)}
`
);
await
msleepAsync
(
2000
);
console
.
info
(
`UiDriver start`
);
for
(
let
i
=
0
;
i
<
num
;
i
++
)
{
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'
允许
'
));
console
.
info
(
`button is
${
JSON
.
stringify
(
button
)}
`
);
await
msleepAsync
(
2000
);
await
button
.
click
();
}
await
msleepAsync
(
2000
);
}
// File operation
export
async
function
getFileDescriptor
(
fileName
)
{
let
fileDescriptor
=
undefined
;
let
mgr
=
globalThis
.
abilityContext
.
resourceManager
await
mgr
.
getRawFileDescriptor
(
fileName
).
then
(
value
=>
{
fileDescriptor
=
{
fd
:
value
.
fd
,
offset
:
value
.
offset
,
length
:
value
.
length
};
console
.
log
(
'
case getRawFileDescriptor success fileName:
'
+
fileName
);
}).
catch
(
error
=>
{
console
.
log
(
'
case getRawFileDescriptor err:
'
+
error
);
});
return
fileDescriptor
;
}
export
async
function
closeFileDescriptor
(
fileName
)
{
await
globalThis
.
abilityContext
.
resourceManager
.
closeRawFileDescriptor
(
fileName
).
then
(()
=>
{
console
.
log
(
'
case closeRawFileDescriptor
'
+
fileName
);
}).
catch
(
error
=>
{
console
.
log
(
'
case closeRawFileDescriptor err:
'
+
error
);
});
}
// wait asynchronously
export
async
function
msleepAsync
(
ms
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
ms
));
}
export
function
assertErr
(
opera
,
err
,
done
)
{
console
.
info
(
`case
${
opera
}
error,errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
}
// callback function for promise call back error
export
function
failureCallback
(
error
)
{
expect
().
assertFail
();
console
.
info
(
`case failureCallback promise called,errMessage is
${
error
.
message
}
`
);
}
// callback function for promise catch error
export
function
catchCallback
(
error
)
{
expect
().
assertFail
();
console
.
info
(
`case error catch called,errMessage is
${
error
.
message
}
`
);
}
export
function
checkDescription
(
actualDescription
,
descriptionKey
,
descriptionValue
)
{
for
(
let
i
=
0
;
i
<
descriptionKey
.
length
;
i
++
)
{
let
property
=
actualDescription
[
descriptionKey
[
i
]];
console
.
info
(
'
case key is
'
+
descriptionKey
[
i
]);
console
.
info
(
'
case actual value is
'
+
property
);
console
.
info
(
'
case hope value is
'
+
descriptionValue
[
i
]);
if
(
descriptionKey
[
i
]
==
'
codec_mime
'
)
{
expect
(
property
).
assertEqual
(
CODECMIMEVALUE
[
descriptionValue
[
i
]]);
}
else
{
expect
(
property
).
assertEqual
(
descriptionValue
[
i
]);
}
}
}
export
async
function
getFd
(
pathName
,
fileType
)
{
let
fdObject
=
{
fileAsset
:
null
,
fdNumber
:
null
}
let
displayName
=
pathName
;
console
.
info
(
'
[mediaLibrary] fileType is
'
+
fileType
);
const
mediaTest
=
mediaLibrary
.
getMediaLibrary
(
globalThis
.
abilityContext
);
let
fileKeyObj
=
mediaLibrary
.
FileKey
;
let
mediaType
;
let
publicPath
;
if
(
fileType
==
'
audio
'
)
{
mediaType
=
mediaLibrary
.
MediaType
.
AUDIO
;
publicPath
=
await
mediaTest
.
getPublicDirectory
(
mediaLibrary
.
DirectoryType
.
DIR_AUDIO
);
}
else
{
mediaType
=
mediaLibrary
.
MediaType
.
VIDEO
;
publicPath
=
await
mediaTest
.
getPublicDirectory
(
mediaLibrary
.
DirectoryType
.
DIR_VIDEO
);
}
console
.
info
(
'
[mediaLibrary] publicPath is
'
+
publicPath
);
let
dataUri
=
await
mediaTest
.
createAsset
(
mediaType
,
displayName
,
publicPath
);
if
(
dataUri
!=
undefined
)
{
let
args
=
dataUri
.
id
.
toString
();
let
fetchOp
=
{
selections
:
fileKeyObj
.
ID
+
"
=?
"
,
selectionArgs
:
[
args
],
}
let
fetchFileResult
=
await
mediaTest
.
getFileAssets
(
fetchOp
);
fdObject
.
fileAsset
=
await
fetchFileResult
.
getAllObject
();
fdObject
.
fdNumber
=
await
fdObject
.
fileAsset
[
0
].
open
(
'
rw
'
);
console
.
info
(
'
case getFd number is:
'
+
fdObject
.
fdNumber
);
}
return
fdObject
;
}
export
async
function
closeFd
(
fileAsset
,
fdNumber
)
{
if
(
fileAsset
!=
null
)
{
await
fileAsset
[
0
].
close
(
fdNumber
).
then
(()
=>
{
console
.
info
(
'
[mediaLibrary] case close fd success
'
);
}).
catch
((
err
)
=>
{
console
.
info
(
'
[mediaLibrary] case close fd failed
'
);
});
}
else
{
console
.
info
(
'
[mediaLibrary] case fileAsset is null
'
);
}
}
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerHlsFuncTest.test.js
浏览文件 @
0f6a939d
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import
media
from
'
@ohos.multimedia.media
'
import
*
as
mediaTestBase
from
'
../../../../../../MediaTestBase
AV
'
;
import
*
as
mediaTestBase
from
'
../../../../../../MediaTestBase
'
;
import
*
as
AVPlayerTestBase
from
'
../../../../../../AVPlayerTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
...
...
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerHttpCompatibilityTest.test.ets
浏览文件 @
0f6a939d
...
...
@@ -14,7 +14,7 @@
*/
import {testAVPlayerFun} from '../../../../../../AVPlayerTestBase.js';
import * as mediaTestBase from '../../../../../../MediaTestBase
AV
';
import * as mediaTestBase from '../../../../../../MediaTestBase';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
export default function AVPlayerHttpCompatibilityTest() {
...
...
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerHttpSeekTest.test.ets
浏览文件 @
0f6a939d
...
...
@@ -14,7 +14,7 @@
*/
import {testAVPlayerSeek} from '../../../../../../AVPlayerTestBase.js';
import * as mediaTestBase from '../../../../../../MediaTestBase
AV
';
import * as mediaTestBase from '../../../../../../MediaTestBase';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
export default function AVPlayerHttpSeekTest() {
...
...
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerLocalTest.test.js
浏览文件 @
0f6a939d
...
...
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import
*
as
mediaTestBase
from
'
../../../../../../MediaTestBase
AV
'
;
import
*
as
mediaTestBase
from
'
../../../../../../MediaTestBase
'
;
import
media
from
'
@ohos.multimedia.media
'
import
audio
from
'
@ohos.multimedia.audio
'
;
import
{
testAVPlayerFun
,
AV_PLAYER_STATE
,
setSource
}
from
'
../../../../../../AVPlayerTestBase.js
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录