未验证 提交 9cfaa6b6 编写于 作者: O openharmony_ci 提交者: Gitee

!5239 web组件新增xts用例

Merge pull request !5239 from 章靖/master
......@@ -37,6 +37,24 @@ struct Index {
@State titleReceive:string=""
@State downloadStart:string=""
@State javaScriptAccess:boolean=true
@State fileAccess:boolean=true
@State domStorageAccess:boolean=false
@State imageAccess:boolean=true
@State geolocationAccess:boolean=true
@State onlineImageAccess:boolean=true
@State fileFromUrlAccess:boolean=true
@State databaseAccess:boolean=true
@State overviewModeAccess:boolean=false
@State initialScale:number=100
@State enterPageEnd:boolean=false
@State newScale:number=0
@State scaleChange:boolean=false
@State geoShow:boolean=false
@State mixedMode:MixedMode=MixedMode.All
@State cacheMode:CacheMode=CacheMode.Default
@State cacheError:boolean=false
@State mixedSwitch:boolean=false
@State mixedAllSwitch:boolean=false
onPageShow(){
let valueChangeEvent={
eventId:10,
......@@ -77,6 +95,17 @@ struct Index {
Column(){
Web({src:$rawfile('index.html'),controller:this.controller})
.javaScriptAccess(this.javaScriptAccess)
.fileAccess(this.fileAccess)
.imageAccess(this.imageAccess)
.domStorageAccess(this.domStorageAccess)
.geolocationAccess(this.geolocationAccess)
.onlineImageAccess(this.onlineImageAccess)
.fileFromUrlAccess(this.fileFromUrlAccess)
.databaseAccess(this.databaseAccess)
.cacheMode(this.cacheMode)
.initialScale(this.initialScale)
.mixedMode(this.mixedMode)
.overviewModeAccess(this.overviewModeAccess)
.userAgent("Mozila/5.0 (Linux; Andriod 9; VRD-AL10; HMSCore 6.3.0.331) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.105 HuaweiBrowser/12.0.4.1 MobileSafari/537.36")
.javaScriptProxy({
object:this.jsObj,
......@@ -113,9 +142,24 @@ struct Index {
})
.onPageEnd((event) => {
this.pageEnd = event.url
console.log("onPageEnd==>")
if(this.enterPageEnd){
Utils.emitEvent(this.newScale,97)
this.enterPageEnd=false
}
})
.onConsole((event) => {
this.console = event.message.getMessage()
let level=event.message.getMessageLevel()
let msg=event.message.getMessage()
console.log("html==>"+msg)
if(this.mixedSwitch){
Utils.emitEvent(msg,186)
this.mixedSwitch=false
}else if(this.mixedAllSwitch){
Utils.emitEvent(level,188)
this.mixedAllSwitch=false
}
return false
})
.onAlert((event) => {
......@@ -127,7 +171,12 @@ struct Index {
return false
})
.onErrorReceive((event) => {
this.errorReceive = event.request.getRequestUrl()
this.errorReceive = event.request.getRequestUrl()
console.log("onErrorReceive==>")
if(this.cacheError){
Utils.emitEvent("cacheError",182)
this.cacheError=false
}
})
.onHttpErrorReceive((event) => {
this.httpErrorReceive = event.response.getResponseCode()
......@@ -138,8 +187,28 @@ struct Index {
.onDownloadStart((event) => {
this.downloadStart = event.url
})
.onScaleChange((event)=>{
console.log("onScaleChange==>")
this.newScale=event.newScale
if(this.scaleChange){
Utils.emitEvent("onScaleChange",98)
this.scaleChange=false
}
})
.onPrompt((event)=>{
event.result.handlePromptConfirm("onPrompt ok")
Utils.emitEvent(event.message,178)
return true
})
.onGeolocationShow(()=>{
console.log("onGeolocationShow==>")
if(this.geoShow){
Utils.emitEvent("onGeolocationShow",99)
this.geoShow=false
}
})
Row(){
Button("web click").key('webcomponent').onClick(()=>{
Button("web click").key('webcomponent').onClick(async ()=>{
console.info("key==>"+this.str)
switch(this.str){
case "emitUserAgent":{
......@@ -224,7 +293,7 @@ struct Index {
let webPageHeight=this.controller.getPageHeight()+""
setTimeout(()=>{
this.controller.runJavaScript({script:"getPageHeight()",callback:(res)=>{
console.info("getPageHeight==>"+res)
console.info("getPageHeight==>"+res)
Utils.emitEventTwo(res,webPageHeight,124)
}})
},3000)
......@@ -274,6 +343,219 @@ struct Index {
},3000)
break;
}
case "emitGeolocationAccessFalse":{
this.geolocationAccess=false
await Utils.sleep(2000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/geo.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getGeoResult()",callback:(res)=>{
console.info("getGeoResult==>"+res)
Utils.emitEvent(res,96)
}})
},3000)
break;
}
case "emitInitialScale":{
this.initialScale=120
await Utils.sleep(1000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"})
this.enterPageEnd=true
break;
}
case "emitOnscaleChange":{
this.initialScale=110
this.scaleChange=true
await Utils.sleep(2000)
this.controller.loadUrl({url:"https://gitee.com/"})
break;
}
case "emitOnGeolocationShow":{
this.geolocationAccess=true
this.geoShow=true
await Utils.sleep(2000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/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"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getDomResult()",callback:(res)=>{
console.info("getDomResult==>"+res)
Utils.emitEvent(res,144)
}})
},3000)
break;
}
case "emitDomStorageAccessTrue":{
this.domStorageAccess=true
await Utils.sleep(2000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/domApi.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getDomResult()",callback:(res)=>{
console.info("getDomResult==>"+res)
Utils.emitEvent(res,146)
}})
},3000)
break;
}
case "emitImageAccessFalse":{
this.imageAccess=false
await Utils.sleep(1000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getImgResult()",callback:(res)=>{
console.info("getImgResult==>"+res)
Utils.emitEvent(res,148)
}})
},3000)
break;
}
case "emitImageAccessTrue":{
this.imageAccess=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getImgResult()",callback:(res)=>{
console.info("getImgResult==>"+res)
Utils.emitEvent(res,150)
}})
},3000)
break;
}
case "emitOnlineImageAccessFalse":{
this.onlineImageAccess=false
await Utils.sleep(1000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/onlineImageAccess.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getImageLoadResult()",callback:(res)=>{
console.info("getImageLoadResult==>"+res)
Utils.emitEvent(res,156)
}})
},3000)
break;
}
case "emitOnlineImageAccessTrue":{
this.onlineImageAccess=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/onlineImageAccess.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getImageLoadResult()",callback:(res)=>{
console.info("getImageLoadResult==>"+res)
Utils.emitEvent(res,158)
}})
},3000)
break;
}
case "emitFileFromUrlAccessFalse":{
this.fileFromUrlAccess=false
await Utils.sleep(2000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/fileFromUrlAccess.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getFileResult()",callback:(res)=>{
console.info("getFileResult==>"+res)
Utils.emitEvent(res,160)
}})
},3000)
break;
}
case "emitFileFromUrlAccessTrue":{
this.fileFromUrlAccess=true
await Utils.sleep(2000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/fileFromUrlAccess.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getFileResult()",callback:(res)=>{
console.info("getFileResult==>"+res)
Utils.emitEvent(res,162)
}})
},3000)
break;
}
case "emitDatabaseAccessTrue":{
this.databaseAccess=true
await Utils.sleep(2000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/databaseAccess.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getDataResult()",callback:(res)=>{
console.info("getDataResult==>"+res)
Utils.emitEvent(res,164)
}})
},3000)
break;
}
case "emitOverviewModeAccessFalse":{
this.overviewModeAccess=false
await Utils.sleep(1000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/overview.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{
console.info("getViewResult==>"+res)
Utils.emitEventTwo(1150,res,168)
}})
},3000)
break;
}
case "emitOverviewModeAccessTrue":{
this.overviewModeAccess=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/overview.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{
console.info("getViewResult==>"+res)
Utils.emitEventTwo(2350,res,170)
}})
},3000)
break;
}
case "emitOnPrompt":{
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
setTimeout(()=>{
this.controller.runJavaScript({script:"toPrompt()"})
},3000)
break;
}
case "emitCacheModeOnly":{
this.cacheError=true
this.cacheMode=CacheMode.Only
await Utils.sleep(2000)
this.controller.loadUrl({url:"https://www.openharmony.cn/mainPlay"})
break;
}
case "emitCacheModeDefault":{
this.cacheMode=CacheMode.Default
await Utils.sleep(2000)
this.controller.loadUrl({url:"https://www.openharmony.cn/mainPlay"})
setTimeout(()=>{
let webTitle=this.controller.getTitle()
Utils.emitEvent(webTitle,184)
},3000)
break;
}
case "emitMixedModeNone":{
this.mixedSwitch=true
this.mixedMode=MixedMode.None
await Utils.sleep(2000)
this.controller.loadUrl({url:"https://www.openharmony.cn/mainPlay"})
break;
}
case "emitMixedModeAll":{
this.mixedAllSwitch=true
this.mixedMode=MixedMode.All
await Utils.sleep(2000)
this.controller.loadUrl({url:"https://www.openharmony.cn/mainPlay"})
break;
}
case "emitFileAccessTrue":{
this.fileAccess=true
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"})
this.controller.runJavaScript({script:"openRawFile()"})
setTimeout(()=>{
let webTitle=this.controller.getTitle()
Utils.emitEvent(webTitle,190)
},3000)
break;
}
case "emitOnPageBegin":{
Utils.emitEvent(this.pageBegin,59)
break;
......
......@@ -115,4 +115,21 @@ export default class Utils {
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
}
static commitKey(emitKey){
try {
let backData = {
data: {
"ACTION": emitKey
}
}
let backEvent = {
eventId:10,
priority:events_emitter.EventPriority.LOW
}
console.info("start send emitKey");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("emit emitKey err: " + JSON.stringify(err));
}
}
}
......@@ -79,6 +79,7 @@ export default function webJsunit() {
*tc.desic Triggered when the render process exits
*/
it('onRenderExited',0,async function(done){
Utils.commitKey("emitOnRenderExited")
emitKey="emitOnResourceLoad";
Utils.registerEvent("onRenderExited",2,106,done);
sendEventByKey('webcomponent',10,'');
......@@ -237,12 +238,222 @@ export default function webJsunit() {
*tc.desic Goes forward or back backOrForward in the history of the web page
*/
it('backOrForward',0,async function(done){
emitKey="emitOnPageBegin";
emitKey="emitGeolocationAccessFalse";
Utils.registerEvent("backOrForward","index",138,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_021
*tc.name geolocationAccessFalse
*tc.desic Sets false not allow access to geographical locations
*/
it('geolocationAccessFalse',0,async function(done){
emitKey="emitInitialScale";
Utils.registerContainEvent("geolocationAccessFalse","位置服务被拒绝",96,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_022
*tc.name initialScale
*tc.desic Sets the initial scale for the Web
*/
it('initialScale',0,async function(done){
emitKey="emitOnscaleChange";
Utils.registerEvent("initialScale",120,97,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_023
*tc.name onScaleChange
*tc.desic Triggered when the scale of WebView changed
*/
it('onScaleChange',0,async function(done){
emitKey="emitOnGeolocationShow";
Utils.registerContainEvent("onScaleChange","onScaleChange",98,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_024
*tc.name onGeolocationShow
*tc.desic Triggered when requesting to show the geolocation permission
*/
it('onGeolocationShow',0,async function(done){
emitKey="emitDomStorageAccessFalse";
Utils.registerContainEvent("onGeolocationShow","onGeolocationShow",99,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_025
*tc.name domStorageAccessFalse
*tc.desic Sets not to enable the DOM Storage API permission
*/
it('domStorageAccessFalse',0,async function(done){
emitKey="emitDomStorageAccessTrue";
Utils.registerContainEvent("domStorageAccessFalse","sorry",144,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_026
*tc.name domStorageAccessTrue
*tc.desic Sets enable the DOM Storage API permission
*/
it('domStorageAccessTrue',0,async function(done){
emitKey="emitImageAccessFalse";
Utils.registerContainEvent("domStorageAccessTrue","domapi",146,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_027
*tc.name imageAccessFalse
*tc.desic Sets Web can not automatically load image resources
*/
it('imageAccessFalse',0,async function(done){
emitKey="emitImageAccessTrue";
Utils.registerEvent("imageAccessFalse","null",148,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_028
*tc.name imageAccessTrue
*tc.desic Sets Web can automatically load image resources
*/
it('imageAccessTrue',0,async function(done){
emitKey="emitOnlineImageAccessFalse";
Utils.registerContainEvent("imageAccessTrue","load complete",150,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_029
*tc.name onlineImageAccessFalse
*tc.desic Sets not to allow image resources to be loaded from the network
*/
it('onlineImageAccessFalse',0,async function(done){
emitKey="emitOnlineImageAccessTrue";
Utils.registerEvent("onlineImageAccessFalse","null",156,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_030
*tc.name onlineImageAccessTrue
*tc.desic Sets allow image resources to be loaded from the network
*/
it('onlineImageAccessTrue',0,async function(done){
emitKey="emitFileFromUrlAccessFalse";
Utils.registerContainEvent("onlineImageAccessTrue","load image complete",158,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_031
*tc.name fileFromUrlAccessFalse
*tc.desic Sets javaScript can not running in the context of a file URL can access content from other file URLs.
*/
it('fileFromUrlAccessFalse',0,async function(done){
emitKey="emitFileFromUrlAccessTrue";
Utils.registerContainEvent("fileFromUrlAccessFalse","fileFromUrlAccess",160,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_032
*tc.name fileFromUrlAccessTrue
*tc.desic Sets javaScript can running in the context of a file URL can access content from other file URLs.
*/
it('fileFromUrlAccessTrue',0,async function(done){
emitKey="emitDatabaseAccessTrue";
Utils.registerContainEvent("fileFromUrlAccessTrue","okStatus",162,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_033
*tc.name databaseAccessTrue
*tc.desic Sets allow the Web access the database
*/
it('databaseAccessTrue',0,async function(done){
emitKey="emitOverviewModeAccessFalse";
Utils.registerContainEvent("databaseAccessTrue","openDatabase",164,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_034
*tc.name overviewModeAccessFalse
*tc.desic Sets not allow the Web access overview mode
*/
it('overviewModeAccessFalse',0,async function(done){
emitKey="emitOverviewModeAccessTrue";
Utils.registerEventTwo("overviewModeAccessFalse",168,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_035
*tc.name overviewModeAccessTrue
*tc.desic Sets allow the Web access overview mode
*/
it('overviewModeAccessTrue',0,async function(done){
emitKey="emitOnPrompt";
Utils.registerEventTwo("overviewModeAccessTrue",170,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_036
*tc.name onPrompt
*tc.desic Triggered when the web page wants to display a JavaScript prompt() dialog
*/
it('onPrompt',0,async function(done){
emitKey="emitCacheModeOnly";
Utils.registerEvent("onPrompt","age",178,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_037
*tc.name cacheModeOnly
*tc.desic load cache and not online
*/
it('cacheModeOnly',0,async function(done){
emitKey="emitCacheModeDefault";
Utils.registerEvent("cacheModeOnly","cacheError",182,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_038
*tc.name cacheModeDefault
*tc.desic load cache when they are available and not expired, otherwise load online
*/
it('cacheModeDefault',0,async function(done){
emitKey="emitMixedModeNone";
Utils.registerContainEvent("cacheModeDefault","OpenHarmony",184,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_039
*tc.name mixedModeNone
*tc.desic Sets Don't allow unsecure sources from a secure origin
*/
it('mixedModeNone',0,async function(done){
emitKey="emitMixedModeAll";
Utils.registerContainEvent("mixedModeNone","insecure image",186,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_040
*tc.name mixedModeAll
*tc.desic Sets Allows all HTTP and HTTPS content can be loaded
*/
it('mixedModeAll',0,async function(done){
emitKey="emitFileAccessTrue";
Utils.registerEvent("mixedModeAll",3,188,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_041
*tc.name fileAccessTrue
*tc.desic Sets enable local file system access in Web
*/
it('fileAccessTrue',0,async function(done){
emitKey="emitOnPageBegin";
Utils.registerContainEvent("fileAccessTrue","index",190,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_042
*tc.name onPageBegin
*tc.desic Triggered when the page loading progress changes
*/
......@@ -252,7 +463,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_022
*tc.number SUB_ACE_BASIC_ETS_API_043
*tc.name onPageEnd
*tc.desic Triggered at the begin of web page loading
*/
......@@ -262,7 +473,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_023
*tc.number SUB_ACE_BASIC_ETS_API_044
*tc.name onConsole
*tc.desic Triggered when the web page receives a JavaScript console message
*/
......@@ -272,7 +483,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_024
*tc.number SUB_ACE_BASIC_ETS_API_045
*tc.name onAlert
*tc.desic Triggered when the Web wants to display a JavaScript alert() dialog
*/
......@@ -282,7 +493,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_025
*tc.number SUB_ACE_BASIC_ETS_API_046
*tc.name onConfirm
*tc.desic Triggered when the web page wants to display a JavaScript confirm() dialog
*/
......@@ -292,7 +503,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_026
*tc.number SUB_ACE_BASIC_ETS_API_047
*tc.name onErrorReceive
*tc.desic Triggered when the web page receives a web resource loading error
*/
......@@ -302,7 +513,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_027
*tc.number SUB_ACE_BASIC_ETS_API_048
*tc.name onHttpErrorReceive
*tc.desic Triggered when the web page receives a web resource loading HTTP error
*/
......@@ -312,7 +523,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_028
*tc.number SUB_ACE_BASIC_ETS_API_049
*tc.name onTitleReceive
*tc.desic Triggered when the title of the main application document changes
*/
......@@ -322,7 +533,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_029
*tc.number SUB_ACE_BASIC_ETS_API_050
*tc.name onDownloadStart
*tc.desic Triggered when starting to download
*/
......@@ -332,7 +543,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_030
*tc.number SUB_ACE_BASIC_ETS_API_051
*tc.name setCookie
*tc.desic Sets the cookie
*/
......@@ -342,7 +553,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_031
*tc.number SUB_ACE_BASIC_ETS_API_052
*tc.name getCookie
*tc.desic Gets all cookies for the given URL
*/
......@@ -352,7 +563,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_032
*tc.number SUB_ACE_BASIC_ETS_API_053
*tc.name zoom
*tc.desic Let the Web zoom by
*/
......@@ -362,7 +573,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_033
*tc.number SUB_ACE_BASIC_ETS_API_054
*tc.name zoomOut
*tc.desic Let the Web zoom out
*/
......@@ -372,7 +583,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_034
*tc.number SUB_ACE_BASIC_ETS_API_055
*tc.name zoomIn
*tc.desic Let the Web zoom in
*/
......@@ -382,7 +593,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_035
*tc.number SUB_ACE_BASIC_ETS_API_056
*tc.name deleteEntireCookie
*tc.desic Delete all cookies
*/
......@@ -392,7 +603,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_036
*tc.number SUB_ACE_BASIC_ETS_API_057
*tc.name saveCookieSync
*tc.desic Saves the cookies
*/
......@@ -402,7 +613,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_037
*tc.number SUB_ACE_BASIC_ETS_API_058
*tc.name clearHistory
*tc.desic Clears the history in the Web
*/
......@@ -412,7 +623,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_038
*tc.number SUB_ACE_BASIC_ETS_API_059
*tc.name stop
*tc.desic Stops the current load
*/
......@@ -422,7 +633,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_039
*tc.number SUB_ACE_BASIC_ETS_API_060
*tc.name onInactive
*tc.desic Let the Web inactive.
*/
......@@ -432,7 +643,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_040
*tc.number SUB_ACE_BASIC_ETS_API_061
*tc.name onActive
*tc.desic Let the Web active
*/
......@@ -442,7 +653,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_041
*tc.number SUB_ACE_BASIC_ETS_API_062
*tc.name registerJavaScriptProxy
*tc.desic Registers the JavaScript object and method list
*/
......@@ -452,7 +663,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_042
*tc.number SUB_ACE_BASIC_ETS_API_063
*tc.name deleteJavaScriptRegister
*tc.desic Deletes a registered JavaScript object with given name
*/
......@@ -462,7 +673,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_043
*tc.number SUB_ACE_BASIC_ETS_API_064
*tc.name javaScriptAccess
*tc.desic Sets whether the Web allows JavaScript scripts to execute
*/
......@@ -472,7 +683,7 @@ export default function webJsunit() {
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_044
*tc.number SUB_ACE_BASIC_ETS_API_065
*tc.name getCookieManager
*tc.desic Gets network cookie manager
*/
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>databaseAccess</title>
</head>
<body>
<div id="status"></div>
<script>
let res=""
try{
if(openDatabase){
res="openDatabase"
}
}catch(e){
console.log("err:"+e)
res="openDatabase is undefined"
}
function getDataResult(){
return res
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>domApi</title>
</head>
<body>
<div id="result"></div>
<script>
if(typeof(Storage)!=="undefined"){
try{
localStorage.setItem("sitename","domapi");
document.getElementById("result").innerHTML=localStorage.getItem("sitename");
}catch(e){
document.getElementById("result").innerHTML="sorry"
}
}
function getDomResult(){
let str=document.getElementById("result").innerHTML
return str
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<title>fileFromUrlAccess</title>
<meta charset="utf-8">
</head>
<body>
<div id="result">fileFromUrlAccess</div>
</body>
<script type="text/javascript">
function load(name){
let xhr=new XMLHttpRequest(),
okStatus=document.location.protocol==="file:" ? 0 : 200;
console.log("okStatus:"+okStatus);
xhr.open("GET",name,false);
xhr.overrideMimeType("text/html;charset=utf-8")
xhr.send(null);
return xhr.status===okStatus?xhr.responseText:null;
}
let text=load("file:///data/storage/el1/bundle/phone/resources/rawfile/fileFromUrlAccess.html");
document.getElementById("result").innerHTML=text;
function getFileResult(){
let text=document.getElementById("result").innerHTML;
return text
}
</script>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>地理位置</title>
</head>
<body>
<div id="result"></div>
<script>
navigator.geolocation.getCurrentPosition(
function(position){
let cords=position.coords;
document.getElementById("result").innerText="当前经度:"+cords.longitude
},
function(error){
let errorTypes={1:"位置服务被拒绝",2:"获取不到位置信息",3:"获取位置信息超时"};
document.getElementById("result").innerText=errorTypes[error.code]
}
);
function getGeoResult(){
let str=document.getElementById("result").innerText
return str
}
</script>
</body>
</html>
\ No newline at end of file
......@@ -14,8 +14,15 @@
<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">
</body>
<script>
let ele=document.getElementById("imgs");
let loadImage;
ele.onload=function(){
loadImage="load complete"
}
function getUserAgent(){
return navigator.userAgent
}
......@@ -49,5 +56,15 @@
function confirmTest(){
confirm("confirm test")
}
function getImgResult(){
return loadImage
}
function toPrompt(){
let result=prompt("age","20");
console.log("result:"+result)
}
function openRawFile(){
document.getElementById("fileAccess").click()
}
</script>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>onlineImageAccess</title>
</head>
<body>
<div id="result">gitee</div>
<img src="https://assets.gitee.com/assets/enterprises/202007/nonprofit-plan-9f4df9ae0451144be097e42b8db40c94.png" alt="gitee" id="gitee">
<script>
let ele=document.getElementById("gitee");
let loadImage;
ele.onload=function(){
loadImage="load image complete"
}
function getImageLoadResult(){
return loadImage
}
</script>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>gailan</title>
<style>
body{
width:2000px;
padding-right:170px;
padding-left: 170px;
border:5px solid blueviolet
}
</style>
</head>
<body>
This is the test page to test SetLoadWithOverviewMode interface
</body>
<script>
function getViewResult(){
let height=document.getElementsByTagName("body")[0].scrollHeight
return height
}
</script>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册