未验证 提交 05edbdf0 编写于 作者: O openharmony_ci 提交者: Gitee

!8966 add webView errorCode xts_acts testcases & pages

Merge pull request !8966 from 王闻天/webViewError
{
"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
{
"string":[
{
"name":"app_name",
"value":"ohosProject"
}
]
}
\ No newline at end of file
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAceWebDevWebViewContErrorTest") {
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 = "ActsAceWebDevWebViewControllerErrorTest"
}
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"
}
{
"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": [
"ActsAceWebDevWebViewControllerErrorTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602"
]
}
]
}
\ No newline at end of file
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;
}
}
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/webViewContMessageError", 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")
}
};
/**
* 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 web_webview from '@ohos.web.webview';
// @ts-nocheck
@Entry
@Component
struct webViewContJavaScriptError {
controller: web_webview.WebviewController = new web_webview.WebviewController();
controllerTwo: web_webview.WebviewController = new web_webview.WebviewController();
@State str:string="emitRegisterJavaScriptProxyInitErr";
@State userAgent:string = "Mozilla/5.0 (Window NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)" +
" CHrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27";
@State javaScriptAccess:boolean=true;
@State fileAccess:boolean=true;
@State domStorageAccess:boolean=false;
@State imageAccess:boolean=true;
@State onlineImageAccess:boolean=true;
@State databaseAccess:boolean=true;
@State errorCode: string = '0';
@State errorMsg: string = 'failed';
@State webResult: string = '';
@State name: string = 'UnExistObj';
testObj = {
test: (data) => {
return "ArkUI Web Component";
},
toString: () => {
console.log('Web Component toString');
}
}
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
}
private valueChangeCallBack=(eventData)=>{
console.info("webViewContJavaScriptError 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("javaScriptErrorTest").key('webViewContJavaScriptError').onClick(() => {
console.info("key==>" + this.str)
switch (this.str) {
case "emitRegisterJavaScriptProxyInitErr": {
try {
this.controllerTwo.registerJavaScriptProxy(this.testObj, "objName", ["test", "toString"]);;
} catch (error) {
console.error(`emitRegisterJavaScriptProxyInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 650)
Utils.emitEvent(this.errorMsg, 651)
break;
}
case "emitRunJavaScriptCallbackInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.runJavaScript(
'test()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error));
return;
}
if (result) {
this.webResult = result;
console.info(`The test() return value is: ${result}`);
}
});
} catch (error) {
console.error(`emitRunJavaScriptCallbackInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 652)
Utils.emitEvent(this.errorMsg, 653)
break;
}
case "emitRunJavaScriptPromiseInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.runJavaScript('test()')
.then(function (result) {
console.log('result: ' + result);
})
.catch(function (error) {
console.error("error: " + error);
})
} catch (error) {
console.error(`emitRunJavaScriptPromiseInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 654)
Utils.emitEvent(this.errorMsg, 655)
break;
}
case "emitRunJavaScriptExtCallbackInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.runJavaScriptExt(
'test()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error));
return;
}
if (result) {
console.info(`The test() return value is: ${result}`);
}
});
} catch (error) {
console.error(`emitRunJavaScriptExtCallbackInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 656)
Utils.emitEvent(this.errorMsg, 657)
break;
}
case "emitRunJavaScriptExtPromiseInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.runJavaScriptExt('test()')
.then(function (result) {
console.log('result: ' + result);
})
.catch(function (error) {
console.error("error: " + error);
})
} catch (error) {
console.error(`emitRunJavaScriptExtPromiseInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 658)
Utils.emitEvent(this.errorMsg, 659)
break;
}
case "emitDeleteJavaScriptRegisterInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.deleteJavaScriptRegister(this.name);
} catch (error) {
console.error(`emitDeleteJavaScriptRegisterInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 660)
Utils.emitEvent(this.errorMsg, 661)
break;
}
case "emitDeleteJavaScriptRegisterNameErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controller.registerJavaScriptProxy(this.testObj, "objName", ["test", "toString"]);
this.controller.refresh();
this.controller.deleteJavaScriptRegister(this.name);
} catch (error) {
console.error(`emitDeleteJavaScriptRegisterNameErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 662)
Utils.emitEvent(this.errorMsg, 663)
break;
}
}
})
}
Web({src:$rawfile('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)
}
}
}
\ No newline at end of file
/**
* 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 web_webview from '@ohos.web.webview';
// @ts-nocheck
@Entry
@Component
struct webViewContJsMessageExtReturnError {
controller: web_webview.WebviewController = new web_webview.WebviewController();
@State str:string="emitJsMessageExtGetStringError";
@State userAgent:string = "Mozilla/5.0 (Window NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)" +
" CHrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27";
@State javaScriptAccess:boolean=true;
@State fileAccess:boolean=true;
@State domStorageAccess:boolean=false;
@State imageAccess:boolean=true;
@State onlineImageAccess:boolean=true;
@State databaseAccess:boolean=true;
@State zoomAccess:boolean=false;
@State errorCode: string = '0';
@State errorTestCode: number = 0;
@State errorMsg: string = 'failed';
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
}
private valueChangeCallBack=(eventData)=>{
console.info("webViewContJsMessageExtReturnError 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("JsMessageExtErrorTest").key('webViewContJsMessageExtReturnError').onClick(async () => {
console.info("key==>" + this.str)
switch (this.str) {
case "emitJsMessageExtGetStringError": {
this.controller.loadUrl($rawfile('testMessageExt.html'));
await Utils.sleep(3000);
try {
this.controller.runJavaScriptExt(
'testArray()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
try {
let type = result.getType();
console.info('run JavaScript result.getType(): ' + type)
result.getString();
}
catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
this.errorTestCode = resError.code;
this.errorMsg = resError.message;
console.error("emitJsMessageExtGetStringError runJavaScriptExt getString result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 816)
Utils.emitEvent(this.errorMsg, 817)
return;
}
}
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitJsMessageExtGetNumberError": {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.controller.loadUrl($rawfile('testMessageExt.html'));
try {
this.controller.runJavaScriptExt(
'testArrayBuffer()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
try {
let type = result.getType();
console.info('run JavaScript result.getType(): ' + type)
result.getNumber();
}
catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
this.errorTestCode = resError.code;
this.errorMsg = resError.message;
console.error("emitJsMessageExtGetNumberError runJavaScriptExt getNumber result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 818)
Utils.emitEvent(this.errorMsg, 819)
return;
}
}
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitJsMessageExtGetBooleanError": {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.controller.loadUrl($rawfile('testMessageExt.html'));
try {
this.controller.runJavaScriptExt(
'testNumber()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
try {
let type = result.getType();
console.info('run JavaScript result.getType(): ' + type)
result.getBoolean();
}
catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
this.errorTestCode = resError.code;
this.errorMsg = resError.message;
console.error("emitJsMessageExtGetBooleanError runJavaScriptExt getBoolean result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 820)
Utils.emitEvent(this.errorMsg, 821)
return;
}
}
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitJsMessageExtGetArrayBufferError": {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.controller.loadUrl($rawfile('testMessageExt.html'));
try {
this.controller.runJavaScriptExt(
'testBoolean()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
try {
let type = result.getType();
console.info('run JavaScript result.getType(): ' + type)
result.getArrayBuffer();
}
catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
this.errorTestCode = resError.code;
this.errorMsg = resError.message;
console.error("emitJsMessageExtGetArrayBufferError runJavaScriptExt getArrayBuffer result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 822)
Utils.emitEvent(this.errorMsg, 823)
return;
}
}
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitJsMessageExtGetArrayError": {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.controller.loadUrl($rawfile('testMessageExt.html'));
try {
this.controller.runJavaScriptExt(
'testString()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
try {
let type = result.getType();
console.info('run JavaScript result.getType(): ' + type)
result.getArray();
}
catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
this.errorTestCode = resError.code;
this.errorMsg = resError.message;
console.error("emitJsMessageExtGetArrayError runJavaScriptExt getArray result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 824)
Utils.emitEvent(this.errorMsg, 825)
return;
}
}
});
} 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)
.zoomAccess(this.zoomAccess)
.onPageEnd(err => {
try {
this.controller.runJavaScriptExt(
'testArray()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
try {
let type = result.getType();
console.info('run JavaScript result.getType(): ' + type)
result.getString();
}
catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
return;
}
}
});
console.info('url: ', err.url);
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
})
}
}
}
\ No newline at end of file
/**
* 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 web_webview from '@ohos.web.webview';
// @ts-nocheck
@Entry
@Component
struct webViewContMessageError {
controller: web_webview.WebviewController = new web_webview.WebviewController();
controllerTwo: web_webview.WebviewController = new web_webview.WebviewController();
ports: web_webview.WebMessagePort[];
msgPort: web_webview.WebMessagePort[] = null;
@State sendFromEts: string = 'Send this message from ets to HTML';
@State receivedFromHtml: string = 'Display received message send from HTML';
@State str:string="emitPostMessageInitErr";
@State userAgent:string = "Mozilla/5.0 (Window NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)" +
" CHrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27";
@State javaScriptAccess:boolean=true;
@State fileAccess:boolean=true;
@State domStorageAccess:boolean=false;
@State imageAccess:boolean=true;
@State onlineImageAccess:boolean=true;
@State databaseAccess:boolean=true;
@State errorCode: string = '0';
@State errorMsg: string = 'failed';
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
}
private valueChangeCallBack=(eventData)=>{
console.info("webViewContMessageError 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("messageEventErrorTest").key('webViewContMessageError').onClick(() => {
console.info("key==>" + this.str)
switch (this.str) {
case "emitPostMessageInitErr": {
try {
this.ports = this.controller.createWebMessagePorts();
this.controllerTwo.postMessage('__init_port__', [this.ports[0]], '*');
} catch (error) {
console.error(`emitPostMessageInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
this.controller.runJavaScript("test()",(res) => {
Utils.emitEvent(this.errorCode, 600)
Utils.emitEvent(this.errorMsg, 601)
})
break;
}
case "emitPostMessageEventUnPortErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.ports = this.controller.createWebMessagePorts();
this.controller.postMessage('__init_port__', [this.ports[0]], '*');
if (this.ports && this.ports[1]) {
this.ports[1].close();
} else {
console.log("ports is null, Please initialize first");
}
this.ports[1].postMessageEvent("post message from ets to html5");
} catch (error) {
console.error(`emitPostMessageEventUnPortErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
this.controller.runJavaScript("test()",(res) => {
Utils.emitEvent(this.errorCode, 602)
Utils.emitEvent(this.errorMsg, 603)
})
break;
}
}
})
}
Web({src:$rawfile('indexEdit.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
/**
* 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 web_webview from '@ohos.web.webview';
// @ts-nocheck
@Entry
@Component
struct webViewContPageOperationsError {
controller: web_webview.WebviewController = new web_webview.WebviewController();
controllerTwo: web_webview.WebviewController = new web_webview.WebviewController();
@State str:string="emitAccessForwardInitErr";
@State userAgent:string = "Mozilla/5.0 (Window NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)" +
" CHrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27";
@State javaScriptAccess:boolean=true;
@State fileAccess:boolean=true;
@State domStorageAccess:boolean=false;
@State imageAccess:boolean=true;
@State onlineImageAccess:boolean=true;
@State databaseAccess:boolean=true;
@State errorCode: string = '0';
@State errorMsg: string = 'failed';
@State steps: number = 2;
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
}
private valueChangeCallBack=(eventData)=>{
console.info("webViewContPageOperationsError 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("pageOperationsErrorTest").key('webViewContPageOperationsError').onClick(() => {
console.info("key==>" + this.str)
switch (this.str) {
case "emitAccessForwardInitErr": {
try {
this.controllerTwo.accessForward();
} catch (error) {
console.error(`emitAccessForwardInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
Utils.emitEvent(this.errorCode, 630)
Utils.emitEvent(this.errorMsg, 631)
break;
}
case "emitForwardInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.forward();
} catch (error) {
console.error(`emitForwardInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
Utils.emitEvent(this.errorCode, 632)
Utils.emitEvent(this.errorMsg, 633)
break;
}
case "emitAccessBackwardInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.accessBackward();
} catch (error) {
console.error(`emitAccessBackwardInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
Utils.emitEvent(this.errorCode, 634)
Utils.emitEvent(this.errorMsg, 635)
break;
}
case "emitBackwardInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.backward();
} catch (error) {
console.error(`emitBackwardInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
Utils.emitEvent(this.errorCode, 636)
Utils.emitEvent(this.errorMsg, 637)
break;
}
case "emitOnActiveInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.onActive();
} catch (error) {
console.error(`emitOnActiveInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
Utils.emitEvent(this.errorCode, 638)
Utils.emitEvent(this.errorMsg, 639)
break;
}
case "emitOnInactiveInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.onInactive();
} catch (error) {
console.error(`emitOnInactiveInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
Utils.emitEvent(this.errorCode, 640)
Utils.emitEvent(this.errorMsg, 641)
break;
}
case "emitRefreshInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.refresh();
} catch (error) {
console.error(`emitRefreshInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
Utils.emitEvent(this.errorCode, 642)
Utils.emitEvent(this.errorMsg, 643)
break;
}
case "emitAccessStepInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.accessStep(this.steps);
} catch (error) {
console.error(`emitAccessStepInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
Utils.emitEvent(this.errorCode, 644)
Utils.emitEvent(this.errorMsg, 645)
break;
}
case "emitClearHistoryInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.clearHistory();
} catch (error) {
console.error(`emitClearHistoryInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
Utils.emitEvent(this.errorCode, 646)
Utils.emitEvent(this.errorMsg, 647)
break;
}
case "emitGetHitTestInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.getHitTest();
} catch (error) {
console.error(`emitGetHitTestInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code
this.errorMsg = error.message
}
Utils.emitEvent(this.errorCode, 648)
Utils.emitEvent(this.errorMsg, 649)
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
/**
* 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 web_webview from '@ohos.web.webview';
// @ts-nocheck
@Entry
@Component
struct webViewContStoreWebArchiveError {
controller: web_webview.WebviewController = new web_webview.WebviewController();
controllerTwo: web_webview.WebviewController = new web_webview.WebviewController();
@State str:string="emitStoreWebArchiveCallBackInitErr";
@State userAgent:string = "Mozilla/5.0 (Window NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)" +
" CHrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27";
@State javaScriptAccess:boolean=true;
@State fileAccess:boolean=true;
@State domStorageAccess:boolean=false;
@State imageAccess:boolean=true;
@State onlineImageAccess:boolean=true;
@State databaseAccess:boolean=true;
@State errorCode: string = '0';
@State errorTestCode: number = 0;
@State errorMsg: string = 'failed';
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
}
private valueChangeCallBack=(eventData)=>{
console.info("webViewContStoreWebArchiveError 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("storeWebArchiveErrorTest").key('webViewContStoreWebArchiveError').onClick(() => {
console.info("key==>" + this.str)
switch (this.str) {
case "emitStoreWebArchiveCallBackInitErr": {
try {
this.controllerTwo.storeWebArchive("/data/storage/el2/base/", true, (error, filename) => {
if (error) {
console.info(`save web archive error: ` + JSON.stringify(error));
return;
}
if (filename != null) {
console.info(`save web archive success: ${filename}`);
}
});
} catch (error) {
console.error(`emitStoreWebArchiveCallBackInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 700)
Utils.emitEvent(this.errorMsg, 701)
break;
}
case "emitStoreWebArchiveCallBackPathErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controller.storeWebArchive("/ErrorPath/Error/Err/E12345/Error.html", false, (error, filename) => {
if (error) {
console.info(`save web archive error: ` + JSON.stringify(error));
this.errorTestCode = error.code;
this.errorMsg = error.message;
console.error("emitStoreWebArchiveCallBackPathErr storeWebArchive return result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 702)
Utils.emitEvent(this.errorMsg, 703)
return;
}
if (filename != null) {
console.info(`save web archive success: ${filename}`);
}
});
} catch (error) {
console.error(`emitStoreWebArchiveCallBackPathErr ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitStoreWebArchiveCallBackUnAccessErr": {
try {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.controller.storeWebArchive("/proc/sys/net/core/", true, (error, filename) => {
if (error) {
console.info(`save web archive error: ` + JSON.stringify(error));
this.errorTestCode = error.code;
this.errorMsg = error.message;
console.error("emitStoreWebArchiveCallBackUnAccessErr storeWebArchive return result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 704)
Utils.emitEvent(this.errorMsg, 705)
return;
}
if (filename != null) {
console.info(`save web archive success: ${filename}`)
}
});
} catch (error) {
console.error(`emitStoreWebArchiveCallBackUnAccessErr ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitStoreWebArchivePromiseInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.storeWebArchive("/data/storage/el2/base/", true)
.then(filename => {
if (filename != null) {
console.info(`save web archive success: ${filename}`);
}
})
.catch(error => {
console.log('error: ' + JSON.stringify(error));
})
} catch (error) {
console.error(`emitStoreWebArchivePromiseInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 706)
Utils.emitEvent(this.errorMsg, 707)
break;
}
case "emitStoreWebArchivePromisePathErr": {
try {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.controller.storeWebArchive("/ErrorPath/Error/Err/E12345/Error.html", false)
.then(filename => {
if (filename != null) {
console.info(`save web archive success: ${filename}`);
}
})
.catch(error => {
console.log('error: ' + JSON.stringify(error));
this.errorTestCode = error.code;
this.errorMsg = error.message;
console.error("emitStoreWebArchivePromisePathErr storeWebArchive return result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 708)
Utils.emitEvent(this.errorMsg, 709)
})
} catch (error) {
console.error(`emitStoreWebArchivePromisePathErr ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitStoreWebArchivePromiseUnAccessErr": {
try {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.controller.storeWebArchive("/proc/sys/net/core/", true)
.then(filename => {
if (filename != null) {
console.info(`save web archive success: ${filename}`);
}
})
.catch(error => {
console.log('error: ' + JSON.stringify(error));
this.errorTestCode = error.code;
this.errorMsg = error.message;
console.error("emitStoreWebArchivePromiseUnAccessErr storeWebArchive return result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 710)
Utils.emitEvent(this.errorMsg, 711)
})
} catch (error) {
console.error(`emitStoreWebArchivePromiseUnAccessErr ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
}
})
}
Web({src:$rawfile('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)
}
}
}
\ No newline at end of file
/**
* 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 web_webview from '@ohos.web.webview';
// @ts-nocheck
@Entry
@Component
struct webViewContWebMessageExtReturnError {
controller: web_webview.WebviewController = new web_webview.WebviewController();
ports: web_webview.WebMessagePort[] = null;
nativePort: web_webview.WebMessagePort = null;
@State str:string="emitWebMessageExtGetStringError";
@State userAgent:string = "Mozilla/5.0 (Window NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)" +
" CHrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27";
@State javaScriptAccess:boolean=true;
@State fileAccess:boolean=true;
@State domStorageAccess:boolean=false;
@State imageAccess:boolean=true;
@State onlineImageAccess:boolean=true;
@State databaseAccess:boolean=true;
@State zoomAccess:boolean=false;
@State errorCode: string = '0';
@State errorTestCode: number = 0;
@State errorMsg: string = 'failed';
@State webResult: string = ''
message: web_webview.WebMessageExt = new web_webview.WebMessageExt();
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
}
private valueChangeCallBack=(eventData)=>{
console.info("webViewContWebMessageExtReturnError 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("WebMessageExtErrorTest").key('webViewContWebMessageExtReturnError').onClick(() => {
console.info("key==>" + this.str)
switch (this.str) {
case "emitWebMessageExtGetStringError": {
this.ports = this.controller.createWebMessagePorts(true);
this.controller.postMessage("init_web_messageport", [this.ports[1]], "*");
this.nativePort = this.ports[0];
this.controller.runJavaScript(
'postErrorToApp()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
this.webResult = result
console.info(`The postErrorToApp() return value is: ${result}`)
}
});
this.nativePort.onMessageEventExt((result) => {
console.log("In eTS side got message");
try {
var type = result.getType();
console.log("In eTS side getType:" + type);
result.getString()
} catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
this.errorTestCode = resError.code;
this.errorMsg = resError.message;
console.error("emitWebMessageExtGetStringError onMessageEventExt getString result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 826)
Utils.emitEvent(this.errorMsg, 827)
}
});
break;
}
case "emitWebMessageExtGetNumberError": {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.ports = this.controller.createWebMessagePorts(true);
this.controller.postMessage("init_web_messageport", [this.ports[1]], "*");
this.nativePort = this.ports[0];
this.controller.runJavaScript(
'postArrayToApp()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
this.webResult = result
console.info(`The postArrayToApp() return value is: ${result}`)
}
});
this.nativePort.onMessageEventExt((result) => {
console.log("In eTS side got message");
try {
var type = result.getType();
console.log("In eTS side getType:" + type);
result.getNumber()
} catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
this.errorTestCode = resError.code;
this.errorMsg = resError.message;
console.error("emitWebMessageExtGetNumberError onMessageEventExt getNumber result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 828)
Utils.emitEvent(this.errorMsg, 829)
}
});
break;
}
case "emitWebMessageExtGetBooleanError": {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.ports = this.controller.createWebMessagePorts(true);
this.controller.postMessage("init_web_messageport", [this.ports[1]], "*");
this.nativePort = this.ports[0];
this.controller.runJavaScript(
'postArrayBufferToApp()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
this.webResult = result
console.info(`The postArrayBufferToApp() return value is: ${result}`)
}
});
this.nativePort.onMessageEventExt((result) => {
console.log("In eTS side got message");
try {
var type = result.getType();
console.log("In eTS side getType:" + type);
result.getBoolean()
} catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
this.errorTestCode = resError.code;
this.errorMsg = resError.message;
console.error("emitWebMessageExtGetBooleanError onMessageEventExt getBoolean result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 830)
Utils.emitEvent(this.errorMsg, 831)
}
});
break;
}
case "emitWebMessageExtGetArrayBufferError": {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.ports = this.controller.createWebMessagePorts(true);
this.controller.postMessage("init_web_messageport", [this.ports[1]], "*");
this.nativePort = this.ports[0];
this.controller.runJavaScript(
'postBooleanToApp()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
this.webResult = result
console.info(`The postBooleanToApp() return value is: ${result}`)
}
});
this.nativePort.onMessageEventExt((result) => {
console.log("In eTS side got message");
try {
var type = result.getType();
console.log("In eTS side getType:" + type);
result.getArrayBuffer()
} catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
this.errorTestCode = resError.code;
this.errorMsg = resError.message;
console.error("emitWebMessageExtGetArrayBufferError onMessageEventExt getArrayBuffer result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 832)
Utils.emitEvent(this.errorMsg, 833)
}
});
break;
}
case "emitWebMessageExtGetArrayError": {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.ports = this.controller.createWebMessagePorts(true);
this.controller.postMessage("init_web_messageport", [this.ports[1]], "*");
this.nativePort = this.ports[0];
this.controller.runJavaScript(
'postNumberToApp()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
this.webResult = result
console.info(`The postNumberToApp() return value is: ${result}`)
}
});
this.nativePort.onMessageEventExt((result) => {
console.log("In eTS side got message");
try {
var type = result.getType();
console.log("In eTS side getType:" + type);
result.getArray()
} catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
this.errorTestCode = resError.code;
this.errorMsg = resError.message;
console.error("emitWebMessageExtGetArrayError onMessageEventExt getArray result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 834)
Utils.emitEvent(this.errorMsg, 835)
}
});
break;
}
case "emitWebMessageExtGetErrorError": {
this.errorTestCode = 0;
this.errorMsg = 'failed';
this.ports = this.controller.createWebMessagePorts(true);
this.controller.postMessage("init_web_messageport", [this.ports[1]], "*");
this.nativePort = this.ports[0];
this.controller.runJavaScript(
'postStringToApp()',
(error, result) => {
if (error) {
console.info(`run JavaScript error: ` + JSON.stringify(error))
return;
}
if (result) {
this.webResult = result
console.info(`The postStringToApp() return value is: ${result}`)
}
});
this.nativePort.onMessageEventExt((result) => {
console.log("In eTS side got message");
try {
var type = result.getType();
console.log("In eTS side getType:" + type);
result.getError()
} catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
this.errorTestCode = resError.code;
this.errorMsg = resError.message;
console.error("emitWebMessageExtGetErrorError onMessageEventExt getError result is :" + this.errorTestCode + this.errorMsg);
Utils.emitEvent(this.errorTestCode, 836)
Utils.emitEvent(this.errorMsg, 837)
}
});
break;
}
}
})
}
Web({src:$rawfile('indexEdit.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)
.zoomAccess(this.zoomAccess)
.onPageEnd(err => {
console.log("In eTS side message onPageEnd init mesaage channel");
console.log("1.create message port")
this.ports = this.controller.createWebMessagePorts(true);
console.log("2.send port1 to HTML5")
this.controller.postMessage("init_web_messageport", [this.ports[1]], "*");
console.log("3.save port0 to current path")
this.nativePort = this.ports[0];
console.log("4.set callback function")
this.nativePort.onMessageEventExt((result) => {
console.log("In eTS side got message");
try {
var type = result.getType();
console.log("In eTS side getType:" + type);
} catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
}
});
console.info('url: ', err.url);
})
}
}
}
\ No newline at end of file
/**
* 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 web_webview from '@ohos.web.webview';
// @ts-nocheck
@Entry
@Component
struct webViewContZoomAndOthersError {
controller: web_webview.WebviewController = new web_webview.WebviewController();
controllerTwo: web_webview.WebviewController = new web_webview.WebviewController();
@State str:string="emitZoomInitErr";
@State userAgent:string = "Mozilla/5.0 (Window NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)" +
" CHrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.27";
@State javaScriptAccess:boolean=true;
@State fileAccess:boolean=true;
@State domStorageAccess:boolean=false;
@State imageAccess:boolean=true;
@State onlineImageAccess:boolean=true;
@State databaseAccess:boolean=true;
@State zoomAccess:boolean=false;
@State errorCode: string = '0';
@State errorMsg: string = 'failed';
@State factor: number = 1;
@State searchString: string = "test";
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
}
private valueChangeCallBack=(eventData)=>{
console.info("webViewContZoomAndOthersError 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("zoomAndOthersErrorTest").key('webViewContZoomAndOthersError').onClick(() => {
console.info("key==>" + this.str)
switch (this.str) {
case "emitZoomInitErr": {
try {
this.controllerTwo.zoom(this.factor);
} catch (error) {
console.error(`emitZoomInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 664)
Utils.emitEvent(this.errorMsg, 665)
break;
}
case "emitZoomEnableErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controller.zoom(this.factor);
} catch (error) {
console.error(`emitZoomEnableErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 666)
Utils.emitEvent(this.errorMsg, 667)
break;
}
case "emitSearchAllAsyncInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.searchAllAsync(this.searchString);
} catch (error) {
console.error(`emitSearchAllAsyncInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 668)
Utils.emitEvent(this.errorMsg, 669)
break;
}
case "emitClearMatchesInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.clearMatches();
} catch (error) {
console.error(`emitClearMatchesInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 670)
Utils.emitEvent(this.errorMsg, 671)
break;
}
case "emitSearchNextInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.searchNext(true);
} catch (error) {
console.error(`emitSearchNextInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 672)
Utils.emitEvent(this.errorMsg, 673)
break;
}
case "emitClearSslCacheInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.clearSslCache();
} catch (error) {
console.error(`emitClearSslCacheInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 674)
Utils.emitEvent(this.errorMsg, 675)
break;
}
case "emitClearClientAuthenticationCacheInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.clearClientAuthenticationCache();
} catch (error) {
console.error(`emitClearClientAuthenticationCacheInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 676)
Utils.emitEvent(this.errorMsg, 677)
break;
}
case "emitCreateWebMessagePortsInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.createWebMessagePorts();
} catch (error) {
console.error(`emitCreateWebMessagePortsInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 678)
Utils.emitEvent(this.errorMsg, 679)
break;
}
case "emitRequestFocusInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.requestFocus();
} catch (error) {
console.error(`emitRequestFocusInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 680)
Utils.emitEvent(this.errorMsg, 681)
break;
}
case "emitZoomInInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.zoomIn();
} catch (error) {
console.error(`emitZoomInInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 682)
Utils.emitEvent(this.errorMsg, 683)
break;
}
case "emitZoomInEnableErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controller.zoomIn();
} catch (error) {
console.error(`emitZoomInEnableErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 684)
Utils.emitEvent(this.errorMsg, 685)
break;
}
case "emitZoomOutInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.zoomOut();
} catch (error) {
console.error(`emitZoomOutInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 686)
Utils.emitEvent(this.errorMsg, 687)
break;
}
case "emitZoomOutEnableErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controller.zoomOut();
} catch (error) {
console.error(`emitZoomOutEnableErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 688)
Utils.emitEvent(this.errorMsg, 689)
break;
}
case "emitGetHitTestValueInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.getHitTestValue();
} catch (error) {
console.error(`emitGetHitTestValueInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 690)
Utils.emitEvent(this.errorMsg, 691)
break;
}
case "emitGetWebIdInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.getWebId();
} catch (error) {
console.error(`emitGetWebIdInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 692)
Utils.emitEvent(this.errorMsg, 693)
break;
}
case "emitGetUserAgentInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.getUserAgent();
} catch (error) {
console.error(`emitGetUserAgentInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 694)
Utils.emitEvent(this.errorMsg, 695)
break;
}
case "emitGetTitleInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.getTitle();
} catch (error) {
console.error(`emitGetTitleInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 696)
Utils.emitEvent(this.errorMsg, 697)
break;
}
case "emitGetPageHeightInitErr": {
try {
this.errorCode = '0';
this.errorMsg = 'failed';
this.controllerTwo.getPageHeight();
} catch (error) {
console.error(`emitGetPageHeightInitErr ErrorCode: ${error.code}, Message: ${error.message}`);
this.errorCode = error.code;
this.errorMsg = error.message;
}
Utils.emitEvent(this.errorCode, 698)
Utils.emitEvent(this.errorMsg, 699)
break;
}
}
})
}
Web({src:$rawfile('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)
.zoomAccess(this.zoomAccess)
}
}
}
\ No newline at end of file
/*
* 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
/**
* 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 webViewContMessageError from './webViewContMessageError.test'
import webViewContPageOperationsError from './webViewContPageOperationsError.test'
import webViewContJavaScriptError from './webViewContJavaScriptError.test'
import webViewContZoomAndOthersError from './webViewContZoomAndOthersError.test'
import webViewContStoreWebArchiveError from './webViewContStoreWebArchiveError.test'
import webViewContGetUrlAndOthersError from './webViewContGetUrlAndOthersError.test'
import webViewContCookieToGeoLocationError from './webViewContCookieToGeoLocationError.test'
import webViewContJsMessageExtReturnError from './webViewContJsMessageExtReturnError.test'
import webViewContWebMessageExtReturnError from './webViewContWebMessageExtReturnError.test'
export default function testsuite() {
webViewContMessageError()
webViewContPageOperationsError()
webViewContJavaScriptError()
webViewContZoomAndOthersError()
webViewContStoreWebArchiveError()
webViewContGetUrlAndOthersError()
webViewContCookieToGeoLocationError()
webViewContJsMessageExtReturnError()
webViewContWebMessageExtReturnError()
}
\ No newline at end of file
/*
* 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
/**
* 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';
let emitKey = "emitGetUrlInitErr";
export default function webViewContGetUrlAndOthersError() {
describe('ActsAceWebDevWebViewContGetUrlAndOthersErrorTest', function () {
beforeAll(async function (done) {
let options = {
uri: 'MainAbility/pages/webViewContGetUrlAndOthersError',
}
try {
router.clear();
let pages = router.getState();
console.info("get webViewContGetUrlAndOthersError state success " + JSON.stringify(pages));
if (!("webViewContGetUrlAndOthersError" == pages.name)) {
console.info("get webViewContGetUrlAndOthersError state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push webViewContGetUrlAndOthersError page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webViewContGetUrlAndOthersError page error: " + err);
}
done()
});
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("webViewContGetUrlAndOthersError beforeEach start");
done();
})
afterEach(async function (done) {
console.info("webViewContGetUrlAndOthersError 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_WEBVIEWERROR_5700
*tc.name testGetUrlInitErr
*tc.desc test interface of getUrl with not been associated with specific Web Components
*/
it('testGetUrlInitErr',0,async function(done){
emitKey="emitStopInitErr";
Utils.registerEvent("testGetUrlInitErr","17100001",712,done);
Utils.registerEvent("testGetUrlInitErr","Init error. The WebviewController must be associated with a Web component.",713,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_5800
*tc.name testStopInitErr
*tc.desc test interface of stop with not been associated with specific Web Components
*/
it('testStopInitErr',0,async function(done){
emitKey="emitBackOrForwardInitErr";
Utils.registerEvent("testStopInitErr","17100001",714,done);
Utils.registerEvent("testStopInitErr","Init error. The WebviewController must be associated with a Web component.",715,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_5900
*tc.name testBackOrForwardInitErr
*tc.desc test interface of backOrForward with not been associated with specific Web Components
*/
it('testBackOrForwardInitErr',0,async function(done){
emitKey="emitScrollToInitErr";
Utils.registerEvent("testBackOrForwardInitErr","17100001",716,done);
Utils.registerEvent("testBackOrForwardInitErr","Init error. The WebviewController must be associated with a Web component.",717,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_6000
*tc.name testScrollToInitErr
*tc.desc test interface of scrollTo with not been associated with specific Web Components
*/
it('testScrollToInitErr',0,async function(done){
emitKey="emitScrollByInitErr";
Utils.registerEvent("testScrollToInitErr","17100001",718,done);
Utils.registerEvent("testScrollToInitErr","Init error. The WebviewController must be associated with a Web component.",719,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_6100
*tc.name testScrollByInitErr
*tc.desc test interface of scrollBy with not been associated with specific Web Components
*/
it('testScrollByInitErr',0,async function(done){
emitKey="emitSlideScrollInitErr";
Utils.registerEvent("testScrollByInitErr","17100001",720,done);
Utils.registerEvent("testScrollByInitErr","Init error. The WebviewController must be associated with a Web component.",721,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_6200
*tc.name testSlideScrollInitErr
*tc.desc test interface of slideScroll with not been associated with specific Web Components
*/
it('testSlideScrollInitErr',0,async function(done){
emitKey="emitGetOriginalUrlInitErr";
Utils.registerEvent("testSlideScrollInitErr","17100001",722,done);
Utils.registerEvent("testSlideScrollInitErr","Init error. The WebviewController must be associated with a Web component.",723,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_6300
*tc.name testGetOriginalUrlInitErr
*tc.desc test interface of getOriginalUrl with not been associated with specific Web Components
*/
it('testGetOriginalUrlInitErr',0,async function(done){
emitKey="emitGetFaviconInitErr";
Utils.registerEvent("testGetOriginalUrlInitErr","17100001",724,done);
Utils.registerEvent("testGetOriginalUrlInitErr","Init error. The WebviewController must be associated with a Web component.",725,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_6400
*tc.name testGetFaviconInitErr
*tc.desc test interface of getFavicon with not been associated with specific Web Components
*/
it('testGetFaviconInitErr',0,async function(done){
emitKey="emitSetNetworkAvailableInitErr";
Utils.registerEvent("testGetFaviconInitErr","17100001",726,done);
Utils.registerEvent("testGetFaviconInitErr","Init error. The WebviewController must be associated with a Web component.",727,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_6500
*tc.name testSetNetworkAvailableInitErr
*tc.desc test interface of setNetworkAvailable with not been associated with specific Web Components
*/
it('testSetNetworkAvailableInitErr',0,async function(done){
emitKey="emitHasImageCallBackInitErr";
Utils.registerEvent("testSetNetworkAvailableInitErr","17100001",728,done);
Utils.registerEvent("testSetNetworkAvailableInitErr","Init error. The WebviewController must be associated with a Web component.",729,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_6600
*tc.name testHasImageCallBackInitErr
*tc.desc test interface of hasImage (callback) with not been associated with specific Web Components
*/
it('testHasImageCallBackInitErr',0,async function(done){
emitKey="emitHasImagePromiseInitErr";
Utils.registerEvent("testHasImageCallBackInitErr","17100001",730,done);
Utils.registerEvent("testHasImageCallBackInitErr","Init error. The WebviewController must be associated with a Web component.",731,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_6700
*tc.name testHasImagePromiseInitErr
*tc.desc test interface of hasImage (promise) with not been associated with specific Web Components
*/
it('testHasImagePromiseInitErr',0,async function(done){
emitKey="emitRemoveCacheInitErr";
Utils.registerEvent("testHasImagePromiseInitErr","17100001",732,done);
Utils.registerEvent("testHasImagePromiseInitErr","Init error. The WebviewController must be associated with a Web component.",733,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_6800
*tc.name testRemoveCacheInitErr
*tc.desc test interface of removeCache with not been associated with specific Web Components
*/
it('testRemoveCacheInitErr',0,async function(done){
emitKey="emitPageUpInitErr";
Utils.registerEvent("testRemoveCacheInitErr","17100001",734,done);
Utils.registerEvent("testRemoveCacheInitErr","Init error. The WebviewController must be associated with a Web component.",735,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_6900
*tc.name testPageUpInitErr
*tc.desc test interface of pageUp with not been associated with specific Web Components
*/
it('testPageUpInitErr',0,async function(done){
emitKey="emitPageDownInitErr";
Utils.registerEvent("testPageUpInitErr","17100001",736,done);
Utils.registerEvent("testPageUpInitErr","Init error. The WebviewController must be associated with a Web component.",737,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_7000
*tc.name testPageDownInitErr
*tc.desc test interface of pageDown with not been associated with specific Web Components
*/
it('testPageDownInitErr',0,async function(done){
emitKey="emitGetBackForwardEntriesInitErr";
Utils.registerEvent("testPageDownInitErr","17100001",738,done);
Utils.registerEvent("testPageDownInitErr","Init error. The WebviewController must be associated with a Web component.",739,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_7100
*tc.name testGetBackForwardEntriesInitErr
*tc.desc test interface of getBackForwardEntries with not been associated with specific Web Components
*/
it('testGetBackForwardEntriesInitErr',0,async function(done){
emitKey="emitSerializeWebStateInitErr";
Utils.registerEvent("testGetBackForwardEntriesInitErr","17100001",740,done);
Utils.registerEvent("testGetBackForwardEntriesInitErr","Init error. The WebviewController must be associated with a Web component.",741,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_7200
*tc.name testSerializeWebStateInitErr
*tc.desc test interface of serializeWebState with not been associated with specific Web Components
*/
it('testSerializeWebStateInitErr',0,async function(done){
emitKey="emitRestoreWebStateInitErr";
Utils.registerEvent("testSerializeWebStateInitErr","17100001",742,done);
Utils.registerEvent("testSerializeWebStateInitErr","Init error. The WebviewController must be associated with a Web component.",743,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_7300
*tc.name testRestoreWebStateInitErr
*tc.desc test interface of restoreWebState with not been associated with specific Web Components
*/
it('testRestoreWebStateInitErr',0,async function(done){
emitKey="emitGetCertificatePromiseInitErr";
Utils.registerEvent("testRestoreWebStateInitErr","17100001",744,done);
Utils.registerEvent("testRestoreWebStateInitErr","Init error. The WebviewController must be associated with a Web component.",745,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_7400
*tc.name testGetCertificatePromiseInitErr
*tc.desc test interface of getCertificate (promise) with not been associated with specific Web Components
*/
it('testGetCertificatePromiseInitErr',0,async function(done){
emitKey="emitGetCertificateCallbackInitErr";
Utils.registerEvent("testGetCertificatePromiseInitErr","17100001",746,done);
Utils.registerEvent("testGetCertificatePromiseInitErr","Init error. The WebviewController must be associated with a Web component.",747,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_7500
*tc.name testGetCertificateCallbackInitErr
*tc.desc test interface of getCertificate (callback) with not been associated with specific Web Components
*/
it('testGetCertificateCallbackInitErr',0,async function(done){
emitKey="emitSetAudioMutedInitErr";
Utils.registerEvent("testGetCertificateCallbackInitErr","17100001",748,done);
Utils.registerEvent("testGetCertificateCallbackInitErr","Init error. The WebviewController must be associated with a Web component.",749,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_7600
*tc.name testSetAudioMutedInitErr
*tc.desc test interface of setAudioMuted with not been associated with specific Web Components
*/
it('testSetAudioMutedInitErr',0,async function(done){
emitKey="emitSetAudioMutedInitErr";
Utils.registerEvent("testSetAudioMutedInitErr","17100001",750,done);
Utils.registerEvent("testSetAudioMutedInitErr","Init error. The WebviewController must be associated with a Web component.",751,done);
sendEventByKey('webViewContGetUrlAndOthersError',10,'');
})
})
}
\ No newline at end of file
/**
* 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';
let emitKey = "emitRegisterJavaScriptProxyInitErr";
export default function webViewContJavaScriptError() {
describe('ActsAceWebDevWebViewContJavaScriptErrorTest', function () {
beforeAll(async function (done) {
let options = {
uri: 'MainAbility/pages/webViewContJavaScriptError',
}
try {
router.clear();
let pages = router.getState();
console.info("get webViewContJavaScriptError state success " + JSON.stringify(pages));
if (!("webViewContJavaScriptError" == pages.name)) {
console.info("get webViewContJavaScriptError state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push webViewContJavaScriptError page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webViewContJavaScriptError page error: " + err);
}
done()
});
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("webViewContJavaScriptError beforeEach start");
done();
})
afterEach(async function (done) {
console.info("webViewContJavaScriptError 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_WEBVIEWERROR_2600
*tc.name testRegisterJavaScriptProxyInitErr
*tc.desc test interface of registerJavaScriptProxy with not been associated with specific Web Components
*/
it('testRegisterJavaScriptProxyInitErr',0,async function(done){
emitKey="emitRunJavaScriptCallbackInitErr";
Utils.registerEvent("testRegisterJavaScriptProxyInitErr","17100001",650,done);
Utils.registerEvent("testRegisterJavaScriptProxyInitErr","Init error. The WebviewController must be associated with a Web component.",651,done);
sendEventByKey('webViewContJavaScriptError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_2700
*tc.name testRunJavaScriptCallbackInitErr
*tc.desc test interface of runJavaScript (callback) with not been associated with specific Web Components
*/
it('testRunJavaScriptCallbackInitErr',0,async function(done){
emitKey="emitRunJavaScriptPromiseInitErr";
Utils.registerEvent("testRunJavaScriptCallbackInitErr","17100001",652,done);
Utils.registerEvent("testRunJavaScriptCallbackInitErr","Init error. The WebviewController must be associated with a Web component.",653,done);
sendEventByKey('webViewContJavaScriptError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_2800
*tc.name testRunJavaScriptPromiseInitErr
*tc.desc test interface of runJavaScript (promise) with not been associated with specific Web Components
*/
it('testRunJavaScriptPromiseInitErr',0,async function(done){
emitKey="emitRunJavaScriptExtCallbackInitErr";
Utils.registerEvent("testRunJavaScriptPromiseInitErr","17100001",654,done);
Utils.registerEvent("testRunJavaScriptPromiseInitErr","Init error. The WebviewController must be associated with a Web component.",655,done);
sendEventByKey('webViewContJavaScriptError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_2900
*tc.name testRunJavaScriptExtCallbackInitErr
*tc.desc test interface of runJavaScriptExt (callback) with not been associated with specific Web Components
*/
it('testRunJavaScriptExtCallbackInitErr',0,async function(done){
emitKey="emitRunJavaScriptExtPromiseInitErr";
Utils.registerEvent("testRunJavaScriptExtCallbackInitErr","17100001",656,done);
Utils.registerEvent("testRunJavaScriptExtCallbackInitErr","Init error. The WebviewController must be associated with a Web component.",657,done);
sendEventByKey('webViewContJavaScriptError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_3000
*tc.name testRunJavaScriptExtPromiseInitErr
*tc.desc test interface of runJavaScriptExt (promise) with not been associated with specific Web Components
*/
it('testRunJavaScriptExtPromiseInitErr',0,async function(done){
emitKey="emitDeleteJavaScriptRegisterInitErr";
Utils.registerEvent("testRunJavaScriptExtPromiseInitErr","17100001",658,done);
Utils.registerEvent("testRunJavaScriptExtPromiseInitErr","Init error. The WebviewController must be associated with a Web component.",659,done);
sendEventByKey('webViewContJavaScriptError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_3100
*tc.name testDeleteJavaScriptRegisterInitErr
*tc.desc test interface of deleteJavaScriptRegister with not been associated with specific Web Components
*/
it('testDeleteJavaScriptRegisterInitErr',0,async function(done){
emitKey="emitDeleteJavaScriptRegisterNameErr";
Utils.registerEvent("testDeleteJavaScriptRegisterInitErr","17100001",660,done);
Utils.registerEvent("testDeleteJavaScriptRegisterInitErr","Init error. The WebviewController must be associated with a Web component.",661,done);
sendEventByKey('webViewContJavaScriptError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_3200
*tc.name testDeleteJavaScriptRegisterNameErr
*tc.desc test interface of deleteJavaScriptRegister with not been registered name
*/
it('testDeleteJavaScriptRegisterNameErr',0,async function(done){
emitKey="emitDeleteJavaScriptRegisterNameErr";
Utils.registerEvent("testDeleteJavaScriptRegisterNameErr","17100008",662,done);
Utils.registerEvent("testDeleteJavaScriptRegisterNameErr","Cannot delete JavaScriptProxy.",663,done);
sendEventByKey('webViewContJavaScriptError',10,'');
})
})
}
\ No newline at end of file
/**
* 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';
let emitKey = "emitJsMessageExtGetStringError";
export default function webViewContJsMessageExtReturnError() {
describe('ActsAceWebDevWebViewContJsMessageExtReturnErrorTest', function () {
beforeAll(async function (done) {
let options = {
uri: 'MainAbility/pages/webViewContJsMessageExtReturnError',
}
try {
router.clear();
let pages = router.getState();
console.info("get webViewContJsMessageExtReturnError state success " + JSON.stringify(pages));
if (!("webViewContJsMessageExtReturnError" == pages.name)) {
console.info("get webViewContJsMessageExtReturnError state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push webViewContJsMessageExtReturnError page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webViewContJsMessageExtReturnError page error: " + err);
}
done()
});
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("webViewContJsMessageExtReturnError beforeEach start");
done();
})
afterEach(async function (done) {
console.info("webViewContJsMessageExtReturnError 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_WEBVIEWERRORHUNDRED_1000
*tc.name testJsMessageExtGetStringError
*tc.desc test interface of JsMessageExt getString with unmatched type
*/
it('testJsMessageExtGetStringError',0,async function(done){
emitKey="emitJsMessageExtGetNumberError";
Utils.registerEvent("testJsMessageExtGetStringError","17100014",816,done);
Utils.registerEvent("testJsMessageExtGetStringError","The type does not match with the value of the result.",817,done);
sendEventByKey('webViewContJsMessageExtReturnError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERRORHUNDRED_1100
*tc.name testJsMessageExtGetNumberError
*tc.desc test interface of JsMessageExt getNumber with unmatched type
*/
it('testJsMessageExtGetNumberError',0,async function(done){
emitKey="emitJsMessageExtGetBooleanError";
Utils.registerEvent("testJsMessageExtGetNumberError","17100014",818,done);
Utils.registerEvent("testJsMessageExtGetNumberError","The type does not match with the value of the result.",819,done);
sendEventByKey('webViewContJsMessageExtReturnError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERRORHUNDRED_1200
*tc.name testJsMessageExtGetBooleanError
*tc.desc test interface of JsMessageExt getBoolean with unmatched type
*/
it('testJsMessageExtGetBooleanError',0,async function(done){
emitKey="emitJsMessageExtGetArrayBufferError";
Utils.registerEvent("testJsMessageExtGetBooleanError","17100014",820,done);
Utils.registerEvent("testJsMessageExtGetBooleanError","The type does not match with the value of the result.",821,done);
sendEventByKey('webViewContJsMessageExtReturnError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERRORHUNDRED_1300
*tc.name testJsMessageExtGetArrayBufferError
*tc.desc test interface of JsMessageExt getArrayBuffer with unmatched type
*/
it('testJsMessageExtGetArrayBufferError',0,async function(done){
emitKey="emitJsMessageExtGetArrayError";
Utils.registerEvent("testJsMessageExtGetArrayBufferError","17100014",822,done);
Utils.registerEvent("testJsMessageExtGetArrayBufferError","The type does not match with the value of the result.",823,done);
sendEventByKey('webViewContJsMessageExtReturnError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERRORHUNDRED_1400
*tc.name testJsMessageExtGetArrayError
*tc.desc test interface of JsMessageExt getArray with unmatched type
*/
it('testJsMessageExtGetArrayError',0,async function(done){
emitKey="emitJsMessageExtGetArrayError";
Utils.registerEvent("testJsMessageExtGetArrayError","17100014",824,done);
Utils.registerEvent("testJsMessageExtGetArrayError","The type does not match with the value of the result.",825,done);
sendEventByKey('webViewContJsMessageExtReturnError',10,'');
})
})
}
\ No newline at end of file
/**
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeEach, afterEach, it, expect } from "@ohos/hypium";
import events_emitter from '@ohos.events.emitter';
import Utils from './Utils.ets';
let emitKey = "emitPostMessageInitErr";
export default function webViewContMessageError() {
describe('ActsAceWebDevWebViewContMessageErrorTest', function () {
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("webViewContMessageError beforeEach start");
done();
})
afterEach(async function (done) {
console.info("webViewContMessageError 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_WEBVIEWERROR_0100
*tc.name testPostMessageInitErr
*tc.desc test interface of postMessage with not been associated with specific Web Components
*/
it('testPostMessageInitErr',0,async function(done){
emitKey="emitPostMessageEventUnPortErr";
Utils.registerEvent("testPostMessageInitErr","17100001",600,done);
Utils.registerEvent("testPostMessageInitErr","Init error. The WebviewController must be associated with a Web component",601,done);
sendEventByKey('webViewContMessageError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_0200
*tc.name testPostMessageEventPortClose
*tc.desc test interface of postMessageEvent with WebMessagePort been closed by ets
*/
it('testPostMessageEventPortClose',0,async function(done){
emitKey="emitPostMessageEventUnPortErr";
Utils.registerEvent("testPostMessageEventPortClose","17100010",602,done);
Utils.registerEvent("testPostMessageEventPortClose","Can not post message using this port.",603,done);
sendEventByKey('webViewContMessageError',10,'');
})
})
}
\ No newline at end of file
/**
* 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';
let emitKey = "emitAccessForwardInitErr";
export default function webViewContPageOperationsError() {
describe('ActsAceWebDevWebViewContPageOperationsErrorTest', function () {
beforeAll(async function (done) {
let options = {
uri: 'MainAbility/pages/webViewContPageOperationsError',
}
try {
router.clear();
let pages = router.getState();
console.info("get webViewContPageOperationsError state success " + JSON.stringify(pages));
if (!("webViewContPageOperationsError" == pages.name)) {
console.info("get webViewContPageOperationsError state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push webViewContPageOperationsError page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webViewContPageOperationsError page error: " + err);
}
done()
});
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("webViewContPageOperationsError beforeEach start");
done();
})
afterEach(async function (done) {
console.info("webViewContPageOperationsError 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_WEBVIEWERROR_1600
*tc.name testAccessForwardInitErr
*tc.desc test interface of accessForward with not been associated with specific Web Components
*/
it('testAccessForwardInitErr',0,async function(done){
emitKey="emitForwardInitErr";
Utils.registerEvent("testAccessForwardInitErr","17100001",630,done);
Utils.registerEvent("testAccessForwardInitErr","Init error. The WebviewController must be associated with a Web component.",631,done);
sendEventByKey('webViewContPageOperationsError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_1700
*tc.name testForwardInitErr
*tc.desc test interface of forward with not been associated with specific Web Components
*/
it('testForwardInitErr',0,async function(done){
emitKey="emitAccessBackwardInitErr";
Utils.registerEvent("testForwardInitErr","17100001",632,done);
Utils.registerEvent("testForwardInitErr","Init error. The WebviewController must be associated with a Web component.",633,done);
sendEventByKey('webViewContPageOperationsError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_1800
*tc.name testAccessBackwardInitErr
*tc.desc test interface of accessBackward with not been associated with specific Web Components
*/
it('testAccessBackwardInitErr',0,async function(done){
emitKey="emitBackwardInitErr";
Utils.registerEvent("testAccessBackwardInitErr","17100001",634,done);
Utils.registerEvent("testAccessBackwardInitErr","Init error. The WebviewController must be associated with a Web component.",635,done);
sendEventByKey('webViewContPageOperationsError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_1900
*tc.name testBackwardInitErr
*tc.desc test interface of backward with not been associated with specific Web Components
*/
it('testBackwardInitErr',0,async function(done){
emitKey="emitOnActiveInitErr";
Utils.registerEvent("testBackwardInitErr","17100001",636,done);
Utils.registerEvent("testBackwardInitErr","Init error. The WebviewController must be associated with a Web component.",637,done);
sendEventByKey('webViewContPageOperationsError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_2000
*tc.name testOnActiveInitErr
*tc.desc test interface of onActive with not been associated with specific Web Components
*/
it('testOnActiveInitErr',0,async function(done){
emitKey="emitOnInactiveInitErr";
Utils.registerEvent("testOnActiveInitErr","17100001",638,done);
Utils.registerEvent("testOnActiveInitErr","Init error. The WebviewController must be associated with a Web component.",639,done);
sendEventByKey('webViewContPageOperationsError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_2100
*tc.name testOnInactiveInitErr
*tc.desc test interface of onInactive with not been associated with specific Web Components
*/
it('testOnInactiveInitErr',0,async function(done){
emitKey="emitRefreshInitErr";
Utils.registerEvent("testOnInactiveInitErr","17100001",640,done);
Utils.registerEvent("testOnInactiveInitErr","Init error. The WebviewController must be associated with a Web component.",641,done);
sendEventByKey('webViewContPageOperationsError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_2200
*tc.name testRefreshInitErr
*tc.desc test interface of refresh with not been associated with specific Web Components
*/
it('testRefreshInitErr',0,async function(done){
emitKey="emitAccessStepInitErr";
Utils.registerEvent("testRefreshInitErr","17100001",642,done);
Utils.registerEvent("testRefreshInitErr","Init error. The WebviewController must be associated with a Web component.",643,done);
sendEventByKey('webViewContPageOperationsError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_2300
*tc.name testAccessStepInitErr
*tc.desc test interface of accessStep with not been associated with specific Web Components
*/
it('testAccessStepInitErr',0,async function(done){
emitKey="emitClearHistoryInitErr";
Utils.registerEvent("testAccessStepInitErr","17100001",644,done);
Utils.registerEvent("testAccessStepInitErr","Init error. The WebviewController must be associated with a Web component.",645,done);
sendEventByKey('webViewContPageOperationsError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_2400
*tc.name testClearHistoryInitErr
*tc.desc test interface of clearHistory with not been associated with specific Web Components
*/
it('testClearHistoryInitErr',0,async function(done){
emitKey="emitGetHitTestInitErr";
Utils.registerEvent("testClearHistoryInitErr","17100001",646,done);
Utils.registerEvent("testClearHistoryInitErr","Init error. The WebviewController must be associated with a Web component.",647,done);
sendEventByKey('webViewContPageOperationsError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_2500
*tc.name testGetHitTestInitErr
*tc.desc test interface of getHitTest with not been associated with specific Web Components
*/
it('testGetHitTestInitErr',0,async function(done){
emitKey="emitGetHitTestInitErr";
Utils.registerEvent("testGetHitTestInitErr","17100001",648,done);
Utils.registerEvent("testGetHitTestInitErr","Init error. The WebviewController must be associated with a Web component.",649,done);
sendEventByKey('webViewContPageOperationsError',10,'');
})
})
}
\ No newline at end of file
/**
* 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';
let emitKey = "emitStoreWebArchiveCallBackInitErr";
export default function webViewContStoreWebArchiveError() {
describe('ActsAceWebDevWebViewContStoreWebArchiveErrorTest', function () {
beforeAll(async function (done) {
let options = {
uri: 'MainAbility/pages/webViewContStoreWebArchiveError',
}
try {
router.clear();
let pages = router.getState();
console.info("get webViewContStoreWebArchiveError state success " + JSON.stringify(pages));
if (!("webViewContStoreWebArchiveError" == pages.name)) {
console.info("get webViewContStoreWebArchiveError state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push webViewContStoreWebArchiveError page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webViewContStoreWebArchiveError page error: " + err);
}
done()
});
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("webViewContStoreWebArchiveError beforeEach start");
done();
})
afterEach(async function (done) {
console.info("webViewContStoreWebArchiveError 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_WEBVIEWERROR_5100
*tc.name testStoreWebArchiveInitErr
*tc.desc test interface of storeWebArchive with not been associated with specific Web Components
*/
it('teststoreWebArchiveInitErr',0,async function(done){
emitKey="emitStoreWebArchiveCallBackPathErr";
Utils.registerEvent("teststoreWebArchiveInitErr","17100001",700,done);
Utils.registerEvent("teststoreWebArchiveInitErr","Init error. The WebviewController must be associated with a Web component.",701,done);
sendEventByKey('webViewContStoreWebArchiveError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_5200
*tc.name testStoreWebArchiveCallBackPathErr
*tc.desc test interface of storeWebArchive with wrong resource path
*/
it('testStoreWebArchiveCallBackPathErr',0,async function(done){
emitKey="emitStoreWebArchiveCallBackUnAccessErr";
Utils.registerEvent("testStoreWebArchiveCallBackPathErr",17100003,702,done);
Utils.registerEvent("testStoreWebArchiveCallBackPathErr","Invalid resource path or file type.",703,done);
sendEventByKey('webViewContStoreWebArchiveError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_5300
*tc.name testStoreWebArchiveCallBackUnAccessErr
*tc.desc test interface of storeWebArchive with resource path cannot access
*/
it('testStoreWebArchiveCallBackUnAccessErr',0,async function(done){
emitKey="emitStoreWebArchivePromiseInitErr";
Utils.registerEvent("testStoreWebArchiveCallBackUnAccessErr",17100003,704,done);
Utils.registerEvent("testStoreWebArchiveCallBackUnAccessErr","Invalid resource path or file type.",705,done);
sendEventByKey('webViewContStoreWebArchiveError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_5400
*tc.name testStoreWebArchivePromiseInitErr
*tc.desc test interface of storeWebArchive promise with not been associated with specific Web Components
*/
it('testStoreWebArchivePromiseInitErr',0,async function(done){
emitKey="emitStoreWebArchivePromisePathErr";
Utils.registerEvent("testStoreWebArchivePromiseInitErr","17100001",706,done);
Utils.registerEvent("testStoreWebArchivePromiseInitErr","Init error. The WebviewController must be associated with a Web component.",707,done);
sendEventByKey('webViewContStoreWebArchiveError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_5500
*tc.name testStoreWebArchivePromisePathErr
*tc.desc test interface of storeWebArchive promise with wrong resource path
*/
it('testStoreWebArchivePromisePathErr',0,async function(done){
emitKey="emitStoreWebArchivePromiseUnAccessErr";
Utils.registerEvent("testStoreWebArchivePromisePathErr",17100003,708,done);
Utils.registerEvent("testStoreWebArchivePromisePathErr","Invalid resource path or file type.",709,done);
sendEventByKey('webViewContStoreWebArchiveError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERROR_5600
*tc.name testStoreWebArchivePromiseUnAccessErr
*tc.desc test interface of storeWebArchive promise with resource path cannot access
*/
it('testStoreWebArchivePromiseUnAccessErr',0,async function(done){
emitKey="emitStoreWebArchivePromiseUnAccessErr";
Utils.registerEvent("testStoreWebArchivePromiseUnAccessErr",17100003,710,done);
Utils.registerEvent("testStoreWebArchivePromiseUnAccessErr","Invalid resource path or file type.",711,done);
sendEventByKey('webViewContStoreWebArchiveError',10,'');
})
})
}
\ No newline at end of file
/**
* 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';
let emitKey = "emitWebMessageExtGetStringError";
export default function webViewContWebMessageExtReturnError() {
describe('ActsAceWebDevWebViewContWebMessageExtReturnErrorTest', function () {
beforeAll(async function (done) {
let options = {
uri: 'MainAbility/pages/webViewContWebMessageExtReturnError',
}
try {
router.clear();
let pages = router.getState();
console.info("get webViewContWebMessageExtReturnError state success " + JSON.stringify(pages));
if (!("webViewContWebMessageExtReturnError" == pages.name)) {
console.info("get webViewContWebMessageExtReturnError state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push webViewContWebMessageExtReturnError page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push webViewContWebMessageExtReturnError page error: " + err);
}
done()
});
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("webViewContWebMessageExtReturnError beforeEach start");
done();
})
afterEach(async function (done) {
console.info("webViewContWebMessageExtReturnError 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_WEBVIEWERRORHUNDRED_1500
*tc.name testWebMessageExtGetStringError
*tc.desc test interface of WebMessageExt getString with unmatched type
*/
it('testWebMessageExtGetStringError',0,async function(done){
emitKey="emitWebMessageExtGetNumberError";
Utils.registerEvent("testWebMessageExtGetStringError","17100014",826,done);
Utils.registerEvent("testWebMessageExtGetStringError","The type does not match with the value of the result.",827,done);
sendEventByKey('webViewContWebMessageExtReturnError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERRORHUNDRED_1600
*tc.name testWebMessageExtGetNumberError
*tc.desc test interface of WebMessageExt getNumber with unmatched type
*/
it('testWebMessageExtGetNumberError',0,async function(done){
emitKey="emitWebMessageExtGetBooleanError";
Utils.registerEvent("testWebMessageExtGetNumberError","17100014",828,done);
Utils.registerEvent("testWebMessageExtGetNumberError","The type does not match with the value of the result.",829,done);
sendEventByKey('webViewContWebMessageExtReturnError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERRORHUNDRED_1700
*tc.name testWebMessageExtGetBooleanError
*tc.desc test interface of WebMessageExt getBoolean with unmatched type
*/
it('testWebMessageExtGetBooleanError',0,async function(done){
emitKey="emitWebMessageExtGetArrayBufferError";
Utils.registerEvent("testWebMessageExtGetBooleanError","17100014",830,done);
Utils.registerEvent("testWebMessageExtGetBooleanError","The type does not match with the value of the result.",831,done);
sendEventByKey('webViewContWebMessageExtReturnError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERRORHUNDRED_1800
*tc.name testWebMessageExtGetArrayBufferError
*tc.desc test interface of WebMessageExt getArrayBuffer with unmatched type
*/
it('testWebMessageExtGetArrayBufferError',0,async function(done){
emitKey="emitWebMessageExtGetArrayError";
Utils.registerEvent("testWebMessageExtGetArrayBufferError","17100014",832,done);
Utils.registerEvent("testWebMessageExtGetArrayBufferError","The type does not match with the value of the result.",833,done);
sendEventByKey('webViewContWebMessageExtReturnError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERRORHUNDRED_1900
*tc.name testWebMessageExtGetArrayError
*tc.desc test interface of WebMessageExt getArray with unmatched type
*/
it('testWebMessageExtGetArrayError',0,async function(done){
emitKey="emitWebMessageExtGetErrorError";
Utils.registerEvent("testWebMessageExtGetArrayError","17100014",834,done);
Utils.registerEvent("testWebMessageExtGetArrayError","The type does not match with the value of the result.",835,done);
sendEventByKey('webViewContWebMessageExtReturnError',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_WEBVIEWERRORHUNDRED_2000
*tc.name testWebMessageExtGetErrorError
*tc.desc test interface of WebMessageExt getError with unmatched type
*/
it('testWebMessageExtGetErrorError',0,async function(done){
emitKey="emitWebMessageExtGetErrorError";
Utils.registerEvent("testWebMessageExtGetErrorError","17100014",836,done);
Utils.registerEvent("testWebMessageExtGetErrorError","The type does not match with the value of the result.",837,done);
sendEventByKey('webViewContWebMessageExtReturnError',10,'');
})
})
}
\ No newline at end of file
{
"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
{
"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"
}
]
}
{
"src": [
"MainAbility/pages/webViewContMessageError",
"MainAbility/pages/webViewContPageOperationsError",
"MainAbility/pages/webViewContJavaScriptError",
"MainAbility/pages/webViewContZoomAndOthersError",
"MainAbility/pages/webViewContStoreWebArchiveError",
"MainAbility/pages/webViewContGetUrlAndOthersError",
"MainAbility/pages/webViewContCookieToGeoLocationError",
"MainAbility/pages/webViewContJsMessageExtReturnError",
"MainAbility/pages/webViewContWebMessageExtReturnError"
]
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>index</title>
<style>
#pageHeight{
height:1300px
}
</style>
</head>
<body>
<div id="container">首页</div>
<div id="pageHeight"></div>
<a href="second.html" id="fileAccess">打开rawfile文件</a>
<img src="icon.png" alt="icon" id="imgs">
</body>
<script>
let ele=document.getElementById("imgs");
let loadImage;
ele.onload=function(){
loadImage="load complete"
}
function getUserAgent(){
return navigator.userAgent
}
function test(){
backToEts.test("backToEts")
}
function testRunJavaScript(){
return "testRunJavaScript"
}
function getPageHeight(){
let height=document.body.scrollHeight
return height
}
function proxy(){
objName.register("backToEts")
}
function registerTest(){
let str=objName.register();
console.log(str);
return str
}
function jsAccess(){
console.log("web111")
}
function consoleTest(){
console.log("console test")
}
function alertTest(){
alert('alert test')
}
function confirmTest(){
confirm("confirm test")
}
function getImgResult(){
return loadImage
}
function toPrompt(){
let result=prompt("age","20");
console.log("result:"+result)
}
function openRawFile(){
document.getElementById("fileAccess").click()
}
function gettitle(){
return document.title
}
</script>
</html>
\ No newline at end of file
<!--index.html-->
<!DOCTYPE html>
<html lang="en-gb">
<head>
<title>WebView MessagePort Demo</title>
</head>
<body>
<h1>Html5 Send and Receive Message</h1>
<h3 id="msg">Receive string:</h3>
<h3 id="msg2">Receive arraybuffer:</h3>
<div style="font-size: 10pt; text-align: center;">
<input type="button" value="Send String" onclick="postStringToApp();" /><br/>
<input type="button" value="Send Number" onclick="postNumberToApp();" /><br/>
<input type="button" value="Send Boolean" onclick="postBooleanToApp();" /><br/>
<input type="button" value="Send ArrayBuffer" onclick="postArrayBufferToApp();" /><br/>
<input type="button" value="Send Array" onclick="postArrayToApp();" /><br/>
<input type="button" value="Send Error" onclick="postErrorToApp();" /><br/>
</div>
</body>
<script src="./index.js"></script>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>second</title>
</head>
<body>
<div style="height: 1300px;background-color: #999999;">second pages</div>
</body>
<script>
function gettitle(){
return document.title
}
</script>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en-gb">
<body>
<h1>run JavaScript Ext demo</h1>
</body>
<script type="text/javascript">
function testString() {
return "hello, world";
}
function testNumber() {
return 01234567;
}
function testBoolean() {
return true;
}
function testArrayBuffer() {
let buffer = new ArrayBuffer(12);
buffer[0] = 'a';
return buffer
}
function testArray() {
let a = Array("apple", "banana", "cherry");
return a
}
</script>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册