Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
8e5de670
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8e5de670
编写于
2月 16, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 16, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7497 【OpenHarmony 4.0.3.2】【monthly_20221018】【ARKUI子系统】【TOD】【rk3568】【必现】新增web-xts用例
Merge pull request !7497 from 王旭鹏/monthly_20221018
上级
df49bb27
fb772336
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
215 addition
and
13 deletion
+215
-13
arkui/ace_ets_web_dev_three/AppScope/app.json
arkui/ace_ets_web_dev_three/AppScope/app.json
+1
-1
arkui/ace_ets_web_dev_three/entry/src/main/ets/MainAbility/pages/web.ets
...eb_dev_three/entry/src/main/ets/MainAbility/pages/web.ets
+149
-3
arkui/ace_ets_web_dev_three/entry/src/main/ets/test/WebJsunit.test.ets
..._web_dev_three/entry/src/main/ets/test/WebJsunit.test.ets
+59
-3
arkui/ace_ets_web_dev_three/entry/src/main/module.json
arkui/ace_ets_web_dev_three/entry/src/main/module.json
+6
-6
未找到文件。
arkui/ace_ets_web_dev_three/AppScope/app.json
浏览文件 @
8e5de670
...
...
@@ -18,4 +18,4 @@
"singleUser"
:
false
}
}
}
\ No newline at end of file
}
arkui/ace_ets_web_dev_three/entry/src/main/ets/MainAbility/pages/web.ets
浏览文件 @
8e5de670
...
...
@@ -18,17 +18,22 @@ import { Hypium } from '@ohos/hypium';
import testsuite from '../../test/List.test';
import Utils from '../../test/Utils';
import web_webview from '@ohos.web.webview';
import fileio from '@ohos.fileio';
let loadedUrl;
@Entry
@Component
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}
responseweb: WebResourceResponse = new WebResourceResponse()
@State str:string="emitLoadUrl"
@State text:boolean=false
@State num:number=0
@State mode: WebDarkMode = WebDarkMode.Off
@State mode1: WebDarkMode = WebDarkMode.On
@State mode2: WebDarkMode = WebDarkMode.Auto
ports: web_webview.WebMessagePort[];
testObj = {
testOne: (data) => {
Utils.emitEvent(data,13)
...
...
@@ -62,6 +67,14 @@ struct Index {
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
try{
web_webview.once("webInited",()=>{
web_webview.WebCookieManager.setCookie("https://www.huawei.com", "a=b");
})
}catch(error){
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
}
build(){
Column(){
...
...
@@ -72,7 +85,7 @@ struct Index {
case "emitLoadUrl":{
try {
setTimeout(()=>{
this.controller.loadUrl(
'www.baidu.com'
);
this.controller.loadUrl(
"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"
);
setTimeout(()=>{
let title = this.controller.getTitle();
Utils.emitEvent(title,1)
...
...
@@ -406,16 +419,126 @@ struct Index {
}
break;
}
case "emitOnce":{
try {
let re = web_webview.WebCookieManager.getCookie("https://www.huawei.com")
Utils.emitEvent(re, 31)
console.log("result: " + re);
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitGetItemAtIndex":{
try {
let res = this.controller.getBackForwardEntries()
let item =res.getItemAtIndex(0)
Utils.emitEvent(item.title, 32)
console.log("result: " + item.title);
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitSlideScroll":{
try {
this.controller.slideScroll(10, 10);
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
try {
let state = this.controller.serializeWebState();
let path = globalThis.AbilityContext.cacheDir;
path += '/WebState';
let fd = fileio.openSync(path, 0o2 | 0o100, 0o666);
fileio.writeSync(fd, state.buffer);
fileio.closeSync(fd);
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
try {
let path = globalThis.AbilityContext.cacheDir;
path += '/WebState';
let fd = fileio.openSync(path, 0o002, 0o666);
let stat = fileio.fstatSync(fd);
let size = stat.size;
let buf = new ArrayBuffer(size);
fileio.read(fd, buf, (err, data) => {
if (data) {
this.controller.restoreWebState(new Uint8Array(data.buffer));
}
fileio.closeSync(fd);
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
try {
this.ports = this.controller.createWebMessagePorts();
this.ports[1].onMessageEvent((msg) => {
if (typeof(msg) == "string") {
console.log("received string message from html5, string is:" + msg);
} else if (typeof(msg) == "object") {
if (msg instanceof ArrayBuffer) {
console.log("received arraybuffer from html5, length is:" + msg.byteLength);
} else {
console.log("not support");
}
} else {
console.log("not support");
}
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitContextMenuMediaType":{
try {
let con = ContextMenuMediaType.Image
Utils.emitEvent(con, 33)
console.log("result: " + con);
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitContextMenuInputFieldType":{
try {
Utils.emitEvent(ContextMenuInputFieldType.PlainText, 34)
Utils.emitEvent(ContextMenuInputFieldType.Telephone, 35)
Utils.emitEvent(ContextMenuInputFieldType.Other, 36)
console.log("result: " + ContextMenuInputFieldType.PlainText);
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitContextMenuEditStateFlags":{
try {
Utils.emitEvent(ContextMenuEditStateFlags.NONE, 37)
Utils.emitEvent(ContextMenuEditStateFlags.CAN_CUT, 38)
Utils.emitEvent(ContextMenuEditStateFlags.CAN_COPY, 39)
Utils.emitEvent(ContextMenuEditStateFlags.CAN_PASTE, 40)
Utils.emitEvent(ContextMenuEditStateFlags.CAN_SELECT_ALL, 41)
console.log("result: " + ContextMenuEditStateFlags.CAN_SELECT_ALL);
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
default:
console.info("can not match case")
}
})
}
Web({src:"www.example.com",controller:this.controller})
.webDebuggingAccess(true)
.mediaPlayGestureAccess(true)
.javaScriptAccess(true)
.zoomAccess(this.text)
.onDataResubmitted((event) => {
console.log('onDataResubmitted')
event.handler.resend();
})
.onSearchResultReceive(ret=>{
var searchResult = ret.activeMatchOrdinal.toString() +
ret.numberOfMatches.toString()
...
...
@@ -424,6 +547,29 @@ struct Index {
Utils.emitEvent(searchResult,16)
},3000)
})
.onContextMenuShow((event) => {
console.info(event.param.getMediaType() + event.param.getSelectionText() + event.param.getSourceType())
console.info(event.param.getInputFieldType().toString())
console.info(event.param.isEditable().toString())
console.info(event.param.getEditStateFlags().toString())
event.result.paste()
event.result.cut()
return true
})
.onHttpErrorReceive((event) => {
event.response.setResponseIsReady(true)
})
.darkMode(this.mode)
.forceDarkAccess(false)
.webSerifFont('serif')
.webFixedFont('fixed')
.webSansSerifFont('serif')
.minLogicalFontSize(1)
.horizontalScrollBarAccess(true)
.verticalScrollBarAccess(true)
.onTouchIconUrlReceived((event) => {
console.log('onTouchIconUrlReceived:' + JSON.stringify(event))
})
}
}
...
...
arkui/ace_ets_web_dev_three/entry/src/main/ets/test/WebJsunit.test.ets
浏览文件 @
8e5de670
...
...
@@ -51,7 +51,7 @@ export default function webJsunit() {
*/
it('LoadUrl',0,async function(done){
emitKey="emitLoadData";
Utils.registerContainEvent("LoadUrl","
百度一下,你就知道
",1,done);
Utils.registerContainEvent("LoadUrl","
index
",1,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
@@ -71,7 +71,7 @@ export default function webJsunit() {
*/
it('Backward',0,async function(done){
emitKey="emitForward";
Utils.registerEvent("Backward","
百度一下,你就知道
",3,done);
Utils.registerEvent("Backward","
index
",3,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
@@ -340,9 +340,65 @@ export default function webJsunit() {
*tc.desic Save current page
*/
it('GetUrl',0,async function(done){
emitKey="emit
GetUrl
";
emitKey="emit
Once
";
Utils.registerContainEvent("GetUrl","17100001",30,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_031
*tc.name Once
*tc.desic Save current page
*/
it('Once',0,async function(done){
emitKey="emitGetItemAtIndex";
Utils.registerContainEvent("Once","a=b",31,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_032
*tc.name GetItemAtIndex
*tc.desic Save current page
*/
it('GetItemAtIndex',0,async function(done){
emitKey="emitContextMenuMediaType";
Utils.registerEvent("GetItemAtIndex","index",32,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_033
*tc.name ContextMenuMediaType
*tc.desic Save current page
*/
it('ContextMenuMediaType',0,async function(done){
emitKey="emitContextMenuInputFieldType";
Utils.registerEvent("ContextMenuMediaType",1,33,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_034
*tc.name ContextMenuInputFieldType
*tc.desic Save current page
*/
it('ContextMenuInputFieldType',0,async function(done){
emitKey="emitContextMenuEditStateFlags";
Utils.registerEvent("ContextMenuInputFieldType",1,34,done);
Utils.registerEvent("ContextMenuInputFieldType",4,35,done);
Utils.registerEvent("ContextMenuInputFieldType",5,36,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_035
*tc.name ContextMenuEditStateFlags
*tc.desic Save current page
*/
it('ContextMenuEditStateFlags',0,async function(done){
emitKey="emitContextMenuEditStateFlags";
Utils.registerEvent("ContextMenuEditStateFlags",0,37,done);
Utils.registerEvent("ContextMenuEditStateFlags",1,38,done);
Utils.registerEvent("ContextMenuEditStateFlags",2,39,done);
Utils.registerEvent("ContextMenuEditStateFlags",4,40,done);
Utils.registerEvent("ContextMenuEditStateFlags",8,41,done);
sendEventByKey('webcomponent',10,'');
})
})
}
\ No newline at end of file
arkui/ace_ets_web_dev_three/entry/src/main/module.json
浏览文件 @
8e5de670
...
...
@@ -15,11 +15,11 @@
"uiSyntax"
:
"ets"
,
"pages"
:
"$profile:main_pages"
,
"metadata"
:
[
{
"name"
:
"ArkTSPartialUpdate"
,
"value"
:
"fals
e"
}
],
{
"name"
:
"ArkTSPartialUpdate"
,
"value"
:
"tru
e"
}
],
"abilities"
:
[{
"name"
:
"com.example.myapplication.MainAbility"
,
"srcEntrance"
:
"./ets/MainAbility/MainAbility.ts"
,
...
...
@@ -46,4 +46,4 @@
}
]
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录