Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
19bd1b16
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看板
提交
19bd1b16
编写于
1月 05, 2023
作者:
Z
zhangjing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
web组件接口变更相关用例修改
Signed-off-by:
N
zhangjing
<
zhangjing403@huawei.com
>
上级
32e66d66
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
52 addition
and
36 deletion
+52
-36
arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets
..._ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets
+29
-29
arkui/ace_ets_web_dev/entry/src/main/ets/test/Utils.ets
arkui/ace_ets_web_dev/entry/src/main/ets/test/Utils.ets
+16
-0
arkui/ace_ets_web_dev/entry/src/main/ets/test/WebJsunit.test.ets
...ce_ets_web_dev/entry/src/main/ets/test/WebJsunit.test.ets
+5
-5
arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/index.html
...e_ets_web_dev/entry/src/main/resources/rawfile/index.html
+2
-2
未找到文件。
arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets
浏览文件 @
19bd1b16
...
...
@@ -269,7 +269,7 @@ struct Index {
break;
}
case "emitOnResourceLoad":{
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"})
this.controller.loadUrl({url:"
resource://rawfile/second.html"});
setTimeout(()=>{
Utils.emitEvent(this.loadedResource,108)
},3000)
...
...
@@ -284,7 +284,7 @@ struct Index {
break;
}
case "emitRunJavaScript":{
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.loadUrl({url:"
resource://rawfile/index.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"testRunJavaScript()",callback:(res)=>{
Utils.emitEvent(res,112)
...
...
@@ -299,7 +299,7 @@ struct Index {
break;
}
case "emitOnRefreshAccessedHistory":{
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"})
this.controller.loadUrl({url:"
resource://rawfile/second.html"});
setTimeout(()=>{
Utils.emitEvent(this.newUrl,116)
},3000)
...
...
@@ -316,7 +316,7 @@ struct Index {
break;
}
case "emitGetTitle":{
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.loadUrl({url:"
resource://rawfile/index.html"});
setTimeout(()=>{
let webTitle=this.controller.getTitle()
Utils.emitEvent(webTitle,122)
...
...
@@ -324,7 +324,7 @@ struct Index {
break;
}
case "emitGetPageHeight":{
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.loadUrl({url:"
resource://rawfile/index.html"});
let webPageHeight=this.controller.getPageHeight()+""
setTimeout(()=>{
this.controller.runJavaScript({script:"getPageHeight()",callback:(res)=>{
...
...
@@ -335,7 +335,7 @@ struct Index {
break;
}
case "emitGetRequestFocus":{
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"})
this.controller.loadUrl({url:"
resource://rawfile/second.html"});
await Utils.sleep(2000)
sendEventByKey('textInput',10,'')
break;
...
...
@@ -382,7 +382,7 @@ struct Index {
case "emitGeolocationAccessFalse":{
this.geolocationAccess=false
await Utils.sleep(2000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/geo.html"})
this.controller.loadUrl({url:"
resource://rawfile/geo.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"getGeoResult()",callback:(res)=>{
console.info("getGeoResult==>"+res)
...
...
@@ -394,7 +394,7 @@ struct Index {
case "emitInitialScale":{
this.initialScale=120
await Utils.sleep(1000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"})
this.controller.loadUrl({url:"
resource://rawfile/second.html"});
this.enterPageEnd=true
break;
}
...
...
@@ -409,13 +409,13 @@ struct Index {
this.geolocationAccess=true
this.geoShow=true
await Utils.sleep(2000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/geo.html"})
this.controller.loadUrl({url:"
resource://rawfile/geo.html"});
break;
}
case "emitDomStorageAccessFalse":{
this.domStorageAccess=false
await Utils.sleep(2000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/domApi.html"})
this.controller.loadUrl({url:"
resource://rawfile/domApi.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"getDomResult()",callback:(res)=>{
console.info("getDomResult==>"+res)
...
...
@@ -427,7 +427,7 @@ struct Index {
case "emitDomStorageAccessTrue":{
this.domStorageAccess=true
await Utils.sleep(2000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/domApi.html"})
this.controller.loadUrl({url:"
resource://rawfile/domApi.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"getDomResult()",callback:(res)=>{
console.info("getDomResult==>"+res)
...
...
@@ -439,7 +439,7 @@ struct Index {
case "emitImageAccessFalse":{
this.imageAccess=false
await Utils.sleep(1000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.loadUrl({url:"
resource://rawfile/index.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"getImgResult()",callback:(res)=>{
console.info("getImgResult==>"+res)
...
...
@@ -451,7 +451,7 @@ struct Index {
case "emitImageAccessTrue":{
this.imageAccess=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.loadUrl({url:"
resource://rawfile/index.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"getImgResult()",callback:(res)=>{
console.info("getImgResult==>"+res)
...
...
@@ -463,7 +463,7 @@ struct Index {
case "emitOnlineImageAccessFalse":{
this.onlineImageAccess=false
await Utils.sleep(1000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/onlineImageAccess.html"})
this.controller.loadUrl({url:"
resource://rawfile/onlineImageAccess.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"getImageLoadResult()",callback:(res)=>{
console.info("getImageLoadResult==>"+res)
...
...
@@ -475,7 +475,7 @@ struct Index {
case "emitOnlineImageAccessTrue":{
this.onlineImageAccess=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/onlineImageAccess.html"})
this.controller.loadUrl({url:"
resource://rawfile/onlineImageAccess.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"getImageLoadResult()",callback:(res)=>{
console.info("getImageLoadResult==>"+res)
...
...
@@ -487,7 +487,7 @@ struct Index {
case "emitDatabaseAccessTrue":{
this.databaseAccess=true
await Utils.sleep(2000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/databaseAccess.html"})
this.controller.loadUrl({url:"
resource://rawfile/databaseAccess.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"getDataResult()",callback:(res)=>{
console.info("getDataResult==>"+res)
...
...
@@ -499,7 +499,7 @@ struct Index {
case "emitOverviewModeAccessFalse":{
this.overviewModeAccess=false
await Utils.sleep(1000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/overview.html"})
this.controller.loadUrl({url:"
resource://rawfile/overview.html"});
setTimeout(()=>{
let webPageHeight=this.controller.getPageHeight()
this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{
...
...
@@ -513,7 +513,7 @@ struct Index {
case "emitOverviewModeAccessTrue":{
this.overviewModeAccess=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/overview.html"})
this.controller.loadUrl({url:"
resource://rawfile/overview.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{
console.info("getViewResult==>"+res)
...
...
@@ -523,7 +523,7 @@ struct Index {
break;
}
case "emitOnPrompt":{
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.loadUrl({url:"
resource://rawfile/index.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"toPrompt()"})
},3000)
...
...
@@ -562,7 +562,7 @@ struct Index {
}
case "emitFileAccessTrue":{
this.fileAccess=true
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.loadUrl({url:"
resource://rawfile/index.html"});
this.controller.runJavaScript({script:"openRawFile()"})
setTimeout(()=>{
let webTitle=this.controller.getTitle()
...
...
@@ -616,7 +616,7 @@ struct Index {
break;
}
case "emitOnTitleReceive":{
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.loadUrl({url:"
resource://rawfile/index.html"});
setTimeout(()=>{
Utils.emitEvent(this.titleReceive,67)
},3000)
...
...
@@ -645,7 +645,7 @@ struct Index {
break;
}
case "emitZoom":{
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.loadUrl({url:"
resource://rawfile/index.html"});
setTimeout(()=>{
this.controller.zoom(2)
setTimeout(() => {
...
...
@@ -728,7 +728,7 @@ struct Index {
}
case "emitOnActive":{
this.controller.onActive()
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.loadUrl({url:"
resource://rawfile/index.html"});
setTimeout(()=>{
let onActiveCalled = this.pageBegin
Utils.emitEvent(onActiveCalled,85)
...
...
arkui/ace_ets_web_dev/entry/src/main/ets/test/Utils.ets
浏览文件 @
19bd1b16
...
...
@@ -29,9 +29,13 @@ export default class Utils {
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
try{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.ACTION).assertEqual(expectedValue);
console.info(`[${testCaseName}] END`);
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
done()
}
let innerEvent = {
...
...
@@ -64,10 +68,14 @@ export default class Utils {
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
try{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.actualValue).assertLarger(backData.data.expectedValue-100);
expect(backData.data.actualValue).assertLess(backData.data.expectedValue-(-100));
console.info(`[${testCaseName}] END`);
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
done()
}
let innerEvent = {
...
...
@@ -101,9 +109,13 @@ export default class Utils {
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
try{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.ACTION).assertContain(expectedValue);
console.info(`[${testCaseName}] END`);
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
done()
}
let innerEvent = {
...
...
@@ -136,9 +148,13 @@ export default class Utils {
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
try{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.actualValue).assertLarger(backData.data.expectedValue);
console.info(`[${testCaseName}] END`);
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
done()
}
let innerEvent = {
...
...
arkui/ace_ets_web_dev/entry/src/main/ets/test/WebJsunit.test.ets
浏览文件 @
19bd1b16
...
...
@@ -91,7 +91,7 @@ export default function webJsunit() {
*/
it('onResourceLoad',0,async function(done){
emitKey="emitLoadUrl";
Utils.register
Event("onResourceLoad","file:///data/storage/el1/bundle/phone/resources/rawfile/
second.html",108,done);
Utils.register
ContainEvent("onResourceLoad","
second.html",108,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
@@ -129,7 +129,7 @@ export default function webJsunit() {
*/
it('onRefreshAccessedHistory',0,async function(done){
emitKey="emitGetHitTest";
Utils.register
Event("onRefreshAccessedHistory","file:///data/storage/el1/bundle/phone/resources/rawfile/
second.html",116,done);
Utils.register
ContainEvent("onRefreshAccessedHistory","
second.html",116,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
@@ -439,7 +439,7 @@ export default function webJsunit() {
*/
it('onPageBegin',0,async function(done){
emitKey="emitOnPageEnd";
Utils.register
Event("onPageBegin","file:///data/storage/el1/bundle/phone/resources/rawfile/
index.html",59,done);
Utils.register
ContainEvent("onPageBegin","
index.html",59,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
@@ -449,7 +449,7 @@ export default function webJsunit() {
*/
it('onPageEnd',0,async function(done){
emitKey="emitOnConsole";
Utils.register
Event("onPageEnd","file:///data/storage/el1/bundle/phone/resources/rawfile/
index.html",60,done);
Utils.register
ContainEvent("onPageEnd","
index.html",60,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
@@ -629,7 +629,7 @@ export default function webJsunit() {
*/
it('onActive',0,async function(done){
emitKey="emitRegisterJavaScriptProxy";
Utils.register
Event("onActive","file:///data/storage/el1/bundle/phone/resources/rawfile/
index.html",85,done);
Utils.register
ContainEvent("onActive","
index.html",85,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/index.html
浏览文件 @
19bd1b16
...
...
@@ -14,8 +14,8 @@
<body>
<div
id=
"container"
>
首页
</div>
<div
id=
"pageHeight"
></div>
<a
href=
"
file:///data/storage/el1/bundle/phone/resources/rawfile/
second.html"
id=
"fileAccess"
>
打开rawfile文件
</a>
<img
src=
"
file:///data/storage/el1/bundle/phone/resources/rawfile/
icon.png"
alt=
"icon"
id=
"imgs"
>
<a
href=
"second.html"
id=
"fileAccess"
>
打开rawfile文件
</a>
<img
src=
"icon.png"
alt=
"icon"
id=
"imgs"
>
</body>
<script>
let
ele
=
document
.
getElementById
(
"
imgs
"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录