提交 fc05df80 编写于 作者: Y ywx1211260

add api

Signed-off-by: Nywx1211260 <yupeng78@huawei.com>
上级 be1d602e
......@@ -26,6 +26,8 @@ struct Index {
controller: web_webview.WebviewController = new web_webview.WebviewController();
controllerTwo: web_webview.WebviewController = new web_webview.WebviewController();
scheme1: web_webview.WebCustomScheme = {schemeName: "name1", isSupportCORS: true, isSupportFetch: true}
scheme2: web_webview.WebCustomScheme = {schemeName: "name2", isSupportCORS: true, isSupportFetch: true}
scheme3: web_webview.WebCustomScheme = {schemeName: "name3", isSupportCORS: true, isSupportFetch: true}
responseweb: WebResourceResponse = new WebResourceResponse()
@State str:string="emitLoadUrl"
@State text:boolean=false
......@@ -68,6 +70,7 @@ struct Index {
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
try{
web_webview.WebviewController.customizeSchemes([this.scheme1, this.scheme2, this.scheme3])
web_webview.once("webInited",()=>{
web_webview.WebCookieManager.setCookie("https://www.huawei.com", "a=b");
})
......@@ -526,6 +529,25 @@ struct Index {
}
break;
}
case "emitGetStoredGeolocation":{
try {
web_webview.GeolocationPermissions.allowGeolocation("file:///")
web_webview.GeolocationPermissions.getStoredGeolocation((error, origins) => {
if (error) {
console.log('getStoredGeolocationAsync error: ' + JSON.stringify(error))
return;
}
if (origins) {
let origins_str: string = origins.join()
console.log('getStoredGeolocationAsync origins: ' + origins_str);
Utils.emitEvent(origins_str, 120);
}
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
default:
console.info("can not match case")
}
......
......@@ -392,7 +392,7 @@ export default function webJsunit() {
*tc.desic Save current page
*/
it('ContextMenuEditStateFlags',0,async function(done){
emitKey="emitContextMenuEditStateFlags";
emitKey="emitGetStoredGeolocation";
Utils.registerEvent("ContextMenuEditStateFlags",0,37,done);
Utils.registerEvent("ContextMenuEditStateFlags",1,38,done);
Utils.registerEvent("ContextMenuEditStateFlags",2,39,done);
......@@ -400,5 +400,15 @@ export default function webJsunit() {
Utils.registerEvent("ContextMenuEditStateFlags",8,41,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_036
*tc.name GetStoredGeolocation
*tc.desic Save current page
*/
it('GetStoredGeolocation',0,async function(done){
emitKey="emitGetStoredGeolocation";
Utils.registerEvent("GetStoredGeolocation","file:///",120,done);
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.
先完成此消息的编辑!
想要评论请 注册