提交 670ffaa9 编写于 作者: Y yupeng
上级 afe18d24
......@@ -36,6 +36,7 @@ struct OnWindowNew {
@State imageAccess:boolean=true;
@State onlineImageAccess:boolean=true;
@State databaseAccess:boolean=true;
@State arr:boolean = true;
onPageShow(){
let valueChangeEvent={
eventId:10,
......@@ -78,9 +79,11 @@ struct OnWindowNew {
this.javaScriptAccess = true;
this.testAllowWindowOpenMethod = false;
this.testMultiWindowAccess = true;
this.controller.runJavaScript("OpenNewWindow()", (res) => {
Utils.emitEvent(this.ref, 7102)
})
setTimeout(()=> {
this.controller.runJavaScript("OpenNewWindow()", (res) => {
Utils.emitEvent(this.ref, 7102)
})
},2000)
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
......@@ -154,19 +157,20 @@ struct OnWindowNew {
break;
}
case "emitGetOriginsPromiseLoadLocalHtml01": {
this.arr = false
let length = -1;
try {
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOrigins()
.then(origins => {
console.log(`getOrigins call`);
if (origins) {
length = origins.length;
console.log(`length is: ${length}`);
}
console.log(`getOrigins call end`);
Utils.emitEvent(length, 7166);
setTimeout(()=> {
web_webview.WebStorage.getOrigins()
.then(origins => {
console.log(`getOrigins call`);
length = origins.length;
console.log(`length is: ${length}`);
Utils.emitEvent(length, 7166);
console.log(`getOrigins call end`);
})
},2000)
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(length, 7166);
......@@ -189,10 +193,12 @@ struct OnWindowNew {
}
})
.onPageVisible((event) => {
if (event) {
console.log('onWindowNew onPageVisible url:' + event.url);
Utils.emitEvent(event.url, this.eventId);
}
if (this.arr) {
if (event) {
console.log('onWindowNew onPageVisible url:' + event.url);
Utils.emitEvent(event.url, this.eventId);
}
}
})
.blockNetwork(this.block)
.onErrorReceive((event) => {
......
......@@ -124,7 +124,7 @@ struct Index {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
this.controller.runJavaScript("test()",(res) => {
Utils.emitEvent(this.userAgentAll, 102)
Utils.emitEvent(this.userAgentAll, 1020)
})
break;
}
......
......@@ -74,8 +74,8 @@ struct webViewOnScroll {
try {
this.firstId = 316;
this.secondId = 318;
this.textX = -100;
this.textY = -100;
this.textX = -50;
this.textY = -50;
this.controller.scrollBy(this.textX, this.textY);
await Utils.sleep(1000)
console.log("action of emitOnscroll is scrollBy" + this.textX + this.textY);
......
......@@ -60,9 +60,8 @@ export default function webViewControllerJsunit() {
*/
it('testGetUserAgent',0,async function(done){
emitKey="emitgetUserAgentAgain";
let userAgent= "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile" +
" Safari/537.36Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36";
Utils.registerEvent("testGetUserAgent",userAgent,102,done);
let userAgent= "Mozilla/5.0 (OpenHarmony 4; ohos) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.0.0 Mobile Safari/537.36Mozilla/5.0 (OpenHarmony 4; ohos) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.0.0 Mobile Safari/537.36";
Utils.registerEvent("testGetUserAgent",userAgent,1020,done);
sendEventByKey('webcomponent',10,'');
})
/*
......@@ -72,8 +71,7 @@ export default function webViewControllerJsunit() {
*/
it('testGetUserAgentAgain',0,async function(done){
emitKey="emitpageDown";
let userAgent= "\"Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88" +
" Mobile Safari/537.36\"";
let userAgent= "\"Mozilla/5.0 (OpenHarmony 4; ohos) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.0.0 Mobile Safari/537.36\"";
Utils.registerEvent("testGetUserAgentAgain",userAgent,104,done);
sendEventByKey('webcomponent',10,'');
})
......
......@@ -82,8 +82,8 @@ export default function webViewOnScroll() {
*/
it('testOnscrollAgain',0,async function(done){
emitKey="emitOnscrollAgain";
Utils.registerEvent("testOnscrollAgain",0,316,done);
Utils.registerEvent("testOnscrollAgain",0,318,done);
Utils.registerEvent("testOnscrollAgain",50,316,done);
Utils.registerEvent("testOnscrollAgain",50,318,done);
sendEventByKey('webViewOnScroll',10,'');
})
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册