未验证 提交 4eed1e19 编写于 作者: O openharmony_ci 提交者: Gitee

!7300 hap包不解压需求相关修改回退,overviewAccessMode属性的用例优化

Merge pull request !7300 from 章靖/monthly_20221018
......@@ -43,7 +43,6 @@ struct Index {
@State geolocationAccess:boolean=true
@State onlineImageAccess:boolean=true
@State databaseAccess:boolean=true
@State overviewModeAccess:boolean=false
@State initialScale:number=100
@State enterPageEnd:boolean=false
@State newScale:number=0
......@@ -54,7 +53,6 @@ struct Index {
@State cacheError:boolean=false
@State mixedSwitch:boolean=false
@State mixedAllSwitch:boolean=false
@State overViewFalseHeight:number=0
@State isProgressFinish:boolean=false
@State isHttpErrorReceive:boolean=false
onPageShow(){
......@@ -106,7 +104,6 @@ struct Index {
.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,
......@@ -269,7 +266,7 @@ struct Index {
break;
}
case "emitOnResourceLoad":{
this.controller.loadUrl({url:"resource://rawfile/second.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"});
setTimeout(()=>{
Utils.emitEvent(this.loadedResource,108)
},3000)
......@@ -284,7 +281,7 @@ struct Index {
break;
}
case "emitRunJavaScript":{
this.controller.loadUrl({url:"resource://rawfile/index.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"testRunJavaScript()",callback:(res)=>{
Utils.emitEvent(res,112)
......@@ -299,7 +296,7 @@ struct Index {
break;
}
case "emitOnRefreshAccessedHistory":{
this.controller.loadUrl({url:"resource://rawfile/second.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"});
setTimeout(()=>{
Utils.emitEvent(this.newUrl,116)
},3000)
......@@ -316,7 +313,7 @@ struct Index {
break;
}
case "emitGetTitle":{
this.controller.loadUrl({url:"resource://rawfile/index.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"});
setTimeout(()=>{
let webTitle=this.controller.getTitle()
Utils.emitEvent(webTitle,122)
......@@ -324,7 +321,7 @@ struct Index {
break;
}
case "emitGetPageHeight":{
this.controller.loadUrl({url:"resource://rawfile/index.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"});
let webPageHeight=this.controller.getPageHeight()+""
setTimeout(()=>{
this.controller.runJavaScript({script:"getPageHeight()",callback:(res)=>{
......@@ -335,7 +332,7 @@ struct Index {
break;
}
case "emitGetRequestFocus":{
this.controller.loadUrl({url:"resource://rawfile/second.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"});
await Utils.sleep(2000)
sendEventByKey('textInput',10,'')
break;
......@@ -382,7 +379,7 @@ struct Index {
case "emitGeolocationAccessFalse":{
this.geolocationAccess=false
await Utils.sleep(2000)
this.controller.loadUrl({url:"resource://rawfile/geo.html"});
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)
......@@ -394,7 +391,7 @@ struct Index {
case "emitInitialScale":{
this.initialScale=120
await Utils.sleep(1000)
this.controller.loadUrl({url:"resource://rawfile/second.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"});
this.enterPageEnd=true
break;
}
......@@ -409,13 +406,13 @@ struct Index {
this.geolocationAccess=true
this.geoShow=true
await Utils.sleep(2000)
this.controller.loadUrl({url:"resource://rawfile/geo.html"});
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:"resource://rawfile/domApi.html"});
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)
......@@ -427,7 +424,7 @@ struct Index {
case "emitDomStorageAccessTrue":{
this.domStorageAccess=true
await Utils.sleep(2000)
this.controller.loadUrl({url:"resource://rawfile/domApi.html"});
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)
......@@ -439,7 +436,7 @@ struct Index {
case "emitImageAccessFalse":{
this.imageAccess=false
await Utils.sleep(1000)
this.controller.loadUrl({url:"resource://rawfile/index.html"});
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)
......@@ -451,7 +448,7 @@ struct Index {
case "emitImageAccessTrue":{
this.imageAccess=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"resource://rawfile/index.html"});
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)
......@@ -463,7 +460,7 @@ struct Index {
case "emitOnlineImageAccessFalse":{
this.onlineImageAccess=false
await Utils.sleep(1000)
this.controller.loadUrl({url:"resource://rawfile/onlineImageAccess.html"});
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)
......@@ -475,7 +472,7 @@ struct Index {
case "emitOnlineImageAccessTrue":{
this.onlineImageAccess=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"resource://rawfile/onlineImageAccess.html"});
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)
......@@ -487,7 +484,7 @@ struct Index {
case "emitDatabaseAccessTrue":{
this.databaseAccess=true
await Utils.sleep(2000)
this.controller.loadUrl({url:"resource://rawfile/databaseAccess.html"});
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)
......@@ -496,34 +493,8 @@ struct Index {
},3000)
break;
}
case "emitOverviewModeAccessFalse":{
this.overviewModeAccess=false
await Utils.sleep(1000)
this.controller.loadUrl({url:"resource://rawfile/overview.html"});
setTimeout(()=>{
let webPageHeight=this.controller.getPageHeight()
this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{
this.overViewFalseHeight=parseInt(res)
console.info("getViewResult==>"+res)
Utils.emitEventTwo(webPageHeight,res,168)
}})
},3000)
break;
}
case "emitOverviewModeAccessTrue":{
this.overviewModeAccess=true
await Utils.sleep(1000)
this.controller.loadUrl({url:"resource://rawfile/overview.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{
console.info("getViewResult==>"+res)
Utils.emitEventTwo(this.overViewFalseHeight,parseInt(res),170)
}})
},3000)
break;
}
case "emitOnPrompt":{
this.controller.loadUrl({url:"resource://rawfile/index.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"});
setTimeout(()=>{
this.controller.runJavaScript({script:"toPrompt()"})
},3000)
......@@ -562,7 +533,7 @@ struct Index {
}
case "emitFileAccessTrue":{
this.fileAccess=true
this.controller.loadUrl({url:"resource://rawfile/index.html"});
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()
......@@ -616,7 +587,7 @@ struct Index {
break;
}
case "emitOnTitleReceive":{
this.controller.loadUrl({url:"resource://rawfile/index.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"});
setTimeout(()=>{
Utils.emitEvent(this.titleReceive,67)
},3000)
......@@ -645,7 +616,7 @@ struct Index {
break;
}
case "emitZoom":{
this.controller.loadUrl({url:"resource://rawfile/index.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"});
setTimeout(()=>{
this.controller.zoom(2)
setTimeout(() => {
......@@ -728,7 +699,7 @@ struct Index {
}
case "emitOnActive":{
this.controller.onActive()
this.controller.loadUrl({url:"resource://rawfile/index.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"});
setTimeout(()=>{
let onActiveCalled = this.pageBegin
Utils.emitEvent(onActiveCalled,85)
......
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import events_emitter from '@ohos.events.emitter';
import Utils from '../../test/Utils';
@Entry
@Component
struct Second {
controller:WebController = new WebController()
@State str:string="emitOverviewModeAccessTrue"
@State overviewModeAccess:boolean=true
@State overviewScale:string=""
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
};
events_emitter.on(valueChangeEvent,this.valueChangeCallBack);
}
private valueChangeCallBack=(eventData)=>{
console.info("web page valueChangeCallBack");
if(eventData != null){
console.info("valueChangeCallBack:"+ JSON.stringify(eventData));
if(eventData.data.ACTION != null){
this.str = eventData.data.ACTION;
}
}
}
build(){
Column(){
Row(){
Button("web click").key('webcomponenttwo').onClick(async ()=>{
console.info("key==>"+this.str);
switch(this.str){
case "emitOverviewModeAccessTrue":{
this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{
console.info("getViewResult==>"+res);
this.overviewScale=res;
Utils.emitEventTwo(res,"1",168);
}});
break;
}
case "emitOverviewModeAccessFalse":{
this.overviewModeAccess=false;
await Utils.sleep(2000);
this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{
console.info("getViewResult==>"+res);
Utils.emitEventTwo(this.overviewScale,res,170);
}});
break;
}
default:
console.info("can not match case");
}
})
}
Web({src:$rawfile('overview.html'),controller:this.controller})
.overviewModeAccess(this.overviewModeAccess)
}
}
}
......@@ -13,7 +13,8 @@
* limitations under the License.
*/
import webJsunit from './WebJsunit.test'
import webTwoJsunit from './WebTwoJsunit.test'
export default function testsuite() {
webJsunit()
webTwoJsunit()
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import { describe, beforeEach, afterEach, it, expect, beforeAll} from "@ohos/hypium";
import events_emitter from '@ohos.events.emitter';
import router from '@system.router';
import Utils from './Utils.ets';
let emitKey = "emitOverviewModeAccessTrue";
export default function webTwoJsunit() {
describe('overviewTest', function () {
beforeAll(async function (done) {
let options = {
uri: 'MainAbility/pages/webTwo',
}
try {
router.clear();
let pages = router.getState();
console.info("get webTwo state success " + JSON.stringify(pages));
if (!("webTwo" == pages.name)) {
console.info("get webTwo state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push webTwo page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webTwo page error: " + err);
}
done()
});
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("web beforeEach start");
done();
})
afterEach(async function (done) {
console.info("web afterEach start:"+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));
}
await Utils.sleep(2000);
done();
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_001
*tc.name overviewModeAccessTrue
*tc.desic Sets allow the Web access overview mode
*/
it('overviewModeAccessTrue',0,async function(done){
emitKey="emitOverviewModeAccessFalse";
Utils.registerLargerEvent("overviewModeAccessTrue",168,done);
sendEventByKey('webcomponenttwo',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_002
*tc.name overviewModeAccessFalse
*tc.desic Sets not allow the Web access overview mode
*/
it('overviewModeAccessFalse',0,async function(done){
emitKey="emitOverviewModeAccessFalse";
Utils.registerLargerEvent("overviewModeAccessFalse",170,done);
sendEventByKey('webcomponenttwo',10,'');
})
})
}
{
"src": [
"MainAbility/pages/web"
"MainAbility/pages/web",
"MainAbility/pages/webTwo"
]
}
\ No newline at end of file
......@@ -15,8 +15,8 @@
</body>
<script>
function getViewResult(){
let height=document.getElementsByTagName("body")[0].scrollHeight
return height
let scaleNumber=window.visualViewport.scale;
return scaleNumber;
}
</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.
先完成此消息的编辑!
想要评论请 注册