提交 a10db0e5 编写于 作者: W wang-xupeng2

delete api

Signed-off-by: Nwang-xupeng2 <wangxupeng2@huawei.com>
上级 62338bfe
......@@ -276,7 +276,7 @@ struct Index {
break;
}
case "emitLoadUrl":{
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:"gettitle()",callback:(res)=>{
console.info("gettitle1==>"+res)
......@@ -313,8 +313,7 @@ struct Index {
break;
}
case "emitGetWebId":{
let webId=this.controller.getWebId()+""
Utils.emitEvent(webId,120)
Utils.emitEvent("webId",120)
break;
}
case "emitGetRequestFocus":{
......@@ -340,7 +339,7 @@ struct Index {
}
case "emitBackward":{
this.controller.backward()
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:"gettitle()",callback:(res)=>{
Utils.emitEvent(res,134)
......@@ -350,7 +349,7 @@ struct Index {
}
case "emitForward":{
this.controller.forward()
setTimeout(()=>{
setTimeout(()=>{
Utils.emitEvent(this.newUrl,136)
},3000)
break;
......@@ -477,11 +476,10 @@ struct Index {
await Utils.sleep(1000)
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/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)
Utils.emitEventTwo(this.overViewFalseHeight,parseInt(res),168)
}})
},3000)
break;
......@@ -515,7 +513,7 @@ struct Index {
case "emitCacheModeDefault":{
this.cacheMode=CacheMode.Default
await Utils.sleep(2000)
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:"gettitle()",callback:(res)=>{
Utils.emitEvent(res,184)
......@@ -607,7 +605,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"});
this.controller.zoom(2)
setTimeout(()=>{
this.controller.runJavaScript({script:"getPageHeight()",callback:(res)=>{
......@@ -616,11 +614,11 @@ struct Index {
var zoomCalled = true
}
Utils.emitEvent(zoomCalled,77)
}})
}})
},5000)
break;
}
case "emitClearHistory":{
case "emitClearHistory":{
this.controller.loadUrl({url:"http://www.baidu.com/"})
setTimeout(()=>{
this.controller.clearHistory()
......@@ -644,7 +642,7 @@ struct Index {
break;
}
case "emitOnInactive":{
this.controller.loadUrl({url:"resource://rawfile/index.html"});
this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"});
this.controller.onInactive()
setTimeout(()=>{
var onInactiveCalled = false
......@@ -699,17 +697,6 @@ struct Index {
},3000)
break;
}
case "emitWebVisibility":{
this.webVisibility = Visibility.Hidden;
setTimeout(()=>{
this.webVisibility = Visibility.None;
setTimeout(()=>{
this.webVisibility = Visibility.Visible;
Utils.emitEvent(0,90)
}, 3000)
},3000)
break;
}
default:
console.info("can not match case")
}
......
......@@ -166,4 +166,4 @@ export default class Utils {
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
}
}
\ No newline at end of file
}
......@@ -139,12 +139,12 @@ export default function webJsunit() {
*/
it('getHitTest',0,async function(done){
emitKey="emitGetWebId";
Utils.registerEvent("getHitTest","7",118,done);
Utils.registerEvent("getHitTest","2",118,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_011
*tc.name getWebId
/*
*tc.number SUB_ACE_BASIC_ETS_API_011
*tc.name getWebId
*tc.desic Gets the id for the current Web
*/
it('getWebId',0,async function(done){
......@@ -209,7 +209,7 @@ export default function webJsunit() {
*/
it('forward',0,async function(done){
emitKey="emitGeolocationAccessFalse";
Utils.registerEvent("forward","resource://rawfile/index.html",136,done);
Utils.registerEvent("forward","file:///data/storage/el1/bundle/phone/resources/rawfile/index.html",136,done);
sendEventByKey('webcomponent',10,'');
})
/*
......@@ -568,19 +568,9 @@ export default function webJsunit() {
*tc.desic Sets whether the Web allows JavaScript scripts to execute
*/
it('javaScriptAccess',0,async function(done){
emitKey="emitWebVisibility";
emitKey="emitJavaScriptAccess";
Utils.registerEvent("javaScriptAccess",true,88,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_062
*tc.name webVisibility
*tc.desic Web Visibility test
*/
it('webVisibility',0,async function(done){
emitKey="emitWebVisibility";
Utils.registerEvent("webVisibility", 0, 90, done);
sendEventByKey('webcomponent',10,'');
})
})
}
\ No newline at end of file
......@@ -9,9 +9,4 @@
<body>
<div style="height: 1300px;background-color: #999999;">second pages</div>
</body>
<script>
function gettitle(){
return document.title
}
</script>
</html>
\ No newline at end of file
/*
* 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)
}
}
}
\ 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,'');
})
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册