diff --git a/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/MainAbility/pages/onWindowNew.ets b/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/MainAbility/pages/onWindowNew.ets index 59a1f1b944e1b84b660cf2a7bd101dfe5e343363..7a67dd9f8dd87a3bd5b037ff3756ee657625a5cd 100644 --- a/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/MainAbility/pages/onWindowNew.ets +++ b/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/MainAbility/pages/onWindowNew.ets @@ -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=false; + @State domStorageAccess:boolean=true; @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; + } } }) } diff --git a/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/MainAbility/pages/webStorage.ets b/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/MainAbility/pages/webStorage.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b7d7d39d9c218fccd9f3a461b224a23ece66801 --- /dev/null +++ b/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/MainAbility/pages/webStorage.ets @@ -0,0 +1,534 @@ +/** + * 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 diff --git a/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/List.test.ets index 6c15331a3e19dcf396b60733040fccd7da8c72e2..ee35d14b9defbd92566ef95bd7748037b8cd39ee 100644 --- a/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/List.test.ets @@ -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 diff --git a/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/WebViewOnWindowNewJsunit.test.ets b/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/WebViewOnWindowNewJsunit.test.ets index aa535c80f9023e2031dff7672c59f3ad13903cba..17894e2a725cf4e152cad4a228b31fb2ca56644b 100644 --- a/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/WebViewOnWindowNewJsunit.test.ets +++ b/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/WebViewOnWindowNewJsunit.test.ets @@ -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 diff --git a/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/WebViewWebStorageJsunit.test.ets b/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/WebViewWebStorageJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a292b360cd869a370ed1b0cb2bfa284858633c4 --- /dev/null +++ b/arkui/ace_ets_web_dev_webviewController/entry/src/main/ets/test/WebViewWebStorageJsunit.test.ets @@ -0,0 +1,340 @@ +/** + * 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 diff --git a/arkui/ace_ets_web_dev_webviewController/entry/src/main/resources/base/profile/main_pages.json b/arkui/ace_ets_web_dev_webviewController/entry/src/main/resources/base/profile/main_pages.json index d92824b7653f9b54903598ec65346c4e9f3f1d04..3adb9e28a017250761e1df5e2f664c0fe5e41354 100644 --- a/arkui/ace_ets_web_dev_webviewController/entry/src/main/resources/base/profile/main_pages.json +++ b/arkui/ace_ets_web_dev_webviewController/entry/src/main/resources/base/profile/main_pages.json @@ -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 diff --git a/arkui/ace_ets_web_dev_webviewController/entry/src/main/resources/rawfile/getOrigins.html b/arkui/ace_ets_web_dev_webviewController/entry/src/main/resources/rawfile/getOrigins.html new file mode 100644 index 0000000000000000000000000000000000000000..d2656e92a7b662fa5a879a8c351db807272cba13 --- /dev/null +++ b/arkui/ace_ets_web_dev_webviewController/entry/src/main/resources/rawfile/getOrigins.html @@ -0,0 +1,39 @@ + + + + + + + + + +
状态信息
+ + + \ No newline at end of file