Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
bd29e310
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看板
提交
bd29e310
编写于
6月 09, 2023
作者:
W
wmlih
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test:add webstorage testcase
Signed-off-by:
N
wmlih
<
wmlih@isoftstone.com
>
上级
59b92dc8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
951 addition
and
3 deletion
+951
-3
arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/MainAbility/pages/onWindowNew.ets
...ller/entry/src/main/ets/MainAbility/pages/onWindowNew.ets
+21
-1
arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/MainAbility/pages/webStorage.ets
...oller/entry/src/main/ets/MainAbility/pages/webStorage.ets
+534
-0
arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/List.test.ets
...v_webviewController/entry/src/main/ets/test/List.test.ets
+2
-0
arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/WebViewOnWindowNewJsunit.test.ets
...entry/src/main/ets/test/WebViewOnWindowNewJsunit.test.ets
+13
-1
arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/WebViewWebStorageJsunit.test.ets
.../entry/src/main/ets/test/WebViewWebStorageJsunit.test.ets
+340
-0
arkui/ace_ets_web_dev_webviewController/entry/src/main/resources/base/profile/main_pages.json
...ler/entry/src/main/resources/base/profile/main_pages.json
+2
-1
arkui/ace_ets_web_dev_webviewController/entry/src/main/resources/rawfile/getOrigins.html
...ntroller/entry/src/main/resources/rawfile/getOrigins.html
+39
-0
未找到文件。
arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/MainAbility/pages/onWindowNew.ets
浏览文件 @
bd29e310
...
...
@@ -32,7 +32,7 @@ struct OnWindowNew {
@State userAgent:string = "Mozilla/5.0 (Window NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) CHrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27";
@State javaScriptAccess:boolean=true;
@State fileAccess:boolean=true;
@State domStorageAccess:boolean=
fals
e;
@State domStorageAccess:boolean=
tru
e;
@State imageAccess:boolean=true;
@State onlineImageAccess:boolean=true;
@State databaseAccess:boolean=true;
...
...
@@ -153,6 +153,26 @@ struct OnWindowNew {
}
break;
}
case "emitGetOriginsPromiseLoadLocalHtml01": {
let length = -1;
try {
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOrigins()
.then(origins => {
console.log(`getOrigins call`);
if (origins) {
length = origins.length;
console.log(`length is: ${length}`);
}
console.log(`getOrigins call end`);
Utils.emitEvent(length, 7166);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(length, 7166);
}
break;
}
}
})
}
...
...
arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/MainAbility/pages/webStorage.ets
0 → 100644
浏览文件 @
bd29e310
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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';
import web_webview from '@ohos.web.webview';
@Entry
@Component
struct getOrigins {
controller: web_webview.WebviewController = new web_webview.WebviewController();
@State str:string= "emitGetOriginsCallbackLoadWebkit01";
@State userAgent:string = "Mozilla/5.0 (Window NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) CHrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27";
@State testMultiWindowAccess:boolean = true;
@State testAllowWindowOpenMethod:boolean = true;
@State javaScriptAccess:boolean= true;
@State fileAccess:boolean= true;
@State domStorageAccess:boolean= true
@State imageAccess:boolean= true
@State onlineImageAccess:boolean= true
@State databaseAccess:boolean= true
@State origin:string= 'resource://rawfile/'
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('webStorage').onClick(async () => {
console.info("key==>" + this.str)
switch (this.str) {
case "emitGetOriginsCallbackLoadWebkit01": {
let origin = '';
try {
web_webview.WebStorage.getOrigins((error, origins) => {
console.log(`getOrigins callback call`);
if (origins) {
origin = origins[0].origin;
console.log(`origin is: ${origins[0].origin}`);
}
Utils.emitEvent(origin, 7136);
console.log(`getOrigins callback call end`);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(origin, 7136);
}
break;
}
case "emitGetOriginsCallbackLoadWebkit02": {
let usage = -1;
try {
web_webview.WebStorage.getOrigins((error, origins) => {
console.log(`getOrigins callback call`);
if (origins) {
usage = origins[0].usage;
console.log(`usage is: ${origins[0].usage}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(usage, 7138);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(usage, 7138);
}
break;
}
case "emitGetOriginsCallbackLoadWebkit03": {
let quota = -1;
try {
web_webview.WebStorage.getOrigins((error, origins) => {
console.log(`getOrigins callback call`);
if (origins) {
quota = origins[0].quota;
console.log(`quota is: ${origins[0].quota}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(quota.toString(), 7140);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(quota.toString(), 7140);
}
break;
}
case "emitGetOriginsPromiseLoadWebkit01": {
let origin = '';
try {
web_webview.WebStorage.getOrigins()
.then(origins => {
console.log(`getOrigins call`);
if (origins) {
origin = origins[0].origin;
console.log(`origin is: ${origins[0].origin}`);
}
Utils.emitEvent(origin, 7142);
console.log(`getOrigins call end`);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(origin, 7142);
}
break;
}
case "emitGetOriginsPromiseLoadWebkit02": {
let usage = -1;
try {
web_webview.WebStorage.getOrigins()
.then(origins => {
console.log(`getOrigins call`);
if (origins) {
usage = origins[0].usage;
console.log(`usage is: ${origins[0].usage}`);
}
console.log(`getOrigins call end`);
Utils.emitEvent(usage, 7144);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(usage, 7144);
}
break;
}
case "emitGetOriginsPromiseLoadWebkit03": {
let quota = -1;
try {
web_webview.WebStorage.getOrigins()
.then(origins => {
console.log(`getOrigins call`);
if (origins) {
quota = origins[0].quota;
console.log(`quota is: ${origins[0].quota}`);
}
console.log(`getOrigins call end`);
Utils.emitEvent(quota.toString(), 7146);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(quota.toString(), 7146);
}
break;
}
case "emitGetOriginsCallbackLoadBaidu01": {
let length = -1;
try {
this.controller.loadUrl('www.baidu.com');
web_webview.WebStorage.getOrigins((error, origins) => {
console.log(`getOrigins callback call`);
if (origins) {
length = origins.length;
console.log(`length is: ${length}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(length, 7148);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(length, 7148);
}
break;
}
case "emitGetOriginsCallbackLoadBaidu02": {
let usage = -1;
try {
this.controller.loadUrl('www.baidu.com');
web_webview.WebStorage.getOrigins((error, origins) => {
console.log(`getOrigins callback call`);
if (origins) {
usage = origins[0].usage;
console.log(`usage is: ${usage}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(usage, 7150);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(usage, 7150);
}
break;
}
case "emitGetOriginsCallbackLoadBaidu03": {
let quota = -1;
try {
this.controller.loadUrl('www.baidu.com');
web_webview.WebStorage.getOrigins((error, origins) => {
console.log(`getOrigins callback call`);
if (origins) {
quota = origins[0].quota;
console.log(`quota is: ${origins[0].quota}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(quota.toString(), 7152);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(quota.toString(), 7152);
}
break;
}
case "emitGetOriginsPromiseLoadBaidu01": {
let length = -1;
try {
this.controller.loadUrl('www.baidu.com');
web_webview.WebStorage.getOrigins()
.then(origins => {
console.log(`getOrigins callback call`);
if (origins) {
length = origins.length;
console.log(`length is: ${length}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(length, 7154);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(length, 7154);
}
break;
}
case "emitGetOriginsPromiseLoadBaidu02": {
let usage = -1;
try {
this.controller.loadUrl('www.baidu.com');
web_webview.WebStorage.getOrigins()
.then(origins => {
console.log(`getOrigins callback call`);
if (origins) {
usage = origins[0].usage;
console.log(`usage is: ${usage}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(usage, 7156);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(usage, 7156);
}
break;
}
case "emitGetOriginsPromiseLoadBaidu03": {
let quota = -1;
try {
this.controller.loadUrl('www.baidu.com');
web_webview.WebStorage.getOrigins()
.then(origins => {
console.log(`getOrigins callback call`);
if (origins) {
quota = origins[0].quota;
console.log(`quota is: ${origins[0].quota}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(quota.toString(), 7158);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(quota.toString(), 7158);
}
break;
}
case "emitGetOriginsCallbackLoadLocalHtml01": {
let length = -1;
try {
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOrigins((error, origins) => {
console.log(`getOrigins callback call`);
if (origins) {
length = origins.length;
console.log(`length is: ${length}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(length, 7160);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(length, 7160);
}
break;
}
case "emitGetOriginsCallbackLoadLocalHtml02": {
let usage = -1;
try {
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOrigins((error, origins) => {
console.log(`getOrigins callback call`);
if (origins) {
usage = origins[0].usage;
console.log(`usage is: ${origins[0].usage}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(usage, 7162);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(usage, 7162);
}
break;
}
case "emitGetOriginsCallbackLoadLocalHtml03": {
let quota = -1
try {
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOrigins((error, origins) => {
console.log(`getOrigins callback call`);
if (origins) {
quota = origins[0].quota;
console.log(`quota is: ${origins[0].quota}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(quota.toString(), 7164);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(quota.toString(), 7164);
}
break;
}
case "emitGetOriginsPromiseLoadLocalHtml02": {
let usage = -1;
try {
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOrigins()
.then(origins => {
console.log(`getOrigins call`);
if (origins) {
usage = origins[0].usage;
console.log(`usage is: ${origins[0].usage}`);
}
console.log(`getOrigins call end`);
Utils.emitEvent(usage, 7168);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(usage, 7168);
}
break;
}
case "emitGetOriginsPromiseLoadLocalHtml03": {
let quota = -1
try {
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOrigins()
.then(origins => {
console.log(`getOrigins call`);
if (origins) {
quota = origins[0].quota;
console.log(`quota is: ${origins[0].quota}`);
Utils.emitEvent(quota.toString(), 7170);
}
console.log(`getOrigins call end`);
}).catch(error => {
console.log('getOrigins error: ' + JSON.stringify(error));
Utils.emitEvent(quota.toString(), 7170);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(quota.toString(), 7170);
}
break;
}
case "emitDeleteOrigin": {
let getUsage = -1
try {
web_webview.WebStorage.deleteOrigin(this.origin);
setTimeout(()=> {
web_webview.WebStorage.getOriginUsage(this.origin)
.then(usage => {
console.log('usage is: ' + usage);
getUsage = usage;
Utils.emitEvent(getUsage, 7172);
})
.catch(error => {
console.log('getOriginUsage error: ' + JSON.stringify(error));
Utils.emitEvent(getUsage, 7172);
})
},3000)
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(getUsage, 7172);
}
break;
}
case "emitDeleteAllData": {
let getUsage = -1
try {
web_webview.WebStorage.deleteAllData();
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOriginUsage(this.origin)
.then(usage => {
console.log('usage is: ' + usage);
getUsage = usage;
Utils.emitEvent(getUsage, 7174);
})
.catch(error => {
console.log('getOriginUsage error: ' + JSON.stringify(error));
Utils.emitEvent(getUsage, 7174);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(getUsage, 7174);
}
break;
}
case "emitGetOriginQuotaCallback": {
let getQuota = -1
try {
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOriginQuota(this.origin, (error, quota) => {
if (quota) {
console.log('quota is: ' + quota);
getQuota = quota;
}
Utils.emitEvent(getQuota.toString(), 7176);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(getQuota.toString(), 7176);
}
break;
}
case "emitGetOriginQuotaPromise": {
let getQuota = -1
try {
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOriginQuota(this.origin)
.then(quota => {
console.log('quota is: ' + quota);
getQuota = quota;
Utils.emitEvent(getQuota.toString(), 7178);
})
.catch(error => {
console.log('getOriginQuota error: ' + JSON.stringify(error));
Utils.emitEvent(getQuota.toString(), 7178);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(getQuota.toString(), 7178);
}
break;
}
case "emitGetOriginUsageCallback": {
let getUsage = -1
try {
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOriginUsage(this.origin, (error, usage) => {
if (usage) {
console.log('usage is: ' + usage);
getUsage = usage;
}
Utils.emitEvent(getUsage, 7180);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(getUsage, 7180);
}
break;
}
case "emitGetOriginUsagePromise": {
let getUsage = -1
try {
this.controller.loadUrl($rawfile('getOrigins.html'));
web_webview.WebStorage.getOriginUsage(this.origin)
.then(usage => {
console.log('usage is: ' + usage);
getUsage = usage;
Utils.emitEvent(getUsage, 7182);
})
.catch(error => {
console.log('getOriginUsage error: ' + JSON.stringify(error));
Utils.emitEvent(getUsage, 7182);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(getUsage, 7182);
}
break;
}
case "emitGetOriginsDomStorageAccessFalse": {
let quota = -1;
try {
this.domStorageAccess = false;
web_webview.WebStorage.getOrigins((error, origins) => {
console.log(`getOrigins callback call`);
if (origins) {
quota = origins[0].quota;
console.log(`quota is: ${origins[0].quota}`);
}
console.log(`getOrigins callback call end`);
Utils.emitEvent(quota.toString(), 7184);
})
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
Utils.emitEvent(quota.toString(), 7184);
}
break;
}
}
})
}
Web({ src: 'https://webkit.org/demos/sticky-notes/index.html', controller: this.controller })
.multiWindowAccess(this.testMultiWindowAccess)
.allowWindowOpenMethod(this.testAllowWindowOpenMethod)
.javaScriptAccess(this.javaScriptAccess)
.fileAccess(this.fileAccess)
.imageAccess(this.imageAccess)
.domStorageAccess(this.domStorageAccess)
.onlineImageAccess(this.onlineImageAccess)
.databaseAccess(this.databaseAccess)
.userAgent(this.userAgent)
}
}
}
\ No newline at end of file
arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/List.test.ets
浏览文件 @
bd29e310
...
...
@@ -19,6 +19,7 @@ import webViewOnErrorReceive03Jsunit from './WebViewOnErrorReceive03Jsunit.test'
import webViewHasImageJsunit from './webViewHasImageJsunit.test'
import webViewSrollToJsunit from './webViewSrollToJsunit.test'
import webViewSrollByJsunit from './webViewSrollByJsunit.test'
import WebViewWebStorageJsunit from './WebViewWebStorageJsunit.test'
export default function testsuite() {
webViewControllerJsunit()
webViewOnWindowNewJsunit()
...
...
@@ -27,4 +28,5 @@ export default function testsuite() {
webViewHasImageJsunit()
webViewSrollToJsunit()
webViewSrollByJsunit()
WebViewWebStorageJsunit()
}
\ No newline at end of file
arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/WebViewOnWindowNewJsunit.test.ets
浏览文件 @
bd29e310
...
...
@@ -148,9 +148,21 @@ export default function webViewOnWindowNewJsunit() {
*tc.desc test api blockNetWork set to false by load online website
*/
it('testBlockNetWorkFalse',0,async function(done){
let title = "www.weibo.com";
emitKey="emitGetOriginsPromiseLoadLocalHtml01";
let title = "www.weibo.com";
Utils.registerEvent("testBlockNetWorkFalse", title, 7114, done);
sendEventByKey('onWindowNew', 10, '');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_0100
*tc.name testGetOriginsPromiseLoadLocalHtml01
*tc.desc test api GetOrigins promise mode by load loacal html
*/
it('testGetOriginsPromiseLoadLocalHtml01', 0, async function(done){
emitKey = 'emitGetOriginsPromiseLoadLocalHtml01';
let length = 1;
Utils.registerEvent("testGetOriginsPromiseLoadLocalHtml01", length, 7166, done);
sendEventByKey('onWindowNew', 10, '');
})
})
}
\ No newline at end of file
arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/WebViewWebStorageJsunit.test.ets
0 → 100644
浏览文件 @
bd29e310
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) 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 Utils from './Utils.ets';
import router from '@system.router';
let emitKey = 'emitGetOriginsCallbackLoadWebkit';
export default function WebViewWebStorageJsunit() {
describe('actsAceWebViewWebStorageJsunit', function () {
beforeEach(async function (done) {
let options = {
uri: "MainAbility/pages/webStorage"
}
try {
router.clear();
let pages = router.getState();
console.info("get webStorage state success " + JSON.stringify(pages));
if (!("webStorage" == pages.name)) {
console.info("get webStorage state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push webStorage page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webStorage page error: " + err);
}
await Utils.sleep(2000);
done()
})
afterEach(async function (done) {
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_GETORIGINS_0100
*tc.name testGetOriginsCallbackLoadWebkit01
*tc.desc test api getOrigins callback mode by checking the value 0f Origins[0].origin when load website which
* address is 'https://webkit.org/demos/sticky-notes/index.html'
*/
it('testGetOriginsCallbackLoadWebkit01', 0, async function(done){
emitKey = 'emitGetOriginsCallbackLoadWebkit02';
let origin = 'https://webkit.org/';
Utils.registerEvent("testGetOriginsCallbackLoadWebkit01", origin, 7136, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_0200
*tc.name testGetOriginsCallbackLoadWebkit02
*tc.desc test api getOrigins callback mode by checking the value 0f Origins[0].usage when load website which
* address is 'https://webkit.org/demos/sticky-notes/index.html'
*/
it('testGetOriginsCallbackLoadWebkit02', 0, async function(done){
emitKey = 'emitGetOriginsCallbackLoadWebkit03';
let usage = 24576;
Utils.registerEvent("testGetOriginsCallbackLoadWebkit02", usage, 7138, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_0300
*tc.name testGetOriginsCallbackLoadWebkit03
*tc.desc test api getOrigins callback mode by the value 0f checking Origins[0].quote when load website which
* address is 'https://webkit.org/demos/sticky-notes/index.html'
*/
it('testGetOriginsCallbackLoadWebkit03', 0, async function(done){
emitKey = 'emitGetOriginsPromiseLoadWebkit01';
let quota = 4054614016;
Utils.registerEvent("testGetOriginsCallbackLoadWebkit03", quota.toString(), 7140, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_0400
*tc.name testGetOriginsPromiseLoadWebkit01
*tc.desc test api getOrigins promise mode by checking the value 0f Origins[0].origin when load website which address
* is 'https://webkit.org/demos/sticky-notes/index.html'
*/
it('testGetOriginsPromiseLoadWebkit01', 0, async function(done){
emitKey = 'emitGetOriginsPromiseLoadWebkit02';
let origin = 'https://webkit.org/';
Utils.registerEvent("testGetOriginsPromiseLoadWebkit01", origin, 7142, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_0500
*tc.name testGetOriginsPromiseLoadWebkit02
*tc.desc test api getOrigins promise mode by checking the value 0f Origins[0].usage when load website which address
* is 'https://webkit.org/demos/sticky-notes/index.html'
*/
it('testGetOriginsPromiseLoadWebkit02', 0, async function(done){
emitKey = 'emitGetOriginsPromiseLoadWebkit03';
let usage = 24576;
Utils.registerEvent("testGetOriginsPromiseLoadWebkit02", usage, 7144, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_0600
*tc.name testGetOriginsPromiseLoadWebkit03
*tc.desc test api getOrigins promise mode by the value 0f checking Origins[0].quote when load website which address
* is 'https://webkit.org/demos/sticky-notes/index.html'
*/
it('testGetOriginsPromiseLoadWebkit03', 0, async function(done){
emitKey = 'emitGetOriginsCallbackLoadBaidu01';
let quota = 4054614016;
Utils.registerEvent("testGetOriginsPromiseLoadWebkit03", quota.toString(), 7146, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_0700
*tc.name testGetOriginsCallbackLoadBaidu01
*tc.desc test api getOrigins callback mode by checking the length of origins when load website which address
* is 'https://www.baidu.com'
*/
it('testGetOriginsCallbackLoadBaidu01', 0, async function(done){
emitKey = 'emitGetOriginsCallbackLoadBaidu02';
let length = 1;
Utils.registerEvent("testGetOriginsCallbackLoadBaidu01", length, 7148, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_0800
*tc.name testGetOriginsLoadBaidu02
*tc.desc test api getOrigins callback mode by checking the value 0f Origins[0].usage when load website which address
* is 'https://www.baidu.com'
*/
it('testGetOriginsCallbackLoadBaidu02', 0, async function(done){
emitKey = 'emitGetOriginsCallbackLoadBaidu03';
let usage = 24576;
Utils.registerEvent("testGetOriginsCallbackLoadBaidu02", usage, 7150, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_0900
*tc.name testGetOriginsCallbackLoadBaidu03
*tc.desc test api getOrigins callback mode by checking the value 0f Origins[0].quota when load website which address
* is 'https://www.baidu.com'
*/
it('testGetOriginsCallbackLoadBaidu03', 0, async function(done){
emitKey = 'emitGetOriginsPromiseLoadBaidu01';
let quota = 4054614016;
Utils.registerEvent("testGetOriginsCallbackLoadBaidu03", quota.toString(), 7152, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_1000
*tc.name testGetOriginsPromiseLoadBaidu01
*tc.desc test api getOrigins Promise mode by checking the length of origins when load website which address
* is 'https://www.baidu.com'
*/
it('testGetOriginsPromiseLoadBaidu01', 0, async function(done){
emitKey = 'emitGetOriginsPromiseLoadBaidu02';
let length = 1;
Utils.registerEvent("testGetOriginsPromiseLoadBaidu01", length, 7154, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_1100
*tc.name testGetOriginsPromiseLoadBaidu02
*tc.desc test api getOrigins Promise mode by checking the value 0f Origins[0].usage when load website which address
* is 'https://www.baidu.com'
*/
it('testGetOriginsPromiseLoadBaidu02', 0, async function(done){
emitKey = 'emitGetOriginsPromiseLoadBaidu03';
let usage = 24576;
Utils.registerEvent("testGetOriginsPromiseLoadBaidu02", usage, 7156, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_1200
*tc.name testGetOriginsPromiseLoadBaidu03
*tc.desc test api getOrigins Promise mode by checking the value 0f Origins[0].quota when load website which address
* is 'https://www.baidu.com'
*/
it('testGetOriginsPromiseLoadBaidu03', 0, async function(done){
emitKey = 'emitGetOriginsCallbackLoadLocalHtml01';
let quota = 4054614016;
Utils.registerEvent("testGetOriginsPromiseLoadBaidu03", quota.toString(), 7158, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_1300
*tc.name testGetOriginsCallbackLoadLocalHtml01
*tc.desc test api getOrigins callback mode by checking the length of origins when load local html
*/
it('testGetOriginsCallbackLoadLocalHtml01', 0, async function(done){
emitKey = 'emitGetOriginsCallbackLoadLocalHtml02';
let length = 1;
Utils.registerEvent("testGetOriginsCallbackLoadLocalHtml01", length, 7160, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_1400
*tc.name testGetOriginsLoadCallbackLocalHtml02
*tc.desc test api getOrigins callback mode by checking the value 0f Origins[0].usage when load local html
*/
it('testGetOriginsLoadCallbackLocalHtml02', 0, async function(done){
emitKey = 'emitGetOriginsCallbackLoadLocalHtml03';
let usage = 24576;
Utils.registerEvent("testGetOriginsLoadCallbackLocalHtml02", usage, 7162, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_1500
*tc.name testGetOriginsCallbackLoadLocalHtml03
*tc.desc test api getOrigins callback mode by checking the value 0f Origins[0].quota when load local html
*/
it('testGetOriginsCallbackLoadLocalHtml03', 0, async function(done){
emitKey = 'emitGetOriginsPromiseLoadLocalHtml02';
let quota = 4054614016;
Utils.registerEvent("testGetOriginsCallbackLoadLocalHtml03", quota.toString(), 7164, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_1600
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_1700
*tc.name testGetOriginsPromiseLoadLocalHtml02
*tc.desc test api getOrigins callback mode by checking the value 0f Origins[0].usage when load local html
*/
it('testGetOriginsLoadPromiseLocalHtml02', 0, async function(done){
emitKey = 'emitGetOriginsPromiseLoadLocalHtml03';
let usage = 24576;
Utils.registerEvent("testGetOriginsPromiseLoadLocalHtml02", usage, 7168, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_1800
*tc.name testGetOriginsPromiseLoadLocalHtml03
*tc.desc test api getOrigins Promise mode by checking the value 0f Origins[0].quota when load local html
*/
it('testGetOriginsPromiseLoadLocalHtml03', 0, async function(done){
emitKey = 'emitDeleteOrigin';
let quota = 4054614016;
Utils.registerEvent("testGetOriginsPromiseLoadLocalHtml03", quota.toString(), 7170, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_1900
*tc.name testDeleteOrigin
*tc.desc test api deleteOrigin by checking the value 0f getOriginUsage when delete 'resource://rawfile/'
*/
it('testDeleteOrigin', 0, async function(done){
emitKey = 'emitDeleteAllData';
let usage = 0;
Utils.registerEvent("testDeleteOrigin", usage, 7172, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_2000
*tc.name testDeleteAllData
*tc.desc test api deleteAllData by checking the value 0f getOriginUsage when delete 'resource://rawfile/'
*/
it('testDeleteAllData', 0, async function(done){
emitKey = 'emitGetOriginQuotaCallback';
let usage = 0;
Utils.registerEvent("testDeleteAllData", usage, 7174, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_2100
*tc.name testGetOriginQuotaCallback
*tc.desc test api getOriginQuota callbcak mode by load loacal html
*/
it('testGetOriginQuotaCallback', 0, async function(done){
emitKey = 'emitGetOriginQuotaPromise';
let quota = 4054614016;
Utils.registerEvent("testGetOriginQuotaCallback", quota.toString(), 7176, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_2200
*tc.name testGetOriginQuotaPromise
*tc.desc test api getOriginQuota callbcak mode by load loacal html
*/
it('testGetOriginQuotaPromise', 0, async function(done){
emitKey = 'emitGetOriginUsageCallback';
let quota = 4054614016;
Utils.registerEvent("testGetOriginQuotaPromise", quota.toString(), 7178, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_2300
*tc.name testGetOriginUsageCallback
*tc.desc test api getOriginUsage callbcak mode by load loacal html
*/
it('testGetOriginUsageCallback', 0, async function(done){
emitKey = 'emitGetOriginUsagePromise';
let usage = 24576;
Utils.registerEvent("testGetOriginUsageCallback", usage, 7180, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_GETORIGINS_2400
*tc.name testGetOriginUsagePromise
*tc.desc test api getOriginUsage callbcak mode by load loacal html
*/
it('testGetOriginUsagePromise', 0, async function(done){
emitKey = 'emitGetOriginsDomStorageAccessFalse';
let usage = 24576;
Utils.registerEvent("testGetOriginUsagePromise", usage, 7182, done);
sendEventByKey('webStorage',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_0900
*tc.name testGetOriginsDomStorageAccessFalse
*tc.desc test api blockNetWork set to false by load online website
*/
it('testGetOriginsDomStorageAccessFalse',0,async function(done){
let quota = 4054614016;
Utils.registerEvent("testGetOriginsDomStorageAccessFalse", quota.toString(), 7184, done);
sendEventByKey('webStorage', 10, '');
})
})
}
\ No newline at end of file
arkui/ace_ets_web_dev_webviewController/entry/src/main/resources/base/profile/main_pages.json
浏览文件 @
bd29e310
...
...
@@ -6,6 +6,7 @@
"MainAbility/pages/onErrorReceive03"
,
"MainAbility/pages/webViewHasImage"
,
"MainAbility/pages/webViewScrollTo"
,
"MainAbility/pages/webViewScrollBy"
"MainAbility/pages/webViewScrollBy"
,
"MainAbility/pages/webStorage"
]
}
\ No newline at end of file
arkui/ace_ets_web_dev_webviewController/entry/src/main/resources/rawfile/getOrigins.html
0 → 100644
浏览文件 @
bd29e310
<!DOCTYPE HTML>
<html>
<head>
<meta
charset=
"UTF-8"
>
<script
type=
"text/javascript"
>
var
db
=
openDatabase
(
'
mydb
'
,
'
1.0
'
,
'
Test DB
'
,
2
*
1024
*
1024
);
var
msg
;
db
.
transaction
(
function
(
tx
)
{
tx
.
executeSql
(
'
CREATE TABLE IF NOT EXISTS LOGS (id unique, log)
'
);
tx
.
executeSql
(
'
INSERT INTO LOGS (id, log) VALUES (1, "W3Cschool教程")
'
);
tx
.
executeSql
(
'
INSERT INTO LOGS (id, log) VALUES (2, "www.w3cschool.cn")
'
);
msg
=
'
<p>数据表已创建,且插入了两条数据。</p>
'
;
document
.
querySelector
(
'
#status
'
).
innerHTML
=
msg
;
});
db
.
transaction
(
function
(
tx
)
{
tx
.
executeSql
(
'
SELECT * FROM LOGS
'
,
[],
function
(
tx
,
results
)
{
var
len
=
results
.
rows
.
length
,
i
;
msg
=
"
<p>查询记录条数:
"
+
len
+
"
</p>
"
;
document
.
querySelector
(
'
#status
'
).
innerHTML
+=
msg
;
for
(
i
=
0
;
i
<
len
;
i
++
){
msg
=
"
<p><b>
"
+
results
.
rows
.
item
(
i
).
log
+
"
</b></p>
"
;
document
.
querySelector
(
'
#status
'
).
innerHTML
+=
msg
;
}
},
null
);
});
</script>
</head>
<body>
<div
id=
"status"
name=
"status"
>
状态信息
</div>
</body>
</html>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录