Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
3f001126
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3f001126
编写于
10月 23, 2022
作者:
H
hekun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ACE test case
Signed-off-by:
N
hekun
<
hekun18@huawei.com
>
上级
a9658291
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
286 addition
and
91 deletion
+286
-91
arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/web_api_9.ets
...pilack/entry/src/main/ets/MainAbility/pages/web_api_9.ets
+184
-0
arkui/ace_ets_component_apilack/entry/src/main/ets/test/Web9Jsunit.test.ets
...onent_apilack/entry/src/main/ets/test/Web9Jsunit.test.ets
+101
-0
arkui/ace_ets_component_apilack/entry/src/main/ets/test/WebJsunitApi9.test.ets
...nt_apilack/entry/src/main/ets/test/WebJsunitApi9.test.ets
+1
-91
未找到文件。
arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/web_api_9.ets
0 → 100644
浏览文件 @
3f001126
/*
* 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.
*/
import events_emitter from '@ohos.events.emitter';
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import { Hypium } from '@ohos/hypium';
import web_webview from '@ohos.web.webview';
import testsuite from '../../test/List.test';
import Utils from '../../test/Utils';
@Entry
@Component
struct Index {
controller: web_webview.WebviewController = new web_webview.WebviewController();
@State isSuccess:Boolean = false;
hitTestValue :HitTestValue = new HitTestValue();
@State str:string="emitUserAgent"
webConTextMenuResult:WebContextMenuResult = new WebContextMenuResult();
controllerWeb: WebController = new WebController();
fileSelector:FileSelectorResult = new FileSelectorResult();
fileSelectorParam:FileSelectorParam = new FileSelectorParam();
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;
}
}
}
private jsObj={
test:(res)=>{
Utils.emitEvent(res,102);
},
toString:(str)=>{
console.info("ets toString:"+String(str));
},
register:(res)=>{
Utils.emitEvent(res,86);
return "web222"
}
}
aboutToAppear(){
let abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
build(){
Column(){
Web({ src: 'www.baidu.com', controller: this.controller })
.onContextMenuShow((event) => {
console.info("x coord = " + event.param.x());
console.info("x coord = " + event.param.y());
console.info("link url = " + event.param.getLinkUrl());
console.info("source url = " + event.param.getSourceUrl());
console.info("source url = " + event.param.getUnfilterendLinkUrl());
console.info("source url = " + event.param.existsImageContents());
console.info("" + event.result.copyImage());
console.info("" + event.result.closeContextMenu());
this.isSuccess = true;
Utils.emitEvent(this.isSuccess,1101)
return true;
}).onWindowNew((event) => {
console.log("onWindowNew...");
var popController: WebController = new WebController();
event.handler.setWebController(popController);
this.isSuccess = true;
Utils.emitEvent(this.isSuccess,1102)
}).onShowFileSelector((event) => {
AlertDialog.show({
title: event.fileSelector.getTitle(),
message: 'isCapture:' + event.fileSelector.isCapture() + " mode:" + event.fileSelector.getMode() + 'acceptType:' + event.fileSelector.getAcceptType(),
confirm: {
value: 'upload',
action: () => {
let fileList: Array<string> = [
'/data/storage/el2/base/test',
]
event.result.handleFileList(fileList)
}
},
cancel: () => {
let fileList: Array<string> = []
event.result.handleFileList(fileList)
}
})
return true;
}).onAlert((event) => {
AlertDialog.show({
title: 'onAlert',
message: 'text',
primaryButton: {
value: 'cancel',
action: () => {
event.result.handleCancel()
}
},
secondaryButton: {
value: 'ok',
action: () => {
event.result.handlePromptConfirm("已經確認")
}
},
cancel: () => {
event.result.handleCancel()
}
})
return true;
})
Web({ src: 'www.baidu.com', controller: this.controller })
.onShowFileSelector((event) => {
AlertDialog.show({
title: event.fileSelector.getTitle(),
message: 'isCapture:' + event.fileSelector.isCapture() + " mode:" + event.fileSelector.getMode() + 'acceptType:' + event.fileSelector.getAcceptType(),
confirm: {
value: 'upload',
action: () => {
let fileList: Array<string> = [
'/data/storage/el2/base/test',
]
event.result.handleFileList(fileList)
}
},
cancel: () => {
let fileList: Array<string> = []
console.info("this is Capture " + event.fileSelector.isCapture());
console.info("this is getTitle" + event.fileSelector.getTitle());
console.info("this is getMode" + event.fileSelector.getMode());
console.info("this is getAcceptType" + event.fileSelector.getAcceptType().length);
}
})
return true;
})
Row() {
Button("webTest").key('web2').onClick(async () => {
console.info("key==>"+this.str);
switch(this.str){
// add
case "emitHitTestValue":
let hitValue = this.controller.getHitTestValue();
console.info("hitType: " + hitValue.getType());
console.info("extra: " + hitValue.getExtra());
Utils.emitEvent(hitValue.getType(),1103);
default:
console.info("can not match case")
}
})
}
}
}
}
arkui/ace_ets_component_apilack/entry/src/main/ets/test/Web9Jsunit.test.ets
0 → 100644
浏览文件 @
3f001126
/*
* 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.
*/
import { describe, beforeEach, afterEach, it, expect } from "@ohos/hypium";
import events_emitter from '@ohos.events.emitter';
import router from '@system.router';
import Utils from './Utils.ets';
let emitKey = "emitUserAgent";
export default function web9Jsunit() {
describe('web9Jsunit', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/web_api_9',
}
try {
router.clear();
let pages = router.getState();
console.info("get web9Jsunit state success " + JSON.stringify(pages));
if (!("AlphabetIndexer" == pages.name)) {
console.info("get web9Jsunit state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push web9Jsunit page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push web9Jsunit page error " + JSON.stringify(err));
}
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_0001
* tc.name WebContextMenuResult
* tc.desic webContextMenuResult
*/
it('webContextMenuResultTest001',0,async function(done){
emitKey="emitwebContextMenuResult";
Utils.registerContainEvent("webContextMenuResult",true,1101,done);
})
/*
* tc.number SUB_ACE_BASIC_ETS_API_0002
* tc.name HitTestValue
* tc.desic webContextMenuResult
*/
it('setWebControllerTest002',0,async function(done){
emitKey="emitsetWebController";
Utils.registerContainEvent("setWebController",true,1102,done);
})
/*
* tc.number SUB_ACE_BASIC_ETS_API_0002
* tc.name HitTestValue
* tc.desic webContextMenuResult
*/
it('setWebControllerTest003',0,async function(done){
emitKey="emitHitTestValue";
Utils.registerContainEvent("HitTestValue",true,1103,done);
sendEventByKey('web2',10,'');
})
})
}
arkui/ace_ets_component_apilack/entry/src/main/ets/test/WebJsunitApi9.test.ets
浏览文件 @
3f001126
...
...
@@ -320,96 +320,6 @@ export default function webJsunit() {
Utils.registerContainEvent("isThirdPartyCookieAllowed",false,826,done);
sendEventByKey('webcomponentapi9',10,'');
});
/*
*tc.number SUB_ACE_BASIC_ETS_API_066
*tc.name storeWebArchive
*tc.desic Save current page
*/
it('storeWebArchive',0,async function(done){
emitKey="emitAllowGeolocation";
Utils.registerContainEvent("storeWebArchive","/data/storage/el2/base/",400,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_072
*tc.name isThirdPartyCookieAllowed
*tc.desic return whether the third party cookie is allowed
*/
it('isThirdPartyCookieAllowed',0,async function(done){
emitKey="emitExistCookie";
Utils.registerEvent("isThirdPartyCookieAllowed",false,412,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_073
*tc.name existCookie
*tc.desic return whether there exits cookie
*/
it('existCookie',0,async function(done){
emitKey="emitOnConsole";
Utils.registerEvent("existCookie",false,414,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_076
*tc.name getLineNumber
*tc.desic return the number of console message lines
*/
it('getLineNumber',0,async function(done){
emitKey="emitOnConsole";
Utils.registerEvent("getLineNumber","51",420,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_077
*tc.name getSourceId
*tc.desic return the source url
*/
it('getSourceId',0,async function(done){
emitKey="emitLoaData";
Utils.registerEvent("getSourceId","file:///data/storage/el1/bundle/phone/resources/rawfile/index.html",422,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_078
*tc.name loadData
*tc.desic load specific strings
*/
it('loadData',0,async function(done){
emitKey="emitZoomAccess";
Utils.registerEvent("loadData","index",424,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_080
*tc.name zoomAccess
*tc.desic set whether it is allowed to zoom
*/
it('zoomAccess',0,async function(done){
emitKey="emitSaveHttpAuthCredentials";
Utils.registerEvent("zoomAccess",false,428,done);
sendEventByKey('webcomponent',10,'');
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录