diff --git a/arkui/ace_ets_web_dev_webController/AppScope/app.json b/arkui/ace_ets_web_dev_webController/AppScope/app.json
new file mode 100644
index 0000000000000000000000000000000000000000..11be5a436922e50eedf1060fcfa630f7efaf5e5a
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/AppScope/app.json
@@ -0,0 +1,21 @@
+{
+ "app": {
+ "bundleName": "com.open.harmony.acewebtest",
+ "vendor": "huawei",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "debug": false,
+ "icon": "$media:icon",
+ "label": "$string:app_name",
+ "description": "$string:description_application",
+ "distributedNotificationEnabled": true,
+ "keepAlive": true,
+ "singleUser": true,
+ "minAPIVersion": 10,
+ "targetAPIVersion": 10,
+ "car": {
+ "apiCompatibleVersion": 10,
+ "singleUser": false
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/AppScope/resources/base/element/string.json b/arkui/ace_ets_web_dev_webController/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string":[
+ {
+ "name":"app_name",
+ "value":"ohosProject"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/AppScope/resources/base/media/app_icon.png b/arkui/ace_ets_web_dev_webController/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023
Binary files /dev/null and b/arkui/ace_ets_web_dev_webController/AppScope/resources/base/media/app_icon.png differ
diff --git a/arkui/ace_ets_web_dev_webController/BUILD.gn b/arkui/ace_ets_web_dev_webController/BUILD.gn
new file mode 100644
index 0000000000000000000000000000000000000000..ffee979aefee8e157acb3f7be079e42562e9ea1d
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/BUILD.gn
@@ -0,0 +1,41 @@
+# Copyright (c) 2021 Huawei Device Co., Ltd.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import("//test/xts/tools/build/suite.gni")
+
+ohos_js_hap_suite("ActsAceWebDevWebControllerTest") {
+ hap_profile = "entry/src/main/module.json"
+ js_build_mode = "debug"
+ deps = [
+ ":ace_ets_web_dev_js_assets",
+ ":ace_ets_web_dev_resources",
+ ]
+ ets2abc = true
+ certificate_profile = "signature/openharmony_sx.p7b"
+ hap_name = "ActsAceWebDevWebControllerTest"
+}
+
+ohos_app_scope("ace_ets_web_dev_app_profile") {
+ app_profile = "AppScope/app.json"
+ sources = [ "AppScope/resources" ]
+}
+
+ohos_js_assets("ace_ets_web_dev_js_assets") {
+ source_dir = "entry/src/main/ets"
+}
+
+ohos_resources("ace_ets_web_dev_resources") {
+ sources = [ "entry/src/main/resources" ]
+ deps = [ ":ace_ets_web_dev_app_profile" ]
+ hap_profile = "entry/src/main/module.json"
+}
diff --git a/arkui/ace_ets_web_dev_webController/Test.json b/arkui/ace_ets_web_dev_webController/Test.json
new file mode 100644
index 0000000000000000000000000000000000000000..0eb6910b1e0b836df516a0c1c6176df09ad2588e
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/Test.json
@@ -0,0 +1,26 @@
+{
+ "description": "Configuration for hjunit demo Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "180000",
+ "bundle-name": "com.open.harmony.acewebtest",
+ "module-name": "phone",
+ "shell-timeout": "600000",
+ "testcase-timeout": 70000
+ },
+ "kits": [{
+ "test-file-name": [
+ "ActsAceWebDevWebControllerTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ },
+ {
+ "type": "ShellKit",
+ "run-command": [
+ "power-shell wakeup",
+ "power-shell setmode 602"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/Application/AbilityStage.ts b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/Application/AbilityStage.ts
new file mode 100644
index 0000000000000000000000000000000000000000..b0e0206ea9fb5ce94ef140d69510b6280969dd8e
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/Application/AbilityStage.ts
@@ -0,0 +1,9 @@
+import AbilityStage from "@ohos.app.ability.AbilityStage"
+
+export default class MyAbilityStage extends AbilityStage {
+ onCreate() {
+ console.log("[Demo] MyAbilityStage onCreate")
+ globalThis.stageOnCreateRun = 1;
+ globalThis.stageContext = this.context;
+ }
+}
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/MainAbility.ts b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/MainAbility.ts
new file mode 100644
index 0000000000000000000000000000000000000000..411ac13d9750a2ce62d740cf75149bd906cdc34c
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/MainAbility.ts
@@ -0,0 +1,37 @@
+import Ability from '@ohos.app.ability.UIAbility'
+
+export default class MainAbility extends Ability {
+ onCreate(want,launchParam){
+ // Ability is creating, initialize resources for this ability
+ console.log("[Demo] MainAbility onCreate")
+ globalThis.abilityWant = want;
+ }
+
+ onDestroy() {
+ // Ability is destroying, release resources for this ability
+ console.log("[Demo] MainAbility onDestroy")
+ }
+
+ onWindowStageCreate(windowStage) {
+ // Main window is created, set main page for this ability
+ console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage)
+ globalThis.windowStage = windowStage
+ globalThis.abilityContext = this.context
+ windowStage.setUIContent(this.context, "MainAbility/pages/webOnBeforeUnload", null)
+ }
+
+ onWindowStageDestroy() {
+ //Main window is destroyed, release UI related resources
+ console.log("[Demo] MainAbility onWindowStageDestroy")
+ }
+
+ onForeground() {
+ // Ability has brought to foreground
+ console.log("[Demo] MainAbility onForeground")
+ }
+
+ onBackground() {
+ // Ability has back to background
+ console.log("[Demo] MainAbility onBackground")
+ }
+};
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSize.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSize.ets
new file mode 100644
index 0000000000000000000000000000000000000000..4d8bf6cbc3dff99859be1cca2e55c151c75d78a3
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSize.ets
@@ -0,0 +1,112 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webDefaultFontSize {
+ controller: WebController = new WebController();
+ @State str:string="emitdefaultFontSize73AndminFontSize1WebC";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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 defaultFontSize: number = 13;
+ @State minFontSize: number = 13;
+ @State checkEleResult: Object = {};
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webDefaultFontSize 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('webDefaultFontSize').onClick(async () => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitdefaultFontSize73AndminFontSize1WebC": {
+ try {
+ this.defaultFontSize = 73;
+ this.minFontSize = 1;
+ await Utils.sleep(2000)
+ console.log("fonsize of emitdefaultFontSize73AndminFontSize1WebC is :" + this.defaultFontSize + this.minFontSize);
+ this.controller.runJavaScript({script:"getPageFontsize()",callback:(result) => {
+ this.checkEleResult = JSON.parse(result)
+ console.log(`The getPageFontsize() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.checkEleResult[1], 432)
+ }})
+ break;
+ }
+ case "emitdefaultFontSize73AndminFontSize73WebC": {
+ try {
+ this.defaultFontSize = 73;
+ this.minFontSize = 73;
+ await Utils.sleep(2000)
+ console.log("fonsize of emitdefaultFontSize73AndminFontSize73WebC is :" + this.defaultFontSize + this.minFontSize);
+ this.controller.runJavaScript({script:"getPageFontsize()",callback:(result) => {
+ this.checkEleResult = JSON.parse(result)
+ console.log(`The getPageFontsize() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.checkEleResult[1], 434)
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('indexFive.html'), controller: this.controller })
+ .defaultFontSize(this.defaultFontSize)
+ .minFontSize(this.minFontSize)
+ .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_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSizeNoAll.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSizeNoAll.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0d2cf6ceb8bd82e048bb969034f381057e22f44b
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSizeNoAll.ets
@@ -0,0 +1,86 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webDefaultFontSizeNoAll {
+ controller: WebController = new WebController();
+ @State str:string="emitdefaultFontSizeAndminFontSizeNoAllWebC";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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 checkEleResult: Object = {};
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webDefaultFontSizeNoAll 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('webDefaultFontSizeNoAll').onClick(() => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitdefaultFontSizeAndminFontSizeNoAllWebC": {
+ try {
+ this.controller.runJavaScript({script:"getPageFontsize()",callback:(result) => {
+ this.checkEleResult = JSON.parse(result)
+ console.log(`The getPageFontsize() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.checkEleResult[1], 440)
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('indexFive.html'), controller: this.controller })
+ .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_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSizeNoMinFontSize.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSizeNoMinFontSize.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e6ce8d5e37e95b63ae854f4c0470506ca9194831
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSizeNoMinFontSize.ets
@@ -0,0 +1,108 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webDefaultFontSizeNoMinFontSize {
+ controller: WebController = new WebController();
+ @State str:string="emitdefaultFontSize7AndNominFontSizeWebC";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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 defaultFontSize: number = 13;
+ @State checkEleResult: Object = {};
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webDefaultFontSizeNoMinFontSize 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('webDefaultFontSizeNoMinFontSize').onClick(async () => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitdefaultFontSize7AndNominFontSizeWebC": {
+ try {
+ this.defaultFontSize = 7;
+ await Utils.sleep(2000);
+ console.log("fonsize of emitdefaultFontSize7AndNominFontSizeWebC is :" + this.defaultFontSize);
+ this.controller.runJavaScript({script:"getPageFontsize()",callback:(result) => {
+ this.checkEleResult = JSON.parse(result)
+ console.log(`The getPageFontsize() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.checkEleResult[1], 436)
+ }})
+ break;
+ }
+ case "emitdefaultFontSize17AndCssFontSize9WebC": {
+ try {
+ this.defaultFontSize = 17;
+ await Utils.sleep(2000);
+ console.log("fonsize of emitdefaultFontSize17AndCssFontSize9WebC is :" + this.defaultFontSize);
+ this.controller.runJavaScript({script:"getTestPageFontsize()",callback:(result) => {
+ this.checkEleResult = JSON.parse(result)
+ console.log(`The getTestPageFontsize() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.checkEleResult[1], 438)
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('indexFive.html'), controller: this.controller })
+ .defaultFontSize(this.defaultFontSize)
+ .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_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSizeWithMinLogical.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSizeWithMinLogical.ets
new file mode 100644
index 0000000000000000000000000000000000000000..95525c02a97a97f5ae5f74e943112dc2d0db4721
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webDefaultFontSizeWithMinLogical.ets
@@ -0,0 +1,97 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webDefaultFontSizeWithMinLogical {
+ controller: WebController = new WebController();
+ @State str:string="emitdefaultFontSizeHalfAndminFontSizeHalfWebC";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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 defaultFontSize: number = 13;
+ @State minFontSize: number = 13;
+ @State minLogicalFontSize: number = 13;
+ @State checkEleResult: Object = {};
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webDefaultFontSizeWithMinLogical 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('webDefaultFontSizeWithMinLogical').onClick(async () => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitdefaultFontSizeHalfAndminFontSizeHalfWebC": {
+ try {
+ this.defaultFontSize = 0.5;
+ this.minFontSize = 0.5;
+ this.minLogicalFontSize = 0.5
+ await Utils.sleep(2000);
+ console.log("fonsize of emitdefaultFontSizeHalfAndminFontSizeHalfWebC is :" + this.defaultFontSize + this.minFontSize);
+ this.controller.runJavaScript({script:"getPageFontsize()",callback:(result) => {
+ this.checkEleResult = JSON.parse(result)
+ console.log(`The getPageFontsize() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.checkEleResult[1], 430)
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('indexFive.html'), controller: this.controller })
+ .defaultFontSize(this.defaultFontSize)
+ .minFontSize(this.minFontSize)
+ .minLogicalFontSize(this.minLogicalFontSize)
+ .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_webController/entry/src/main/ets/MainAbility/pages/webGetCookieManager.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webGetCookieManager.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f67f14217f78e3faf486976e906263db9da84dd1
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webGetCookieManager.ets
@@ -0,0 +1,88 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webGetCookieManager {
+ controller: WebController = new WebController();
+ handler: FullScreenExitHandler = null
+ @State str:string="emitGetCookieManagerWebc";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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 cookieManager: Object = {};
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webGetCookieManager 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("cookieTest").key('webGetCookieManager').onClick(() => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitGetCookieManagerWebc": {
+ try {
+ let result = this.controller.getCookieManager().setCookie()
+ console.log("result: " + result)
+ Utils.sleep(1000);
+ this.cookieManager = this.controller.getCookieManager()
+ console.log("this.cookieManager: " + JSON.stringify(this.cookieManager));
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(JSON.stringify(this.cookieManager).length, 446)
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:'www.example.com', controller: this.controller })
+ .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_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorReceive.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorReceive.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f627e324833e5009563e5e5a97875f12c9ded4ce
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorReceive.ets
@@ -0,0 +1,131 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+import UIAbility from '@ohos.app.ability.UIAbility';
+
+@Entry
+@Component
+struct webONHttpErrorReceive {
+ controller: WebController = new WebController();
+ @State str:string="emitOnHttpErrorReceiveFixedUserAgentWebc";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @State userAgent:string = "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36";
+ @State title:string = "test";
+ @State requestKey:string = "";
+ @State requestValue:string = "";
+ @State responseKey:string = "";
+ @State responseValue:string = "";
+
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webONHttpErrorReceive 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("onHttpErrorTest").key('webONHttpErrorReceive').onClick(async () => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnHttpErrorReceiveFixedUserAgentWebc": {
+ try {
+ this.controller.loadUrl({ url: 'http://1.1.1.123/index.html' });
+ await Utils.sleep(1000);
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ Utils.emitEvent(this.title, 490)
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:'http://1.1.1.123/index.html', controller: this.controller })
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onHttpErrorReceive((event) => {
+ console.log('url:' + event.request.getRequestUrl());
+ Utils.emitEvent(event.request.getRequestUrl(), 462);
+ console.log('isMainFrame:' + event.request.isMainFrame());
+ Utils.emitEvent(event.request.isMainFrame(), 464);
+ console.log('isRedirect:' + event.request.isRedirect());
+ Utils.emitEvent(event.request.isRedirect(), 466);
+ console.log('isRequestGesture:' + event.request.isRequestGesture());
+ Utils.emitEvent(event.request.isRequestGesture(), 468);
+ console.log('getRequestMethod:' + event.request.getRequestMethod());
+ Utils.emitEvent(event.request.getRequestMethod(), 470);
+ console.log('getResponseData:' + JSON.stringify(event.response.getResponseData()));
+ Utils.emitEvent(JSON.stringify(event.response.getResponseData()), 472);
+ console.log('getResponseEncoding:' + event.response.getResponseEncoding());
+ Utils.emitEvent(event.response.getResponseEncoding(), 474);
+ console.log('getResponseMimeType:' + event.response.getResponseMimeType());
+ Utils.emitEvent(event.response.getResponseMimeType(), 476);
+ console.log('getResponseCode:' + event.response.getResponseCode());
+ Utils.emitEvent(event.response.getResponseCode(), 478);
+ this.title = JSON.stringify(event.response.getResponseCode()) + event.request.getRequestUrl();
+ console.log("this.title result is :" + this.title);
+ console.log('getReasonMessage:' + event.response.getReasonMessage());
+ Utils.emitEvent(event.response.getReasonMessage(), 480);
+ let result = event.request.getRequestHeader()
+ console.log('The request header result size is ' + result.length)
+ for (let i of result) {
+ console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue);
+ this.requestKey = i.headerKey;
+ this.requestValue = i.headerValue;
+ }
+ console.log('The request header last result is ' + this.requestKey + this.requestValue);
+ Utils.emitEvent(this.requestKey, 482);
+ Utils.emitEvent(this.requestValue, 484);
+ let resph = event.response.getResponseHeader()
+ console.log('The response header result size is ' + resph.length)
+ for (let i of resph) {
+ console.log('The response header key is : ' + i.headerKey + ' , value is : ' + i.headerValue);
+ this.responseKey = i.headerKey;
+ this.responseValue = i.headerValue;
+ }
+ console.log('The response header last result is ' + this.responseKey + this.responseValue);
+ Utils.emitEvent(this.responseKey, 486);
+ Utils.emitEvent(this.responseValue, 488);
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorReceiveExample.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorReceiveExample.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7b6e3f524bc1d4c0db8e187357b81b28357ea296
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorReceiveExample.ets
@@ -0,0 +1,150 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+import UIAbility from '@ohos.app.ability.UIAbility';
+
+@Entry
+@Component
+struct webONHttpErrorReceiveExample {
+ controller: WebController = new WebController();
+ responseweb: WebResourceResponse = new WebResourceResponse()
+ heads:Header[] = new Array()
+ @State webdata: string = "\n" +
+ "\n"+
+ "
\n"+
+ "intercept test\n"+
+ "\n"+
+ "\n"+
+ "intercept test
\n"+
+ ""+
+ "\n"+
+ ""
+ @State str:string="emitOnHttpErrorReceiveByExampleWebc";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @State userAgent:string = "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36";
+ @State title:string = "test";
+
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webONHttpErrorReceiveExample 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("onHttpErrorTest").key('webONHttpErrorReceiveExample').onClick(async () => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnHttpErrorReceiveByExampleWebc": {
+ try {
+ this.controller.loadUrl({ url: 'http://1.1.1.123/index.html' });
+ await Utils.sleep(1000);
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.title, 492);
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:'http://1.1.1.123/index.html', controller: this.controller })
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onInterceptRequest((event) => {
+ console.log('url:' + event.request.getRequestUrl())
+ var head1:Header = {
+ headerKey:"Connection",
+ headerValue:"keep-alive"
+ }
+ var head2:Header = {
+ headerKey:"Cache-Control",
+ headerValue:"no-cache"
+ }
+ var length = this.heads.push(head1)
+ length = this.heads.push(head2)
+ this.responseweb.setResponseHeader(this.heads)
+ this.responseweb.setResponseData(this.webdata)
+ this.responseweb.setResponseEncoding('utf-8')
+ this.responseweb.setResponseMimeType('text/html')
+ this.responseweb.setResponseCode(200)
+ this.responseweb.setReasonMessage('OK')
+ this.responseweb.setResponseIsReady(true)
+ return this.responseweb
+ })
+ .onHttpErrorReceive((event) => {
+ console.log('url:' + event.request.getRequestUrl());
+ console.log('isMainFrame:' + event.request.isMainFrame());
+ console.log('isRedirect:' + event.request.isRedirect());
+ console.log('isRequestGesture:' + event.request.isRequestGesture());
+ console.log('getRequestMethod:' + event.request.getRequestMethod());
+ console.log('getResponseData:' + JSON.stringify(event.response.getResponseData()));
+ console.log('getResponseEncoding:' + event.response.getResponseEncoding());
+ console.log('getResponseMimeType:' + event.response.getResponseMimeType());
+ console.log('getResponseCode:' + event.response.getResponseCode());
+ Utils.emitEvent(event.response.getResponseCode(), 491)
+ console.log("this.title result is :" + this.title);
+ console.log('getReasonMessage:' + event.response.getReasonMessage());
+ let result = event.request.getRequestHeader()
+ console.log('The request header result size is ' + result.length)
+ for (let i of result) {
+ console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue);
+ }
+ let resph = event.response.getResponseHeader()
+ console.log('The response header result size is ' + resph.length)
+ for (let i of resph) {
+ console.log('The response header key is : ' + i.headerKey + ' , value is : ' + i.headerValue);
+ }
+ })
+ .onTitleReceive((event) => {
+ console.log('title:' + event.title);
+ this.title = event.title
+ Utils.emitEvent(this.title, 492);
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorReceiveIframe.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorReceiveIframe.ets
new file mode 100644
index 0000000000000000000000000000000000000000..941bbab087818540b7591e0c7b48d5b589da6bea
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorReceiveIframe.ets
@@ -0,0 +1,110 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+import UIAbility from '@ohos.app.ability.UIAbility';
+
+@Entry
+@Component
+struct webONHttpErrorReceiveIframe {
+ controller: WebController = new WebController();
+ @State str:string="emitOnHttpErrorReceiveByIframeHtmlWebc";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @State userAgent:string = "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36";
+ @State title:string = "test";
+
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webONHttpErrorReceiveIframe 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("onHttpErrorTest").key('webONHttpErrorReceiveIframe').onClick(() => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnHttpErrorReceiveByIframeHtmlWebc": {
+ try {
+ this.controller.runJavaScript({script:"gettitle()",callback:(result) => {
+ this.title = JSON.parse(result)
+ console.log(`The gettitle() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.title, 498);
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('indexSix.html'), controller: this.controller })
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onHttpErrorReceive((event) => {
+ console.log('url:' + event.request.getRequestUrl());
+ console.log('isMainFrame:' + event.request.isMainFrame());
+ Utils.emitEvent(event.request.isMainFrame(), 496);
+ console.log('isRedirect:' + event.request.isRedirect());
+ console.log('isRequestGesture:' + event.request.isRequestGesture());
+ console.log('getRequestMethod:' + event.request.getRequestMethod());
+ console.log('getResponseData:' + JSON.stringify(event.response.getResponseData()));
+ console.log('getResponseEncoding:' + event.response.getResponseEncoding());
+ console.log('getResponseMimeType:' + event.response.getResponseMimeType());
+ console.log('getResponseCode:' + event.response.getResponseCode());
+ console.log('getReasonMessage:' + event.response.getReasonMessage());
+ let result = event.request.getRequestHeader()
+ console.log('The request header result size is ' + result.length)
+ for (let i of result) {
+ console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue);
+ }
+ let resph = event.response.getResponseHeader()
+ console.log('The response header result size is ' + resph.length)
+ for (let i of resph) {
+ console.log('The response header key is : ' + i.headerKey + ' , value is : ' + i.headerValue);
+ }
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorRecvExampleIsReady.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorRecvExampleIsReady.ets
new file mode 100644
index 0000000000000000000000000000000000000000..73e71b2a30dbd3fed7ba3164f15620d88eaf946e
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webONHttpErrorRecvExampleIsReady.ets
@@ -0,0 +1,150 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+import UIAbility from '@ohos.app.ability.UIAbility';
+
+@Entry
+@Component
+struct webONHttpErrorRecvExampleIsReady {
+ controller: WebController = new WebController();
+ responseweb: WebResourceResponse = new WebResourceResponse()
+ heads:Header[] = new Array()
+ @State webdata: string = "\n" +
+ "\n"+
+ "\n"+
+ "intercept test\n"+
+ "\n"+
+ "\n"+
+ "intercept test
\n"+
+ ""+
+ "\n"+
+ ""
+ @State str:string="emitOnHttpErrorRecvExampleIsReadyFalseWebc";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @State userAgent:string = "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36";
+ @State title:string = "";
+
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webONHttpErrorRecvExampleIsReady 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("onHttpErrorTest").key('webONHttpErrorRecvExampleIsReady').onClick(async () => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnHttpErrorRecvExampleIsReadyFalseWebc": {
+ try {
+ this.controller.loadUrl({ url: 'http://1.1.1.123/index.html' });
+ await Utils.sleep(1000);
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.title, 494);
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:'http://1.1.1.123/index.html', controller: this.controller })
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onInterceptRequest((event) => {
+ console.log('url:' + event.request.getRequestUrl())
+ var head1:Header = {
+ headerKey:"Connection",
+ headerValue:"keep-alive"
+ }
+ var head2:Header = {
+ headerKey:"Cache-Control",
+ headerValue:"no-cache"
+ }
+ var length = this.heads.push(head1)
+ length = this.heads.push(head2)
+ this.responseweb.setResponseHeader(this.heads)
+ this.responseweb.setResponseData(this.webdata)
+ this.responseweb.setResponseEncoding('utf-8')
+ this.responseweb.setResponseMimeType('text/html')
+ this.responseweb.setResponseCode(200)
+ this.responseweb.setReasonMessage('OK')
+ this.responseweb.setResponseIsReady(false)
+ return this.responseweb
+ })
+ .onHttpErrorReceive((event) => {
+ console.log('url:' + event.request.getRequestUrl());
+ console.log('isMainFrame:' + event.request.isMainFrame());
+ console.log('isRedirect:' + event.request.isRedirect());
+ console.log('isRequestGesture:' + event.request.isRequestGesture());
+ console.log('getRequestMethod:' + event.request.getRequestMethod());
+ console.log('getResponseData:' + JSON.stringify(event.response.getResponseData()));
+ console.log('getResponseEncoding:' + event.response.getResponseEncoding());
+ console.log('getResponseMimeType:' + event.response.getResponseMimeType());
+ console.log('getResponseCode:' + event.response.getResponseCode());
+ Utils.emitEvent(event.response.getResponseCode(), 493)
+ console.log("this.title result is :" + this.title);
+ console.log('getReasonMessage:' + event.response.getReasonMessage());
+ let result = event.request.getRequestHeader()
+ console.log('The request header result size is ' + result.length)
+ for (let i of result) {
+ console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue);
+ }
+ let resph = event.response.getResponseHeader()
+ console.log('The response header result size is ' + resph.length)
+ for (let i of resph) {
+ console.log('The response header key is : ' + i.headerKey + ' , value is : ' + i.headerValue);
+ }
+ })
+ .onTitleReceive((event) => {
+ console.log('title:' + event.title);
+ this.title = event.title
+ Utils.emitEvent(this.title, 494);
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnAudioStateChanged.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnAudioStateChanged.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b32d933ac5de71ed71facb893f9e53902ca67239
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnAudioStateChanged.ets
@@ -0,0 +1,111 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+import UIAbility from '@ohos.app.ability.UIAbility';
+
+@Entry
+@Component
+struct webOnAudioStateChanged {
+ controller: WebController = new WebController();
+ @State str:string="emitAudioStatePlayWebc";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @State userAgent:string = "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36";
+ @State playing: boolean = false
+ @State checkResult:string="";
+ @State firstId:number= 501;
+
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnAudioStateChanged 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("audioStateTest").key('webOnAudioStateChanged').onClick(() => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitAudioStatePlayWebc": {
+ try {
+ this.controller.requestFocus();
+ this.controller.runJavaScript({script:"play()",callback:(result) => {
+ this.checkResult = result
+ console.log(`The controller.play() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.checkResult, 502)
+ }})
+ break;
+ }
+ case "emitAudioStatePauseWebc": {
+ try {
+ this.controller.requestFocus();
+ this.firstId = 503;
+ this.controller.runJavaScript({script:"pause()",callback:(result) => {
+ this.checkResult = result
+ console.log(`The controller.pause() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.checkResult, 504)
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('audioTest.html'), controller: this.controller })
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onAudioStateChanged(event => {
+ this.playing = event.playing
+ console.log('onAudioStateChanged playing: ' + this.playing + this.firstId);
+ Utils.emitEvent(this.playing, this.firstId)
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnBeforeUnload.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnBeforeUnload.ets
new file mode 100644
index 0000000000000000000000000000000000000000..42cc42b0cdd0da1e60c9650a0c405cb7c2a7b1a1
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnBeforeUnload.ets
@@ -0,0 +1,127 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webOnBeforeUnload {
+ controller: WebController = new WebController();
+ @State str:string="emitOnBeforeUnloadWebC";
+ @State firstId:number=402;
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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";
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnBeforeUnload page valueChangeCallBack");
+ if(eventData != null){
+ console.info("valueChangeCallBack:"+ JSON.stringify(eventData));
+ if(eventData.data.ACTION != null){
+ this.str = eventData.data.ACTION;
+ }
+ }
+ }
+ private jsObj={
+ test:(res)=>{
+ Utils.emitEvent(res,102);
+ },
+ toString:(str)=>{
+ console.info("ets toString:"+String(str));
+ },
+ register:(res)=>{
+ Utils.emitEvent(res,86);
+ return "web222"
+ }
+ }
+ aboutToAppear(){
+ let abilityDelegator: any
+ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ let abilityDelegatorArguments: any
+ abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ }
+ build() {
+ Column() {
+ Row() {
+ Button("web click").key('webOnBeforeUnload').onClick(async () => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnBeforeUnloadWebC": {
+ try {
+ this.controller.refresh();
+ await Utils.sleep(1000);
+ console.log("action of emitOnBeforeUnload is refresh");
+ this.controller.runJavaScript({script:"myRefresh()",callback:(result) => {
+ console.log(`The myRefresh() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ break;
+ }
+ case "emitOnBeforeUnloadAgainWebC": {
+ try {
+ this.firstId = 404;
+ this.controller.requestFocus();
+ await Utils.sleep(1000);
+ console.log("action of emitOnBeforeUnloadAgain is loadUrl new");
+ this.controller.runJavaScript({script:"myNewPage()",callback:(result) => {
+ console.log(`The myNewPage() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('onBeforeUnloadTest.html'), controller: this.controller })
+ .key("TestwebOnBeforeUnload")
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onBeforeUnload((event) => {
+ console.log("event.url:" + event.url)
+ console.log("event.message:" + event.message)
+ Utils.emitEvent(event.message, this.firstId)
+ console.log("event.result.handleCancel: " + event.result.handleCancel());
+ console.log("event.result.handleConfirm: " + event.result.handleConfirm());
+ return true
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstCont.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstCont.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c1845003f6fd86c14ddfd8c44fb8f3643679c334
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstCont.ets
@@ -0,0 +1,88 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webOnFirstCont {
+ controller: WebController = new WebController();
+ @State str:string="emitOnfirstcontentfulpaintWebc";
+ @State firstId:number=422;
+ @State firstcontentfulpaint:string='NoSrcTest';
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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";
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnFirstCont 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('webOnFirstCont').onClick(() => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnfirstcontentfulpaintWebc": {
+ try {
+ this.controller.refresh();
+ console.log("action of emitOnfirstcontentfulpaintWebc is refresh");
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ Utils.emitEvent(this.firstcontentfulpaint, this.firstId)
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:'', controller: this.controller })
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onFirstContentfulPaint(event => {
+ console.log("onFirstContentfulPaint:" + "[navigationStartTick]:" +
+ event.navigationStartTick + ", [firstContentfulPaintMs]:" + event.firstContentfulPaintMs)
+ this.firstcontentfulpaint = JSON.stringify(event)
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstContFour.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstContFour.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5bad37e7c24ff74dca352cbdd5cf950e1e2156b8
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstContFour.ets
@@ -0,0 +1,99 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webOnFirstContFour {
+ controller: WebController = new WebController();
+ @State str:string="emitRefreshOnfirstcontentfulpaintWebc";
+ @State firstId:number=428;
+ @State firstcontentfulpaint:boolean=false;
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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 firstBoo:boolean=false;
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnFirstContFour 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('webOnFirstContFour').onClick(() => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitRefreshOnfirstcontentfulpaintWebc": {
+ try {
+ this.controller.clearHistory();
+ this.controller.refresh();
+ this.firstBoo = true
+ console.log("action of emitRefreshOnfirstcontentfulpaintWebc is refresh");
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:'www.example.com', controller: this.controller })
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onFirstContentfulPaint(event => {
+ console.log("onFirstContentfulPaint:" + "[navigationStartTick]:" +
+ event.navigationStartTick + ", [firstContentfulPaintMs]:" + event.firstContentfulPaintMs + this.firstId)
+ if (event.firstContentfulPaintMs > 0 && event.firstContentfulPaintMs < 3000) {
+ this.firstcontentfulpaint = true;
+ console.error("result of onFirstContentfulPaint is: "+ this.firstcontentfulpaint + this.firstId);
+ }
+ })
+ .onPageEnd((event) => {
+ console.log('url' + event.url + this.firstcontentfulpaint + this.firstId);
+ if (this.firstBoo) {
+ Utils.emitEvent(this.firstcontentfulpaint, this.firstId)
+ }
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstContThree.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstContThree.ets
new file mode 100644
index 0000000000000000000000000000000000000000..cff6f06f1f43e2d5f16e61030e3e711e1900d600
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstContThree.ets
@@ -0,0 +1,92 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webOnFirstContThree {
+ controller: WebController = new WebController();
+ @State str:string="emitLoadUrlOnfirstcontentfulpaintWebc";
+ @State firstId:number=426;
+ @State firstcontentfulpaint:boolean=false;
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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";
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnFirstContThree 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('webOnFirstContThree').onClick(() => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitLoadUrlOnfirstcontentfulpaintWebc": {
+ try {
+ this.controller.clearHistory();
+ this.controller.loadUrl({url:"resource://rawfile/onfirstcontentfulpaint.html"})
+ console.log("action of emitLoadUrlOnfirstcontentfulpaintWebc is loadUrl");
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ Utils.emitEvent(this.firstcontentfulpaint, this.firstId);
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:'www.example.com', controller: this.controller })
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onFirstContentfulPaint(event => {
+ console.log("onFirstContentfulPaint:" + "[navigationStartTick]:" +
+ event.navigationStartTick + ", [firstContentfulPaintMs]:" + event.firstContentfulPaintMs + this.firstId)
+ if (event.firstContentfulPaintMs > 0 && event.firstContentfulPaintMs < 5000) {
+ this.firstcontentfulpaint = true;
+ console.error("result of onFirstContentfulPaint is: "+ this.firstcontentfulpaint + this.firstId);
+ }
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstContTwo.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstContTwo.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c19713c913853d3c8aad8cdd864c99165bd60324
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFirstContTwo.ets
@@ -0,0 +1,90 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webOnFirstContTwo {
+ controller: WebController = new WebController();
+ @State str:string="emitNoneOnfirstcontentfulpaintWebc";
+ @State firstId:number=424;
+ @State firstcontentfulpaint:string='VisibilityNoneTest';
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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 webVisibility: Visibility = Visibility.None
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnFirstContTwo 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('webOnFirstContTwo').onClick(() => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitNoneOnfirstcontentfulpaintWebc": {
+ try {
+ this.controller.refresh();
+ console.log("action of emitNoneOnfirstcontentfulpaintWebc is refresh");
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ Utils.emitEvent(this.firstcontentfulpaint, this.firstId)
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('indexCopy.html'), controller: this.controller })
+ .visibility(this.webVisibility)
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onFirstContentfulPaint(event => {
+ console.log("onFirstContentfulPaint:" + "[navigationStartTick]:" +
+ event.navigationStartTick + ", [firstContentfulPaintMs]:" + event.firstContentfulPaintMs)
+ this.firstcontentfulpaint = JSON.stringify(event)
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFullScreenEnter.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFullScreenEnter.ets
new file mode 100644
index 0000000000000000000000000000000000000000..91782a16df115a25ac7d08c00ad1093826c208da
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFullScreenEnter.ets
@@ -0,0 +1,96 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webOnFullScreenEnter {
+ controller: WebController = new WebController();
+ handler: FullScreenExitHandler = null
+ @State str:string="emitOnfullscreenenterWebc";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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 checkEleResult:string="";
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnFullScreenEnter 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('webOnFullScreenEnter').onClick(async () => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnfullscreenenterWebc": {
+ try {
+ this.controller.runJavaScript({script:"elementFullScreen()",callback:(result) => {
+ console.log(`The elementFullScreen() return value is: ${result}`);
+ }})
+ await Utils.sleep(1000);
+ this.controller.runJavaScript({script:"checkIsFullScreen()",callback:(result) => {
+ this.checkEleResult = JSON.stringify(result)
+ console.log(`The checkIsFullScreen() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(JSON.stringify(this.handler).length + this.checkEleResult, 442)
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('fullScreenTest.html'), controller: this.controller })
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onFullScreenEnter((event) => {
+ console.log("onFullScreenEnter...")
+ this.handler = event.handler
+ console.log("this.handler: " + JSON.stringify(this.handler))
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFullScreenExit.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFullScreenExit.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0c37574497ee7db5d38f2fd00b5e7e9ef128402c
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnFullScreenExit.ets
@@ -0,0 +1,103 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webOnFullScreenExit {
+ controller: WebController = new WebController();
+ handler: FullScreenExitHandler = null
+ @State str:string="emitOnfullscreenexitWebc";
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @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 checkEleResult:string="";
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnFullScreenExit 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('webOnFullScreenExit').onClick(async () => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnfullscreenexitWebc": {
+ try {
+ this.controller.runJavaScript({script:"elementFullScreen()",callback:(result) => {
+ console.log(`The elementFullScreen() return value is: ${result}`);
+ }})
+ await Utils.sleep(1000);
+ this.controller.runJavaScript({script:"elementExitFullScreen()",callback:(result) => {
+ console.log(`The elementExitFullScreen() return value is: ${result}`);
+ }})
+ await Utils.sleep(1000);
+ this.controller.runJavaScript({script:"checkIsFullScreen()",callback:(result) => {
+ this.checkEleResult = JSON.stringify(result)
+ console.log(`The checkIsFullScreen() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(JSON.stringify(this.handler).length + this.checkEleResult, 444)
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('fullScreenTest.html'), controller: this.controller })
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onFullScreenExit(() => {
+ console.log("onFullScreenExit...")
+ console.log("this.handler: " + JSON.stringify(this.handler))
+ this.handler.exitFullScreen()
+ })
+ .onFullScreenEnter((event) => {
+ this.handler = event.handler
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnInterceptReqOne.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnInterceptReqOne.ets
new file mode 100644
index 0000000000000000000000000000000000000000..37fe56160ee5f27a9362dbd7fc67da6cd6c863fc
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnInterceptReqOne.ets
@@ -0,0 +1,106 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webOnInterceptReqOne {
+ controller: WebController = new WebController();
+ responseweb: WebResourceResponse = new WebResourceResponse()
+ heads:Header[] = new Array()
+ @State str:string="emitOnInterceptRequestWebC";
+ @State webdata: string = "\n" +
+ "\n"+
+ "\n"+
+ "intercept test\n"+
+ "\n"+
+ "\n"+
+ "intercept test
\n"+
+ "\n"+
+ ""
+ @State title:string = "test";
+
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnInterceptReqOne 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('webOnInterceptReqOne').onClick(() => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnInterceptRequestWebC": {
+ try {
+ this.controller.loadUrl({url:"resource://rawfile/indexCopy.html"})
+ Utils.sleep(1000);
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.title, 406);
+ }})
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('indexCopy.html'), controller: this.controller })
+ .onInterceptRequest((event) => {
+ console.log('url:' + event.request.getRequestUrl())
+ var head1:Header = {
+ headerKey:"Connection",
+ headerValue:"keep-alive"
+ }
+ var head2:Header = {
+ headerKey:"Cache-Control",
+ headerValue:"no-cache"
+ }
+ var length = this.heads.push(head1)
+ length = this.heads.push(head2)
+ this.responseweb.setResponseHeader(this.heads)
+ this.responseweb.setResponseEncoding('utf-8')
+ this.responseweb.setResponseMimeType('text/html')
+ this.responseweb.setResponseCode(200)
+ this.responseweb.setReasonMessage('OK')
+ return this.responseweb
+ console.log("this.responseweb: " + this.responseweb);
+ })
+ .onTitleReceive((event) => {
+ console.log('title:' + event.title);
+ this.title = event.title
+ Utils.emitEvent(this.title, 492);
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnInterceptReqThree.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnInterceptReqThree.ets
new file mode 100644
index 0000000000000000000000000000000000000000..2ec0045c117d5b60137c016854bb68f0215297b8
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnInterceptReqThree.ets
@@ -0,0 +1,129 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webOnInterceptReqThree {
+ controller: WebController = new WebController();
+ responseweb: WebResourceResponse = new WebResourceResponse()
+ heads:Header[] = new Array()
+ @State str:string="emitOnInterceptRequestThirdWebC";
+ @State firstId:number=410;
+ @State webdata: string = "\n" +
+ "\n"+
+ "\n"+
+ "intercept test\n"+
+ "\n"+
+ "\n"+
+ "intercept test
\n"+
+ "\n"+
+ ""
+ @State title:string = "test";
+
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnInterceptReqThree 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('webOnInterceptReqThree').onClick(() => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnInterceptRequestThirdWebC": {
+ try {
+ this.controller.refresh();
+ this.controller.runJavaScript({script:"gettitle()",callback:(result) => {
+ this.title = JSON.parse(result)
+ console.log(`The gettitle() return value is: ${result}`);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('indexCopy.html'), controller: this.controller })
+ .onInterceptRequest((event) => {
+ console.log('url:' + event.request.getRequestUrl())
+ var head1:Header = {
+ headerKey:"Connection",
+ headerValue:"keep-alive"
+ }
+ var head2:Header = {
+ headerKey:"Cache-Control",
+ headerValue:"no-cache"
+ }
+ var length = this.heads.push(head1)
+ length = this.heads.push(head2)
+ this.responseweb.setResponseHeader(this.heads)
+ this.responseweb.setResponseData(this.webdata)
+ this.responseweb.setResponseEncoding('utf-8')
+ this.responseweb.setResponseMimeType('text/html')
+ this.responseweb.setResponseCode(404)
+ this.responseweb.setReasonMessage('OK')
+ this.controller.runJavaScript({script:"gettitle()",callback:(result) => {
+ this.title = JSON.parse(result)
+ console.log(`The gettitle() return value is: ${result}`);
+ }})
+ return this.responseweb
+ console.log("this.responseweb: " + this.responseweb);
+ })
+ .onHttpErrorReceive((event) => {
+ console.log('url:' + event.request.getRequestUrl())
+ console.log('isMainFrame:' + event.request.isMainFrame())
+ console.log('isRedirect:' + event.request.isRedirect())
+ console.log('isRequestGesture:' + event.request.isRequestGesture())
+ console.log('getResponseData:' + event.response.getResponseData())
+ console.log('getResponseEncoding:' + event.response.getResponseEncoding())
+ console.log('getResponseMimeType:' + event.response.getResponseMimeType())
+ console.log('getResponseCode:' + event.response.getResponseCode())
+ Utils.emitEvent(event.response.getResponseCode(), this.firstId)
+ console.log('getReasonMessage:' + event.response.getReasonMessage())
+ let result = event.request.getRequestHeader()
+ console.log('The request header result size is ' + result.length)
+ for (let i of result) {
+ console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue)
+ }
+ let resph = event.response.getResponseHeader()
+ console.log('The response header result size is ' + resph.length)
+ for (let i of resph) {
+ console.log('The response header key is : ' + i.headerKey + ' , value is : ' + i.headerValue)
+ }
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnInterceptReqTwo.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnInterceptReqTwo.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c89d2043f2466bc564621fe38c7a318b8e764bcd
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnInterceptReqTwo.ets
@@ -0,0 +1,105 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webOnInterceptReqTwo {
+ controller: WebController = new WebController();
+ responseweb: WebResourceResponse = new WebResourceResponse()
+ heads:Header[] = new Array()
+ @State str:string="emitOnInterceptRequestSecondWebC";
+ @State webdata: string = "\n" +
+ "\n"+
+ "\n"+
+ "intercept test\n"+
+ "\n"+
+ "\n"+
+ "intercept test
\n"+
+ "\n"+
+ ""
+ @State title:string = "test";
+
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnInterceptReqTwo 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('webOnInterceptReqTwo').onClick(async () => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnInterceptRequestSecondWebC": {
+ try {
+ this.controller.runJavaScript({script:"test()",callback:(res) => {
+ Utils.emitEvent(this.title, 408);
+ }})
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:$rawfile('indexCopy.html'), controller: this.controller })
+ .onInterceptRequest((event) => {
+ console.log('url:' + event.request.getRequestUrl())
+ var head1:Header = {
+ headerKey:"Connection",
+ headerValue:"keep-alive"
+ }
+ var head2:Header = {
+ headerKey:"Cache-Control",
+ headerValue:"no-cache"
+ }
+ var length = this.heads.push(head1)
+ length = this.heads.push(head2)
+ this.responseweb.setResponseHeader(this.heads)
+ this.responseweb.setResponseData(this.webdata)
+ this.responseweb.setResponseEncoding('utf-8')
+ this.responseweb.setResponseMimeType('text/html')
+ this.responseweb.setResponseCode(200)
+ this.responseweb.setReasonMessage('OK')
+ return this.responseweb
+ console.log("this.responseweb: " + this.responseweb);
+ })
+ .onTitleReceive((event) => {
+ console.log('title:' + event.title);
+ this.title = event.title
+ Utils.emitEvent(this.title, 408);
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnSslError.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnSslError.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c89ef844de4b2d3d14b4312912c460b6062f0fe9
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/MainAbility/pages/webOnSslError.ets
@@ -0,0 +1,95 @@
+/**
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
+import { Hypium } from '@ohos/hypium';
+import testsuite from '../../test/List.test';
+import Utils from '../../test/Utils';
+
+@Entry
+@Component
+struct webOnSslError {
+ controller: WebController = new WebController();
+ @State str:string="emitOnsslerroreventreceiveWebC";
+ @State firstId:number=420;
+ @State javaScriptAccess:boolean=true;
+ @State fileAccess:boolean=true;
+ @State domStorageAccess:boolean=false;
+ @State imageAccess:boolean=true;
+ @State onlineImageAccess:boolean=true;
+ @State databaseAccess:boolean=true;
+ @State sslerrorText:string="no call error"
+ @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";
+ onPageShow(){
+ let valueChangeEvent={
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
+ }
+ private valueChangeCallBack=(eventData)=>{
+ console.info("webOnSslError 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('webOnSslError').onClick(async () => {
+ console.info("key==>" + this.str)
+ switch (this.str) {
+ case "emitOnsslerroreventreceiveWebC": {
+ try {
+ this.controller.refresh();
+ await Utils.sleep(2000);
+ this.controller.loadUrl({ url: 'https://wrong.host.badssl.com' })
+ console.log("action of emitOnsslerroreventreceiveWebC is loadUrl");
+ } catch (error) {
+ console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
+ }
+ break;
+ }
+ }
+ })
+ }
+ Web({ src:'https://wrong.host.badssl.com', controller: this.controller })
+ .javaScriptAccess(this.javaScriptAccess)
+ .fileAccess(this.fileAccess)
+ .imageAccess(this.imageAccess)
+ .domStorageAccess(this.domStorageAccess)
+ .onlineImageAccess(this.onlineImageAccess)
+ .databaseAccess(this.databaseAccess)
+ .userAgent(this.userAgent)
+ .onSslErrorEventReceive((event) => {
+ console.log("event result is :" + JSON.stringify(event.handler) + event.error);
+ this.sslerrorText = JSON.stringify(event.error)
+ Utils.emitEvent(this.sslerrorText, this.firstId)
+ return true
+ })
+ .onErrorReceive((event) => {
+ console.log('getErrorInfo:' + event.error.getErrorInfo())
+ console.log('getErrorCode:' + event.error.getErrorCode())
+ console.log('url:' + event.request.getRequestUrl())
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a4ee2f1652b3d04ce83ece64ef70f8dfa62a2dc8
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import TestRunner from '@ohos.application.testRunner'
+import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+var abilityDelegator = undefined
+var abilityDelegatorArguments = undefined
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s it',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams = `${targetParams} ${key} ${parameters[key]}`
+ }
+ }
+ return targetParams.trim()
+}
+
+async function onAbilityCreateCallback() {
+ console.log("onAbilityCreateCallback");
+}
+
+async function addAbilityMonitorCallback(err: any) {
+ console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
+}
+
+export default class OpenHarmonyTestRunner implements TestRunner {
+ constructor() {
+ }
+
+ onPrepare() {
+ console.info("OpenHarmonyTestRunner OnPrepare ")
+ }
+
+ async onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
+ let lMonitor = {
+ abilityName: testAbilityName,
+ onAbilityCreate: onAbilityCreateCallback,
+ };
+ abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
+ var cmd = 'aa start -d 0 -a com.example.myapplication.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd,
+ (err: any, d: any) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + d.stdResult);
+ console.info('executeShellCommand : data : ' + d.exitCode);
+ })
+ console.info('OpenHarmonyTestRunner onRun end')
+ }
+};
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..db7c843f9ef1f4fbf1030c3c719bb76a1f901e4b
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/List.test.ets
@@ -0,0 +1,59 @@
+/**
+ * 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 webOnBeforeUnload from './webOnBeforeUnload.test'
+import webOnInterceptReqOne from './webOnInterceptReqOne.test'
+import webOnInterceptReqTwo from './webOnInterceptReqTwo.test'
+import webOnInterceptReqThree from './webOnInterceptReqThree.test'
+import webOnSslError from './webOnSslError.test'
+import webOnFirstCont from './webOnFirstCont.test'
+import webOnFirstContTwo from './webOnFirstContTwo.test'
+import webOnFirstContThree from './webOnFirstContThree.test'
+import webOnFirstContFour from './webOnFirstContFour.test'
+import webDefaultFontSizeWithMinLogical from './webDefaultFontSizeWithMinLogical.test'
+import webDefaultFontSize from './webDefaultFontSize.test'
+import webDefaultFontSizeNoMinFontSize from './webDefaultFontSizeNoMinFontSize.test'
+import webDefaultFontSizeNoAll from './webDefaultFontSizeNoAll.test'
+import webOnFullScreenEnter from './webOnFullScreenEnter.test'
+import webOnFullScreenExit from './webOnFullScreenExit.test'
+import webGetCookieManager from './webGetCookieManager.test'
+import webONHttpErrorReceive from './webONHttpErrorReceive.test'
+import webONHttpErrorReceiveExample from './webONHttpErrorReceiveExample.test'
+import webONHttpErrorRecvExampleIsReady from './webONHttpErrorRecvExampleIsReady.test'
+import webONHttpErrorReceiveIframe from './webONHttpErrorReceiveIframe.test'
+import webOnAudioStateChanged from './webOnAudioStateChanged.test'
+
+export default function testsuite() {
+ //webOnBeforeUnload()
+ webOnInterceptReqOne()
+ webOnInterceptReqTwo()
+ webOnInterceptReqThree()
+ webOnSslError()
+ webOnFirstCont()
+ webOnFirstContTwo()
+ webOnFirstContThree()
+ webOnFirstContFour()
+ webDefaultFontSizeWithMinLogical()
+ webDefaultFontSize()
+ webDefaultFontSizeNoMinFontSize()
+ webDefaultFontSizeNoAll()
+ //webOnFullScreenEnter()
+ //webOnFullScreenExit()
+ webGetCookieManager()
+ webONHttpErrorReceive()
+ webONHttpErrorReceiveExample()
+ webONHttpErrorRecvExampleIsReady()
+ webONHttpErrorReceiveIframe()
+ //webOnAudioStateChanged()
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/Utils.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/Utils.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1188613cf2a664c4186c9fde8d0138c00ff48e69
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/Utils.ets
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import events_emitter from '@ohos.events.emitter';
+import { expect } from "@ohos/hypium";
+export default class Utils {
+ static sleep(time){
+ return new Promise((resolve,reject)=>{
+ setTimeout(()=>{
+ resolve("ok")
+ },time)
+ }).then(()=>{
+ console.info(`sleep ${time} over...`)
+ })
+ }
+ static registerEvent(testCaseName,expectedValue,eventId,done){
+ 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 = {
+ eventId:eventId,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(innerEvent,callBack)
+ }catch(err){
+ console.info(`[${testCaseName}] err:`+JSON.stringify(err));
+ }
+ }
+ static emitEvent(actualValue,eventId){
+ try {
+ let backData = {
+ data: {
+ "ACTION": actualValue
+ }
+ }
+ let backEvent = {
+ eventId:eventId,
+ 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));
+ }
+ }
+ static registerEventTwo(testCaseName,eventId,done){
+ 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 = {
+ eventId:eventId,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(innerEvent,callBack)
+ }catch(err){
+ console.info(`[${testCaseName}] err:`+JSON.stringify(err));
+ }
+ }
+ static emitEventTwo(expectedValue,actualValue,eventId){
+ try {
+ let backData = {
+ data: {
+ "expectedValue":expectedValue,
+ "actualValue":actualValue
+ }
+ }
+ let backEvent = {
+ eventId:eventId,
+ 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));
+ }
+ }
+ static registerContainEvent(testCaseName,expectedValue,eventId,done){
+ 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 = {
+ eventId:eventId,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(innerEvent,callBack)
+ }catch(err){
+ console.info(`[${testCaseName}] err:`+JSON.stringify(err));
+ }
+ }
+ static commitKey(emitKey){
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ }
+ static registerLargerEvent(testCaseName,eventId,done){
+ 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);
+ console.info(`[${testCaseName}] END`);
+ }catch(err){
+ console.info(`[${testCaseName}] err:`+JSON.stringify(err));
+ }
+ done()
+ }
+ let innerEvent = {
+ eventId:eventId,
+ priority:events_emitter.EventPriority.LOW
+ }
+ events_emitter.on(innerEvent,callBack)
+ }catch(err){
+ console.info(`[${testCaseName}] err:`+JSON.stringify(err));
+ }
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSize.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSize.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1cfc39c623b7919d2af8cfa93ec7f15a62458e32
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSize.test.ets
@@ -0,0 +1,88 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitdefaultFontSize73AndminFontSize1WebC";
+export default function webDefaultFontSize() {
+ describe('ActsAceWebDevWebDefaultFontSizeTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webDefaultFontSize',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webDefaultFontSize state success " + JSON.stringify(pages));
+ if (!("webDefaultFontSize" == pages.name)) {
+ console.info("get webDefaultFontSize state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webDefaultFontSize page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webDefaultFontSize page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webDefaultFontSize beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webDefaultFontSize afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR6_API_0200
+ *tc.name testDefaultFontSize73AndMinFontSize1WebC
+ *tc.desc test with defaultfontsize 73 and minfontsize 1
+ */
+ it('testDefaultFontSize73AndMinFontSize1WebC',0,async function(done){
+ emitKey="emitdefaultFontSize73AndminFontSize73WebC";
+ Utils.registerEvent("testDefaultFontSize73AndMinFontSize1WebC","72px",432,done);
+ sendEventByKey('webDefaultFontSize',10,'');
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR6_API_0300
+ *tc.name testDefaultFontSize73AndMinFontSize73WebC
+ *tc.desc test with defaultfontsize 73 and minfontsize 73
+ */
+ it('testDefaultFontSize73AndMinFontSize73WebC',0,async function(done){
+ emitKey="emitdefaultFontSize73AndminFontSize73WebC";
+ Utils.registerEvent("testDefaultFontSize73AndMinFontSize73WebC","72px",434,done);
+ sendEventByKey('webDefaultFontSize',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSizeNoAll.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSizeNoAll.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..8f8a5f53819c42b962d7c36b6faf82277883995c
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSizeNoAll.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitdefaultFontSizeAndminFontSizeNoAllWebC";
+export default function webDefaultFontSizeNoAll() {
+ describe('ActsAceWebDevWebDefaultFontSizeNoAllTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webDefaultFontSizeNoAll',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webDefaultFontSizeNoAll state success " + JSON.stringify(pages));
+ if (!("webDefaultFontSizeNoAll" == pages.name)) {
+ console.info("get webDefaultFontSizeNoAll state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webDefaultFontSizeNoAll page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webDefaultFontSizeNoAll page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webDefaultFontSizeNoAll beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webDefaultFontSizeNoAll afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR6_API_0600
+ *tc.name testNoDefaultFontSizeAndNoMinFontSizeWebC
+ *tc.desc test with no set defaultfontsize or minfontsize
+ */
+ it('testNoDefaultFontSizeAndNoMinFontSizeWebC',0,async function(done){
+ emitKey="emitdefaultFontSizeAndminFontSizeNoAllWebC";
+ Utils.registerEvent("testNoDefaultFontSizeAndNoMinFontSizeWebC","16px",440,done);
+ sendEventByKey('webDefaultFontSizeNoAll',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSizeNoMinFontSize.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSizeNoMinFontSize.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..6dcee4e0bd428bf46ff2291b27e413c4cb8cbf5e
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSizeNoMinFontSize.test.ets
@@ -0,0 +1,88 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitdefaultFontSize7AndNominFontSizeWebC";
+export default function webDefaultFontSizeNoMinFontSize() {
+ describe('ActsAceWebDevWebDefaultFontSizeNoMinFontSizeTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webDefaultFontSizeNoMinFontSize',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webDefaultFontSizeNoMinFontSize state success " + JSON.stringify(pages));
+ if (!("webDefaultFontSizeNoMinFontSize" == pages.name)) {
+ console.info("get webDefaultFontSizeNoMinFontSize state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webDefaultFontSizeNoMinFontSize page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webDefaultFontSizeNoMinFontSize page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webDefaultFontSizeNoMinFontSize beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webDefaultFontSizeNoMinFontSize afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR6_API_0400
+ *tc.name testDefaultFontSize7AndNoMinFontSizeWebC
+ *tc.desc test with defaultfontsize 7 and no set minfontsize
+ */
+ it('testDefaultFontSize7AndNoMinFontSizeWebC',0,async function(done){
+ emitKey="emitdefaultFontSize17AndCssFontSize9WebC";
+ Utils.registerEvent("testDefaultFontSize7AndNoMinFontSizeWebC","8px",436,done);
+ sendEventByKey('webDefaultFontSizeNoMinFontSize',10,'');
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR6_API_0500
+ *tc.name testDefaultFontSize17AndCssFontSize9WebC
+ *tc.desc test with defaultfontsize 17 and css font-size 9
+ */
+ it('testDefaultFontSize17AndCssFontSize9WebC',0,async function(done){
+ emitKey="emitdefaultFontSize17AndCssFontSize9WebC";
+ Utils.registerEvent("testDefaultFontSize17AndCssFontSize9WebC","9px",438,done);
+ sendEventByKey('webDefaultFontSizeNoMinFontSize',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSizeWithMinLogical.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSizeWithMinLogical.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..cd1e19bc04ea331d348db984ad14ff59995c8af6
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webDefaultFontSizeWithMinLogical.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitdefaultFontSizeHalfAndminFontSizeHalfWebC";
+export default function webDefaultFontSizeWithMinLogical() {
+ describe('ActsAceWebDevWebDefaultFontSizeWithMinLogicalTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webDefaultFontSizeWithMinLogical',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webDefaultFontSizeWithMinLogical state success " + JSON.stringify(pages));
+ if (!("webDefaultFontSizeWithMinLogical" == pages.name)) {
+ console.info("get webDefaultFontSizeWithMinLogical state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webDefaultFontSizeWithMinLogical page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webDefaultFontSizeWithMinLogical page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webDefaultFontSizeWithMinLogical beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webDefaultFontSizeWithMinLogical afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR6_API_0100
+ *tc.name testDefaultFontSizeHalfAndMinFontSizeHalfWebC
+ *tc.desc test with defaultfontsize 0.5 , minfontsize 0.5 and minLogicalFontSize 0.5
+ */
+ it('testDefaultFontSizeHalfAndMinFontSizeHalfWebC',0,async function(done){
+ emitKey="emitdefaultFontSizeHalfAndminFontSizeHalfWebC";
+ Utils.registerEvent("testDefaultFontSizeHalfAndMinFontSizeHalfWebC","1px",430,done);
+ sendEventByKey('webDefaultFontSizeWithMinLogical',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webGetCookieManager.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webGetCookieManager.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..86ea99dc0dd4f2508b3e76426013189c7ef1134c
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webGetCookieManager.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitGetCookieManagerWebc";
+export default function webGetCookieManager() {
+ describe('ActsAceWebDevWebGetCookieManagerTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webGetCookieManager',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webGetCookieManager state success " + JSON.stringify(pages));
+ if (!("webGetCookieManager" == pages.name)) {
+ console.info("get webGetCookieManager state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webGetCookieManager page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webGetCookieManager page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webGetCookieManager beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webGetCookieManager afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBGETCOOKIEMMANAGER_API_0100
+ *tc.name testGetCookieManagerWebc
+ *tc.desc test interface of onfullscreenexit with runjavascript exitFullscreen
+ */
+ it('testGetCookieManagerWebc',0,async function(done){
+ emitKey="emitGetCookieManagerWebc";
+ Utils.registerEvent("testGetCookieManagerWebc",2,446,done);
+ sendEventByKey('webGetCookieManager',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorReceive.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorReceive.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c09380416acdd482beca03856a421858cd06952e
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorReceive.test.ets
@@ -0,0 +1,92 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnHttpErrorReceiveFixedUserAgentWebc";
+export default function webONHttpErrorReceive() {
+ describe('ActsAceWebDevWebONHttpErrorReceiveTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webONHttpErrorReceive',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webONHttpErrorReceive state success " + JSON.stringify(pages));
+ if (!("webONHttpErrorReceive" == pages.name)) {
+ console.info("get webONHttpErrorReceive state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webONHttpErrorReceive page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webONHttpErrorReceive page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webONHttpErrorReceive beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webONHttpErrorReceive afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBERRORRECV_API_0100
+ *tc.name testOnHttpErrorReceiveFixedUserAgentWebc
+ *tc.desc test interface of onHttpErrorReceive with parameter fixed userAgent
+ */
+ it('testOnHttpErrorReceiveFixedUserAgentWebc',0,async function(done){
+ emitKey="emitOnHttpErrorReceiveFixedUserAgentWebc";
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc","http://1.1.1.123/index.html",362,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUstestOnHttpErrorReceiveFixedUserAgentWebcerAgent",true,364,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc",false,466,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc",false,468,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc","GET",470,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc","",472,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc","utf-8",474,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc","text/html",476,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc",403,478,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc","Forbidden",480,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc","User-Agent",482,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc","Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36",484,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc","User-Agent",486,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc","Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36",488,done);
+ Utils.registerEvent("testOnHttpErrorReceiveFixedUserAgentWebc","403http://1.1.1.123/index.html",490,done);
+ sendEventByKey('webONHttpErrorReceive',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorReceiveExample.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorReceiveExample.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..66c2cbda00354f65f2229566bbb5097631b8b216
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorReceiveExample.test.ets
@@ -0,0 +1,79 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnHttpErrorReceiveByExampleWebc";
+export default function webONHttpErrorReceiveExample() {
+ describe('ActsAceWebDevWebONHttpErrorReceiveExampleTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webONHttpErrorReceiveExample',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webONHttpErrorReceiveExample state success " + JSON.stringify(pages));
+ if (!("webONHttpErrorReceiveExample" == pages.name)) {
+ console.info("get webONHttpErrorReceiveExample state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webONHttpErrorReceiveExample page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webONHttpErrorReceiveExample page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webONHttpErrorReceiveExample beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webONHttpErrorReceiveExample afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBERRORRECV_API_0200
+ *tc.name testOnHttpErrorReceiveByExampleWebc
+ *tc.desc test interface of onHttpErrorReceive with parameter used by example
+ */
+ it('testOnHttpErrorReceiveByExampleWebc',0,async function(done){
+ emitKey="emitOnHttpErrorReceiveByExampleWebc";
+ Utils.registerEvent("testOnHttpErrorReceiveByExampleWebc",403,491,done);
+ Utils.registerEvent("testOnHttpErrorReceiveByExampleWebc","intercept test",492,done);
+ sendEventByKey('webONHttpErrorReceiveExample',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorReceiveIframe.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorReceiveIframe.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..810f537cb5cb5772d8bf65734fb7e57cbbd3a39f
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorReceiveIframe.test.ets
@@ -0,0 +1,79 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnHttpErrorReceiveByIframeHtmlWebc";
+export default function webONHttpErrorReceiveIframe() {
+ describe('ActsAceWebDevWebONHttpErrorReceiveIframeTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webONHttpErrorReceiveIframe',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webONHttpErrorReceiveIframe state success " + JSON.stringify(pages));
+ if (!("webONHttpErrorReceiveIframe" == pages.name)) {
+ console.info("get webONHttpErrorReceiveIframe state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webONHttpErrorReceiveIframe page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webONHttpErrorReceiveIframe page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webONHttpErrorReceiveIframe beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webONHttpErrorReceiveIframe afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBERRORRECV_API_0300
+ *tc.name testOnHttpErrorReceiveByIframeHtmlWebc
+ *tc.desc test interface of onHttpErrorReceive with parameter used by html file with iframe
+ */
+ it('testOnHttpErrorReceiveByIframeHtmlWebc',0,async function(done){
+ emitKey="emitOnHttpErrorReceiveByIframeHtmlWebc";
+ Utils.registerEvent("testOnHttpErrorReceiveByIframeHtmlWebc",false,496,done);
+ Utils.registerEvent("testOnHttpErrorReceiveByIframeHtmlWebc","index",498,done);
+ sendEventByKey('webONHttpErrorReceiveIframe',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorRecvExampleIsReady.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorRecvExampleIsReady.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..68b2a305c18322827981ce93f0f1a86a4e492d1b
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webONHttpErrorRecvExampleIsReady.test.ets
@@ -0,0 +1,79 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnHttpErrorRecvExampleIsReadyFalseWebc";
+export default function webONHttpErrorRecvExampleIsReady() {
+ describe('ActsAceWebDevWebONHttpErrorRecvExampleIsReadyTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webONHttpErrorRecvExampleIsReady',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webONHttpErrorRecvExampleIsReady state success " + JSON.stringify(pages));
+ if (!("webONHttpErrorRecvExampleIsReady" == pages.name)) {
+ console.info("get webONHttpErrorRecvExampleIsReady state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webONHttpErrorRecvExampleIsReady page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webONHttpErrorRecvExampleIsReady page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webONHttpErrorRecvExampleIsReady beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webONHttpErrorRecvExampleIsReady afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBERRORRECV_API_0300
+ *tc.name testOnHttpErrorRecvExampleIsReadyFalseWebc
+ *tc.desc test interface of onHttpErrorReceive with parameter used by example but setResponseIsReady false
+ */
+ it('testOnHttpErrorRecvExampleIsReadyFalseWebc',0,async function(done){
+ emitKey="emitOnHttpErrorRecvExampleIsReadyFalseWebc";
+ Utils.registerEvent("testOnHttpErrorRecvExampleIsReadyFalseWebc",403,493,done);
+ Utils.registerEvent("testOnHttpErrorRecvExampleIsReadyFalseWebc","",494,done);
+ sendEventByKey('webONHttpErrorRecvExampleIsReady',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnAudioStateChanged.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnAudioStateChanged.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c04316ee7ec8d695a0ad0bca69f9995366705cc8
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnAudioStateChanged.test.ets
@@ -0,0 +1,90 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitAudioStatePlayWebc";
+export default function webOnAudioStateChanged() {
+ describe('ActsAceWebDevWebOnAudioStateChangedTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webOnAudioStateChanged',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webOnAudioStateChanged state success " + JSON.stringify(pages));
+ if (!("webOnAudioStateChanged" == pages.name)) {
+ console.info("get webOnAudioStateChanged state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webOnAudioStateChanged page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webOnAudioStateChanged page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnAudioStateChanged beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnAudioStateChanged afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBAUDIOSTATE_API_0100
+ *tc.name testOnAudioStateChangedPlayWebc
+ *tc.desc test interface of onaudiostatechanged with audio play
+ */
+ it('testOnAudioStateChangedPlayWebc',0,async function(done){
+ emitKey="emitAudioStatePauseWebc";
+ Utils.registerEvent("testOnAudioStateChangedPlayWebc",true,501,done);
+ Utils.registerEvent("testOnAudioStateChangedPlayWebc","false",502,done);
+ sendEventByKey('webOnAudioStateChanged',10,'');
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBAUDIOSTATE_API_0200
+ *tc.name testOnAudioStateChangedPauseWebc
+ *tc.desc test interface of onaudiostatechanged with audio pause
+ */
+ it('testOnAudioStateChangedPauseWebc',0,async function(done){
+ emitKey="emitAudioStatePauseWebc";
+ Utils.registerEvent("testOnAudioStateChangedPauseWebc",false,503,done);
+ Utils.registerEvent("testOnAudioStateChangedPauseWebc","true",504,done);
+ sendEventByKey('webOnAudioStateChanged',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnBeforeUnload.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnBeforeUnload.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..ccd7f62c81a17afdc9cd377d31efd8b066c09259
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnBeforeUnload.test.ets
@@ -0,0 +1,69 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnBeforeUnloadWebC";
+export default function webOnBeforeUnload() {
+ describe('ActsAceWebDevWebOnBeforeUnloadTest', function () {
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnBeforeUnload beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnBeforeUnload afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEB_API_0100
+ *tc.name testOnBeforeUnloadWebC
+ *tc.desc onBeforeUnload after page refresh
+ */
+ it('testOnBeforeUnloadWebC',0,async function(done){
+ emitKey="emitOnBeforeUnloadAgainWebC";
+ Utils.registerEvent("testOnBeforeUnloadWebC","Is it OK to leave/reload this page?",402,done);
+ sendEventByKey('webOnBeforeUnload',10,'');
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEB_API_0200
+ *tc.name testOnBeforeUnloadAgainWebC
+ *tc.desc onBeforeUnload after page loadUrl new
+ */
+ it('testOnBeforeUnloadAgainWebC',0,async function(done){
+ emitKey="emitOnBeforeUnloadAgainWebC";
+ Utils.registerEvent("testOnBeforeUnloadAgainWebC","Is it OK to leave/reload this page?",404,done);
+ sendEventByKey('webOnBeforeUnload',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstCont.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstCont.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..2c97cb8818824ca8ffc73fb7675eb6c58eb84b1f
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstCont.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnfirstcontentfulpaintWebc";
+export default function webOnFirstCont() {
+ describe('ActsAceWebDevWebOnFirstContTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webOnFirstCont',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webOnFirstCont state success " + JSON.stringify(pages));
+ if (!("webOnFirstCont" == pages.name)) {
+ console.info("get webOnFirstCont state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webOnFirstCont page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webOnFirstCont page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnFirstCont beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnFirstCont afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR5_API_0100
+ *tc.name testOnfirstcontentfulpaintWebc
+ *tc.desc onfirstcontentfulpaint with web src null
+ */
+ it('testOnfirstcontentfulpaintWebc',0,async function(done){
+ emitKey="emitOnfirstcontentfulpaintWebc";
+ Utils.registerEvent("testOnfirstcontentfulpaintWebc","NoSrcTest",422,done);
+ sendEventByKey('webOnFirstCont',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstContFour.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstContFour.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..330188d00027a8333fea59f901f4b9da1e49ca1c
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstContFour.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitRefreshOnfirstcontentfulpaintWebc";
+export default function webOnFirstContFour() {
+ describe('ActsAceWebDevWebOnFirstContFourTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webOnFirstContFour',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webOnFirstContFour state success " + JSON.stringify(pages));
+ if (!("webOnFirstContFour" == pages.name)) {
+ console.info("get webOnFirstContFour state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webOnFirstContFour page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webOnFirstContFour page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnFirstContFour beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnFirstContFour afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR5_API_0400
+ *tc.name testOnfirstcontentfulpaintrefreshWebc
+ *tc.desc onfirstcontentfulpaint with web refresh
+ */
+ it('testOnfirstcontentfulpaintrefreshWebc',0,async function(done){
+ emitKey="emitRefreshOnfirstcontentfulpaintWebc";
+ Utils.registerEvent("testOnfirstcontentfulpaintrefreshWebc",true,428,done);
+ sendEventByKey('webOnFirstContFour',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstContThree.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstContThree.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..40ed21a5a48788de6f32abfdbc363f6cb2a20097
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstContThree.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitLoadUrlOnfirstcontentfulpaintWebc";
+export default function webOnFirstContThree() {
+ describe('ActsAceWebDevWebOnFirstContThreeTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webOnFirstContThree',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webOnFirstContThree state success " + JSON.stringify(pages));
+ if (!("webOnFirstContThree" == pages.name)) {
+ console.info("get webOnFirstContThree state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webOnFirstContThree page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webOnFirstContThree page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnFirstContThree beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnFirstContThree afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR5_API_0300
+ *tc.name testOnfirstcontentfulpaintloadurlWebc
+ *tc.desc onfirstcontentfulpaint with web load url
+ */
+ it('testOnfirstcontentfulpaintloadurlWebc',0,async function(done){
+ emitKey="emitLoadUrlOnfirstcontentfulpaintWebc";
+ Utils.registerEvent("testOnfirstcontentfulpaintloadurlWebc",true,426,done);
+ sendEventByKey('webOnFirstContThree',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstContTwo.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstContTwo.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1ae89cbf3128d2e39ab6b3ba3bbf89cb9884d1a3
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFirstContTwo.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitNoneOnfirstcontentfulpaintWebc";
+export default function webOnFirstContTwo() {
+ describe('ActsAceWebDevWebOnFirstContTwoTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webOnFirstContTwo',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webOnFirstContTwo state success " + JSON.stringify(pages));
+ if (!("webOnFirstContTwo" == pages.name)) {
+ console.info("get webOnFirstContTwo state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webOnFirstContTwo page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webOnFirstContTwo page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnFirstContTwo beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnFirstContTwo afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR5_API_0200
+ *tc.name testOnfirstcontentfulpaintvisibilitynoneWebc
+ *tc.desc onfirstcontentfulpaint with web visibility none
+ */
+ it('testOnfirstcontentfulpaintvisibilitynoneWebc',0,async function(done){
+ emitKey="emitNoneOnfirstcontentfulpaintWebc";
+ Utils.registerEvent("testOnfirstcontentfulpaintvisibilitynoneWebc","VisibilityNoneTest",424,done);
+ sendEventByKey('webOnFirstContTwo',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFullScreenEnter.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFullScreenEnter.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..fb1a41d680572c81546d853bac358338568c39d1
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFullScreenEnter.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnfullscreenenterWebc";
+export default function webOnFullScreenEnter() {
+ describe('ActsAceWebDevWebOnFullScreenEnterTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webOnFullScreenEnter',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webOnFullScreenEnter state success " + JSON.stringify(pages));
+ if (!("webOnFullScreenEnter" == pages.name)) {
+ console.info("get webOnFullScreenEnter state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webOnFullScreenEnter page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webOnFullScreenEnter page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnFullScreenEnter beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnFullScreenEnter afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBFULLSCREEN_API_0100
+ *tc.name testOnFullScreenEnterWebc
+ *tc.desc test interface of onfullscreenenter with runjavascript handleFullScreen
+ */
+ it('testOnFullScreenEnterWebc',0,async function(done){
+ emitKey="emitOnfullscreenenterWebc";
+ Utils.registerEvent("testOnFullScreenEnterWebc","2\"true\"",442,done);
+ sendEventByKey('webOnFullScreenEnter',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFullScreenExit.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFullScreenExit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5f6c496170ff32bee923d81ca205f361f6bff387
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnFullScreenExit.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnfullscreenexitWebc";
+export default function webOnFullScreenExit() {
+ describe('ActsAceWebDevWebOnFullScreenExitTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webOnFullScreenExit',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webOnFullScreenExit state success " + JSON.stringify(pages));
+ if (!("webOnFullScreenExit" == pages.name)) {
+ console.info("get webOnFullScreenExit state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webOnFullScreenExit page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webOnFullScreenExit page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnFullScreenExit beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnFullScreenExit afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBFULLSCREEN_API_0200
+ *tc.name testOnFullScreenExitWebc
+ *tc.desc test interface of onfullscreenexit with runjavascript exitFullscreen
+ */
+ it('testOnFullScreenExitWebc',0,async function(done){
+ emitKey="emitOnfullscreenexitWebc";
+ Utils.registerEvent("testOnFullScreenExitWebc","2\"false\"",444,done);
+ sendEventByKey('webOnFullScreenExit',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnInterceptReqOne.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnInterceptReqOne.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..530489977b236b24d853b1cd96c3fb42bcbbd44a
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnInterceptReqOne.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnInterceptRequestWebC";
+export default function webOnInterceptReqOne() {
+ describe('ActsAceWebDevWebOnInterceptReqOneTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webOnInterceptReqOne',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webOnInterceptReqOne state success " + JSON.stringify(pages));
+ if (!("webOnInterceptReqOne" == pages.name)) {
+ console.info("get webOnInterceptReqOne state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webOnInterceptReqOne page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webOnInterceptReqOne page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnInterceptReqOne beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnInterceptReqOne afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR2_API_0100
+ *tc.name testOnInterceptRequestWebC
+ *tc.desc onInterceptRequest without setting webresourceresponse
+ */
+ it('testOnInterceptRequestWebC',0,async function(done){
+ emitKey="emitOnInterceptRequestWebC";
+ Utils.registerEvent("testOnInterceptRequestWebC","resource://rawfile/indexCopy.html",406,done);
+ sendEventByKey('webOnInterceptReqOne',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnInterceptReqThree.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnInterceptReqThree.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..046a21c861e46e16709b6870af5d6853851e3827
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnInterceptReqThree.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnInterceptRequestThirdWebC";
+export default function webOnInterceptReqThree() {
+ describe('ActsAceWebDevWebOnInterceptReqThreeTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webOnInterceptReqThree',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webOnInterceptReqThree state success " + JSON.stringify(pages));
+ if (!("webOnInterceptReqThree" == pages.name)) {
+ console.info("get webOnInterceptReqThree state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webOnInterceptReqThree page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webOnInterceptReqThree page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnInterceptReqThree beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnInterceptReqThree afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR2_API_0300
+ *tc.name testOnInterceptRequestThirdWebC
+ *tc.desc onInterceptRequest with setting setresponsecede 404
+ */
+ it('testOnInterceptRequestThirdWebC',0,async function(done){
+ emitKey="emitOnInterceptRequestThirdWebC";
+ Utils.registerEvent("testOnInterceptRequestThirdWebC",404,410,done);
+ sendEventByKey('webOnInterceptReqThree',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnInterceptReqTwo.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnInterceptReqTwo.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f8fc8fc4eb74c8947ae9010dfe8d4dc6fb1f6ca8
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnInterceptReqTwo.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnInterceptRequestSecondWebC";
+export default function webOnInterceptReqTwo() {
+ describe('ActsAceWebDevWebOnInterceptReqTwoTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webOnInterceptReqTwo',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webOnInterceptReqTwo state success " + JSON.stringify(pages));
+ if (!("webOnInterceptReqTwo" == pages.name)) {
+ console.info("get webOnInterceptReqTwo state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webOnInterceptReqTwo page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webOnInterceptReqTwo page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnInterceptReqTwo beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnInterceptReqTwo afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR2_API_0200
+ *tc.name testOnInterceptRequestAgainWebC
+ *tc.desc onInterceptRequest with setting webresourceresponse
+ */
+ it('testOnInterceptRequestAgainWebC',0,async function(done){
+ emitKey="emitOnInterceptRequestSecondWebC";
+ Utils.registerEvent("testOnInterceptRequestAgainWebC","intercept test",408,done);
+ sendEventByKey('webOnInterceptReqTwo',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnSslError.test.ets b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnSslError.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..dda328fc6daa211a17f612dc16bc180b9aa05139
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/ets/test/webOnSslError.test.ets
@@ -0,0 +1,78 @@
+/**
+ * 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, beforeAll} from "@ohos/hypium";
+import events_emitter from '@ohos.events.emitter';
+import Utils from './Utils.ets';
+import router from '@system.router';
+// @ts-nocheck
+let emitKey = "emitOnsslerroreventreceiveWebC";
+export default function webOnSslError() {
+ describe('ActsAceWebDevWebOnSslErrorTest', function () {
+ beforeAll(async function (done) {
+ let options = {
+ uri: 'MainAbility/pages/webOnSslError',
+ }
+ try {
+ router.clear();
+ let pages = router.getState();
+ console.info("get webOnSslError state success " + JSON.stringify(pages));
+ if (!("webOnSslError" == pages.name)) {
+ console.info("get webOnSslError state success " + JSON.stringify(pages.name));
+ let result = await router.push(options);
+ await Utils.sleep(2000);
+ console.info("push webOnSslError page success " + JSON.stringify(result));
+ }
+ } catch (err) {
+ console.error("push webOnSslError page error: " + err);
+ }
+ done()
+ });
+ beforeEach(async function (done) {
+ await Utils.sleep(2000);
+ console.info("webOnSslError beforeEach start");
+ done();
+ })
+ afterEach(async function (done) {
+ console.info("webOnSslError afterEach start:" + emitKey);
+ try {
+ let backData = {
+ data: {
+ "ACTION": emitKey
+ }
+ }
+ let backEvent = {
+ eventId:10,
+ priority:events_emitter.EventPriority.LOW
+ }
+ console.info("start send emitKey");
+ events_emitter.emit(backEvent, backData);
+ } catch (err) {
+ console.info("emit emitKey err: " + JSON.stringify(err));
+ }
+ await Utils.sleep(2000);
+ done();
+ })
+ /*
+ *tc.number SUB_ACE_BASIC_ETS_WEBPATR4_API_0100
+ *tc.name testOnsslerroreventreceiveWebC
+ *tc.desc onsslerroreventreceive after load https://wrong.host.badssl.com
+ */
+ it('testOnsslerroreventreceiveWebC',0,async function(done){
+ emitKey="emitOnsslerroreventreceiveWebC";
+ Utils.registerEvent("testOnsslerroreventreceiveWebC","1",420,done);
+ sendEventByKey('webOnSslError',10,'');
+ })
+ })
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/module.json b/arkui/ace_ets_web_dev_webController/entry/src/main/module.json
new file mode 100644
index 0000000000000000000000000000000000000000..0729db882db60f8b8798a190efe02dbd546c03b4
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/module.json
@@ -0,0 +1,49 @@
+{
+ "module": {
+ "name": "phone",
+ "type": "entry",
+ "srcEntrance": "./ets/Application/AbilityStage.ts",
+ "description": "$string:phone_entry_dsc",
+ "mainElement": "MainAbility",
+ "deviceTypes": [
+ "tablet",
+ "default",
+ "phone"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "uiSyntax": "ets",
+ "pages": "$profile:main_pages",
+ "metadata": [
+ {
+ "name": "ArkTSPartialUpdate",
+ "value": "true"
+ }
+ ],
+ "abilities": [{
+ "name": "com.example.myapplication.MainAbility",
+ "srcEntrance": "./ets/MainAbility/MainAbility.ts",
+ "description": "$string:phone_entry_main",
+ "icon": "$media:icon",
+ "label": "$string:entry_label",
+ "visible": true,
+ "orientation": "portrait",
+ "skills": [{
+ "actions": [
+ "action.system.home"
+ ],
+ "entities": [
+ "entity.system.home"
+ ]
+ }]
+ }],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.LOCATION"
+ },
+ {
+ "name": "ohos.permission.INTERNET"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/resources/base/element/string.json b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..2977b612ec4595b13eaaffe3e8fc578e83c42d48
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,32 @@
+{
+ "string": [
+ {
+ "name": "phone_entry_dsc",
+ "value": "i am an entry for phone"
+ },
+ {
+ "name": "phone_entry_main",
+ "value": "the phone entry ability"
+ },
+ {
+ "name": "entry_label",
+ "value": "ActsContextTest"
+ },
+ {
+ "name": "form_description",
+ "value": "my form"
+ },
+ {
+ "name": "serviceability_description",
+ "value": "my whether"
+ },
+ {
+ "name": "description_application",
+ "value": "demo for test"
+ },
+ {
+ "name": "app_name",
+ "value": "Demo"
+ }
+ ]
+}
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/resources/base/media/icon.png b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023
Binary files /dev/null and b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/base/media/icon.png differ
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/resources/base/profile/main_pages.json b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..edf97b318a7a30ebba625da14218ba06ff3c9170
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,25 @@
+{
+ "src": [
+ "MainAbility/pages/webOnBeforeUnload",
+ "MainAbility/pages/webOnSslError",
+ "MainAbility/pages/webOnInterceptReqOne",
+ "MainAbility/pages/webOnInterceptReqTwo",
+ "MainAbility/pages/webOnInterceptReqThree",
+ "MainAbility/pages/webDefaultFontSizeWithMinLogical",
+ "MainAbility/pages/webDefaultFontSize",
+ "MainAbility/pages/webDefaultFontSizeNoMinFontSize",
+ "MainAbility/pages/webDefaultFontSizeNoAll",
+ "MainAbility/pages/webOnFirstCont",
+ "MainAbility/pages/webOnFirstContTwo",
+ "MainAbility/pages/webOnFirstContThree",
+ "MainAbility/pages/webOnFirstContFour",
+ "MainAbility/pages/webOnFullScreenEnter",
+ "MainAbility/pages/webOnFullScreenExit",
+ "MainAbility/pages/webGetCookieManager",
+ "MainAbility/pages/webONHttpErrorReceive",
+ "MainAbility/pages/webONHttpErrorReceiveExample",
+ "MainAbility/pages/webONHttpErrorRecvExampleIsReady",
+ "MainAbility/pages/webONHttpErrorReceiveIframe",
+ "MainAbility/pages/webOnAudioStateChanged"
+ ]
+}
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/01.mp3 b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/01.mp3
new file mode 100644
index 0000000000000000000000000000000000000000..85573aabb4945760a979388540f9374db46a968c
Binary files /dev/null and b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/01.mp3 differ
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/audioTest.html b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/audioTest.html
new file mode 100644
index 0000000000000000000000000000000000000000..fe6d79a64c43650b7dc3c8b65e1fddcb3963207a
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/audioTest.html
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+ audioTest
+
+
+
+
+
+
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/fullScreenTest.html b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/fullScreenTest.html
new file mode 100644
index 0000000000000000000000000000000000000000..f2ed82c5ae9fd9756792ef525baba8a6b3ef4a35
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/fullScreenTest.html
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+ FullScreenTest
+
+
+
+ 这是被全屏的元素
+
+
+
+
+
+
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/icon.png b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023
Binary files /dev/null and b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/icon.png differ
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/indexCopy.html b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/indexCopy.html
new file mode 100644
index 0000000000000000000000000000000000000000..fa59796574fb6671e6bde9adab5bd24eba6dee8d
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/indexCopy.html
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+ index
+
+
+
+ 首页
+
+ 内容
+
+ 末尾
+ 打开rawfile文件
+
+
+
+
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/indexFive.html b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/indexFive.html
new file mode 100644
index 0000000000000000000000000000000000000000..c65e08261621b08a6c583aa96a688409217d17d5
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/indexFive.html
@@ -0,0 +1,97 @@
+
+
+
+
+
+
+ index
+
+
+
+ 首页
+
+ 内容
+
+ 末尾
+ 打开rawfile文件
+
+
+
+
\ No newline at end of file
diff --git a/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/indexFour.html b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/indexFour.html
new file mode 100644
index 0000000000000000000000000000000000000000..5c71d04e2a47fe63c98ed93f34c332c6aa1fed7e
--- /dev/null
+++ b/arkui/ace_ets_web_dev_webController/entry/src/main/resources/rawfile/indexFour.html
@@ -0,0 +1,52 @@
+
+
+
+
+ homework
+
+
+
+
+
+
+
+

+
+
+
+
+
+