Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
6a290999
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看板
未验证
提交
6a290999
编写于
2月 01, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 01, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7253 【OpenHarmony 4.0.2.3】【master】【ARKUI子系统】【TOD】【rk3568】【必现】修改失败web-xts用例
Merge pull request !7253 from yupeng/master
上级
4645da2b
2dc690eb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
196 addition
and
13 deletion
+196
-13
arkui/ace_ets_webView/entry/src/main/ets/MainAbility/pages/webCovered.ets
...bView/entry/src/main/ets/MainAbility/pages/webCovered.ets
+73
-0
arkui/ace_ets_webView/entry/src/main/ets/MainAbility/test/WebViewCoveredJsunit.test.ets
...c/main/ets/MainAbility/test/WebViewCoveredJsunit.test.ets
+94
-0
arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets
..._web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets
+10
-6
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/Utils.ets
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/Utils.ets
+12
-0
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets
...ts_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets
+7
-7
未找到文件。
arkui/ace_ets_webView/entry/src/main/ets/MainAbility/pages/webCovered.ets
0 → 100644
浏览文件 @
6a290999
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 web_webview from '@ohos.web.webview';
import image from "@ohos.multimedia.image"
@Entry
@Component
struct WebComponent {
controller: web_webview.WebviewController = new web_webview.WebviewController();
@State icon: image.PixelMap = undefined;
@State family: string = "serif";
@State fontSize: number = 13;
build() {
Column() {
Button('getBackForwardEntries').key("webCovered01")
.onClick(() => {
try {
let list = this.controller.getBackForwardEntries();
let historyItem = list.getItemAtIndex(list.currentIndex);
console.log("HistoryItem: " + JSON.stringify(historyItem));
this.icon = historyItem.icon;
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
})
try {
let backData = {
data: {
"ACTION": this.icon
}
}
let backEvent = {
eventId:01,
priority:events_emitter.EventPriority.LOW
}
console.info("webFlag start to emit action state");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("webFlag emit action state err: " + JSON.stringify(err));
}
}
Web({ src: 'www.example.com', controller: this.controller }).key("webCovered02")
.webSerifFont(this.family)
.webSansSerifFont(this.family)
.minLogicalFontSize(this.fontSize)
.onTouchIconUrlReceived((event) => {
console.log('onTouchIconUrlReceived:' + JSON.stringify(event))
})
Divider().width("3%")
Web({ src: 'www.example.com', controller: this.controller }).key("webCovered03")
.onDataResubmitted((event) => {
console.log('onDataResubmitted')
event.handler.resend();
})
}
}
}
\ No newline at end of file
arkui/ace_ets_webView/entry/src/main/ets/MainAbility/test/WebViewCoveredJsunit.test.ets
0 → 100644
浏览文件 @
6a290999
/**
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function webViewCoveredJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('WebViewCoveredTest', function () {
beforeEach(async function (done) {
console.info("WebViewCoveredTest beforeEach start");
let options = {
uri: 'pages/webCovered',
}
try {
router.clear();
let pages = router.getState();
console.info("get WebViewCovered state success " + JSON.stringify(pages));
if (!("WebViewCovered" == pages.name)) {
console.info("get WebViewCovered state success " + JSON.stringify(pages.name));
let result = await router.push(options)
console.info("push WebViewCovered page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push WebViewCovered page error " + JSON.stringify(result));
}
await sleep(4)
done()
});
afterEach(async function () {
await sleep(1)
console.info("WebViewCovered after each called");
});
it('WebViewCoveredJsunit_01', 0, async function (done) {
console.info('[WebViewCoveredJsunit01] START');
try{
let callBack=(backData)=>{
console.info('WebViewCoveredJsunit01 get result is:'+JSON.stringify(backData));
expect(backData.data.ACTION).assertEqual(historyItem.icon);
console.info('[WebViewCoveredJsunit01] END');
done()
}
let innerEvent = {
eventId:01,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(innerEvent,callBack)
}catch(err){
console.info('[WebViewCoveredJsunit01] err:'+JSON.stringify(err));
}
}
sendEventByKey('webCovered01',10,'');
done();
});
it('WebViewCoveredJsunit_02', 0, async function (done) {
console.info('[WebViewCoveredJsunit02] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('webCovered02');
let obj = JSON.parse(strJson);
console.info("[WebViewCoveredJsunit02] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.webSerifFont).assertEqual("serif");
expect(obj.$attrs.webSansSerifFont).assertEqual("serif");
expect(obj.$attrs.minLogicalFontSize).assertEqual(13);
done();
});
})
}
arkui/ace_ets_web_dev_two/entry/src/main/ets/MainAbility/pages/web.ets
浏览文件 @
6a290999
...
...
@@ -32,7 +32,7 @@ struct Index {
host: string = "www.spincast.org"
realm: string = "protected example"
username_password: string[]
origin: string="
file://
/"
origin: string="
resource://rawfile
/"
onPageShow(){
let valueChangeEvent={
eventId:10,
...
...
@@ -84,8 +84,12 @@ struct Index {
})
break;
}
case "emitAllowGeolocation":{
web_webview.GeolocationPermissions.allowGeolocation("file:///")
case "emitAllowGeolocation":{
try {
web_webview.GeolocationPermissions.allowGeolocation("resource://rawfile/");
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
web_webview.GeolocationPermissions.getAccessibleGeolocation(this.origin, (error, result) => {
if (error) {
console.log('error:' + JSON.stringify(error));
...
...
@@ -98,7 +102,7 @@ struct Index {
break;
}
case "emitDeleteGeolocation":{
web_webview.GeolocationPermissions.deleteGeolocation("
file://
/")
web_webview.GeolocationPermissions.deleteGeolocation("
resource://rawfile
/")
web_webview.GeolocationPermissions.getStoredGeolocation((error,origins) => {
if (error) {
console.log('error:' + JSON.stringify(error));
...
...
@@ -111,7 +115,7 @@ struct Index {
break;
}
case "emitDeleteAllGeolocation":{
web_webview.GeolocationPermissions.allowGeolocation("
file://
/")
web_webview.GeolocationPermissions.allowGeolocation("
resource://rawfile
/")
web_webview.GeolocationPermissions.deleteAllGeolocation()
web_webview.GeolocationPermissions.getStoredGeolocation((error,origins) => {
if (error) {
...
...
@@ -160,7 +164,7 @@ struct Index {
break;
}
case "emitLoaData":{
this.controller.loadUrl({url:"
file:///data/storage/el1/bundle/phone/resources
/rawfile/index.html"})
this.controller.loadUrl({url:"
resource:/
/rawfile/index.html"})
setTimeout(()=>{
this.controller.loadData({
data: "
<html><title>
index
</title></html>
",
...
...
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/Utils.ets
浏览文件 @
6a290999
...
...
@@ -29,9 +29,13 @@ export default class Utils {
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
try{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.ACTION).assertEqual(expectedValue);
console.info(`[${testCaseName}] END`);
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
done()
}
let innerEvent = {
...
...
@@ -64,10 +68,14 @@ export default class Utils {
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
try{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.actualValue).assertLarger(backData.data.expectedValue-100);
expect(backData.data.actualValue).assertLess(backData.data.expectedValue-(-100));
console.info(`[${testCaseName}] END`);
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
done()
}
let innerEvent = {
...
...
@@ -101,9 +109,13 @@ export default class Utils {
console.info(`[${testCaseName}] START`);
try{
let callBack=(backData)=>{
try{
console.info(`${testCaseName} get result is:`+JSON.stringify(backData));
expect(backData.data.ACTION).assertContain(expectedValue);
console.info(`[${testCaseName}] END`);
}catch(err){
console.info(`[${testCaseName}] err:`+JSON.stringify(err));
}
done()
}
let innerEvent = {
...
...
arkui/ace_ets_web_dev_two/entry/src/main/ets/test/WebJsunit.test.ets
浏览文件 @
6a290999
...
...
@@ -61,7 +61,7 @@ export default function webJsunit() {
*/
it('allowGeolocation',0,async function(done){
emitKey="emitDeleteGeolocation";
Utils.registerEvent("allowGeolocation","
file://
/, result: true",402,done);
Utils.registerEvent("allowGeolocation","
resource://rawfile
/, result: true",402,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
@@ -69,19 +69,19 @@ export default function webJsunit() {
*tc.name deleteGeolocation
*tc.desic delete specific restored geolocation
*/
it('deletGeolocation',0,async function(done){
it('delet
e
Geolocation',0,async function(done){
emitKey="emitDeleteAllGeolocation";
Utils.registerEvent("deletGeolocation","",404,done);
Utils.registerEvent("delet
e
Geolocation","",404,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_069
*tc.name deletAllGeolocation
*tc.name delet
e
AllGeolocation
*tc.desic delete all restored geolocation
*/
it('deletAllGeolocation',0,async function(done){
it('delet
e
AllGeolocation',0,async function(done){
emitKey="emitIsCookieAllowed";
Utils.registerEvent("deletAllGeolocation","",406,done);
Utils.registerEvent("delet
e
AllGeolocation","",406,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
@@ -141,7 +141,7 @@ export default function webJsunit() {
*/
it('getSourceId',0,async function(done){
emitKey="emitLoaData";
Utils.registerEvent("getSourceId","
file:///data/storage/el1/bundle/phone/resources
/rawfile/index.html",422,done);
Utils.registerEvent("getSourceId","
resource:/
/rawfile/index.html",422,done);
sendEventByKey('webcomponent',10,'');
})
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录