Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4423bbd2
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看板
提交
4423bbd2
编写于
12月 17, 2021
作者:
O
openharmony_ci
提交者:
Gitee
12月 17, 2021
浏览文件
操作
浏览文件
下载
差异文件
!1387 优化compileruntime测试套
Merge pull request !1387 from clearme777/OpenHarmony-3.0-LTS
上级
c7f41830
3e4f0ce2
变更
67
显示空白变更内容
内联
并排
Showing
67 changed file
with
2615 addition
and
2698 deletion
+2615
-2698
compileruntime/process_lib_standard/src/main/config.json
compileruntime/process_lib_standard/src/main/config.json
+6
-1
compileruntime/process_lib_standard/src/main/java/com/example/childprocess/MainAbility.java
...d/src/main/java/com/example/childprocess/MainAbility.java
+0
-31
compileruntime/process_lib_standard/src/main/java/com/example/childprocess/MyApplication.java
...src/main/java/com/example/childprocess/MyApplication.java
+0
-25
compileruntime/process_lib_standard/src/main/js/default/app.js
...leruntime/process_lib_standard/src/main/js/default/app.js
+3
-2
compileruntime/process_lib_standard/src/main/js/default/pages/index/index.css
...ss_lib_standard/src/main/js/default/pages/index/index.css
+1
-36
compileruntime/process_lib_standard/src/main/js/default/pages/index/index.hml
...ss_lib_standard/src/main/js/default/pages/index/index.hml
+2
-3
compileruntime/process_lib_standard/src/main/js/default/pages/index/index.js
...ess_lib_standard/src/main/js/default/pages/index/index.js
+5
-5
compileruntime/process_lib_standard/src/main/js/default/test/List.test.js
...rocess_lib_standard/src/main/js/default/test/List.test.js
+0
-1
compileruntime/process_lib_standard/src/main/js/default/test/Process.test.js
...ess_lib_standard/src/main/js/default/test/Process.test.js
+328
-638
compileruntime/process_lib_standard/src/main/js/test/ExampleJsunit.test.js
...ocess_lib_standard/src/main/js/test/ExampleJsunit.test.js
+0
-24
compileruntime/process_lib_standard/src/main/resources/base/element/string.json
..._lib_standard/src/main/resources/base/element/string.json
+3
-3
compileruntime/process_lib_standard/src/main/resources/base/media/icon.png
...ocess_lib_standard/src/main/resources/base/media/icon.png
+0
-0
compileruntime/process_lib_standard/src/ohosTest/js/default/app.js
...ntime/process_lib_standard/src/ohosTest/js/default/app.js
+0
-22
compileruntime/process_lib_standard/src/ohosTest/js/default/i18n/en-US.json
...cess_lib_standard/src/ohosTest/js/default/i18n/en-US.json
+0
-8
compileruntime/process_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json
...cess_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json
+0
-8
compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.css
...ib_standard/src/ohosTest/js/default/pages/index/index.css
+0
-9
compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.hml
...ib_standard/src/ohosTest/js/default/pages/index/index.hml
+0
-5
compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.js
...lib_standard/src/ohosTest/js/default/pages/index/index.js
+0
-55
compileruntime/process_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js
...s_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js
+0
-25
compileruntime/process_lib_standard/src/ohosTest/js/test/List.test.js
...me/process_lib_standard/src/ohosTest/js/test/List.test.js
+0
-16
compileruntime/process_lib_standard/src/ohosTest/resources/base/element/string.json
..._standard/src/ohosTest/resources/base/element/string.json
+0
-12
compileruntime/url_lib_standard/src/main/config.json
compileruntime/url_lib_standard/src/main/config.json
+6
-1
compileruntime/url_lib_standard/src/main/java/com/example/url/MainAbility.java
...b_standard/src/main/java/com/example/url/MainAbility.java
+0
-30
compileruntime/url_lib_standard/src/main/java/com/example/url/MyApplication.java
...standard/src/main/java/com/example/url/MyApplication.java
+0
-24
compileruntime/url_lib_standard/src/main/js/default/app.js
compileruntime/url_lib_standard/src/main/js/default/app.js
+3
-2
compileruntime/url_lib_standard/src/main/js/default/pages/index/index.css
...rl_lib_standard/src/main/js/default/pages/index/index.css
+1
-36
compileruntime/url_lib_standard/src/main/js/default/pages/index/index.js
...url_lib_standard/src/main/js/default/pages/index/index.js
+3
-2
compileruntime/url_lib_standard/src/main/js/default/test/List.test.js
...me/url_lib_standard/src/main/js/default/test/List.test.js
+0
-1
compileruntime/url_lib_standard/src/main/js/default/test/url.test.js
...ime/url_lib_standard/src/main/js/default/test/url.test.js
+2087
-0
compileruntime/url_lib_standard/src/main/js/test/ExampleJsunit.test.js
...e/url_lib_standard/src/main/js/test/ExampleJsunit.test.js
+0
-23
compileruntime/url_lib_standard/src/main/js/test/url.test.js
compileruntime/url_lib_standard/src/main/js/test/url.test.js
+0
-564
compileruntime/url_lib_standard/src/main/resources/base/element/string.json
..._lib_standard/src/main/resources/base/element/string.json
+3
-3
compileruntime/url_lib_standard/src/main/resources/base/media/icon.png
...e/url_lib_standard/src/main/resources/base/media/icon.png
+0
-0
compileruntime/url_lib_standard/src/ohosTest/js/default/app.js
...leruntime/url_lib_standard/src/ohosTest/js/default/app.js
+0
-22
compileruntime/url_lib_standard/src/ohosTest/js/default/i18n/en-US.json
.../url_lib_standard/src/ohosTest/js/default/i18n/en-US.json
+0
-8
compileruntime/url_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json
.../url_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json
+0
-8
compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.css
...ib_standard/src/ohosTest/js/default/pages/index/index.css
+0
-9
compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.hml
...ib_standard/src/ohosTest/js/default/pages/index/index.hml
+0
-5
compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.js
...lib_standard/src/ohosTest/js/default/pages/index/index.js
+0
-55
compileruntime/url_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js
...l_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js
+0
-25
compileruntime/url_lib_standard/src/ohosTest/js/test/List.test.js
...untime/url_lib_standard/src/ohosTest/js/test/List.test.js
+0
-16
compileruntime/url_lib_standard/src/ohosTest/resources/base/element/string.json
..._standard/src/ohosTest/resources/base/element/string.json
+0
-12
compileruntime/util_lib_standard/src/main/config.json
compileruntime/util_lib_standard/src/main/config.json
+6
-1
compileruntime/util_lib_standard/src/main/java/com/example/childprocess/MainAbility.java
...d/src/main/java/com/example/childprocess/MainAbility.java
+0
-31
compileruntime/util_lib_standard/src/main/java/com/example/childprocess/MyApplication.java
...src/main/java/com/example/childprocess/MyApplication.java
+0
-25
compileruntime/util_lib_standard/src/main/java/com/example/url/MainAbility.java
...b_standard/src/main/java/com/example/url/MainAbility.java
+0
-30
compileruntime/util_lib_standard/src/main/java/com/example/url/MyApplication.java
...standard/src/main/java/com/example/url/MyApplication.java
+0
-24
compileruntime/util_lib_standard/src/main/js/default/app.js
compileruntime/util_lib_standard/src/main/js/default/app.js
+3
-2
compileruntime/util_lib_standard/src/main/js/default/pages/index/index.css
...il_lib_standard/src/main/js/default/pages/index/index.css
+1
-36
compileruntime/util_lib_standard/src/main/js/default/pages/index/index.hml
...il_lib_standard/src/main/js/default/pages/index/index.hml
+2
-3
compileruntime/util_lib_standard/src/main/js/default/pages/index/index.js
...til_lib_standard/src/main/js/default/pages/index/index.js
+3
-3
compileruntime/util_lib_standard/src/main/js/default/test/List.test.js
...e/util_lib_standard/src/main/js/default/test/List.test.js
+0
-1
compileruntime/util_lib_standard/src/main/js/default/test/TextCodr.test.js
...il_lib_standard/src/main/js/default/test/TextCodr.test.js
+141
-579
compileruntime/util_lib_standard/src/main/js/test/ExampleJsunit.test.js
.../util_lib_standard/src/main/js/test/ExampleJsunit.test.js
+0
-24
compileruntime/util_lib_standard/src/main/resources/base/element/string.json
..._lib_standard/src/main/resources/base/element/string.json
+3
-3
compileruntime/util_lib_standard/src/main/resources/base/media/icon.png
.../util_lib_standard/src/main/resources/base/media/icon.png
+0
-0
compileruntime/util_lib_standard/src/ohosTest/js/default/app.js
...eruntime/util_lib_standard/src/ohosTest/js/default/app.js
+0
-22
compileruntime/util_lib_standard/src/ohosTest/js/default/i18n/en-US.json
...util_lib_standard/src/ohosTest/js/default/i18n/en-US.json
+0
-8
compileruntime/util_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json
...util_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json
+0
-8
compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.css
...ib_standard/src/ohosTest/js/default/pages/index/index.css
+0
-9
compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.hml
...ib_standard/src/ohosTest/js/default/pages/index/index.hml
+0
-5
compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.js
...lib_standard/src/ohosTest/js/default/pages/index/index.js
+0
-55
compileruntime/util_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js
...l_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js
+0
-25
compileruntime/util_lib_standard/src/ohosTest/js/test/List.test.js
...ntime/util_lib_standard/src/ohosTest/js/test/List.test.js
+0
-16
compileruntime/util_lib_standard/src/ohosTest/resources/base/element/string.json
..._standard/src/ohosTest/resources/base/element/string.json
+0
-12
compileruntime/worker_lib_standard/src/main/config.json
compileruntime/worker_lib_standard/src/main/config.json
+4
-0
compileruntime/worker_lib_standard/src/main/js/test/Worker.test.js
...ntime/worker_lib_standard/src/main/js/test/Worker.test.js
+1
-1
未找到文件。
compileruntime/process_lib_standard/src/main/config.json
浏览文件 @
4423bbd2
...
...
@@ -5,6 +5,10 @@
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
}
},
"deviceConfig"
:
{},
...
...
@@ -23,6 +27,7 @@
},
"abilities"
:
[
{
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
...
...
@@ -49,7 +54,7 @@
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
tru
e
"autoDesignWidth"
:
fals
e
}
}
]
...
...
compileruntime/process_lib_standard/src/main/java/com/example/childprocess/MainAbility.java
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
package
com.example.childprocess
;
import
ohos.ace.ability.AceAbility
;
import
ohos.aafwk.content.Intent
;
public
class
MainAbility
extends
AceAbility
{
@Override
public
void
onStart
(
Intent
intent
)
{
super
.
onStart
(
intent
);
}
@Override
public
void
onStop
()
{
super
.
onStop
();
}
}
compileruntime/process_lib_standard/src/main/java/com/example/childprocess/MyApplication.java
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
package
com.example.childprocess
;
import
ohos.aafwk.ability.AbilityPackage
;
public
class
MyApplication
extends
AbilityPackage
{
@Override
public
void
onInitialize
()
{
super
.
onInitialize
();
}
}
compileruntime/process_lib_standard/src/main/js/default/app.js
浏览文件 @
4423bbd2
/*
* Copyright (C) 2021 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 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,
* 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
'
);
...
...
compileruntime/process_lib_standard/src/main/js/default/pages/index/index.css
浏览文件 @
4423bbd2
...
...
@@ -5,40 +5,5 @@
}
.title
{
font-size
:
40px
;
color
:
#000000
;
opacity
:
0.9
;
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
@media
screen
and
(
device-type
:
wearable
)
{
.title
{
font-size
:
28px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
tv
)
{
.container
{
background-image
:
url("../../common/images/Wallpaper.png")
;
background-size
:
cover
;
background-repeat
:
no-repeat
;
background-position
:
center
;
}
.title
{
font-size
:
100px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
compileruntime/process_lib_standard/src/main/js/default/pages/index/index.hml
浏览文件 @
4423bbd2
<div class="container"
onswipe="touchMove"
>
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{
title
}}
{{ $t('strings.hello') }} {{
title
}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
\ No newline at end of file
compileruntime/process_lib_standard/src/main/js/default/pages/index/index.js
浏览文件 @
4423bbd2
/*
* Copyright (C) 2021 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 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,
* 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
'
import
app
from
'
@system.app
'
import
device
from
'
@system.device
'
import
router
from
'
@system.router
'
import
{
Core
}
from
'
deccjsunit/lite
'
import
{
Core
,
Constant
,
ExpectExtend
,
ReportExtend
,
InstrumentLog
}
from
'
deccjsunit/index
'
export
default
{
data
:
{
...
...
@@ -30,7 +30,7 @@ export default {
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
core
.
init
()
require
(
'
../../
../
test/List.test
'
)
require
(
'
../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
...
...
compileruntime/process_lib_standard/src/main/js/test/List.test.js
→
compileruntime/process_lib_standard/src/main/js/
default/
test/List.test.js
浏览文件 @
4423bbd2
...
...
@@ -13,5 +13,4 @@
* limitations under the License.
*/
require
(
'
./ExampleJsunit.test.js
'
)
require
(
'
./Process.test.js
'
)
\ No newline at end of file
compileruntime/process_lib_standard/src/main/js/test/Process.test.js
→
compileruntime/process_lib_standard/src/main/js/
default/
test/Process.test.js
浏览文件 @
4423bbd2
...
...
@@ -23,23 +23,16 @@ describe('ChildProcessTest', function () {
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testRunCmd001
'
,
0
,
async
function
(
done
)
{
console
.
log
(
"
test start +++
"
)
it
(
'
testRunCmd001
'
,
0
,
async
function
()
{
var
child
=
process
.
runCmd
(
'
echo abc
'
)
console
.
log
(
"
test start +++ 11111
"
)
child
.
wait
()
console
.
log
(
"
test start +++ 2222
"
)
var
res
=
new
Uint8Array
([
97
,
98
,
99
,
10
,
0
])
console
.
log
(
"
test start +++ 333
"
)
await
child
.
getOutput
().
then
(
val
=>
{
var
array
=
new
Uint8Array
([
97
,
98
,
99
,
10
,
0
])
child
.
getOutput
().
then
(
val
=>
{
console
.
log
(
"
test_runCmd_00
"
+
val
)
for
(
var
i
=
0
;
i
<
res
.
length
;
i
++
)
{
console
.
log
(
"
test then array [i]=
"
+
res
[
i
]);
console
.
log
(
"
test then val [i]=
"
+
val
[
i
]);
expect
(
val
[
i
]).
assertEqual
(
res
[
i
])
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
done
();
})
/**
...
...
@@ -48,16 +41,15 @@ describe('ChildProcessTest', function () {
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testRunCmd002
'
,
0
,
async
function
(
done
)
{
it
(
'
testRunCmd002
'
,
0
,
async
function
(
)
{
var
child
=
process
.
runCmd
(
'
echo abc;
'
,
{
maxBuffer
:
2
})
child
.
wait
()
var
array
=
new
Uint8Array
([
97
,
98
,
0
])
await
child
.
getOutput
().
then
(
val
=>
{
child
.
getOutput
().
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
done
()
})
/**
...
...
@@ -357,7 +349,7 @@ describe('ChildProcessTest', function () {
var
status
=
child
.
wait
();
status
.
then
(
val
=>
{
console
.
log
(
'
---CJX---
'
+
val
);
expect
(
val
).
assertEqual
(
9
);
expect
(
val
).
assertEqual
(
0
);
})
})
...
...
@@ -1562,8 +1554,11 @@ describe('ChildProcessTest', function () {
* @tc.author: wangben
*/
it
(
'
testCwd001
'
,
0
,
function
()
{
var
cwd
=
process
.
cwd
()
expect
(
cwd
).
assertEqual
(
'
/
'
)
var
cwdir
=
process
.
cwd
()
if
(
cwdir
){
var
flag
=
true
}
expect
(
flag
).
assertEqual
(
true
)
})
/**
...
...
@@ -1573,10 +1568,13 @@ describe('ChildProcessTest', function () {
* @tc.author: wangben
*/
it
(
'
testCwd002
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
cwd
=
process
.
cwd
()
expect
(
cwd
).
assertEqual
(
'
/
'
)
var
cwdir
=
process
.
cwd
()
if
(
cwdir
){
var
flag
=
true
}
expect
(
flag
).
assertEqual
(
true
)
}
})
...
...
@@ -1587,38 +1585,13 @@ describe('ChildProcessTest', function () {
* @tc.author: wangben
*/
it
(
'
testCwd003
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
1
0
;
i
++
)
for
(
var
i
=
0
;
i
<
100
0
;
i
++
)
{
var
cwd
=
process
.
cwd
()
expect
(
cwd
).
assertEqual
(
'
/
'
)
}
})
/**
* @tc.name: testCwd004
* @tc.desc: Return the current work directory.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testCwd004
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
18
;
i
++
)
{
var
cwd
=
process
.
cwd
()
expect
(
cwd
).
assertEqual
(
'
/
'
)
var
cwdir
=
process
.
cwd
()
if
(
cwdir
){
var
flag
=
true
}
})
/**
* @tc.name: testCwd005
* @tc.desc: Return the current work directory.
* @tc.require: AR000GFB2S
* @tc.author: wangben
*/
it
(
'
testCwd005
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
29
;
i
++
)
{
var
cwd
=
process
.
cwd
()
expect
(
cwd
).
assertEqual
(
'
/
'
)
expect
(
flag
).
assertEqual
(
true
)
}
})
...
...
@@ -1765,7 +1738,7 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testTid001
'
,
0
,
function
()
{
var
pres
=
P
rocess
.
tid
var
pres
=
p
rocess
.
tid
console
.
info
(
'
test press value:
'
+
pres
)
if
(
pres
>
0
)
{
...
...
@@ -1781,9 +1754,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testTid002
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
pres
=
P
rocess
.
tid
var
pres
=
p
rocess
.
tid
if
(
pres
>
0
)
{
var
flag
=
true
...
...
@@ -1799,45 +1772,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testTid003
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
8
;
i
++
)
for
(
var
i
=
0
;
i
<
1000
;
i
++
)
{
var
pres
=
Process
.
tid
if
(
pres
>
0
)
{
var
flag
=
true
}
expect
(
flag
).
assertEqual
(
true
)
}
})
/**
* @tc.name: testTid004
* @tc.desc: Returns the tid of the current thread.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testTid004
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
18
;
i
++
)
{
var
pres
=
Process
.
tid
if
(
pres
>
0
)
{
var
flag
=
true
}
expect
(
flag
).
assertEqual
(
true
)
}
})
/**
* @tc.name: testTid005
* @tc.desc: Returns the tid of the current thread.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testTid005
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
26
;
i
++
)
{
var
pres
=
Process
.
tid
var
pres
=
process
.
tid
if
(
pres
>
0
)
{
var
flag
=
true
...
...
@@ -1853,7 +1790,7 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testIsisolatedProcess001
'
,
0
,
function
()
{
var
pres
=
P
rocess
.
isIsolatedProcess
()
var
pres
=
p
rocess
.
isIsolatedProcess
()
expect
(
pres
).
assertEqual
(
true
)
})
...
...
@@ -1864,9 +1801,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testIsisolatedProcess002
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
pres
=
P
rocess
.
isIsolatedProcess
()
var
pres
=
p
rocess
.
isIsolatedProcess
()
expect
(
pres
).
assertEqual
(
true
)
}
})
...
...
@@ -1878,37 +1815,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testIsisolatedProcess003
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
1
8
;
i
++
)
for
(
var
i
=
0
;
i
<
1
000
;
i
++
)
{
var
pres
=
Process
.
isIsolatedProcess
()
expect
(
pres
).
assertEqual
(
true
)
}
})
/**
* @tc.name: testIsisolatedProcess004
* @tc.desc: Returns a boolean whether the process is isolated.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testIsisolatedProcess004
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
20
;
i
++
)
{
var
pres
=
Process
.
isIsolatedProcess
()
expect
(
pres
).
assertEqual
(
true
)
}
})
/**
* @tc.name: testIsisolatedProcess005
* @tc.desc: Returns a boolean whether the process is isolated.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testIsisolatedProcess005
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
25
;
i
++
)
{
var
pres
=
Process
.
isIsolatedProcess
()
var
pres
=
process
.
isIsolatedProcess
()
expect
(
pres
).
assertEqual
(
true
)
}
})
...
...
@@ -1920,8 +1829,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testIsappuid001
'
,
0
,
function
()
{
var
isorno
=
Process
.
isAppUid
(
456
)
expect
(
isorno
).
assertEqual
(
false
)
var
appUid
=
process
.
uid
var
isorno
=
process
.
isAppUid
(
appUid
)
expect
(
isorno
).
assertEqual
(
true
)
})
/**
...
...
@@ -1931,7 +1841,7 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testIsappuid002
'
,
0
,
function
()
{
var
isorno
=
P
rocess
.
isAppUid
(
123
)
var
isorno
=
p
rocess
.
isAppUid
(
123
)
expect
(
isorno
).
assertEqual
(
false
)
})
...
...
@@ -1942,7 +1852,7 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testIsappuid003
'
,
0
,
function
()
{
var
isorno
=
P
rocess
.
isAppUid
(
80000
)
var
isorno
=
p
rocess
.
isAppUid
(
80000
)
expect
(
isorno
).
assertEqual
(
false
)
})
...
...
@@ -1953,7 +1863,7 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testIsappuid004
'
,
0
,
function
()
{
var
isorno
=
P
rocess
.
isAppUid
(
789
)
var
isorno
=
p
rocess
.
isAppUid
(
789
)
expect
(
isorno
).
assertEqual
(
false
)
})
...
...
@@ -1964,7 +1874,7 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testIsappuid005
'
,
0
,
function
()
{
var
isorno
=
P
rocess
.
isAppUid
(
8569
)
var
isorno
=
p
rocess
.
isAppUid
(
8569
)
expect
(
isorno
).
assertEqual
(
false
)
})
...
...
@@ -1975,7 +1885,7 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testIs64Bit001
'
,
0
,
function
()
{
var
isorno
=
P
rocess
.
is64Bit
()
var
isorno
=
p
rocess
.
is64Bit
()
expect
(
isorno
).
assertEqual
(
false
)
})
...
...
@@ -1986,9 +1896,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testIs64Bit002
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
isorno
=
P
rocess
.
is64Bit
()
var
isorno
=
p
rocess
.
is64Bit
()
expect
(
isorno
).
assertEqual
(
false
)
}
})
...
...
@@ -2000,37 +1910,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testIs64Bit003
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
1
5
;
i
++
)
for
(
var
i
=
0
;
i
<
1
000
;
i
++
)
{
var
isorno
=
Process
.
is64Bit
()
expect
(
isorno
).
assertEqual
(
false
)
}
})
/**
* @tc.name: testIs64Bit004
* @tc.desc: Returns a boolean whether the process is running in a 64-bit environment.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testIs64Bit004
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
18
;
i
++
)
{
var
isorno
=
Process
.
is64Bit
()
expect
(
isorno
).
assertEqual
(
false
)
}
})
/**
* @tc.name: testIs64Bit005
* @tc.desc: Returns a boolean whether the process is running in a 64-bit environment.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testIs64Bit005
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
22
;
i
++
)
{
var
isorno
=
Process
.
is64Bit
()
var
isorno
=
process
.
is64Bit
()
expect
(
isorno
).
assertEqual
(
false
)
}
})
...
...
@@ -2042,8 +1924,12 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetuidforname001
'
,
0
,
function
()
{
var
pres
=
Process
.
getUidForName
(
"
1111
"
)
expect
(
pres
).
assertEqual
(
-
1
)
var
pres
=
process
.
getUidForName
(
"
root
"
)
if
(
pres
!=
-
1
)
{
var
flag
=
true
expect
(
flag
).
assertEqual
(
true
)
}
})
/**
...
...
@@ -2053,9 +1939,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetuidforname002
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
pres
=
P
rocess
.
getUidForName
(
"
12356
"
)
var
pres
=
p
rocess
.
getUidForName
(
"
12356
"
)
expect
(
pres
).
assertEqual
(
-
1
)
}
})
...
...
@@ -2067,37 +1953,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetuidforname003
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
18
;
i
++
)
{
var
pres
=
Process
.
getUidForName
(
"
12356
"
)
expect
(
pres
).
assertEqual
(
-
1
)
}
})
/**
* @tc.name: testGetuidforname004
* @tc.desc: Returns the uid based on the specified user name.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testGetuidforname004
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
16
;
i
++
)
{
var
pres
=
Process
.
getUidForName
(
"
12356
"
)
expect
(
pres
).
assertEqual
(
-
1
)
}
})
/**
* @tc.name: testGetuidforname005
* @tc.desc: Returns the uid based on the specified user name.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testGetuidforname005
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
21
;
i
++
)
for
(
var
i
=
0
;
i
<
1000
;
i
++
)
{
var
pres
=
P
rocess
.
getUidForName
(
"
12356
"
)
var
pres
=
p
rocess
.
getUidForName
(
"
12356
"
)
expect
(
pres
).
assertEqual
(
-
1
)
}
})
...
...
@@ -2109,8 +1967,8 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetthreadpriority001
'
,
0
,
function
()
{
var
pres
=
P
rocess
.
tid
var
pri
=
P
rocess
.
getThreadPriority
(
pres
)
var
pres
=
p
rocess
.
tid
var
pri
=
p
rocess
.
getThreadPriority
(
pres
)
if
(
pri
)
{
var
flag
=
true
...
...
@@ -2125,10 +1983,10 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetthreadpriority002
'
,
0
,
function
()
{
var
pres
=
P
rocess
.
tid
for
(
var
i
=
0
;
i
<
3
;
i
++
)
var
pres
=
p
rocess
.
tid
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
pri
=
P
rocess
.
getThreadPriority
(
pres
)
var
pri
=
p
rocess
.
getThreadPriority
(
pres
)
if
(
pri
>
0
)
{
var
flag
=
true
...
...
@@ -2144,48 +2002,10 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetthreadpriority003
'
,
0
,
function
()
{
var
pres
=
P
rocess
.
tid
for
(
var
i
=
0
;
i
<
1
6
;
i
++
)
var
pres
=
p
rocess
.
tid
for
(
var
i
=
0
;
i
<
1
000
;
i
++
)
{
var
pri
=
Process
.
getThreadPriority
(
pres
)
if
(
pri
>
0
)
{
var
flag
=
true
expect
(
flag
).
assertEqual
(
true
)
}
}
})
/**
* @tc.name: testGetthreadpriority004
* @tc.desc: Returns the thread priority based on the specified tid.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testGetthreadpriority004
'
,
0
,
function
()
{
var
pres
=
Process
.
tid
for
(
var
i
=
0
;
i
<
18
;
i
++
)
{
var
pri
=
Process
.
getThreadPriority
(
pres
)
if
(
pri
>
0
)
{
var
flag
=
true
expect
(
flag
).
assertEqual
(
true
)
}
}
})
/**
* @tc.name: testGetthreadpriority005
* @tc.desc: Returns the thread priority based on the specified tid.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testGetthreadpriority005
'
,
0
,
function
()
{
var
pres
=
Process
.
tid
for
(
var
i
=
0
;
i
<
25
;
i
++
)
{
var
pri
=
Process
.
getThreadPriority
(
pres
)
var
pri
=
process
.
getThreadPriority
(
pres
)
if
(
pri
>
0
)
{
var
flag
=
true
...
...
@@ -2202,10 +2022,10 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetstartrealtime001
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
pri
=
P
rocess
.
getStartRealtime
()
if
(
pri
>
0
)
var
pri
=
p
rocess
.
getStartRealtime
()
if
(
pri
!==
null
)
{
var
flag
=
true
}
...
...
@@ -2221,8 +2041,8 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetstartrealtime002
'
,
0
,
function
()
{
var
pri
=
P
rocess
.
getStartRealtime
()
if
(
pri
>
0
)
var
pri
=
p
rocess
.
getStartRealtime
()
if
(
pri
!==
null
)
{
var
flag
=
true
}
...
...
@@ -2237,48 +2057,10 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetstartrealtime003
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
1
6
;
i
++
)
for
(
var
i
=
0
;
i
<
1
00
;
i
++
)
{
var
pri
=
Process
.
getStartRealtime
()
if
(
pri
>
0
)
{
var
flag
=
true
}
expect
(
flag
).
assertEqual
(
true
)
}
})
/**
* @tc.name: testGetstartrealtime004
* @tc.desc: Returns the elapsed real time (in milliseconds) taken from the start of
* the system to the start of the process.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testGetstartrealtime004
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
19
;
i
++
)
{
var
pri
=
Process
.
getStartRealtime
()
if
(
pri
>
0
)
{
var
flag
=
true
}
expect
(
flag
).
assertEqual
(
true
)
}
})
/**
* @tc.name: testGetstartrealtime005
* @tc.desc: Returns the elapsed real time (in milliseconds) taken from the start of
* the system to the start of the process.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testGetstartrealtime005
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
22
;
i
++
)
{
var
pri
=
Process
.
getStartRealtime
()
if
(
pri
>
0
)
var
pri
=
process
.
getStartRealtime
()
if
(
pri
!==
null
)
{
var
flag
=
true
}
...
...
@@ -2293,9 +2075,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetpastCputime001
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
pri
=
P
rocess
.
getPastCputime
()
var
pri
=
p
rocess
.
getPastCputime
()
if
(
pri
>
0
)
{
var
flag
=
true
...
...
@@ -2311,7 +2093,7 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetpastCputime002
'
,
0
,
function
()
{
var
pri
=
P
rocess
.
getPastCputime
()
var
pri
=
p
rocess
.
getPastCputime
()
if
(
pri
>
0
)
{
var
flag
=
true
...
...
@@ -2326,9 +2108,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetpastCputime003
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
1
2
;
i
++
)
for
(
var
i
=
0
;
i
<
1
00
;
i
++
)
{
var
pri
=
P
rocess
.
getPastCputime
()
var
pri
=
p
rocess
.
getPastCputime
()
if
(
pri
>
0
)
{
var
flag
=
true
...
...
@@ -2344,27 +2126,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetpastCputime004
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
16
;
i
++
)
{
var
pri
=
Process
.
getPastCputime
()
if
(
pri
>
0
)
{
var
flag
=
true
}
expect
(
flag
).
assertEqual
(
true
)
}
})
/**
* @tc.name: testGetpastCputime005
* @tc.desc: Returns the cpu time (in milliseconds) from the time when the process starts to the current time.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testGetpastCputime005
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
21
;
i
++
)
for
(
var
i
=
0
;
i
<
1000
;
i
++
)
{
var
pri
=
P
rocess
.
getPastCputime
()
var
pri
=
p
rocess
.
getPastCputime
()
if
(
pri
>
0
)
{
var
flag
=
true
...
...
@@ -2381,7 +2145,7 @@ describe('ChildProcessTest', function () {
*/
it
(
'
testGetSystemConfig001
'
,
0
,
function
()
{
var
_SC_ARG_MAX
=
0
var
pri
=
P
rocess
.
getSystemConfig
(
_SC_ARG_MAX
)
var
pri
=
p
rocess
.
getSystemConfig
(
_SC_ARG_MAX
)
if
(
pri
>
0
)
{
var
flag
=
true
...
...
@@ -2397,9 +2161,9 @@ describe('ChildProcessTest', function () {
*/
it
(
'
testGetSystemConfig002
'
,
0
,
function
()
{
var
_SC_ARG_MAX
=
0
for
(
var
i
=
0
;
i
<
3
;
i
++
)
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
pri
=
P
rocess
.
getSystemConfig
(
_SC_ARG_MAX
)
var
pri
=
p
rocess
.
getSystemConfig
(
_SC_ARG_MAX
)
if
(
pri
>
0
)
{
var
flag
=
true
...
...
@@ -2416,47 +2180,9 @@ describe('ChildProcessTest', function () {
*/
it
(
'
testGetSystemConfig003
'
,
0
,
function
()
{
var
_SC_ARG_MAX
=
0
for
(
var
i
=
0
;
i
<
8
;
i
++
)
for
(
var
i
=
0
;
i
<
100
;
i
++
)
{
var
pri
=
Process
.
getSystemConfig
(
_SC_ARG_MAX
)
if
(
pri
>
0
)
{
var
flag
=
true
}
expect
(
flag
).
assertEqual
(
true
)
}
})
/**
* @tc.name: testGetSystemConfig004
* @tc.desc: Returns the system configuration at runtime.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testGetSystemConfig004
'
,
0
,
function
()
{
var
_SC_ARG_MAX
=
0
for
(
var
i
=
0
;
i
<
15
;
i
++
)
{
var
pri
=
Process
.
getSystemConfig
(
_SC_ARG_MAX
)
if
(
pri
>
0
)
{
var
flag
=
true
}
expect
(
flag
).
assertEqual
(
true
)
}
})
/**
* @tc.name: testGetSystemConfig005
* @tc.desc: Returns the system configuration at runtime.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testGetSystemConfig005
'
,
0
,
function
()
{
var
_SC_ARG_MAX
=
0
for
(
var
i
=
0
;
i
<
19
;
i
++
)
{
var
pri
=
Process
.
getSystemConfig
(
_SC_ARG_MAX
)
var
pri
=
process
.
getSystemConfig
(
_SC_ARG_MAX
)
if
(
pri
>
0
)
{
var
flag
=
true
...
...
@@ -2472,7 +2198,7 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetAvailableCores001
'
,
0
,
function
()
{
var
pri
=
P
rocess
.
getAvailableCores
()
var
pri
=
p
rocess
.
getAvailableCores
()
if
(
pri
!=
null
)
{
var
flag
=
true
...
...
@@ -2487,9 +2213,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetAvailableCores002
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
pri
=
P
rocess
.
getAvailableCores
()
var
pri
=
p
rocess
.
getAvailableCores
()
if
(
pri
!=
0
)
{
var
flag
=
true
...
...
@@ -2505,45 +2231,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetAvailableCores003
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
9
;
i
++
)
{
var
pri
=
Process
.
getAvailableCores
()
if
(
pri
!=
0
)
{
var
flag
=
true
}
expect
(
flag
).
assertEqual
(
true
)
}
})
/**
* @tc.name: testGetAvailableCores004
* @tc.desc: Returns cpu cores available for the current process on a multi-core device.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testGetAvailableCores004
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
12
;
i
++
)
{
var
pri
=
Process
.
getAvailableCores
()
if
(
pri
!=
0
)
{
var
flag
=
true
}
expect
(
flag
).
assertEqual
(
true
)
}
})
/**
* @tc.name: testGetAvailableCores005
* @tc.desc: Returns cpu cores available for the current process on a multi-core device.
* @tc.require: AR000GFB04
* @tc.author: liwenqiang
*/
it
(
'
testGetAvailableCores005
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
18
;
i
++
)
for
(
var
i
=
0
;
i
<
1000
;
i
++
)
{
var
pri
=
P
rocess
.
getAvailableCores
()
var
pri
=
p
rocess
.
getAvailableCores
()
if
(
pri
!=
0
)
{
var
flag
=
true
...
...
@@ -2559,7 +2249,7 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetEnvironmentVar001
'
,
0
,
function
()
{
var
pri
=
P
rocess
.
getEnvironmentVar
(
"
USER
"
)
var
pri
=
p
rocess
.
getEnvironmentVar
(
"
USER
"
)
if
(
pri
!=
null
)
{
var
flag
=
true
expect
(
flag
).
assertEqual
(
true
)
...
...
@@ -2573,9 +2263,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetEnvironmentVar002
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
3
;
i
++
)
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
pri
=
P
rocess
.
getEnvironmentVar
(
"
PATH
"
)
var
pri
=
p
rocess
.
getEnvironmentVar
(
"
PATH
"
)
if
(
pri
!=
null
)
{
var
flag
=
true
...
...
@@ -2591,9 +2281,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetEnvironmentVar003
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
1
5
;
i
++
)
for
(
var
i
=
0
;
i
<
1
00
;
i
++
)
{
var
pri
=
P
rocess
.
getEnvironmentVar
(
"
PATH
"
)
var
pri
=
p
rocess
.
getEnvironmentVar
(
"
PATH
"
)
if
(
pri
!=
null
)
{
var
flag
=
true
...
...
@@ -2609,9 +2299,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetEnvironmentVar004
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
26
;
i
++
)
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
var
pri
=
Process
.
getEnvironmentVar
(
"
PATH
"
)
var
pri
=
process
.
getEnvironmentVar
(
"
USER
"
)
if
(
pri
!=
null
)
{
var
flag
=
true
...
...
@@ -2627,9 +2317,9 @@ describe('ChildProcessTest', function () {
* @tc.author: liwenqiang
*/
it
(
'
testGetEnvironmentVar005
'
,
0
,
function
()
{
for
(
var
i
=
0
;
i
<
1
9
;
i
++
)
for
(
var
i
=
0
;
i
<
1
00
;
i
++
)
{
var
pri
=
Process
.
getEnvironmentVar
(
"
PATH
"
)
var
pri
=
process
.
getEnvironmentVar
(
"
USER
"
)
if
(
pri
!=
null
)
{
var
flag
=
true
...
...
compileruntime/process_lib_standard/src/main/js/test/ExampleJsunit.test.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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
app
from
'
@system.app
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/lite
'
describe
(
'
appInfoTest
'
,
function
()
{
it
(
'
app_info_test_001
'
,
0
,
function
()
{
var
info
=
app
.
getInfo
()
expect
(
info
.
versionCode
).
assertEqual
(
'
1000000
'
)
})
})
\ No newline at end of file
compileruntime/process_lib_standard/src/main/resources/base/element/string.json
浏览文件 @
4423bbd2
{
"string"
:
[
{
"name"
:
"
entry_MainAbility
"
,
"value"
:
"
entry_MainAbility
"
"name"
:
"
app_name
"
,
"value"
:
"
OsAccountTest
"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_
Empty
Ability"
"value"
:
"JS_
Phone_Empty Feature
Ability"
}
]
}
\ No newline at end of file
compileruntime/process_lib_standard/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
4423bbd2
6.6 KB
compileruntime/process_lib_standard/src/ohosTest/js/default/app.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
TestApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
TestApplication onDestroy
'
);
}
};
compileruntime/process_lib_standard/src/ohosTest/js/default/i18n/en-US.json
已删除
100644 → 0
浏览文件 @
c7f41830
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
},
"Files"
:
{
}
}
\ No newline at end of file
compileruntime/process_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json
已删除
100644 → 0
浏览文件 @
c7f41830
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
}
\ No newline at end of file
compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.css
已删除
100644 → 0
浏览文件 @
c7f41830
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.hml
已删除
100644 → 0
浏览文件 @
c7f41830
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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
file
from
'
@system.file
'
import
app
from
'
@system.app
'
import
device
from
'
@system.device
'
import
router
from
'
@system.router
'
import
{
Core
,
ExpectExtend
,
ReportExtend
,
InstrumentLog
}
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
'
})
const
reportExtend
=
new
ReportExtend
(
file
)
const
instrumentLog
=
new
InstrumentLog
({
'
id
'
:
'
report
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
addService
(
'
report
'
,
reportExtend
)
core
.
addService
(
'
report
'
,
instrumentLog
)
core
.
init
()
core
.
subscribeEvent
(
'
spec
'
,
instrumentLog
)
core
.
subscribeEvent
(
'
suite
'
,
instrumentLog
)
core
.
subscribeEvent
(
'
task
'
,
instrumentLog
)
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
\ No newline at end of file
compileruntime/process_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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
app
from
'
@system.app
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
appInfoTest
'
,
function
()
{
it
(
'
app_info_test_001
'
,
0
,
function
()
{
var
info
=
app
.
getInfo
()
expect
(
info
.
versionName
).
assertEqual
(
'
1.0
'
)
expect
(
info
.
versionCode
).
assertEqual
(
'
3
'
)
})
})
\ No newline at end of file
compileruntime/process_lib_standard/src/ohosTest/js/test/List.test.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
require
(
'
./ExampleJsunit.test.js
'
)
\ No newline at end of file
compileruntime/process_lib_standard/src/ohosTest/resources/base/element/string.json
已删除
100644 → 0
浏览文件 @
c7f41830
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"childprocess"
},
{
"name"
:
"mainability_description"
,
"value"
:
"hap sample empty page"
}
]
}
\ No newline at end of file
compileruntime/url_lib_standard/src/main/config.json
浏览文件 @
4423bbd2
...
...
@@ -5,6 +5,10 @@
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
}
},
"deviceConfig"
:
{},
...
...
@@ -23,6 +27,7 @@
},
"abilities"
:
[
{
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
...
...
@@ -49,7 +54,7 @@
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
tru
e
"autoDesignWidth"
:
fals
e
}
}
]
...
...
compileruntime/url_lib_standard/src/main/java/com/example/url/MainAbility.java
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
package
com.example.url
;
import
ohos.ace.ability.AceAbility
;
import
ohos.aafwk.content.Intent
;
public
class
MainAbility
extends
AceAbility
{
@Override
public
void
onStart
(
Intent
intent
)
{
super
.
onStart
(
intent
);
}
@Override
public
void
onStop
()
{
super
.
onStop
();
}
}
compileruntime/url_lib_standard/src/main/java/com/example/url/MyApplication.java
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
package
com.example.url
;
import
ohos.aafwk.ability.AbilityPackage
;
public
class
MyApplication
extends
AbilityPackage
{
@Override
public
void
onInitialize
()
{
super
.
onInitialize
();
}
}
compileruntime/url_lib_standard/src/main/js/default/app.js
浏览文件 @
4423bbd2
/*
* Copyright (C) 2021 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 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,
* 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
'
);
...
...
compileruntime/url_lib_standard/src/main/js/default/pages/index/index.css
浏览文件 @
4423bbd2
...
...
@@ -5,40 +5,5 @@
}
.title
{
font-size
:
40px
;
color
:
#000000
;
opacity
:
0.9
;
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
@media
screen
and
(
device-type
:
wearable
)
{
.title
{
font-size
:
28px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
tv
)
{
.container
{
background-image
:
url("../../common/images/Wallpaper.png")
;
background-size
:
cover
;
background-repeat
:
no-repeat
;
background-position
:
center
;
}
.title
{
font-size
:
100px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
compileruntime/url_lib_standard/src/main/js/default/pages/index/index.js
浏览文件 @
4423bbd2
...
...
@@ -16,7 +16,8 @@ import file from '@system.file'
import
app
from
'
@system.app
'
import
device
from
'
@system.device
'
import
router
from
'
@system.router
'
import
{
Core
}
from
'
deccjsunit/lite
'
import
{
Core
,
Constant
,
ExpectExtend
,
ReportExtend
,
InstrumentLog
}
from
'
deccjsunit/index
'
export
default
{
data
:
{
...
...
@@ -29,7 +30,7 @@ export default {
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
core
.
init
()
require
(
'
../../
../
test/List.test
'
)
require
(
'
../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
...
...
compileruntime/url_lib_standard/src/main/js/test/List.test.js
→
compileruntime/url_lib_standard/src/main/js/
default/
test/List.test.js
浏览文件 @
4423bbd2
...
...
@@ -13,4 +13,3 @@
* limitations under the License.
*/
require
(
'
./url.test.js
'
)
require
(
'
./ExampleJsunit.test.js
'
)
compileruntime/url_lib_standard/src/main/js/default/test/url.test.js
0 → 100644
浏览文件 @
4423bbd2
/*
* 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
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
Url
from
'
@ohos.url
'
describe
(
'
UrlFunTest
'
,
function
()
{
/**
* @tc.name: testUrlAppend001
* @tc.desc: Appends a specified key/value pair as a new search parameter.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlAppend001
'
,
0
,
function
()
{
var
that
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?foo=1&bar=2
'
);
var
params
=
new
Url
.
URLSearchParams
(
that
.
search
);
params
.
append
(
'
ma
'
,
'
jk
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
foo=1&bar=2&ma=jk
'
)
})
/**
* @tc.name: testUrlAppend002
* @tc.desc: Appends a specified key/value pair as a new search parameter.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlAppend002
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
)
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
params
.
append
(
"
ma 大
"
,
"
jk¥
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
foo=1&bar=2&ma+%E5%A4%A7=jk%EF%BF%A5
"
)
})
/**
* @tc.name: testUrlAppend003
* @tc.desc: Appends a specified key/value pair as a new search parameter.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlAppend003
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
)
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
params
.
append
(
"
foo~!@#$%^&*()_+-=
"
,
"
jk
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
foo=1&bar=2&foo%7E%21%40%23%24%25%5E%26*%28%29_%2B-%3D=jk
"
)
})
/**
* @tc.name: testUrlAppend004
* @tc.desc: Appends a specified key/value pair as a new search parameter.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlAppend004
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
)
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
params
.
append
(
"
app
"
,
"
par
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
foo=1&bar=2&app=par
"
)
})
/**
* @tc.name: testUrlAppend005
* @tc.desc: Appends a specified key/value pair as a new search parameter.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlAppend005
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
)
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
params
.
append
(
"
123
"
,
"
456
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
foo=1&bar=2&123=456
"
)
})
/**
* @tc.name: testUrlDelete001
* @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlDelete001
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
)
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
params
.
delete
(
"
foo
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
bar=2
"
)
})
/**
* @tc.name: testUrlDelete002
* @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlDelete002
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo大=1&bar=2
'
);
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
);
params
.
delete
(
'
foo
'
);
var
result
=
params
.
toString
();
expect
(
result
).
assertEqual
(
"
foo%E5%A4%A7=1&bar=2
"
);
})
/**
* @tc.name: testUrlDelete003
* @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlDelete003
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo大=1&bar=2
'
);
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
);
params
.
delete
(
"
foo大
"
);
var
result
=
params
.
toString
();
expect
(
result
).
assertEqual
(
"
bar=2
"
)
})
/**
* @tc.name: testUrlDelete004
* @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlDelete004
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
);
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
);
params
.
delete
(
'
bar
'
);
var
result
=
params
.
toString
();
expect
(
result
).
assertEqual
(
"
foo=1
"
);
})
/**
* @tc.name: testUrlDelete005
* @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlDelete005
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
);
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
);
params
.
delete
(
"
faa
"
);
var
result
=
params
.
toString
();
expect
(
result
).
assertEqual
(
"
foo=1&bar=2
"
)
})
/**
* @tc.name: testUrlEntries001
* @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlEntries001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
);
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
.
entries
())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
};
expect
(
arr
[
1
]).
assertEqual
(
"
value1
"
);
})
/**
* @tc.name: testUrlEntries002
* @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlEntries002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
.
entries
())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
2
]).
assertEqual
(
"
key2
"
)
})
/**
* @tc.name: testUrlEntries003
* @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlEntries003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
params
.
append
(
"
foo
"
,
"
jk
"
)
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
.
entries
())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
5
]).
assertEqual
(
"
jk
"
)
})
/**
* @tc.name: testUrlEntries004
* @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlEntries004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
.
entries
())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
3
]).
assertEqual
(
"
value2
"
)
})
/**
* @tc.name: testUrlEntries005
* @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlEntries005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
params
.
append
(
"
jss
"
,
"
txt
"
)
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
.
entries
())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
4
]).
assertEqual
(
"
jss
"
)
})
/**
* @tc.name: testUrlForEach001
* @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlForEach001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
var
arr
=
{};
var
i
=
0
;
function
func
(
str1
,
str2
,
params
)
{
arr
[
i
]
=
'
key=
'
+
str1
+
'
'
+
'
value=
'
+
str2
+
'
'
+
'
flag=
'
+
params
i
++
;
}
params
.
forEach
(
func
);
expect
(
arr
[
0
]).
assertEqual
(
'
key=key1 value=value1 flag=key1=value1&key2=value2
'
);
})
/**
* @tc.name: testUrlForEach002
* @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlForEach002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
var
arr
=
{};
var
i
=
0
;
function
func
(
str1
,
str2
,
params
)
{
arr
[
i
]
=
'
key=
'
+
str1
+
'
'
+
'
value=
'
+
str2
+
'
'
+
'
flag=
'
+
params
i
++
;
}
params
.
forEach
(
func
);
expect
(
arr
[
1
]).
assertEqual
(
'
key=key2 value=value2 flag=key1=value1&key2=value2
'
);
})
/**
* @tc.name: testUrlForEach003
* @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlForEach003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
params
.
append
(
'
foo
'
,
'
jk
'
)
var
arr
=
{};
var
i
=
0
;
function
func
(
str1
,
str2
,
params
)
{
arr
[
i
]
=
'
key=
'
+
str1
+
'
'
+
'
value=
'
+
str2
+
'
'
+
'
flag=
'
+
params
i
++
;
}
params
.
forEach
(
func
);
expect
(
arr
[
2
]).
assertEqual
(
'
key=foo value=jk flag=key1=value1&key2=value2&foo=jk
'
);
})
/**
* @tc.name: testUrlForEach004
* @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlForEach004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
params
.
append
(
'
foo
'
,
'
jk
'
)
var
arr
=
{};
var
i
=
0
;
function
func
(
str1
,
str2
,
params
)
{
arr
[
i
]
=
'
key=
'
+
str1
+
'
'
+
'
value=
'
+
str2
+
'
'
+
'
flag=
'
+
params
i
++
;
}
params
.
forEach
(
func
)
expect
(
arr
[
2
]).
assertEqual
(
'
key=foo value=jk flag=key1=value1&key2=value2&foo=jk
'
)
})
/**
* @tc.name: testUrlForEach005
* @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object.
* @tc.require: AR000GFB2S
* @tc.author: jiangkai
*/
it
(
'
testUrlForEach005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
params
.
append
(
'
foo
'
,
'
jk
'
)
var
arr
=
{};
var
i
=
0
;
function
func
(
str1
,
str2
,
params
)
{
arr
[
i
]
=
'
key=
'
+
str1
+
'
'
+
'
value=
'
+
str2
+
'
'
+
'
flag=
'
+
params
i
++
;
}
params
.
forEach
(
func
)
expect
(
arr
[
2
]).
assertEqual
(
'
key=foo value=jk flag=key1=value1&key2=value2&foo=jk
'
)
})
/**
* @tc.name: testUrlGet001
* @tc.desc: Returns the first value associated to the given search parameter.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlGet001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
var
result
=
params
.
get
(
"
1
"
)
expect
(
result
).
assertEqual
(
undefined
)
})
/**
* @tc.name: testUrlForEach002
* @tc.desc: Returns the first value associated to the given search parameter.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlForEach002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
var
result
=
params
.
get
(
"
key2
"
)
expect
(
result
).
assertEqual
(
"
value2
"
)
})
/**
* @tc.name: testUrlForEach003
* @tc.desc: Returns the first value associated to the given search parameter.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlForEach003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
params
.
append
(
"
5
"
,
"
JKL
"
)
var
result
=
params
.
get
(
"
5
"
)
expect
(
result
).
assertEqual
(
"
JKL
"
)
})
/**
* @tc.name: testUrlForEach004
* @tc.desc: Returns the first value associated to the given search parameter.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlForEach004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
var
result
=
params
.
get
(
"
key1
"
)
expect
(
result
).
assertEqual
(
"
value1
"
)
})
/**
* @tc.name: testUrlForEach005
* @tc.desc: Returns the first value associated to the given search parameter.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlForEach005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
params
.
append
(
"
jss
"
,
"
JL
"
)
var
result
=
params
.
get
(
"
jss
"
)
expect
(
result
).
assertEqual
(
"
JL
"
)
})
/**
* @tc.name: testUrlGetAll001
* @tc.desc: Returns all key-value pairs associated with a given search parameter as an array.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlGetAll001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2
"
)
params
.
append
(
"
key1
"
,
"
AAA
"
)
var
result
=
params
.
getAll
(
"
key1
"
)
console
.
info
(
'
test result size=
'
+
result
.
length
)
console
.
info
(
'
test result type=
'
+
typeof
result
)
console
.
info
(
'
test result=
'
+
result
)
var
s
=
"
value1,AAA
"
console
.
info
(
'
test s size=
'
+
s
.
length
)
expect
(
result
[
0
]).
assertEqual
(
"
value1
"
)
expect
(
result
[
1
]).
assertEqual
(
"
AAA
"
)
})
/**
* @tc.name: testUrlGetAll002
* @tc.desc: Returns all key-value pairs associated with a given search parameter as an array.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlGetAll002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&8=DEF
"
)
params
.
append
(
"
8
"
,
"
A8A
"
)
var
result
=
params
.
getAll
(
"
8
"
)
console
.
info
(
'
test result size=
'
+
result
.
length
)
console
.
info
(
'
test result type=
'
+
typeof
result
)
console
.
info
(
'
test result=
'
+
result
)
var
s
=
"
DEF,A8A
"
console
.
info
(
'
test s size=
'
+
s
.
length
)
expect
(
result
[
0
]).
assertEqual
(
"
DEF
"
)
expect
(
result
[
1
]).
assertEqual
(
"
A8A
"
)
})
/**
* @tc.name: testUrlGetAll003
* @tc.desc: Returns all key-value pairs associated with a given search parameter as an array.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlGetAll003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2&key3=大
"
)
params
.
append
(
"
key3
"
,
"
A3A
"
)
var
result
=
params
.
getAll
(
"
key3
"
)
expect
(
result
[
0
]).
assertEqual
(
"
大
"
)
expect
(
result
[
1
]).
assertEqual
(
"
A3A
"
)
})
/**
* @tc.name: testUrlGetAll004
* @tc.desc: Returns all key-value pairs associated with a given search parameter as an array.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlGetAll004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2&key3=大
"
)
params
.
append
(
"
key4
"
,
"
A3A3
"
)
var
result
=
params
.
getAll
(
"
key4
"
)
console
.
info
(
'
test result size=
'
+
result
.
length
)
console
.
info
(
'
test result type=
'
+
typeof
result
)
console
.
info
(
'
test result=
'
+
result
)
expect
(
result
[
0
]).
assertEqual
(
"
A3A3
"
)
})
/**
* @tc.name: testUrlGetAll005
* @tc.desc: Returns all key-value pairs associated with a given search parameter as an array.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlGetAll005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2&key3=大
"
)
params
.
append
(
"
key3
"
,
"
A3A
"
)
var
result
=
params
.
getAll
(
"
key2
"
)
console
.
info
(
'
test result size=
'
+
result
.
length
)
console
.
info
(
'
test result type=
'
+
typeof
result
)
console
.
info
(
'
test result=
'
+
result
)
var
s
=
"
value2
"
console
.
info
(
'
test s size=
'
+
s
.
length
)
expect
(
result
[
0
]).
assertEqual
(
"
value2
"
)
})
/**
* @tc.name: testUrlHas001
* @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlHas001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
key1=value1&key2=value2&key3=大
"
)
var
result
=
params
.
has
(
"
2
"
)
expect
(
result
).
assertEqual
(
false
)
})
/**
* @tc.name: testUrlHas002
* @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlHas002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
小=value1&key2=value2&key3=大
"
)
var
result
=
params
.
has
(
"
小
"
)
expect
(
result
).
assertEqual
(
true
)
})
/**
* @tc.name: testUrlHas003
* @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlHas003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
小=value1&¥=value2&key3=大
"
)
params
.
append
(
"
¥
"
,
"
ACA
"
)
var
result
=
params
.
has
(
"
¥
"
)
expect
(
result
).
assertEqual
(
true
)
})
/**
* @tc.name: testUrlHas004
* @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlHas004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
小=value1&key2=value2&key3=大
"
)
var
result
=
params
.
has
(
"
无
"
)
expect
(
result
).
assertEqual
(
false
)
})
/**
* @tc.name: testUrlHas005
* @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlHas005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
小=value1&¥=value2&key3=大
"
)
params
.
append
(
"
¥
"
,
"
ACA
"
)
var
result
=
params
.
has
(
"
¥11
"
)
expect
(
result
).
assertEqual
(
false
)
})
/**
* @tc.name: testUrlKeys001
* @tc.desc: Returns an iterator allowing to go through all keys contained in this object.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlKeys001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
小=value1&¥=value2&key3=大
"
);
var
arr
=
{};
var
i
=
0
;
for
(
var
key
of
params
.
keys
())
{
arr
[
i
]
=
key
i
++
};
expect
(
arr
[
0
]).
assertEqual
(
"
小
"
);
})
/**
* @tc.name: testUrlKeys002
* @tc.desc: Returns an iterator allowing to go through all keys contained in this object.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlKeys002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
小=value1&¥=value2&key3=大
"
);
var
arr
=
{};
var
i
=
0
;
for
(
var
key
of
params
.
keys
())
{
arr
[
i
]
=
key
i
++
};
expect
(
arr
[
1
]).
assertEqual
(
"
¥
"
);
})
/**
* @tc.name: testUrlKeys003
* @tc.desc: Returns an iterator allowing to go through all keys contained in this object.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlKeys003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
小=value1&¥=value2&key3=大
"
);
var
arr
=
{};
var
i
=
0
;
for
(
var
key
of
params
.
keys
())
{
arr
[
i
]
=
key
i
++
};
expect
(
arr
[
2
]).
assertEqual
(
"
key3
"
);
})
/**
* @tc.name: testUrlKeys004
* @tc.desc: Returns an iterator allowing to go through all keys contained in this object.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlKeys004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
小=value1&¥=value2&key3=大&key4=六
"
);
var
arr
=
{};
var
i
=
0
;
for
(
var
key
of
params
.
keys
())
{
arr
[
i
]
=
key
i
++
};
expect
(
arr
[
3
]).
assertEqual
(
"
key4
"
);
})
/**
* @tc.name: testUrlKeys005
* @tc.desc: Returns an iterator allowing to go through all keys contained in this object.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlKeys005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
小=value1&¥=value2&key3=大&key4=六&key5=发
"
);
var
arr
=
{};
var
i
=
0
;
for
(
var
key
of
params
.
keys
())
{
arr
[
i
]
=
key
i
++
};
expect
(
arr
[
4
]).
assertEqual
(
"
key5
"
);
})
/**
* @tc.name: testUrlSet001
* @tc.desc: Sets the value associated with a given search parameter to the given value.
* If there were several matching values, this method deletes the others.
* If the search parameter doesn't exist, this method creates it.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlSet001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
1=value1&2=value2&key3=3
"
);
params
.
set
(
"
11
"
,
"
CCC
"
);
var
res
=
params
.
toString
();
expect
(
res
).
assertEqual
(
"
1=value1&2=value2&key3=3&11=CCC
"
);
})
/**
* @tc.name: testUrlSet002
* @tc.desc: Sets the value associated with a given search parameter to the given value.
* If there were several matching values, this method deletes the others.
* If the search parameter doesn't exist, this method creates it.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlSet002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
1=value1&2=value2&key3=3
"
);
params
.
set
(
'
10
'
,
'
BBB
'
);
var
res
=
params
.
toString
();
expect
(
res
).
assertEqual
(
"
1=value1&2=value2&key3=3&10=BBB
"
);
})
/**
* @tc.name: testUrlSet003
* @tc.desc: Sets the value associated with a given search parameter to the given value.
* If there were several matching values, this method deletes the others.
* If the search parameter doesn't exist, this method creates it.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlSet003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
1=value1&2=value2&key3=3
"
);
params
.
set
(
"
ma 大
"
,
"
10¥
"
);
var
res
=
params
.
toString
();
expect
(
res
).
assertEqual
(
"
1=value1&2=value2&key3=3&ma+%E5%A4%A7=10%EF%BF%A5
"
);
})
/**
* @tc.name: testUrlSet004
* @tc.desc: Sets the value associated with a given search parameter to the given value.
* If there were several matching values, this method deletes the others.
* If the search parameter doesn't exist, this method creates it.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlSet004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
1=value1&2=value2&key3=3
"
);
params
.
set
(
"
1
"
,
"
CCC
"
);
var
res
=
params
.
toString
();
expect
(
res
).
assertEqual
(
"
1=CCC&2=value2&key3=3
"
);
})
/**
* @tc.name: testUrlSet005
* @tc.desc: Sets the value associated with a given search parameter to the given value.
* If there were several matching values, this method deletes the others.
* If the search parameter doesn't exist, this method creates it.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlSet005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
1=value1&2=value2&key3=3
"
);
params
.
set
(
'
12
'
,
'
BBB
'
);
var
res
=
params
.
toString
();
expect
(
res
).
assertEqual
(
"
1=value1&2=value2&key3=3&12=BBB
"
);
})
/**
* @tc.name: testUrlSort001
* @tc.desc: Sort all key/value pairs contained in this object in place and return undefined.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlSort001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
1=value1&3=value3&2=key2
"
);
params
.
sort
();
var
res
=
params
.
toString
();
expect
(
res
).
assertEqual
(
"
1=value1&2=key2&3=value3
"
);
})
/**
* @tc.name: testUrlSort002
* @tc.desc: Sort all key/value pairs contained in this object in place and return undefined.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlSort002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
a=value1&c=value2&b=key2
"
);
params
.
sort
();
var
res
=
params
.
toString
();
expect
(
res
).
assertEqual
(
"
a=value1&b=key2&c=value2
"
);
})
/**
* @tc.name: testUrlSort003
* @tc.desc: Sort all key/value pairs contained in this object in place and return undefined.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlSort003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
d=value1&c=value2&b=33
"
);
params
.
append
(
"
a
"
,
"
ACA
"
);
params
.
sort
();
var
res
=
params
.
toString
();
expect
(
res
).
assertEqual
(
"
a=ACA&b=33&c=value2&d=value1
"
);
})
/**
* @tc.name: testUrlSort004
* @tc.desc: Sort all key/value pairs contained in this object in place and return undefined.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlSort004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
1=value1&3=value3&2=key2&4=key4
"
);
params
.
sort
();
var
res
=
params
.
toString
();
expect
(
res
).
assertEqual
(
"
1=value1&2=key2&3=value3&4=key4
"
);
})
/**
* @tc.name: testUrlSort005
* @tc.desc: Sort all key/value pairs contained in this object in place and return undefined.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlSort005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
a=value1&c=value2&4=key4&b=key2
"
);
params
.
sort
();
var
res
=
params
.
toString
();
expect
(
res
).
assertEqual
(
"
4=key4&a=value1&b=key2&c=value2
"
);
})
/**
* @tc.name: testUrlValues001
* @tc.desc: Returns an iterator allowing to go through all values contained in this object.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlValues001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
d=value1&c=value2&b=大
"
)
var
arr
=
{}
var
i
=
0
for
(
var
value
of
params
.
values
())
{
arr
[
i
]
=
value
i
++
}
expect
(
arr
[
0
]).
assertEqual
(
"
value1
"
)
})
/**
* @tc.name: testUrlValues002
* @tc.desc: Returns an iterator allowing to go through all values contained in this object.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlValues002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
d=value1&c=value2&b=大
"
)
var
arr
=
{}
var
i
=
0
for
(
var
value
of
params
.
values
())
{
arr
[
i
]
=
value
i
++
}
expect
(
arr
[
1
]).
assertEqual
(
"
value2
"
)
})
/**
* @tc.name: testUrlValues003
* @tc.desc: Returns an iterator allowing to go through all values contained in this object.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlValues003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
d=value1&c=value2&b=大
"
)
params
.
append
(
"
a
"
,
"
ACA
"
)
var
arr
=
{}
var
i
=
0
for
(
var
value
of
params
.
values
())
{
arr
[
i
]
=
value
i
++
}
expect
(
arr
[
3
]).
assertEqual
(
"
ACA
"
)
})
/**
* @tc.name: testUrlValues004
* @tc.desc: Returns an iterator allowing to go through all values contained in this object.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlValues004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
d=value1&c=value2&b=大&4=key4
"
)
var
arr
=
{}
var
i
=
0
for
(
var
value
of
params
.
values
())
{
arr
[
i
]
=
value
i
++
}
expect
(
arr
[
3
]).
assertEqual
(
"
key4
"
)
})
/**
* @tc.name: testUrlValues005
* @tc.desc: Returns an iterator allowing to go through all values contained in this object.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlValues005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
d=value1&c=value2&b=大&4=key4&5=key5
"
)
var
arr
=
{}
var
i
=
0
for
(
var
value
of
params
.
values
())
{
arr
[
i
]
=
value
i
++
}
expect
(
arr
[
4
]).
assertEqual
(
"
key5
"
)
})
/**
* @tc.name: testUrlToString001
* @tc.desc: Returns a query string suitable for use in a URL.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlToString001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
d=value1&c=value2&b=大
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
d=value1&c=value2&b=%E5%A4%A7
"
)
})
/**
* @tc.name: testUrlToString002
* @tc.desc: Returns a query string suitable for use in a URL.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlToString002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
d=value1&c=value2&b= 大
"
)
params
.
append
(
"
1 12
"
,
"
QQQ
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
d=value1&c=value2&b=+%E5%A4%A7&1+12=QQQ
"
)
})
/**
* @tc.name: testUrlToString003
* @tc.desc: Returns a query string suitable for use in a URL.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlToString003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
¥=)
"
)
params
.
delete
(
"
5
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
%EF%BF%A5=%29
"
)
})
/**
* @tc.name: testUrlToString004
* @tc.desc: Returns a query string suitable for use in a URL.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlToString004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
d=value1&c=value2&b=大&4=key4
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
d=value1&c=value2&b=%E5%A4%A7&4=key4
"
)
})
/**
* @tc.name: testUrlToString005
* @tc.desc: Returns a query string suitable for use in a URL.
* @tc.require: AR000GFB2S
* @tc.author: maxiaodong
*/
it
(
'
testUrlToString005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
"
d=value1&c=value2&b= 大&4=key4&5=key5
"
)
params
.
append
(
"
1 12
"
,
"
QQQ
"
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
d=value1&c=value2&b=+%E5%A4%A7&4=key4&5=key5&1+12=QQQ
"
)
})
/**
* @tc.name: testUrlSearchParamsConstruction001
* @tc.desc: A parameterized constructor used to create an URLSearchParams instance.
* @tc.require: AR000GFB2S
* @tc.author: zhangyouyou
*/
it
(
'
testUrlSearchParamsConstruction001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
?user=abc&query=xyz
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
user=abc&query=xyz
"
)
})
/**
* @tc.name: testUrlSearchParamsConstruction002
* @tc.desc: A parameterized constructor used to create an URLSearchParams instance.
* @tc.require: AR000GFB2S
* @tc.author: zhangyouyou
*/
it
(
'
testUrlSearchParamsConstruction002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
({
user
:
'
abc
'
,
query
:
[
'
first
'
,
'
second
'
]
});
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
user=abc&query=first%2Csecond
"
)
})
/**
* @tc.name: testUrlSearchParamsConstruction003
* @tc.desc: A parameterized constructor used to create an URLSearchParams instance.
* @tc.require: AR000GFB2S
* @tc.author: zhangyouyou
*/
it
(
'
testUrlSearchParamsConstruction003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
([
[
'
user
'
,
'
abc
'
],
[
'
query
'
,
'
first
'
],
[
'
query
'
,
'
second
'
],
]);
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
user=abc&query=first&query=second
"
)
})
/**
* @tc.name: testUrlSearchParamsConstruction004
* @tc.desc: A parameterized constructor used to create an URLSearchParams instance.
* @tc.require: AR000GFB2S
* @tc.author: zhangyouyou
*/
it
(
'
testUrlSearchParamsConstruction004
'
,
0
,
function
()
{
const
map
=
new
Map
();
map
.
set
(
'
user
'
,
'
abc
'
);
map
.
set
(
'
query
'
,
'
xyz
'
);
let
params
=
new
Url
.
URLSearchParams
(
map
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
user=abc&query=xyz
"
)
})
/**
* @tc.name: testUrlSearchParamsConstruction005
* @tc.desc: A parameterized constructor used to create an URLSearchParams instance.
* @tc.require: AR000GFB2S
* @tc.author: zhangyouyou
*/
it
(
'
testUrlSearchParamsConstruction005
'
,
0
,
function
()
{
function
*
getQueryPairs
()
{
yield
[
'
user
'
,
'
abc
'
];
yield
[
'
query
'
,
'
first
'
];
yield
[
'
query
'
,
'
second
'
];
}
let
params
=
new
Url
.
URLSearchParams
(
getQueryPairs
());
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
user=abc&query=first&query=second
"
)
})
/**
* @tc.name: testUrlSearchParamsConstruction006
* @tc.desc: A parameterized constructor used to create an URLSearchParams instance.
* @tc.require: AR000GFB2S
* @tc.author: zhangyouyou
*/
it
(
'
testUrlSearchParamsConstruction006
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
()
params
.
append
(
'
abcde
'
,
'
fghki
'
)
var
paramsResult
=
params
.
toString
()
expect
(
paramsResult
).
assertEqual
(
'
abcde=fghki
'
)
})
/**
* @tc.name: testUrlSearchParamsConstruction007
* @tc.desc: A parameterized constructor used to create an URLSearchParams instance.
* @tc.require: AR000GFB2S
* @tc.author: zhangyouyou
*/
it
(
'
testUrlSearchParamsConstruction007
'
,
0
,
function
()
{
let
param
let
params
=
new
Url
.
URLSearchParams
(
param
)
params
.
append
(
'
abcde
'
,
'
fghki
'
)
var
paramsResult
=
params
.
toString
()
expect
(
paramsResult
).
assertEqual
(
'
abcde=fghki
'
)
})
/**
* @tc.name: testUrlToString001
* @tc.desc: Returns the serialized URL as a string.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlToString001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
http://username:password@host:8080/directory/file?query#fragment
"
)
})
/**
* @tc.name: testUrlToString002
* @tc.desc: Returns the serialized URL as a string.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlToString002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
http://username:password@host:8080/directory/file
"
)
})
/**
* @tc.name: testUrlToString003
* @tc.desc: Returns the serialized URL as a string.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlToString003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080#fragment
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
http://username:password@host:8080/#fragment
"
)
})
/**
* @tc.name: testUrlToString004
* @tc.desc: Returns the serialized URL as a string.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlToString004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http1://host/directory/file?query#fragment
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
http1://host/directory/file?query#fragment
"
)
})
/**
* @tc.name: testUrlToString005
* @tc.desc: Returns the serialized URL as a string.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlToString005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http:host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
"
http://host:8080/directory/file?query#fragment
"
)
})
/**
* @tc.name: testUrlHref001
* @tc.desc: Gets and sets the serialized URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHref001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
"
http://username:password@host:8080/directory/file?query#fragment
"
)
})
/**
* @tc.name: testUrlHref002
* @tc.desc: Gets and sets the serialized URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHref002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
"
http://host:8080/directory/file?query#fragment
"
)
})
/**
* @tc.name: testUrlHref003
* @tc.desc: Gets and sets the serialized URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHref003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
"
http://username:password@host:8080/
"
)
})
/**
* @tc.name: testUrlHref004
* @tc.desc: Gets and sets the serialized URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHref004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
href
=
'
http1://myhost/path?sss=1#ff
'
;
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
"
http1://myhost/path?sss=1#ff
"
)
})
/**
* @tc.name: testUrlHref005
* @tc.desc: Gets and sets the serialized URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHref005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
href
=
'
http://myhost:99/path#ff
'
;
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
"
http://myhost:99/path#ff
"
)
})
/**
* @tc.name: testUrlOrigin001
* @tc.desc: Gets the read-only serialization of the URL's origin.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlOrigin001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
origin
expect
(
result
).
assertEqual
(
'
http://host:8080
'
)
})
/**
* @tc.name: testUrlOrigin002
* @tc.desc: Gets the read-only serialization of the URL's origin.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlOrigin002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:11/directory/file?query#fragment
'
)
var
result
=
params
.
origin
expect
(
result
).
assertEqual
(
'
http://host:11
'
)
})
/**
* @tc.name: testUrlOrigin003
* @tc.desc: Gets the read-only serialization of the URL's origin.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlOrigin003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host/directory/file?query#fragment
'
)
var
result
=
params
.
origin
expect
(
result
).
assertEqual
(
'
http://host
'
)
})
/**
* @tc.name: testUrlOrigin004
* @tc.desc: Gets the read-only serialization of the URL's origin.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlOrigin004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@aaaasshost:212/directory/file?query#fragment
'
)
var
result
=
params
.
origin
expect
(
result
).
assertEqual
(
'
http://aaaasshost:212
'
)
})
/**
* @tc.name: testUrlOrigin005
* @tc.desc: Gets the read-only serialization of the URL's origin.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
Url_origin_test_005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host22:100#fragment
'
)
var
result
=
params
.
origin
expect
(
result
).
assertEqual
(
'
http://host22:100
'
)
})
/**
* @tc.name: testUrlProtocol001
* @tc.desc: Gets and sets the protocol portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlProtocol001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
protocol
expect
(
result
).
assertEqual
(
'
http:
'
)
})
/**
* @tc.name: testUrlProtocol002
* @tc.desc: Gets and sets the protocol portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlProtocol002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http1://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
protocol
expect
(
result
).
assertEqual
(
'
http1:
'
)
})
/**
* @tc.name: testUrlProtocol003
* @tc.desc: Gets and sets the protocol portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlProtocol003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
https://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
protocol
expect
(
result
).
assertEqual
(
'
https:
'
)
})
/**
* @tc.name: testUrlProtocol004
* @tc.desc: Gets and sets the protocol portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlProtocol004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
protocol
=
'
https:
'
;
var
result
=
params
.
protocol
expect
(
result
).
assertEqual
(
'
https:
'
)
})
/**
* @tc.name: testUrlProtocol005
* @tc.desc: Gets and sets the protocol portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlProtocol005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
protocol
=
'
ftp:
'
;
var
result
=
params
.
protocol
expect
(
result
).
assertEqual
(
'
ftp:
'
)
})
/**
* @tc.name: testUrlUsername001
* @tc.desc: Gets and sets the username portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlUsername001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
username
expect
(
result
).
assertEqual
(
'
username
'
)
})
/**
* @tc.name: testUrlUsername002
* @tc.desc: Gets and sets the username portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlUsername002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://zhao:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
username
expect
(
result
).
assertEqual
(
'
zhao
'
)
})
/**
* @tc.name: testUrlUsername003
* @tc.desc: Gets and sets the username portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlUsername003
'
,
0
,
function
()
{
console
.
log
(
'
testUrlUsername[start]
'
)
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
username
=
'
skk
'
console
.
log
(
'
testUrlUsername[
'
+
params
.
username
+
'
]
'
)
var
result
=
params
.
username
console
.
log
(
'
testUrlUsername[
'
+
result
+
'
]
'
)
expect
(
result
).
assertEqual
(
'
skk
'
)
})
/**
* @tc.name: testUrlUsername004
* @tc.desc: Gets and sets the username portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlUsername004
'
,
0
,
function
()
{
console
.
log
(
'
testUrlUsername[start]
'
)
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
username
=
'
skp111
'
console
.
log
(
'
testUrlUsername[
'
+
params
.
username
+
'
]
'
)
var
result
=
params
.
username
console
.
log
(
'
testUrlUsername[
'
+
result
+
'
]
'
)
expect
(
result
).
assertEqual
(
'
skp111
'
)
})
/**
* @tc.name: testUrlUsername005
* @tc.desc: Gets and sets the username portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlUsername005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://usme@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
username
expect
(
result
).
assertEqual
(
'
usme
'
)
})
/**
* @tc.name: testUrlPassword001
* @tc.desc: Gets and sets the password portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPassword001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:11@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
password
expect
(
result
).
assertEqual
(
'
11
'
)
})
/**
* @tc.name: testUrlPassword002
* @tc.desc: Gets and sets the password portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPassword002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:23aa@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
password
expect
(
result
).
assertEqual
(
'
23aa
'
)
})
/**
* @tc.name: testUrlPassword003
* @tc.desc: Gets and sets the password portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPassword003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
password
expect
(
result
).
assertEqual
(
''
)
})
/**
* @tc.name: testUrlPassword004
* @tc.desc: Gets and sets the password portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPassword004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
password
=
"
1234
"
var
result
=
params
.
password
expect
(
result
).
assertEqual
(
'
1234
'
)
})
/**
* @tc.name: testUrlPassword005
* @tc.desc: Gets and sets the password portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPassword005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
password
=
""
;
var
result
=
params
.
password
expect
(
result
).
assertEqual
(
''
)
})
/**
* @tc.name: testUrlHost001
* @tc.desc: Gets and sets the host portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHost001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
host
expect
(
result
).
assertEqual
(
'
host:8080
'
)
})
/**
* @tc.name: testUrlHost002
* @tc.desc: Gets and sets the host portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHost002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@hosthost/directory/file?query#fragment
'
)
var
result
=
params
.
host
expect
(
result
).
assertEqual
(
'
hosthost
'
)
})
/**
* @tc.name: testUrlHost003
* @tc.desc: Gets and sets the host portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHost003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:199/directory/file?query#fragment
'
)
var
result
=
params
.
host
expect
(
result
).
assertEqual
(
'
host:199
'
)
})
/**
* @tc.name: testUrlHost004
* @tc.desc: Gets and sets the host portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHost004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
host
=
'
jkjk
'
params
.
password
=
'
test
'
var
result
=
params
.
host
expect
(
result
).
assertEqual
(
'
jkjk:8080
'
)
})
/**
* @tc.name: testUrlHost005
* @tc.desc: Gets and sets the host portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHost005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
host
=
'
jkjk:100
'
var
result
=
params
.
host
expect
(
result
).
assertEqual
(
'
jkjk:100
'
)
})
/**
* @tc.name: testUrlHostname001
* @tc.desc: Gets and sets the host name portion of the URL,not include the port.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHostname001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
hostname
expect
(
result
).
assertEqual
(
'
host
'
)
})
/**
* @tc.name: testUrlHostname002
* @tc.desc: Gets and sets the host name portion of the URL,not include the port.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHostname002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host123:8080/directory/file?query#fragment
'
)
var
result
=
params
.
hostname
expect
(
result
).
assertEqual
(
'
host123
'
)
})
/**
* @tc.name: testUrlHostname003
* @tc.desc: Gets and sets the host name portion of the URL,not include the port.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHostname003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@885ssa:8080/directory/file?query#fragment
'
)
var
result
=
params
.
hostname
expect
(
result
).
assertEqual
(
'
885ssa
'
)
})
/**
* @tc.name: testUrlHostname004
* @tc.desc: Gets and sets the host name portion of the URL,not include the port.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHostname004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
hostname
=
'
sksk
'
var
result
=
params
.
hostname
expect
(
result
).
assertEqual
(
'
sksk
'
)
})
/**
* @tc.name: testUrlHostname005
* @tc.desc: Gets and sets the host name portion of the URL,not include the port.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHostname005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
hostname
=
'
hosthost
'
var
result
=
params
.
hostname
expect
(
result
).
assertEqual
(
'
hosthost
'
)
})
/**
* @tc.name: testUrlPort001
* @tc.desc: Gets and sets the port portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPort001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
port
expect
(
result
).
assertEqual
(
'
8080
'
)
})
/**
* @tc.name: testUrlPort002
* @tc.desc: Gets and sets the port portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPort002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:100/directory/file?query#fragment
'
)
var
result
=
params
.
port
expect
(
result
).
assertEqual
(
'
100
'
)
})
/**
* @tc.name: testUrlPort003
* @tc.desc: Gets and sets the port portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPort003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host/directory/file?query#fragment
'
)
var
result
=
params
.
port
expect
(
result
).
assertEqual
(
''
)
})
/**
* @tc.name: testUrlPort004
* @tc.desc: Gets and sets the port portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPort004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
port
=
'
99
'
var
result
=
params
.
port
expect
(
result
).
assertEqual
(
'
99
'
)
})
/**
* @tc.name: testUrlPort005
* @tc.desc: Gets and sets the port portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPort005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
port
=
'
123
'
var
result
=
params
.
port
expect
(
result
).
assertEqual
(
'
123
'
)
})
/**
* @tc.name: testUrlPathname001
* @tc.desc: Gets and sets the path portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPathname001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
pathname
expect
(
result
).
assertEqual
(
'
/directory/file
'
)
})
/**
* @tc.name: testUrlPathname002
* @tc.desc: Gets and sets the path portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPathname002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory?query#fragment
'
)
var
result
=
params
.
pathname
expect
(
result
).
assertEqual
(
'
/directory
'
)
})
/**
* @tc.name: testUrlPathname003
* @tc.desc: Gets and sets the path portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPathname003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080?query#fragment
'
)
var
result
=
params
.
pathname
expect
(
result
).
assertEqual
(
'
/
'
)
})
/**
* @tc.name: testUrlPathname004
* @tc.desc: Gets and sets the path portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPathname004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
pathname
=
'
path
'
var
result
=
params
.
pathname
expect
(
result
).
assertEqual
(
'
/path
'
)
})
/**
* @tc.name: testUrlPathname005
* @tc.desc: Gets and sets the path portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlPathname005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
pathname
=
'
/directory/file11
'
var
result
=
params
.
pathname
expect
(
result
).
assertEqual
(
'
/directory/file11
'
)
})
/**
* @tc.name: testUrlSearch001
* @tc.desc: Gets and sets the serialized query portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlSearch001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=qqqq#fragment
'
)
var
result
=
params
.
search
expect
(
result
).
assertEqual
(
'
?query=qqqq
'
)
})
/**
* @tc.name: testUrlSearch002
* @tc.desc: Gets and sets the serialized query portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlSearch002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=qqqq&ll=pp#fragment
'
)
var
result
=
params
.
search
expect
(
result
).
assertEqual
(
'
?query=qqqq&ll=pp
'
)
})
/**
* @tc.name: testUrlSearch003
* @tc.desc: Gets and sets the serialized query portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlSearch003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?ppp9875=77#fragment
'
)
var
result
=
params
.
search
expect
(
result
).
assertEqual
(
'
?ppp9875=77
'
)
})
/**
* @tc.name: testUrlSearch004
* @tc.desc: Gets and sets the serialized query portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlSearch004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=qqqq#fragment
'
)
params
.
search
=
'
kk=99
'
var
result
=
params
.
search
expect
(
result
).
assertEqual
(
'
?kk=99
'
)
})
/**
* @tc.name: testUrlSearch005
* @tc.desc: Gets and sets the serialized query portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlSearch005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=qqqq#fragment
'
)
params
.
search
=
'
pppk=99
'
var
result
=
params
.
search
expect
(
result
).
assertEqual
(
'
?pppk=99
'
)
})
/**
* @tc.name: testUrlHash001
* @tc.desc: Gets and sets the fragment portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHash001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#fragment
'
)
var
result
=
params
.
hash
expect
(
result
).
assertEqual
(
'
#fragment
'
)
})
/**
* @tc.name: testUrlHash002
* @tc.desc: Gets and sets the fragment portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHash002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#fragment
'
)
params
.
hash
=
'
123456
'
var
result
=
params
.
hash
expect
(
result
).
assertEqual
(
'
#123456
'
)
})
/**
* @tc.name: testUrlHash003
* @tc.desc: Gets and sets the fragment portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHash003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#poiu
'
)
var
result
=
params
.
hash
expect
(
result
).
assertEqual
(
'
#poiu
'
)
})
/**
* @tc.name: testUrlHash004
* @tc.desc: Gets and sets the fragment portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHash004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp
'
)
var
result
=
params
.
hash
expect
(
result
).
assertEqual
(
''
)
})
/**
* @tc.name: testUrlHash005
* @tc.desc: Gets and sets the fragment portion of the URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlHash005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#fragment
'
)
params
.
hash
=
'
qwer
'
var
result
=
params
.
hash
expect
(
result
).
assertEqual
(
'
#qwer
'
)
})
/**
* @tc.name: testUrlToJson001
* @tc.desc: Returns the serialized URL as a string.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlToJson001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
)
var
result
=
params
.
toJSON
()
expect
(
result
).
assertEqual
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
)
})
/**
* @tc.name: testUrlToJson002
* @tc.desc: Returns the serialized URL as a string.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlToJson002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://host:8080/directory/file?query=pppppp#qwer=da
'
)
var
result
=
params
.
toJSON
()
expect
(
result
).
assertEqual
(
'
http://host:8080/directory/file?query=pppppp#qwer=da
'
)
})
/**
* @tc.name: testUrlToJson003
* @tc.desc: Returns the serialized URL as a string.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlToJson003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080
'
)
var
result
=
params
.
toJSON
()
expect
(
result
).
assertEqual
(
'
http://username:password@host:8080/
'
)
})
/**
* @tc.name: testUrlToJson004
* @tc.desc: Returns the serialized URL as a string.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlToJson004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http11://username:password@host:8080?query=pppppp#qwer=da
'
)
var
result
=
params
.
toJSON
()
expect
(
result
).
assertEqual
(
'
http11://username:password@host:8080?query=pppppp#qwer=da
'
)
})
/**
* @tc.name: testUrlToJson005
* @tc.desc: Returns the serialized URL as a string.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlToJson005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory
'
)
var
result
=
params
.
toJSON
()
expect
(
result
).
assertEqual
(
'
http://username:password@host:8080/directory
'
)
})
/**
* @tc.name: testUrlIPv6001
* @tc.desc: Gets and sets the serialized URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlIPv6001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/index.html
'
)
})
/**
* @tc.name: testUrlIPv6002
* @tc.desc: Gets and sets the serialized URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlIPv6002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://[1080:0:0:0:8:800:200C:417A]/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://[1080::8:800:200c:417a]/index.html
'
)
})
/**
* @tc.name: testUrlIPv6003
* @tc.desc: Gets and sets the serialized URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlIPv6003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://[::FFFF:129.144.52.38]:80/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://[::ffff:8190:3426]/index.html
'
)
})
/**
* @tc.name: testUrlIPv4001
* @tc.desc: Gets and sets the serialized URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlIPv4001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://0377.0xff.255.1:80/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://255.255.255.1/index.html
'
)
})
/**
* @tc.name: testUrlIPv4002
* @tc.desc: Gets and sets the serialized URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlIPv4002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://0377.0xff.255.g/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://0377.0xff.255.g/index.html
'
)
})
/**
* @tc.name: testUrlIPv4003
* @tc.desc: Gets and sets the serialized URL.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlIPv4003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://190.254.245.9:80/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://190.254.245.9/index.html
'
)
})
/**
* @tc.name: testUrlConstruction001
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
https://developer.mozilla.org
'
,)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
https://developer.mozilla.org/
'
)
})
/**
* @tc.name: testUrlConstruction002
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
https://developer.mozilla.org
'
,
'
flie:/developer.mozilla.org
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
https://developer.mozilla.org/
'
)
})
/**
* @tc.name: testUrlConstruction003
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
https://developer.mozilla.org
'
,
'
ftp://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
https://developer.mozilla.org/
'
)
})
/**
* @tc.name: testUrlConstruction004
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
'
,
'
http://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://www.example.com/
'
)
})
/**
* @tc.name: testUrlConstruction005
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
.
'
,
'
http://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://www.example.com/
'
)
})
/**
* @tc.name: testUrlConstruction006
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction006
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
../h:
'
,
'
http://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://www.example.com/h:
'
)
})
/**
* @tc.name: testUrlConstruction007
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction007
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
/sca/./path/path/../scasa/jjjjj
'
,
'
http://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://www.example.com/sca/path/scasa/jjjjj
'
)
})
/**
* @tc.name: testUrlConstruction008
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction008
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
/../sca/./path/path/../scasa/jjjjj
'
,
'
http://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://www.example.com/sca/path/scasa/jjjjj
'
)
})
/**
* @tc.name: testUrlConstruction009
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction009
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
/../sca/./path/path/../scasa/jjjjj
'
,
'
file://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
file://www.example.com/sca/path/scasa/jjjjj
'
)
})
/**
* @tc.name: testUrlConstruction010
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction010
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
/../sca/./path/path/../scasa/jjjjj
'
,
'
file1://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
file1://www.example.com/sca/path/scasa/jjjjj
'
)
})
/**
* @tc.name: testUrlConstruction011
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
Url_construction_test_011
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
htt1p://www.0902zy.cn/path?abc=123&def=456#yyyy
'
)
let
params1
=
new
Url
.
URL
(
'
www.baidu.com/ssaa
'
,
params
)
var
result
=
params1
.
href
expect
(
result
).
assertEqual
(
'
htt1p://www.0902zy.cn/www.baidu.com/ssaa
'
)
})
/**
* @tc.name: testUrlConstruction012
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction012
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
htt1p://www.0902zy.cn/path?abc=123&def=456#yyyy
'
)
let
params1
=
new
Url
.
URL
(
'
//www.baidu.com/ssaa
'
,
params
)
var
result
=
params1
.
href
expect
(
result
).
assertEqual
(
'
htt1p://www.baidu.com/ssaa
'
)
})
/**
* @tc.name: testUrlConstruction013
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction013
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
htt1p://www.0902zy.cn/path?abc=123&def=456#yyyy
'
)
let
params1
=
new
Url
.
URL
(
''
,
params
)
var
result
=
params1
.
href
expect
(
result
).
assertEqual
(
'
htt1p://www.0902zy.cn/path?abc=123&def=456#yyyy
'
)
})
/**
* @tc.name: testUrlConstruction014
* @tc.desc: URL constructor, which is used to instantiate a URL object.
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it
(
'
testUrlConstruction014
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
htt1p://www.0902zy.cn/path?abc=123&def=456#yyyy
'
)
var
result
=
params
.
searchParams
.
toString
();
expect
(
result
).
assertEqual
(
'
abc=123&def=456
'
)
})
})
\ No newline at end of file
compileruntime/url_lib_standard/src/main/js/test/ExampleJsunit.test.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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
app
from
'
@system.app
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/lite
'
describe
(
'
appInfoTest
'
,
function
()
{
it
(
'
app_info_test_001
'
,
0
,
function
()
{
var
info
=
app
.
getInfo
()
expect
(
info
.
versionCode
).
assertEqual
(
'
1000000
'
)
})
})
\ No newline at end of file
compileruntime/url_lib_standard/src/main/js/test/url.test.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/lite
'
import
Url
from
'
@ohos.url
'
describe
(
'
Url_mxa_jk_Test
'
,
function
()
{
it
(
'
Url_append_test_001
'
,
0
,
function
()
{
var
that
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?foo=1&bar=2
'
)
var
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
params
.
append
(
'
ma
'
,
'
jk
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
foo=1&bar=2&ma=jk
'
)
})
it
(
'
Url_append_test_002
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
)
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
params
.
append
(
'
ma 大
'
,
'
jk¥
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
foo=1&bar=2&ma+%E5%A4%A7=jk%EF%BF%A5
'
)
})
it
(
'
Url_append_test_003
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
)
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
params
.
append
(
'
foo~!@#$%^&*()_+-=
'
,
'
jk
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
foo=1&bar=2&foo%7E%21%40%23%24%25%5E%26*%28%29_%2B-%3D=jk
'
)
})
it
(
'
Url_delete_test_001
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo=1&bar=2
'
)
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
params
.
delete
(
'
foo
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
bar=2
'
)
})
it
(
'
Url_delete_test_002
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo大=1&bar=2
'
)
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
params
.
delete
(
'
foo
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
foo%E5%A4%A7=1&bar=2
'
)
})
it
(
'
Url_delete_test_003
'
,
0
,
function
()
{
let
that
=
new
Url
.
URL
(
'
https://example.com?foo大=1&bar=2
'
)
let
params
=
new
Url
.
URLSearchParams
(
that
.
search
)
params
.
delete
(
'
foo大
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
bar=2
'
)
})
it
(
'
Url_entries_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
.
entries
())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
1
]).
assertEqual
(
'
value1
'
)
})
it
(
'
Url_entries_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
.
entries
())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
2
]).
assertEqual
(
'
key2
'
)
})
it
(
'
Url_entries_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
params
.
append
(
'
foo
'
,
'
jk
'
)
var
i
=
0
;
var
arr
=
{};
for
(
var
pair
of
params
.
entries
())
{
arr
[
i
]
=
pair
[
0
];
i
++
;
arr
[
i
]
=
pair
[
1
];
i
++
;
}
expect
(
arr
[
5
]).
assertEqual
(
'
jk
'
)
})
it
(
'
Url_forEach_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
var
arr
=
{};
var
i
=
0
;
function
func
(
str1
,
str2
,
params
)
{
arr
[
i
]
=
'
key=
'
+
str1
+
'
'
+
'
value=
'
+
str2
+
'
'
+
'
flag=
'
+
params
i
++
;
}
params
.
forEach
(
func
)
expect
(
arr
[
0
]).
assertEqual
(
'
key=key1 value=value1 flag=key1=value1&key2=value2
'
)
})
it
(
'
Url_forEach_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
var
arr
=
{};
var
i
=
0
;
function
func
(
str1
,
str2
,
params
)
{
arr
[
i
]
=
'
key=
'
+
str1
+
'
'
+
'
value=
'
+
str2
+
'
'
+
'
flag=
'
+
params
i
++
;
}
params
.
forEach
(
func
)
expect
(
arr
[
1
]).
assertEqual
(
'
key=key2 value=value2 flag=key1=value1&key2=value2
'
)
})
it
(
'
Url_forEach_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
params
.
append
(
'
foo
'
,
'
jk
'
)
var
arr
=
{};
var
i
=
0
;
function
func
(
str1
,
str2
,
params
)
{
arr
[
i
]
=
'
key=
'
+
str1
+
'
'
+
'
value=
'
+
str2
+
'
'
+
'
flag=
'
+
params
i
++
;
}
params
.
forEach
(
func
)
expect
(
arr
[
2
]).
assertEqual
(
'
key=foo value=jk flag=key1=value1&key2=value2&foo=jk
'
)
})
it
(
'
Url_get_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
var
result
=
params
.
get
(
'
1
'
)
expect
(
result
).
assertEqual
(
undefined
)
})
it
(
'
Url_get_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
var
result
=
params
.
get
(
'
key2
'
)
expect
(
result
).
assertEqual
(
'
value2
'
)
})
it
(
'
Url_get_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
params
.
append
(
'
5
'
,
'
JKL
'
)
var
result
=
params
.
get
(
'
5
'
)
expect
(
result
).
assertEqual
(
'
JKL
'
)
})
it
(
'
Url_getAll_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2
'
)
params
.
append
(
'
key1
'
,
'
AAA
'
)
var
result
=
params
.
getAll
(
'
key1
'
)
expect
(
result
).
assertEqual
(
'
value1,AAA
'
)
})
it
(
'
Url_getAll_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&8=DEF
'
)
params
.
append
(
'
8
'
,
'
A8A
'
)
var
result
=
params
.
getAll
(
'
8
'
)
expect
(
result
).
assertEqual
(
'
DEF,A8A
'
)
})
it
(
'
Url_getAll_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2&key3=大
'
)
params
.
append
(
'
key3
'
,
'
A3A
'
)
var
result
=
params
.
getAll
(
'
key3
'
)
expect
(
result
).
assertEqual
(
'
大,A3A
'
)
})
it
(
'
Url_has_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
key1=value1&key2=value2&key3=大
'
)
var
result
=
params
.
has
(
'
2
'
)
expect
(
result
).
assertEqual
(
false
)
})
it
(
'
Url_has_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
小=value1&key2=value2&key3=大
'
)
var
result
=
params
.
has
(
'
小
'
)
expect
(
result
).
assertEqual
(
true
)
})
it
(
'
Url_has_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
小=value1&¥=value2&key3=大
'
)
params
.
append
(
'
¥
'
,
'
ACA
'
)
var
result
=
params
.
has
(
'
¥
'
)
expect
(
result
).
assertEqual
(
true
)
})
it
(
'
Url_keys_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
小=value1&¥=value2&key3=大
'
)
var
arr
=
{};
var
i
=
0
;
for
(
var
key
of
params
.
keys
())
{
arr
[
i
]
=
key
;
i
++
;
}
expect
(
arr
[
0
]).
assertEqual
(
'
小
'
)
})
it
(
'
Url_keys_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
小=value1&¥=value2&key3=大
'
)
var
arr
=
{};
var
i
=
0
;
for
(
var
key
of
params
.
keys
())
{
arr
[
i
]
=
key
;
i
++
;
}
expect
(
arr
[
1
]).
assertEqual
(
'
¥
'
)
})
it
(
'
Url_keys_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
小=value1&¥=value2&key3=大
'
)
var
arr
=
{};
var
i
=
0
;
for
(
var
key
of
params
.
keys
())
{
arr
[
i
]
=
key
;
i
++
;
}
expect
(
arr
[
2
]).
assertEqual
(
'
key3
'
)
})
it
(
'
Url_set_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
1=value1&2=value2&key3=3
'
)
params
.
set
(
'
11
'
,
'
CCC
'
)
var
res
=
params
.
toString
()
expect
(
res
).
assertEqual
(
'
1=value1&2=value2&key3=3&11=CCC
'
)
})
it
(
'
Url_set_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
1=value1&2=value2&key3=3
'
)
params
.
set
(
'
10
'
,
'
BBB
'
)
var
res
=
params
.
toString
()
expect
(
res
).
assertEqual
(
'
1=value1&2=value2&key3=3&10=BBB
'
)
})
it
(
'
Url_set_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
1=value1&2=value2&key3=3
'
)
params
.
set
(
'
ma 大
'
,
'
10¥
'
)
var
res
=
params
.
toString
()
expect
(
res
).
assertEqual
(
'
1=value1&2=value2&key3=3&ma+%E5%A4%A7=10%EF%BF%A5
'
)
})
it
(
'
Url_sort_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
1=value1&3=value3&2=key2
'
)
params
.
sort
()
var
res
=
params
.
toString
()
expect
(
res
).
assertEqual
(
'
1=value1&2=key2&3=value3
'
)
})
it
(
'
Url_sort_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
a=value1&c=value2&b=key2
'
)
params
.
sort
()
var
res
=
params
.
toString
()
expect
(
res
).
assertEqual
(
'
a=value1&b=key2&c=value2
'
)
})
it
(
'
Url_sort_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
d=value1&c=value2&b=33
'
)
params
.
append
(
'
a
'
,
'
ACA
'
)
params
.
sort
()
var
res
=
params
.
toString
()
expect
(
res
).
assertEqual
(
'
a=ACA&b=33&c=value2&d=value1
'
)
})
it
(
'
Url_Values_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
d=value1&c=value2&b=大
'
)
var
arr
=
{};
var
i
=
0
;
for
(
var
value
of
params
.
values
())
{
arr
[
i
]
=
value
;
i
++
;
}
expect
(
arr
[
0
]).
assertEqual
(
'
value1
'
)
})
it
(
'
Url_Values_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
d=value1&c=value2&b=大
'
)
var
arr
=
{};
var
i
=
0
;
for
(
var
value
of
params
.
values
())
{
arr
[
i
]
=
value
;
i
++
;
}
expect
(
arr
[
1
]).
assertEqual
(
'
value2
'
)
})
it
(
'
Url_Values_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
d=value1&c=value2&b=大
'
)
params
.
append
(
'
a
'
,
'
ACA
'
)
var
arr
=
{};
var
i
=
0
;
for
(
var
value
of
params
.
values
())
{
arr
[
i
]
=
value
;
i
++
;
}
expect
(
arr
[
3
]).
assertEqual
(
'
ACA
'
)
})
it
(
'
Url_toString_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
d=value1&c=value2&b=大
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
d=value1&c=value2&b=%E5%A4%A7
'
)
})
it
(
'
Url_toString_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
d=value1&c=value2&b= 大
'
)
params
.
append
(
'
1 12
'
,
'
QQQ
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
d=value1&c=value2&b=+%E5%A4%A7&1+12=QQQ
'
)
})
it
(
'
Url_toString_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
¥=)
'
)
params
.
delete
(
'
5
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
%EF%BF%A5=%29
'
)
})
//new url SearchParams
it
(
'
Url_construction_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
(
'
?user=abc&query=xyz
'
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
user=abc&query=xyz
'
)
})
it
(
'
Url_construction_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
({
user
:
'
abc
'
,
query
:
[
'
first
'
,
'
second
'
]
})
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
user=abc&query=first%2Csecond
'
)
})
it
(
'
Url_construction_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URLSearchParams
([
[
'
user
'
,
'
abc
'
],
[
'
query
'
,
'
first
'
],
[
'
query
'
,
'
second
'
],
])
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
user=abc&query=first&query=second
'
)
})
it
(
'
Url_construction_test_004
'
,
0
,
function
()
{
const
map
=
new
Map
()
map
.
set
(
'
user
'
,
'
abc
'
)
map
.
set
(
'
query
'
,
'
xyz
'
)
let
params
=
new
Url
.
URLSearchParams
(
map
)
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
user=abc&query=xyz
'
)
})
it
(
'
Url_construction_test_004
'
,
0
,
function
()
{
function
*
getQueryPairs
()
{
yield
[
'
user
'
,
'
abc
'
]
yield
[
'
query
'
,
'
first
'
]
yield
[
'
query
'
,
'
second
'
]
}
let
params
=
new
Url
.
URLSearchParams
(
getQueryPairs
())
var
result
=
params
.
toString
()
expect
(
result
).
assertEqual
(
'
user=abc&query=first&query=second
'
)
})
//new url - get
it
(
'
Url_to_string_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
to_string
()
expect
(
result
).
assertEqual
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
})
it
(
'
Url_href_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
})
it
(
'
Url_origin_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
origin
expect
(
result
).
assertEqual
(
'
http://host:8080
'
)
})
it
(
'
Url_protocol_test_004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
protocol
expect
(
result
).
assertEqual
(
'
http:
'
)
})
it
(
'
Url_username_test_005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
username
expect
(
result
).
assertEqual
(
'
username
'
)
})
it
(
'
Url_password_test_006
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
password
expect
(
result
).
assertEqual
(
'
password
'
)
})
it
(
'
Url_host_test_007
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
host
expect
(
result
).
assertEqual
(
'
host:8080
'
)
})
it
(
'
Url_hostname_test_008
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
hostname
expect
(
result
).
assertEqual
(
'
host
'
)
})
it
(
'
Url_port_test_009
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
port
expect
(
result
).
assertEqual
(
'
8080
'
)
})
it
(
'
Url_pathname_test_010
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
var
result
=
params
.
pathname
expect
(
result
).
assertEqual
(
'
/directory/file
'
)
})
it
(
'
Url_search_test_011
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=qqqq#fragment
'
)
var
result
=
params
.
search
expect
(
result
).
assertEqual
(
'
?query=qqqq
'
)
})
it
(
'
Url_search_test_012
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#fragment
'
)
var
result
=
params
.
search
expect
(
result
).
assertEqual
(
'
?query=pppppp
'
)
})
it
(
'
Url_hash_test_013
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#fragment
'
)
var
result
=
params
.
hash
expect
(
result
).
assertEqual
(
'
#fragment
'
)
})
//new url - set
it
(
'
Url_href_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
href
=
'
http://[::192.9.5.5]/ipng
'
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://[::c009:505]/ipng
'
)
})
it
(
'
Url_protocol_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
protocol
=
'
https:
'
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
https://username:password@host:8080/directory/file?query#fragment
'
)
})
it
(
'
Url_username_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
username
=
'
username1
'
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://username1:password@host:8080/directory/file?query#fragment
'
)
})
it
(
'
Url_password_test_004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
password
=
'
passwd
'
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://username:passwd@host:8080/directory/file?query#fragment
'
)
})
it
(
'
Url_host_test_005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
host
=
'
www.baidu.com:99
'
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://username:password@www.baidu.com:99/directory/file?query#fragment
'
)
})
it
(
'
Url_hostname_test_006
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
hostname
=
'
www.baidu.com
'
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://username:password@www.baidu.com:8080/directory/file?query#fragment
'
)
})
it
(
'
Url_port_test_007
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
port
=
'
99
'
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://username:password@host:99/directory/file?query#fragment
'
)
})
it
(
'
Url_pathname_test_008
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query#fragment
'
)
params
.
pathname
=
'
/path/ddd
'
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://username:password@host:8080/path/ddd?query#fragment
'
)
})
it
(
'
Url_search_test_009
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=qqqq#fragment
'
)
params
.
search
=
'
?pppppp=1234
'
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://username:password@host:8080/directory/file?pppppp=1234#fragment
'
)
})
it
(
'
Url_hash_test_010
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#fragment
'
)
params
.
hash
=
'
#qwer=da
'
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
)
})
//new url JSON
it
(
'
Url_toJSON_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
)
var
result
=
params
.
toJSON
()
expect
(
result
).
assertEqual
(
'
http://username:password@host:8080/directory/file?query=pppppp#qwer=da
'
)
})
//new url IPV6
it
(
'
Url_IPV6_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/index.html
'
)
})
it
(
'
Url_IPV6_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://[1080:0:0:0:8:800:200C:417A]/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://[1080::8:800:200c:417a]/index.html
'
)
})
it
(
'
Url_IPV6_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://[::FFFF:129.144.52.38]:80/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://[::ffff:8190:3426]/index.html
'
)
})
//new url IPV4
it
(
'
Url_IPV4_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://0377.0xff.255.1:80/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://255.255.255.1/index.html
'
)
})
it
(
'
Url_IPV4_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://0377.0xff.255.g/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://0377.0xff.255.g/index.html
'
)
})
it
(
'
Url_IPV4_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
http://190.254.245.9:80/index.html
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://190.254.245.9/index.html
'
)
})
//new url url_base
it
(
'
Url_base_test_001
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
https://developer.mozilla.org
'
,)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
https://developer.mozilla.org/
'
)
})
it
(
'
Url_base_test_002
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
https://developer.mozilla.org
'
,
'
flie:/developer.mozilla.org
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
https://developer.mozilla.org/
'
)
})
it
(
'
Url_base_test_003
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
https://developer.mozilla.org
'
,
'
ftp://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
https://developer.mozilla.org/
'
)
})
it
(
'
Url_base_test_004
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
'
,
'
http://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://www.example.com/
'
)
})
it
(
'
Url_base_test_005
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
.
'
,
'
http://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://www.example.com/
'
)
})
it
(
'
Url_base_test_006
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
../h:
'
,
'
http://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://www.example.com/h:
'
)
})
it
(
'
Url_base_test_007
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
/sca/./path/path/../scasa/jjjjj
'
,
'
http://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://www.example.com/sca/path/scasa/jjjjj
'
)
})
it
(
'
Url_base_test_008
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
sca/./path/path/../scasa/jjjjj
'
,
'
http://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://www.example.com/sca/path/scasa/jjjjj
'
)
})
it
(
'
Url_base_test_009
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
/../sca/./path/path/../scasa/jjjjj
'
,
'
http://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
http://www.example.com/sca/path/scasa/jjjjj
'
)
})
it
(
'
Url_base_test_010
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
/../sca/./path/path/../scasa/jjjjj
'
,
'
file://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
file://www.example.com/sca/path/scasa/jjjjj
'
)
})
it
(
'
Url_base_test_011
'
,
0
,
function
()
{
let
params
=
new
Url
.
URL
(
'
/../sca/./path/path/../scasa/jjjjj
'
,
'
file1://www.example.com
'
)
var
result
=
params
.
href
expect
(
result
).
assertEqual
(
'
file1://www.example.com/sca/path/scasa/jjjjj
'
)
})
})
\ No newline at end of file
compileruntime/url_lib_standard/src/main/resources/base/element/string.json
浏览文件 @
4423bbd2
{
"string"
:
[
{
"name"
:
"
entry_MainAbility
"
,
"value"
:
"
entry_MainAbility
"
"name"
:
"
app_name
"
,
"value"
:
"
OsAccountTest
"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_
Empty
Ability"
"value"
:
"JS_
Phone_Empty Feature
Ability"
}
]
}
\ No newline at end of file
compileruntime/url_lib_standard/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
4423bbd2
6.6 KB
compileruntime/url_lib_standard/src/ohosTest/js/default/app.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
TestApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
TestApplication onDestroy
'
);
}
};
compileruntime/url_lib_standard/src/ohosTest/js/default/i18n/en-US.json
已删除
100644 → 0
浏览文件 @
c7f41830
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
},
"Files"
:
{
}
}
\ No newline at end of file
compileruntime/url_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json
已删除
100644 → 0
浏览文件 @
c7f41830
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
}
\ No newline at end of file
compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.css
已删除
100644 → 0
浏览文件 @
c7f41830
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.hml
已删除
100644 → 0
浏览文件 @
c7f41830
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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
file
from
'
@system.file
'
import
app
from
'
@system.app
'
import
device
from
'
@system.device
'
import
router
from
'
@system.router
'
import
{
Core
,
Constant
,
ExpectExtend
,
ReportExtend
,
InstrumentLog
}
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
'
})
const
reportExtend
=
new
ReportExtend
(
file
)
const
instrumentLog
=
new
InstrumentLog
({
'
id
'
:
'
report
'
,
'
version
'
:
'
1.0.3
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
addService
(
'
report
'
,
reportExtend
)
core
.
addService
(
'
report
'
,
instrumentLog
)
core
.
init
()
core
.
subscribeEvent
(
'
spec
'
,
instrumentLog
)
core
.
subscribeEvent
(
'
suite
'
,
instrumentLog
)
core
.
subscribeEvent
(
'
task
'
,
instrumentLog
)
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
\ No newline at end of file
compileruntime/url_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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
app
from
'
@system.app
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
appInfoTest
'
,
function
()
{
it
(
'
app_info_test_001
'
,
0
,
function
()
{
var
info
=
app
.
getInfo
()
expect
(
info
.
versionName
).
assertEqual
(
'
1.0
'
)
expect
(
info
.
versionCode
).
assertEqual
(
'
3
'
)
})
})
\ No newline at end of file
compileruntime/url_lib_standard/src/ohosTest/js/test/List.test.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
require
(
'
./ExampleJsunit.test.js
'
)
\ No newline at end of file
compileruntime/url_lib_standard/src/ohosTest/resources/base/element/string.json
已删除
100644 → 0
浏览文件 @
c7f41830
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"URL"
},
{
"name"
:
"mainability_description"
,
"value"
:
"hap sample empty page"
}
]
}
compileruntime/util_lib_standard/src/main/config.json
浏览文件 @
4423bbd2
...
...
@@ -5,6 +5,10 @@
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
}
},
"deviceConfig"
:
{},
...
...
@@ -23,6 +27,7 @@
},
"abilities"
:
[
{
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
...
...
@@ -49,7 +54,7 @@
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
tru
e
"autoDesignWidth"
:
fals
e
}
}
]
...
...
compileruntime/util_lib_standard/src/main/java/com/example/childprocess/MainAbility.java
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
package
com.example.childprocess
;
import
ohos.ace.ability.AceAbility
;
import
ohos.aafwk.content.Intent
;
public
class
MainAbility
extends
AceAbility
{
@Override
public
void
onStart
(
Intent
intent
)
{
super
.
onStart
(
intent
);
}
@Override
public
void
onStop
()
{
super
.
onStop
();
}
}
compileruntime/util_lib_standard/src/main/java/com/example/childprocess/MyApplication.java
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
package
com.example.childprocess
;
import
ohos.aafwk.ability.AbilityPackage
;
public
class
MyApplication
extends
AbilityPackage
{
@Override
public
void
onInitialize
()
{
super
.
onInitialize
();
}
}
compileruntime/util_lib_standard/src/main/java/com/example/url/MainAbility.java
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
package
com.example.url
;
import
ohos.ace.ability.AceAbility
;
import
ohos.aafwk.content.Intent
;
public
class
MainAbility
extends
AceAbility
{
@Override
public
void
onStart
(
Intent
intent
)
{
super
.
onStart
(
intent
);
}
@Override
public
void
onStop
()
{
super
.
onStop
();
}
}
compileruntime/util_lib_standard/src/main/java/com/example/url/MyApplication.java
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
package
com.example.url
;
import
ohos.aafwk.ability.AbilityPackage
;
public
class
MyApplication
extends
AbilityPackage
{
@Override
public
void
onInitialize
()
{
super
.
onInitialize
();
}
}
compileruntime/util_lib_standard/src/main/js/default/app.js
浏览文件 @
4423bbd2
/*
* Copyright (C) 2021 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 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,
* 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
'
);
...
...
compileruntime/util_lib_standard/src/main/js/default/pages/index/index.css
浏览文件 @
4423bbd2
...
...
@@ -5,40 +5,5 @@
}
.title
{
font-size
:
40px
;
color
:
#000000
;
opacity
:
0.9
;
}
@media
screen
and
(
device-type
:
tablet
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
100px
;
}
}
@media
screen
and
(
device-type
:
wearable
)
{
.title
{
font-size
:
28px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
tv
)
{
.container
{
background-image
:
url("../../common/images/Wallpaper.png")
;
background-size
:
cover
;
background-repeat
:
no-repeat
;
background-position
:
center
;
}
.title
{
font-size
:
100px
;
color
:
#FFFFFF
;
}
}
@media
screen
and
(
device-type
:
phone
)
and
(
orientation
:
landscape
)
{
.title
{
font-size
:
60px
;
}
}
compileruntime/util_lib_standard/src/main/js/default/pages/index/index.hml
浏览文件 @
4423bbd2
<div class="container"
onswipe="touchMove"
>
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{
title
}}
{{ $t('strings.hello') }} {{
title
}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
\ No newline at end of file
compileruntime/util_lib_standard/src/main/js/default/pages/index/index.js
浏览文件 @
4423bbd2
...
...
@@ -12,12 +12,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
file
from
'
@system.file
'
import
app
from
'
@system.app
'
import
device
from
'
@system.device
'
import
router
from
'
@system.router
'
import
{
Core
}
from
'
deccjsunit/lite
'
import
{
Core
,
Constant
,
ExpectExtend
,
ReportExtend
,
InstrumentLog
}
from
'
deccjsunit/index
'
export
default
{
data
:
{
...
...
@@ -30,7 +30,7 @@ export default {
console
.
info
(
'
onShow finish
'
)
const
core
=
Core
.
getInstance
()
core
.
init
()
require
(
'
../../
../
test/List.test
'
)
require
(
'
../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
...
...
compileruntime/util_lib_standard/src/main/js/test/List.test.js
→
compileruntime/util_lib_standard/src/main/js/
default/
test/List.test.js
浏览文件 @
4423bbd2
...
...
@@ -13,5 +13,4 @@
* limitations under the License.
*/
require
(
'
./ExampleJsunit.test.js
'
)
require
(
'
./TextCodr.test.js
'
)
\ No newline at end of file
compileruntime/util_lib_standard/src/main/js/test/TextCodr.test.js
→
compileruntime/util_lib_standard/src/main/js/
default/
test/TextCodr.test.js
浏览文件 @
4423bbd2
...
...
@@ -225,11 +225,14 @@ describe('TextEncoderTest', function () {
* @tc.author: shikai
*/
it
(
'
testUtilPromiseWrapper003
'
,
0
,
async
function
()
{
const
a
=
util
.
promiseWrapper
(
function
()
{})();
const
b
=
util
.
promiseWrapper
(
function
()
{})();
expect
(
a
).
assertInstanceOf
(
'
Promise
'
);
expect
(
b
).
assertInstanceOf
(
'
Promise
'
);
let
errToThrow
;
const
thrower
=
util
.
promiseWrapper
(
function
(
a
,
b
,
c
,
cb
)
{
errToThrow
=
new
Error
();
throw
errToThrow
;
});
thrower
(
1
,
2
,
3
).
catch
(
err
=>
{
expect
(
err
).
strictEqual
(
errToThrow
);
})
})
/**
...
...
@@ -372,12 +375,12 @@ describe('TextEncoderTest', function () {
*/
it
(
'
testUtilCallbackWrapper004
'
,
0
,
async
function
()
{
async
function
promiseFn
()
{
return
Promise
.
reject
(
'
value
'
)
;
return
21
;
};
var
cb
=
util
.
callbackWrapper
(
promiseFn
);
cb
((
err
,
ret
)
=>
{
expect
(
err
).
strictEqual
(
'
value
'
);
expect
(
ret
).
strictEqual
(
undefined
);
expect
(
err
).
strictEqual
(
null
);
expect
(
ret
).
strictEqual
(
21
);
})
})
...
...
@@ -729,8 +732,8 @@ describe('TextEncoderTest', function () {
var
that
=
new
util
.
TextEncoder
()
var
buffer
=
new
ArrayBuffer
(
20
)
var
result
=
new
Uint8Array
(
buffer
)
result
=
that
.
encode
(
'
abc
'
)
expect
(
result
[
0
]).
assertEqual
(
0x61
)
result
=
that
.
encode
(
'
\
uD800楼楼
'
)
expect
(
result
[
5
]).
assertEqual
(
188
)
})
/**
...
...
@@ -743,8 +746,8 @@ describe('TextEncoderTest', function () {
var
that
=
new
util
.
TextEncoder
()
var
buffer
=
new
ArrayBuffer
(
20
)
var
result
=
new
Uint8Array
(
buffer
)
result
=
that
.
encode
(
'
\
uD800楼楼
'
)
expect
(
result
[
5
]).
assertEqual
(
188
)
result
=
that
.
encode
(
'
a
\
uD800楼楼
'
)
expect
(
result
[
0
]).
assertEqual
(
0x61
)
})
/**
...
...
@@ -757,8 +760,8 @@ describe('TextEncoderTest', function () {
var
that
=
new
util
.
TextEncoder
()
var
buffer
=
new
ArrayBuffer
(
20
)
var
result
=
new
Uint8Array
(
buffer
)
result
=
that
.
encode
(
'
a
\
uD800楼楼
'
)
expect
(
result
[
0
]).
assertEqual
(
0x61
)
result
=
that
.
encode
(
'
a
bc
\
uD800楼楼
'
)
expect
(
result
[
1
]).
assertEqual
(
0x62
)
})
/**
...
...
@@ -771,8 +774,9 @@ describe('TextEncoderTest', function () {
var
that
=
new
util
.
TextEncoder
()
var
buffer
=
new
ArrayBuffer
(
20
)
var
result
=
new
Uint8Array
(
buffer
)
result
=
that
.
encode
(
'
abc
\
uD800楼楼
'
)
expect
(
result
[
1
]).
assertEqual
(
0x62
)
result
=
that
.
encode
(
'
123
\
uD800楼楼
'
)
expect
(
result
[
0
]).
assertEqual
(
49
)
expect
(
result
[
9
]).
assertEqual
(
230
)
})
/**
...
...
@@ -785,9 +789,8 @@ describe('TextEncoderTest', function () {
var
that
=
new
util
.
TextEncoder
()
var
buffer
=
new
ArrayBuffer
(
20
)
var
result
=
new
Uint8Array
(
buffer
)
result
=
that
.
encode
(
'
123
\
uD800楼楼
'
)
expect
(
result
[
0
]).
assertEqual
(
49
)
expect
(
result
[
9
]).
assertEqual
(
230
)
result
=
that
.
encode
(
'
abc
\
uD800楼楼
'
)
expect
(
result
[
1
]).
assertEqual
(
0x62
)
})
/**
...
...
@@ -960,6 +963,7 @@ describe('TextEncoderTest', function () {
expect
(
result
.
written
).
assertEqual
(
0
)
})
/**
* @tc.name: testGetLower001
* @tc.desc: Obtains the lower bound of the current range.
* @tc.require: AR000GFB4U
...
...
@@ -1458,7 +1462,8 @@ describe('TextEncoderTest', function () {
/**
* @tc.name: testInstersect001
* @tc.desc: Returns the intersection of the current range and the range specified by the given lower and upper bounds.
* @tc.desc: Returns the intersection of the current range and
* the range specified by the given lower and upper bounds.
* @tc.require: AR000GFB4U
* @tc.author: jiangkai
*/
...
...
@@ -1469,7 +1474,8 @@ describe('TextEncoderTest', function () {
/**
* @tc.name: testInstersect002
* @tc.desc: Returns the intersection of the current range and the range specified by the given lower and upper bounds.
* @tc.desc: Returns the intersection of the current range and
* the range specified by the given lower and upper bounds.
* @tc.require: AR000GFB4U
* @tc.author: jiangkai
*/
...
...
@@ -1480,7 +1486,8 @@ describe('TextEncoderTest', function () {
/**
* @tc.name: testInstersect003
* @tc.desc: Returns the intersection of the current range and the range specified by the given lower and upper bounds.
* @tc.desc: Returns the intersection of the current range and
* the range specified by the given lower and upper bounds.
* @tc.require: AR000GFB4U
* @tc.author: jiangkai
*/
...
...
@@ -1491,7 +1498,8 @@ describe('TextEncoderTest', function () {
/**
* @tc.name: testInstersect004
* @tc.desc: Returns the intersection of the current range and the range specified by the given lower and upper bounds.
* @tc.desc: Returns the intersection of the current range and
* the range specified by the given lower and upper bounds.
* @tc.require: AR000GFB4U
* @tc.author: jiangkai
*/
...
...
@@ -1502,7 +1510,8 @@ describe('TextEncoderTest', function () {
/**
* @tc.name: testInstersect005
* @tc.desc: Returns the intersection of the current range and the range specified by the given lower and upper bounds.
* @tc.desc: Returns the intersection of the current range and
* the range specified by the given lower and upper bounds.
* @tc.require: AR000GFB4U
* @tc.author: jiangkai
*/
...
...
@@ -1565,12 +1574,14 @@ describe('TextEncoderTest', function () {
var
result
=
rangeFif
.
toString
()
expect
(
result
).
assertEqual
(
'
[35, 45]
'
)
})
})
})
describe
(
'
Base64Test
'
,
function
()
{
/**
* @tc.name: testEncode001
* @tc.desc: Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.desc: Encodes all bytes from the specified u8 array into
* a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
...
...
@@ -1578,7 +1589,8 @@ describe('TextEncoderTest', function () {
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
115
,
49
,
51
]);
var
rarray
=
new
Uint8Array
([
99
,
122
,
69
,
122
]);
var
result
=
that
.
encode
(
array
);
var
flags
=
0
;
var
result
=
that
.
encode
(
array
,
flags
);
for
(
var
i
=
0
;
i
<
4
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
...
...
@@ -1586,7 +1598,8 @@ describe('TextEncoderTest', function () {
/**
* @tc.name: testEncode002
* @tc.desc: Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.desc: Encodes all bytes from the specified u8 array into
* a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
...
...
@@ -1594,7 +1607,8 @@ describe('TextEncoderTest', function () {
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
rarray
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
,
73
,
69
,
53
,
118
,
90
,
71
,
85
,
117
,
97
,
110
,
77
,
61
]);
var
result
=
that
.
encode
(
array
);
var
flags
=
0
;
var
result
=
that
.
encode
(
array
,
flags
);
for
(
var
i
=
0
;
i
<
20
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
...
...
@@ -1602,15 +1616,19 @@ describe('TextEncoderTest', function () {
/**
* @tc.name: testEncode003
* @tc.desc: Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.desc: Encodes all bytes from the specified u8 array into
* a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testEncode003
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
69
,
110
,
99
,
111
,
100
,
105
,
110
,
103
,
32
,
105
,
110
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
rarray
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
,
73
,
69
,
86
,
117
,
89
,
50
,
57
,
107
,
97
,
87
,
53
,
110
,
73
,
71
,
108
,
117
,
73
,
69
,
53
,
118
,
90
,
71
,
85
,
117
,
97
,
110
,
77
,
61
]);
var
result
=
that
.
encode
(
array
);
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
69
,
110
,
99
,
111
,
100
,
105
,
110
,
103
,
32
,
105
,
110
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
rarray
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
,
73
,
69
,
86
,
117
,
89
,
50
,
57
,
107
,
97
,
87
,
53
,
110
,
73
,
71
,
108
,
117
,
73
,
69
,
53
,
118
,
90
,
71
,
85
,
117
,
97
,
110
,
77
,
61
]);
var
flags
=
0
;
var
result
=
that
.
encode
(
array
,
flags
);
for
(
var
i
=
0
;
i
<
36
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
...
...
@@ -1618,7 +1636,8 @@ describe('TextEncoderTest', function () {
/**
* @tc.name: testEncode004
* @tc.desc: Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.desc: Encodes all bytes from the specified u8 array into
* a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
...
...
@@ -1626,7 +1645,8 @@ describe('TextEncoderTest', function () {
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
168
,
174
,
155
,
255
]);
var
rarray
=
new
Uint8Array
([
113
,
75
,
54
,
98
,
47
,
119
,
61
,
61
]);
var
result
=
that
.
encode
(
array
);
var
flags
=
0
;
var
result
=
that
.
encode
(
array
,
flags
);
for
(
var
i
=
0
;
i
<
8
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
...
...
@@ -1634,7 +1654,8 @@ describe('TextEncoderTest', function () {
/**
* @tc.name: testEncode005
* @tc.desc: Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.desc: Encodes all bytes from the specified u8 array into
* a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
...
...
@@ -1642,7 +1663,8 @@ describe('TextEncoderTest', function () {
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
var
rarray
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
]);
var
result
=
that
.
encode
(
array
);
var
flags
=
0
;
var
result
=
that
.
encode
(
array
,
flags
);
for
(
var
i
=
0
;
i
<
8
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
...
...
@@ -1657,7 +1679,8 @@ describe('TextEncoderTest', function () {
it
(
'
testEncodeToString001
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
115
,
49
,
51
]);
var
result
=
that
.
encodeToString
(
array
)
var
flags
=
0
;
var
result
=
that
.
encodeToString
(
array
,
flags
)
expect
(
result
).
assertEqual
(
'
czEz
'
)
})
...
...
@@ -1669,8 +1692,10 @@ describe('TextEncoderTest', function () {
*/
it
(
'
testEncodeToString002
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
result
=
that
.
encodeToString
(
array
);
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
flags
=
0
;
var
result
=
that
.
encodeToString
(
array
,
flags
);
expect
(
result
).
assertEqual
(
'
QmFzZTY0IE5vZGUuanM=
'
)
})
...
...
@@ -1682,8 +1707,10 @@ describe('TextEncoderTest', function () {
*/
it
(
'
testEncodeToString003
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
69
,
110
,
99
,
111
,
100
,
105
,
110
,
103
,
32
,
105
,
110
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
result
=
that
.
encodeToString
(
array
);
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
69
,
110
,
99
,
111
,
100
,
105
,
110
,
103
,
32
,
105
,
110
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
flags
=
0
;
var
result
=
that
.
encodeToString
(
array
,
flags
);
expect
(
result
).
assertEqual
(
'
QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM=
'
)
})
...
...
@@ -1696,7 +1723,8 @@ describe('TextEncoderTest', function () {
it
(
'
testEncodeToString004
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
168
,
174
,
155
,
255
]);
var
result
=
that
.
encodeToString
(
array
);
var
flags
=
0
;
var
result
=
that
.
encodeToString
(
array
,
flags
);
expect
(
result
).
assertEqual
(
'
qK6b/w==
'
)
})
...
...
@@ -1709,498 +1737,119 @@ describe('TextEncoderTest', function () {
it
(
'
testEncodeToString005
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
var
result
=
that
.
encodeToString
(
array
);
var
flags
=
0
;
var
result
=
that
.
encodeToString
(
array
,
flags
);
expect
(
result
).
assertEqual
(
'
QmFzZTY0
'
)
})
/**
* @tc.name: testDecode001
* @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.desc: Decodes a Base64 encoded String or input u8 array into
* a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecode001
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
buff
=
'
czEz
'
;
var
rarray
=
new
Uint8Array
([
115
,
49
,
51
]);
var
result
=
that
.
decode
(
buff
);
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
})
/**
* @tc.name: testDecode002
* @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecode002
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
buff
=
'
QmFzZTY0IE5vZGUuanM=
'
;
var
rarray
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
result
=
that
.
decode
(
buff
);
for
(
var
i
=
0
;
i
<
14
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
})
/**
* @tc.name: testDecode003
* @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecode003
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
buff
=
'
QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM=
'
;
var
rarray
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
69
,
110
,
99
,
111
,
100
,
105
,
110
,
103
,
32
,
105
,
110
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
result
=
that
.
decode
(
buff
);
for
(
var
i
=
0
;
i
<
26
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
})
/**
* @tc.name: testDecode004
* @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecode004
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
buff
=
'
qK6b/w==
'
;
var
rarray
=
new
Uint8Array
([
168
,
174
,
155
,
255
]);
var
result
=
that
.
decode
(
buff
);
for
(
var
i
=
0
;
i
<
4
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
})
/**
* @tc.name: testDecode005
* @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecode005
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
buff
=
'
QmFzZTY0
'
;
var
rarray
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
var
result
=
that
.
decode
(
buff
);
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
})
/**
* @tc.name: testDecode001
* @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecode001
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
99
,
122
,
69
,
122
]);
var
rarray
=
new
Uint8Array
([
115
,
49
,
51
]);
var
result
=
that
.
decode
(
array
);
var
that
=
new
util
.
TextDecoder
(
'
utf-8
'
);
var
arr
=
new
Uint8Array
(
3
);
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
])
;
arr
[
i
]
=
0x61
+
i
;
}
var
retStr
=
that
.
decode
(
arr
);
var
rel
=
'
abc
'
;
expect
(
retStr
).
assertEqual
(
rel
);
})
/**
* @tc.name: testDecode002
* @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.desc: Decodes a Base64 encoded String or input u8 array into
* a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecode002
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
,
73
,
69
,
53
,
118
,
90
,
71
,
85
,
117
,
97
,
110
,
77
,
61
]);
var
rarray
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
result
=
that
.
decode
(
array
);
for
(
var
i
=
0
;
i
<
14
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
var
that
=
new
util
.
TextDecoder
(
'
utf-16le
'
)
var
arr
=
new
Uint8Array
(
6
)
arr
[
0
]
=
0x61
;
arr
[
1
]
=
0x00
;
arr
[
2
]
=
0x62
;
arr
[
3
]
=
0x00
;
arr
[
4
]
=
0x63
;
arr
[
5
]
=
0x00
;
var
retStr
=
that
.
decode
(
arr
)
var
rel
=
'
abc
'
expect
(
retStr
).
assertEqual
(
rel
)
})
/**
* @tc.name: testDecode003
* @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.desc: Decodes a Base64 encoded String or input u8 array into
* a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecode003
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
,
73
,
69
,
86
,
117
,
89
,
50
,
57
,
107
,
97
,
87
,
53
,
110
,
73
,
71
,
108
,
117
,
73
,
69
,
53
,
118
,
90
,
71
,
85
,
117
,
97
,
110
,
77
,
61
]);
var
rarray
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
69
,
110
,
99
,
111
,
100
,
105
,
110
,
103
,
32
,
105
,
110
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
result
=
that
.
decode
(
array
);
for
(
var
i
=
0
;
i
<
26
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
var
that
=
new
util
.
TextDecoder
(
'
utf-16be
'
);
var
arr
=
new
Uint8Array
(
6
);
arr
[
0
]
=
0x00
;
arr
[
1
]
=
0x61
;
arr
[
2
]
=
0x00
;
arr
[
3
]
=
0x62
;
arr
[
4
]
=
0x00
;
arr
[
5
]
=
0x63
;
var
retStr
=
that
.
decode
(
arr
);
var
rel
=
'
abc
'
expect
(
retStr
).
assertEqual
(
rel
);
})
/**
* @tc.name: testDecode004
* @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.desc: Decodes a Base64 encoded String or input u8 array into
* a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecode004
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
113
,
75
,
54
,
98
,
47
,
119
,
61
,
61
]);
var
rarray
=
new
Uint8Array
([
168
,
174
,
155
,
255
]);
var
result
=
that
.
decode
(
array
);
for
(
var
i
=
0
;
i
<
4
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
var
that
=
new
util
.
TextDecoder
(
'
utf-8
'
,
{
ignoreBOM
:
true
})
var
arr
=
new
Uint8Array
(
6
)
arr
[
0
]
=
0xEF
;
arr
[
1
]
=
0xBB
;
arr
[
2
]
=
0xBF
;
arr
[
3
]
=
0x61
;
arr
[
4
]
=
0x62
;
arr
[
5
]
=
0x63
;
var
retStr
=
that
.
decode
(
arr
,
{
stream
:
true
})
var
BOM
=
'
\
uFEFF
'
var
rel
=
'
abc
'
var
re
=
BOM
+
rel
expect
(
retStr
).
assertEqual
(
re
);
})
/**
* @tc.name: testDecode005
* @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.desc: Decodes a Base64 encoded String or input u8 array into
* a newly-allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecode005
'
,
0
,
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
]);
var
rarray
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
var
result
=
that
.
decode
(
array
);
for
(
var
i
=
0
;
i
<
6
;
i
++
)
{
expect
(
result
[
i
]).
assertEqual
(
rarray
[
i
]);
}
})
//base64 EncodeAsync test
/**
* @tc.name: testEncodeAsync001
* @tc.desc: Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testEncodeAsync001
'
,
0
,
async
function
()
{
var
that
=
await
new
util
.
Base64
();
var
array
=
new
Uint8Array
([
115
,
49
,
51
]);
var
rarray
=
new
Uint8Array
([
99
,
122
,
69
,
122
]);
that
.
encodeAsync
(
array
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
rarray
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
rarray
[
i
])
}
})
})
/**
* @tc.name: testEncodeAsync002
* @tc.desc: Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testEncodeAsync002
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
rarray
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
,
73
,
69
,
53
,
118
,
90
,
71
,
85
,
117
,
97
,
110
,
77
,
61
]);
that
.
encodeAsync
(
array
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
rarray
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
rarray
[
i
])
}
})
})
/**
* @tc.name: testEncodeAsync003
* @tc.desc: Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testEncodeAsync003
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
69
,
110
,
99
,
111
,
100
,
105
,
110
,
103
,
32
,
105
,
110
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
var
rarray
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
,
73
,
69
,
86
,
117
,
89
,
50
,
57
,
107
,
97
,
87
,
53
,
110
,
73
,
71
,
108
,
117
,
73
,
69
,
53
,
118
,
90
,
71
,
85
,
117
,
97
,
110
,
77
,
61
]);
that
.
encodeAsync
(
array
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
rarray
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
rarray
[
i
])
}
})
})
/**
* @tc.name: testEncodeAsync004
* @tc.desc: Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testEncodeAsync004
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
168
,
174
,
155
,
255
]);
var
rarray
=
new
Uint8Array
([
113
,
75
,
54
,
98
,
47
,
119
,
61
,
61
]);
that
.
encodeAsync
(
array
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
rarray
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
rarray
[
i
])
}
})
})
/**
* @tc.name: testEncodeAsync005
* @tc.desc: Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testEncodeAsync005
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
var
rarray
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
]);
that
.
encodeAsync
(
array
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
rarray
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
rarray
[
i
])
}
})
})
/**
* @tc.name: testEncodeToStringAsync001
* @tc.desc: Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testEncodeToStringAsync001
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
115
,
49
,
51
]);
that
.
encodeToStringAsync
(
array
).
then
(
val
=>
{
expect
(
val
).
assertEqual
(
'
czEz
'
)
})
})
/**
* @tc.name: testEncodeToStringAsync002
* @tc.desc: Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testEncodeToStringAsync002
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
that
.
encodeToStringAsync
(
array
).
then
(
val
=>
{
expect
(
val
).
assertEqual
(
'
QmFzZTY0IE5vZGUuanM=
'
)
})
})
/**
* @tc.name: testEncodeToStringAsync003
* @tc.desc: Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testEncodeToStringAsync003
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
,
73
,
69
,
86
,
117
,
89
,
50
,
57
,
107
,
97
,
87
,
53
,
110
,
73
,
71
,
108
,
117
,
73
,
69
,
53
,
118
,
90
,
71
,
85
,
117
,
97
,
110
,
77
,
61
]);
that
.
encodeToStringAsync
(
array
).
then
(
val
=>
{
expect
(
val
).
assertEqual
(
'
QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM=
'
)
})
})
/**
* @tc.name: testEncodeToStringAsync004
* @tc.desc: Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testEncodeToStringAsync004
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
168
,
174
,
155
,
255
]);
that
.
encodeToStringAsync
(
array
).
then
(
val
=>
{
expect
(
val
).
assertEqual
(
'
qK6b/w==
'
)
})
})
/**
* @tc.name: testEncodeToStringAsync005
* @tc.desc: Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testEncodeToStringAsync005
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
that
.
encodeToStringAsync
(
array
).
then
(
val
=>
{
expect
(
val
).
assertEqual
(
'
QmFzZTY0
'
)
})
})
/**
* @tc.name: testDecodeAsync001
* @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecodeAsync001
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
buff
=
'
czEz
'
;
var
array
=
new
Uint8Array
([
115
,
49
,
51
]);
that
.
decodeAsync
(
buff
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testDecodeAsync002
* @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecodeAsync002
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
buff
=
'
QmFzZTY0IE5vZGUuanM=
'
;
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
that
.
decodeAsync
(
buff
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testDecodeAsync003
* @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecodeAsync003
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
buff
=
'
QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM=
'
;
var
array
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
69
,
110
,
99
,
111
,
100
,
105
,
110
,
103
,
32
,
105
,
110
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
that
.
decodeAsync
(
buff
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testDecodeAsync004
* @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecodeAsync004
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
buff
=
'
qK6b/w==
'
;
var
array
=
new
Uint8Array
([
168
,
174
,
155
,
255
]);
that
.
decodeAsync
(
buff
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
array
[
i
])
}
})
})
/**
* @tc.name: testDecodeAsync005
* @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecodeAsync005
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
buff
=
'
QmFzZTY0
'
;
var
rarray
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
that
.
decodeAsync
(
buff
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
rarray
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
rarray
[
i
])
}
})
})
/**
* @tc.name: testDecodeAsync001
* @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecodeAsync001
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
99
,
122
,
69
,
122
]);
var
rarray
=
new
Uint8Array
([
115
,
49
,
51
]);
that
.
decodeAsync
(
array
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
rarray
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
rarray
[
i
])
}
})
})
/**
* @tc.name: testDecodeAsync002
* @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecodeAsync002
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
,
73
,
69
,
53
,
118
,
90
,
71
,
85
,
117
,
97
,
110
,
77
,
61
]);
var
rarray
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
that
.
decodeAsync
(
array
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
rarray
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
rarray
[
i
])
}
})
})
/**
* @tc.name: testDecodeAsync003
* @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecodeAsync003
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
,
73
,
69
,
86
,
117
,
89
,
50
,
57
,
107
,
97
,
87
,
53
,
110
,
73
,
71
,
108
,
117
,
73
,
69
,
53
,
118
,
90
,
71
,
85
,
117
,
97
,
110
,
77
,
61
]);
var
rarray
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
,
32
,
69
,
110
,
99
,
111
,
100
,
105
,
110
,
103
,
32
,
105
,
110
,
32
,
78
,
111
,
100
,
101
,
46
,
106
,
115
]);
that
.
decodeAsync
(
array
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
rarray
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
rarray
[
i
])
}
})
})
/**
* @tc.name: testDecodeAsync004
* @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecodeAsync004
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
113
,
75
,
54
,
98
,
47
,
119
,
61
,
61
]);
var
rarray
=
new
Uint8Array
([
168
,
174
,
155
,
255
]);
that
.
decodeAsync
(
array
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
rarray
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
rarray
[
i
])
}
})
var
that
=
new
util
.
TextDecoder
(
'
utf-16be
'
);
var
arr
=
new
Uint8Array
(
6
);
arr
[
0
]
=
0x00
;
arr
[
1
]
=
0x61
;
arr
[
2
]
=
0x00
;
arr
[
3
]
=
0x62
;
arr
[
4
]
=
0x00
;
arr
[
5
]
=
0x63
;
var
retStr
=
that
.
decode
(
arr
);
var
rel
=
'
abc
'
expect
(
retStr
).
assertEqual
(
rel
);
})
/**
* @tc.name: testDecodeAsync005
* @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array.
* @tc.require: AR000GFB2Q
* @tc.author: bihu
*/
it
(
'
testDecodeAsync005
'
,
0
,
async
function
()
{
var
that
=
new
util
.
Base64
()
var
array
=
new
Uint8Array
([
81
,
109
,
70
,
122
,
90
,
84
,
89
,
48
]);
var
rarray
=
new
Uint8Array
([
66
,
97
,
115
,
101
,
54
,
52
]);
that
.
decodeAsync
(
array
).
then
(
val
=>
{
for
(
var
i
=
0
;
i
<
rarray
.
length
;
i
++
)
{
expect
(
val
[
i
]).
assertEqual
(
rarray
[
i
])
}
})
})
})
})
describe
(
'
RationalNumberFunTest
'
,
function
()
{
/**
* @tc.name: testRationalNumberCreateRationalFromString001
* @tc.desc: Creates a RationalNumber object based on a given string.
...
...
@@ -2878,6 +2527,7 @@ describe('TextEncoderTest', function () {
})
describe
(
'
LruBufferFunTest
'
,
function
()
{
/**
* @tc.name: testLruBufferUpdateCapacity001
* @tc.desc: Updates the buffer capacity to a specified capacity.
...
...
@@ -3118,94 +2768,6 @@ describe('TextEncoderTest', function () {
expect
(
temp5
).
assertEqual
(
22
)
})
/**
* @tc.name: testLruBufferGetCreateCount001
* @tc.desc: Obtains the number of times createDefault(Object) returned a value.
* @tc.require: AR000GFB59
* @tc.author: lixingyang
*/
it
(
'
testLruBufferGetCreateCount001
'
,
0
,
function
()
{
var
that
=
new
util
.
LruBuffer
()
that
.
put
(
1
,
2
)
that
.
put
(
2
,
10
)
that
.
put
(
'
abcd
'
,
15
)
that
.
get
(
3
)
that
.
get
(
5
)
that
.
get
(
10
)
var
result
=
that
.
getCreateCount
()
expect
(
result
).
assertEqual
(
0
)
})
/**
* @tc.name: testLruBufferGetCreateCount002
* @tc.desc: Obtains the number of times createDefault(Object) returned a value.
* @tc.require: AR000GFB59
* @tc.author: lixingyang
*/
it
(
'
testLruBufferGetCreateCount002
'
,
0
,
function
()
{
var
that
=
new
util
.
LruBuffer
()
that
.
put
(
1
,
2
)
that
.
put
(
2
,
10
)
that
.
put
(
'
abcd
'
,
15
)
that
.
get
(
6
)
that
.
get
(
8
)
that
.
get
(
20
)
var
result
=
that
.
getCreateCount
()
expect
(
result
).
assertEqual
(
0
)
})
/**
* @tc.name: testLruBufferGetCreateCount003
* @tc.desc: Obtains the number of times createDefault(Object) returned a value.
* @tc.require: AR000GFB59
* @tc.author: lixingyang
*/
it
(
'
testLruBufferGetCreateCount003
'
,
0
,
function
()
{
var
that
=
new
util
.
LruBuffer
()
that
.
put
(
1
,
2
)
that
.
put
(
2
,
10
)
that
.
get
(
'
abc
'
)
that
.
get
(
'
cndk
'
)
var
result
=
that
.
getCreateCount
()
expect
(
result
).
assertEqual
(
0
)
})
/**
* @tc.name: testLruBufferGetCreateCount004
* @tc.desc: Obtains the number of times createDefault(Object) returned a value.
* @tc.require: AR000GFB59
* @tc.author: lixingyang
*/
it
(
'
testLruBufferGetCreateCount004
'
,
0
,
function
()
{
var
that
=
new
util
.
LruBuffer
()
that
.
put
(
5
,
2
)
that
.
put
(
10
,
10
)
that
.
put
(
'
abcd
'
,
'
abcd
'
)
that
.
get
(
3
)
that
.
get
(
20
)
that
.
get
(
12
)
var
result
=
that
.
getCreateCount
()
expect
(
result
).
assertEqual
(
0
)
})
/**
* @tc.name: testLruBufferGetCreateCount005
* @tc.desc: Obtains the number of times createDefault(Object) returned a value.
* @tc.require: AR000GFB59
* @tc.author: lixingyang
*/
it
(
'
testLruBufferGetCreateCount005
'
,
0
,
function
()
{
var
that
=
new
util
.
LruBuffer
()
that
.
put
(
'
xsjk
'
,
'
bcjds
'
)
that
.
put
(
'
ajc
'
,
10
)
that
.
put
(
'
abcd
'
,
15
)
that
.
get
(
2
)
that
.
get
(
10
)
that
.
get
(
30
)
var
result
=
that
.
getCreateCount
()
expect
(
result
).
assertEqual
(
0
)
})
/**
* @tc.name: testLruBufferGetMissCount001
* @tc.desc: Obtains the number of times that the queried values are not matched.
...
...
compileruntime/util_lib_standard/src/main/js/test/ExampleJsunit.test.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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
app
from
'
@system.app
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/lite
'
describe
(
'
appInfoTest
'
,
function
()
{
it
(
'
app_info_test_001
'
,
0
,
function
()
{
var
info
=
app
.
getInfo
()
expect
(
info
.
versionCode
).
assertEqual
(
'
1000000
'
)
})
})
\ No newline at end of file
compileruntime/util_lib_standard/src/main/resources/base/element/string.json
浏览文件 @
4423bbd2
{
"string"
:
[
{
"name"
:
"
entry_MainAbility
"
,
"value"
:
"
entry_MainAbility
"
"name"
:
"
app_name
"
,
"value"
:
"
OsAccountTest
"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_
Empty
Ability"
"value"
:
"JS_
Phone_Empty Feature
Ability"
}
]
}
\ No newline at end of file
compileruntime/util_lib_standard/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
4423bbd2
6.6 KB
compileruntime/util_lib_standard/src/ohosTest/js/default/app.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
TestApplication onCreate
'
);
},
onDestroy
()
{
console
.
info
(
'
TestApplication onDestroy
'
);
}
};
compileruntime/util_lib_standard/src/ohosTest/js/default/i18n/en-US.json
已删除
100644 → 0
浏览文件 @
c7f41830
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
},
"Files"
:
{
}
}
\ No newline at end of file
compileruntime/util_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json
已删除
100644 → 0
浏览文件 @
c7f41830
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
},
"Files"
:
{
}
}
\ No newline at end of file
compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.css
已删除
100644 → 0
浏览文件 @
c7f41830
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.hml
已删除
100644 → 0
浏览文件 @
c7f41830
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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
file
from
'
@system.file
'
import
app
from
'
@system.app
'
import
device
from
'
@system.device
'
import
router
from
'
@system.router
'
import
{
Core
,
ExpectExtend
,
ReportExtend
,
InstrumentLog
}
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
'
})
const
reportExtend
=
new
ReportExtend
(
file
)
const
instrumentLog
=
new
InstrumentLog
({
'
id
'
:
'
report
'
})
core
.
addService
(
'
expect
'
,
expectExtend
)
core
.
addService
(
'
report
'
,
reportExtend
)
core
.
addService
(
'
report
'
,
instrumentLog
)
core
.
init
()
core
.
subscribeEvent
(
'
spec
'
,
instrumentLog
)
core
.
subscribeEvent
(
'
suite
'
,
instrumentLog
)
core
.
subscribeEvent
(
'
task
'
,
instrumentLog
)
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
\ No newline at end of file
compileruntime/util_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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
app
from
'
@system.app
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
describe
(
'
appInfoTest
'
,
function
()
{
it
(
'
app_info_test_001
'
,
0
,
function
()
{
var
info
=
app
.
getInfo
()
expect
(
info
.
versionName
).
assertEqual
(
'
1.0
'
)
expect
(
info
.
versionCode
).
assertEqual
(
'
3
'
)
})
})
\ No newline at end of file
compileruntime/util_lib_standard/src/ohosTest/js/test/List.test.js
已删除
100644 → 0
浏览文件 @
c7f41830
/*
* 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.
*/
require
(
'
./ExampleJsunit.test.js
'
)
\ No newline at end of file
compileruntime/util_lib_standard/src/ohosTest/resources/base/element/string.json
已删除
100644 → 0
浏览文件 @
c7f41830
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"childprocess"
},
{
"name"
:
"mainability_description"
,
"value"
:
"hap sample empty page"
}
]
}
compileruntime/worker_lib_standard/src/main/config.json
浏览文件 @
4423bbd2
...
...
@@ -5,6 +5,10 @@
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
}
},
"deviceConfig"
:
{},
...
...
compileruntime/worker_lib_standard/src/main/js/test/Worker.test.js
浏览文件 @
4423bbd2
...
...
@@ -16,7 +16,7 @@
// @ts-nocheck
import
app
from
'
@system.app
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
//import worker from "@ohos.worker";
import
worker
from
'
@ohos.worker
'
var
worker
=
globalThis
.
requireNapi
(
'
worker
'
);
describe
(
'
workerTest
'
,
function
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录