Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e830485f
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看板
提交
e830485f
编写于
9月 23, 2022
作者:
Z
zhangxinyue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add new
Signed-off-by:
N
zhangxinyue
<
zhangxinyue38@huawei.com
>
上级
0769d441
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
241 addition
and
27 deletion
+241
-27
arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets
..._web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets
+137
-3
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets
...ts_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets
+104
-24
未找到文件。
arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets
浏览文件 @
e830485f
...
...
@@ -27,6 +27,7 @@ struct Index {
responseweb: WebResourceResponse = new WebResourceResponse()
@State str:string="emitStoreWebArchive"
@State text:string=""
@State num:number=0
@State textRatio:number=100
@State zoomAccessValue:boolean=true
host: string = "www.spincast.org"
...
...
@@ -79,14 +80,14 @@ struct Index {
let level = event.message.getMessageLevel()
let msg = event.message.getMessage()
let lineNumber = event.message.getLineNumber().toString()
let sourceId = event.message.getSourceId()
console.log("lineNumber:" + lineNumber)
setTimeout(()=>{
Utils.emitEvent(lineNumber,420)
},3000)
setTimeout(()=>{
let sourceId = event.message.getSourceId()
Utils.emitEvent(sourceId,422)
},
3
000)
},
5
000)
return false
})
.onSearchResultReceive(ret=>{
...
...
@@ -215,6 +216,139 @@ struct Index {
},3000);
break ;
}
case "emitGetOriginUsage":{
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/webstorage.html"})
setTimeout(()=>{
web_webview.WebStorage.getOriginUsage("file:///data/storage/el1/bundle/phone/resources/rawfile/webstorage.html",(error,result)=>{
if (error) {
console.log('error:' + error);
return;
}
this.text = result.toString();
console.log("usage is:" + this.text)
})
setTimeout(()=>{
Utils.emitEvent(this.text,432)
},3000)
},3000)
break;
}
case "emitGetOriginUsagePromise":{
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/webstorage.html"})
setTimeout(()=>{
web_webview.WebStorage.getOriginUsage("file:///data/storage/el1/bundle/phone/resources/rawfile/webstorage.html")
.then(usage=>{
console.log('usage: '+usage)
setTimeout(()=>{
Utils.emitEvent(usage.toString(),447)
},3000)
})
.catch(error=>{
console.log('error: '+error)
})
},3000)
break;
}
case "emitGetOriginQuota":{
web_webview.WebStorage.getOriginQuota("file:///data/storage/el1/bundle/phone/resources/rawfile/webstorage.html",(error,result)=>{
if (error) {
console.log('error:' + error);
return;
}
this.text = result.toString();
console.log("usage is:" + this.text)
})
setTimeout(()=>{
Utils.emitEvent(this.text,434)
},3000)
break;
}
case "emitGetOriginQuotaPromise":{
setTimeout(()=>{
web_webview.WebStorage.getOriginQuota("file:///data/storage/el1/bundle/phone/resources/rawfile/webstorage.html")
.then(quota=>{
console.log('usage: '+quota)
setTimeout(()=>{
Utils.emitEvent(quota.toString(),448)
},3000)
})
.catch(error=>{
console.log('error: '+error)
})
},3000)
break;
}
case "emitGetOrigins":{
web_webview.WebStorage.getOrigins((error, origins) => {
if (error) {
console.log('error: ' + error);
return;
}
this.text = origins[0].origin.toString();
var us = origins[0].usage;
var qu = origins[0].quota;
console.log("usage is:" + this.text)
})
setTimeout(()=>{
Utils.emitEvent(this.text,436)
},3000)
break;
}
case "emitGetOriginsPromise":{
setTimeout(()=>{
web_webview.WebStorage.getOrigins()
.then(origins=>{
for (let i = 0; i
<
origins.length
;
i
++)
{
console.log
('
origin:
'
+
origins
[
i
].
origin
);
console.log
('
usage:
'
+
origins
[
i
].
usage
);
console.log
('
quota:
'
+
origins
[
i
].
quota
);
}
setTimeout(()=
>
{
Utils.emitEvent
(
origins
[0].
origin
,449)
},3000)
})
.catch(error=
>
{
console.log
('
error:
'+
error
)
})
},3000)
this.controller.loadUrl
({
url:
"
file:
///
data
/
storage
/
el1
/
bundle
/
phone
/
resources
/
rawfile
/
index.html
"})
break
;
}
case
"
emitDeleteOrigin
"
:
{
web_webview.WebStorage.deleteOrigin
("
file:
///
data
/
storage
/
el1
/
bundle
/
phone
/
resources
/
rawfile
/
webstorage.html
")
setTimeout(()=
>
{
web_webview.WebStorage.getOriginUsage
("
file:
///
data
/
storage
/
el1
/
bundle
/
phone
/
resources
/
rawfile
/
webstorage.html
",(
error
,
usage) =
>
{
if
(
error
)
{
console.log
('
error:
'
+
error
);
return
;
}
this.num =
usage
console.log
("
usage
is:
"
+
this.num
)
setTimeout(()=
>
{
Utils.emitEvent
(
this.num
,438)
},4000)
})
},3000)
break
;
}
case
"
emitDeleteAllData
"
:
{
web_webview.WebStorage.deleteAllData
()
setTimeout(()=
>
{
web_webview.WebStorage.getOriginUsage
("
file:
///
data
/
storage
/
el1
/
bundle
/
phone
/
resources
/
rawfile
/
webstorage.html
",(
error
,
usage) =
>
{
if
(
error
)
{
console.log
('
error:
'
+
error
);
return
;
}
this.num =
usage
console.log
("
usage
is:
"
+
this.num
)
setTimeout(()=
>
{
Utils.emitEvent
(
this.num
,440)
},4000)
})
},3000)
break
;
}
case
"
emitSaveHttpAuthCredentials
"
:
{
web_webview.WebDataBase.saveHttpAuthCredentials
(
this.host
,
this.realm
,
"
Stromgol
",
"
Laroche
");
setTimeout(()=
>
{
...
...
@@ -253,4 +387,4 @@ struct Index {
}
}
}
}
}
\ No newline at end of file
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets
浏览文件 @
e830485f
...
...
@@ -120,28 +120,8 @@ export default function webJsunit() {
*tc.desic return whether there exits cookie
*/
it('existCookie',0,async function(done){
emitKey="emitOnConsole";
Utils.registerEvent("existCookie",false,414,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_076
*tc.name getLineNumber
*tc.desic return the number of console message lines
*/
it('getLineNumber',0,async function(done){
emitKey="emitOnConsole";
Utils.registerEvent("getLineNumber","51",420,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_077
*tc.name getSourceId
*tc.desic return the source url
*/
it('getSourceId',0,async function(done){
emitKey="emitLoaData";
Utils.registerEvent("
getSourceId","file:///data/storage/el1/bundle/phone/resources/rawfile/index.html",422
,done);
Utils.registerEvent("
existCookie",false,414
,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
@@ -160,10 +140,60 @@ export default function webJsunit() {
*tc.desic set whether it is allowed to zoom
*/
it('zoomAccess',0,async function(done){
emitKey="emit
SaveHttpAuthCredentials
";
emitKey="emit
GetOriginUsage
";
Utils.registerEvent("zoomAccess",false,428,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_082
*tc.name getOriginUsage
*tc.desic get origin usage
*/
it('getOriginUsage',0,async function(done){
emitKey="emitGetOriginQuota";
Utils.registerEvent("getOriginUsage","24576",432,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_083
*tc.name getOriginQuota
*tc.desic get origin storage
*/
it('getOriginQuota',0,async function(done){
emitKey="emitGetOrigins";
Utils.registerEvent("getOriginQuota","2575722086",434,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_084
*tc.name getOrigins
*tc.desic get origins
*/
it('getOrigins',0,async function(done){
emitKey="emitDeleteOrigin";
Utils.registerEvent("getOrigins","file:///",436,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_085
*tc.name deleteOrigin
*tc.desic delete specific url usage
*/
it('deleteOrigin',0,async function(done){
emitKey="emitDeleteAllData";
Utils.registerEvent("deleteOrigin",0,438,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_086
*tc.name deleteAllData
*tc.desic delete all data
*/
it('deleteAllData',0,async function(done){
emitKey="emitSaveHttpAuthCredentials";
Utils.registerEvent("deleteAllData",0,440,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_087
*tc.name saveHttpAuthCredentials
...
...
@@ -190,10 +220,60 @@ export default function webJsunit() {
*tc.desic delete credentials
*/
it('deleteHttpAuthCredentials',0,async function(done){
emitKey="emit
SearchAllAsync
";
emitKey="emit
GetOriginUsagePromise
";
Utils.registerEvent("deleteHttpAuthCredentials",false,446,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_090
*tc.name getOriginUsagePromise
*tc.desic promise method
*/
it('getOriginUsagePromise',0,async function(done){
emitKey="emitGetOriginQuotaPromise";
Utils.registerEvent("getOriginUsagePromise",'24576',447,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_091
*tc.name getOriginQuotaPromise
*tc.desic promise method
*/
it('getOriginQuotaPromise',0,async function(done){
emitKey="emitGetOriginsPromise";
Utils.registerEvent("getOriginQuotaPromise",'2575722086',448,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_092
*tc.name getOriginsPromise
*tc.desic promise method
*/
it('getOriginsPromise',0,async function(done){
emitKey="emitOnConsole";
Utils.registerEvent("getOriginsPromise",'file:///',449,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_077
*tc.name getSourceId
*tc.desic return the source url
*/
it('getSourceId',0,async function(done){
emitKey="emitOnConsole";
Utils.registerEvent("getSourceId","file:///data/storage/el1/bundle/phone/resources/rawfile/index.html",422,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_076
*tc.name getLineNumber
*tc.desic return the number of console message lines
*/
it('getLineNumber',0,async function(done){
emitKey="emitSearchAllAsync";
Utils.registerEvent("getLineNumber","51",420,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_079
*tc.name searchAllAsync
...
...
@@ -205,4 +285,4 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
})
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录