提交 c1f164c2 编写于 作者: W wangwentian

add webViewController_part1 xts_acts testcase & pages modify review

Signed-off-by: Nwangwentian <wtwanga@isoftstone.com>
上级 69f52ad3
{
"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) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAceWebDevWebViewControllerTest") {
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 = "ActsAceWebDevWebViewControllerTest"
}
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": [
"ActsAceWebDevWebViewControllerTest.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/webViewController", 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) 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 webViewControllerJsunit from './webViewControllerJsunit.test'
export default function testsuite() {
webViewControllerJsunit()
}
\ 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 } from "@ohos/hypium";
import events_emitter from '@ohos.events.emitter';
import Utils from './Utils.ets';
let emitKey = "emitGetWebId";
export default function webViewControllerJsunit() {
describe('ActsAceWebDevWebViewControllerTest', function () {
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("web beforeEach start");
done();
})
afterEach(async function (done) {
console.info("web 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_API_0100
*tc.name testGetWebId
*tc.desc Get the WebId
*/
it('testGetWebId',0,async function(done){
emitKey="emitgetUserAgent";
Utils.registerEvent("testGetWebId",6,100,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_0200
*tc.name testGetUserAgent
*tc.desc Get the UserAgent
*/
it('testGetUserAgent',0,async function(done){
emitKey="emitgetUserAgentAgain";
let userAgent= "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile" +
" Safari/537.36Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88 Mobile Safari/537.36";
Utils.registerEvent("testGetUserAgent",userAgent,102,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_0300
*tc.name testGetUserAgentAgain
*tc.desc Get the UserAgent again
*/
it('testGetUserAgentAgain',0,async function(done){
emitKey="emitpageDown";
let userAgent= "\"Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.88" +
" Mobile Safari/537.36\"";
Utils.registerEvent("testGetUserAgentAgain",userAgent,104,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_0400
*tc.name testPageDown
*tc.desc Go pageDown
*/
it('testPageDown',0,async function(done){
emitKey="emitpageUp";
Utils.registerEvent("testPageDown",true,106,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_0500
*tc.name testPageUp
*tc.desc Go pageUp
*/
it('testPageUp',0,async function(done){
emitKey="emitpageDownAgain";
Utils.registerEvent("testPageUp",true,108,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_0600
*tc.name testPageDownAgain
*tc.desc Go PageDown Again
*/
it('testPageDownAgain',0,async function(done){
emitKey="emitpageUpAgain";
Utils.registerEvent("testPageDownAgain",true,110,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_0700
*tc.name testPageUpAgain
*tc.desc Go PageUp again
*/
it('testPageUpAgain',0,async function(done){
emitKey="emitGetFavicon";
Utils.registerEvent("testPageUpAgain",true,112,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_0800
*tc.name testGetFavicon
*tc.desc test for getFavicon
*/
it('testGetFavicon',0,async function(done){
emitKey="emitGetFaviconAgain";
Utils.registerEvent("testGetFavicon",undefined,114,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_0900
*tc.name testGetFaviconAgain
*tc.desc test for getFavicon again
*/
it('testGetFaviconAgain',0,async function(done){
emitKey="emitGetOriginalUrl";
Utils.registerEvent("testGetFaviconAgain",5,116,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_1000
*tc.name testGetOriginalUrl
*tc.desc test for getOriginalUrl
*/
it('testGetOriginalUrl',0,async function(done){
emitKey="emitGetOriginalUrlTwo";
let indexUrl = "//rawfile/indexCopy.html";
Utils.registerEvent("testGetOriginalUrl",indexUrl,118,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_1100
*tc.name testGetOriginalUrlTwo
*tc.desc test for getOriginalUrl again
*/
it('testGetOriginalUrlTwo',0,async function(done){
emitKey="emitSetNetworkAvailable";
let indexUrl = "//rawfile/indexCopy.html//rawfile/indexTwo.html";
Utils.registerEvent("testGetOriginalUrlTwo",indexUrl,120,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_1100
*tc.name testSetNetworkAvailable
*tc.desc test for setNetworkAvailable
*/
it('testSetNetworkAvailable',0,async function(done){
emitKey="emitSetNetworkAvailableAgain";
Utils.registerEvent("testSetNetworkAvailable",false,122,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_1200
*tc.name testSetNetworkAvailableAgain
*tc.desc test for setNetworkAvailable again
*/
it('testSetNetworkAvailableAgain',0,async function(done){
emitKey="emitSetNetworkAvailableAgain";
Utils.registerEvent("testSetNetworkAvailableAgain",true,124,done);
sendEventByKey('webcomponent',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"
},
{
"name": "ohos.permission.GET_NETWORK_INFO"
}
]
}
}
\ 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/webViewController"
]
}
\ 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>databaseAccess</title>
</head>
<body>
<div id="status"></div>
<script>
let res=""
try{
if(openDatabase){
res="openDatabase"
}
}catch(e){
console.log("err:"+e)
res="openDatabase is undefined"
}
function getDataResult(){
return res
}
</script>
</body>
</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>domApi</title>
</head>
<body>
<div id="result"></div>
<script>
if(typeof(Storage)!=="undefined"){
try{
localStorage.setItem("sitename","domapi");
document.getElementById("result").innerHTML=localStorage.getItem("sitename");
}catch(e){
document.getElementById("result").innerHTML="sorry"
}
}
function getDomResult(){
let str=document.getElementById("result").innerHTML
return str
}
</script>
</body>
</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>地理位置</title>
</head>
<body>
<div id="result"></div>
<script>
navigator.geolocation.getCurrentPosition(
function(position){
let cords=position.coords;
document.getElementById("result").innerText="当前经度:"+cords.longitude
},
function(error){
let errorTypes={1:"位置服务被拒绝",2:"获取不到位置信息",3:"获取位置信息超时"};
document.getElementById("result").innerText=errorTypes[error.code]
console.log("errorcode is:" + error.code)
}
);
function getGeoResult(){
let str=document.getElementById("result").innerText
return str
}
</script>
</body>
</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>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
<!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:900px
}
#pageHeight1{
height:900px
}
</style>
</head>
<body>
<div id="container">首页</div>
<div id="pageHeight"></div>
<div id="contenttext">内容</div>
<div id="pageHeight1"></div>
<div id="ending">末尾</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
}
function getNavigatorOnLine(){
let onlineResult = navigator.onLine;
return onlineResult
}
function checkPageUpEle(){
const up_element = document.getElementById("container");
let UpEle = up_element.innerText;
let x = up_element.scrollLeft;
let y = up_element.scrollTop;
let z = up_element.scrollHeight;
let w = up_element.scrollWidth;
let style = (window.getComputedStyle(document.getElementById("container"), null)).display;
let style2 = (window.getComputedStyle(document.getElementById("container"), null)).getPropertyValue("visibility");
console.log("UpEle : " + UpEle + style + style2 + x + y + z + w);
return [UpEle,style,style2,x,y,z,w]
}
function checkContentEle(){
const middle_element = document.getElementById("contenttext");
let ContentEle = middle_element.innerText;
let x = middle_element.scrollLeft;
let y = middle_element.scrollTop;
let z = middle_element.scrollHeight;
let w = middle_element.scrollWidth;
let style = (window.getComputedStyle(document.getElementById("contenttext"), null)).display;
let style2 = (window.getComputedStyle(document.getElementById("contenttext"), null)).getPropertyValue("visibility");
console.log("ContentEle : " + ContentEle + style + style2 + x + y + z + w);
return [ContentEle,style,style2,x,y,z,w]
}
function checkPageDownEle(){
const down_element = document.getElementById("ending");
let DownEle = down_element.innerText;
let x = down_element.scrollLeft;
let y = down_element.scrollTop;
let z = down_element.scrollHeight;
let w = down_element.scrollWidth;
let style = (window.getComputedStyle(document.getElementById("ending"), null)).display;
let style2 = (window.getComputedStyle(document.getElementById("ending"), null)).getPropertyValue("visibility");
console.log("DownEle : " + DownEle + style + style2 + x + y + z + w);
return [DownEle,style,style2,x,y,z,w]
}
function checkVIsible(){
let m = document.body.scrollHeight;
let n = document.documentElement.scrollHeight;
let a = document.body.scrollTop;
let b = document.documentElement.scrollTop;
console.log("checkVisible result is : " + m + n + a + b);
return [m,n,a,b]
}
</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>index</title>
<style>
#pageHeight{
height:1300px
}
#pageHeight1{
height:1300px
}
</style>
</head>
<body>
<div id="container">首页</div>
<div id="pageHeight"></div>
<div id="contenttext">内容</div>
<div id="pageHeight1"></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
}
function getNavigatorOnLine(){
let onlineResult = navigator.onLine;
return onlineResult
}
function checkPageUpEle(){
let UpEle = document.getElementById("container").innerText
let style = (window.getComputedStyle(document.getElementById("container"), null)).getPropertyValue("visibility");
console.log("UpEle : " + UpEle + style);
return [UpEle,style]
}
function checkContentEle(){
let ContentEle = document.getElementById("contenttext").innerText
let style = (window.getComputedStyle(document.getElementById("contenttext"), null)).getPropertyValue("visibility");
console.log("ContentEle : " + ContentEle + style);
return [ContentEle,style]
}
function checkPageDownEle(){
let DownEle = document.getElementById("fileAccess").innerText
let style = (window.getComputedStyle(document.getElementById("fileAccess"), null)).getPropertyValue("visibility");
console.log("DownEle : " + DownEle + style);
return [DownEle,style]
}
checkPageUpEle();
checkContentEle();
checkPageDownEle();
getNavigatorOnLine();
</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>index</title>
<style>
#pageHeight{
height:1300px
}
#pageHeight1{
height:1300px
}
</style>
</head>
<body>
<div id="container">首页</div>
<div id="pageHeight"></div>
<div id="contenttext">内容</div>
<div id="pageHeight1"></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
}
function getNavigatorOnLine(){
let onlineResult = navigator.onLine;
return onlineResult
}
function checkPageUpEle(){
let UpEle = document.getElementById("container").innerText
let style = (window.getComputedStyle(document.getElementById("container"), null)).getPropertyValue("visibility");
console.log("UpEle : " + UpEle + style);
return [UpEle,style]
}
function checkContentEle(){
let ContentEle = document.getElementById("contenttext").innerText
let style = (window.getComputedStyle(document.getElementById("contenttext"), null)).getPropertyValue("visibility");
console.log("ContentEle : " + ContentEle + style);
return [ContentEle,style]
}
function checkPageDownEle(){
let DownEle = document.getElementById("fileAccess").innerText
let style = (window.getComputedStyle(document.getElementById("fileAccess"), null)).getPropertyValue("visibility");
console.log("DownEle : " + DownEle + style);
return [DownEle,style]
}
checkPageUpEle();
checkContentEle();
checkPageDownEle();
getNavigatorOnLine();
</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>onlineImageAccess</title>
</head>
<body>
<div id="result">gitee</div>
<img src="https://assets.gitee.com/assets/enterprises/202007/nonprofit-plan-9f4df9ae0451144be097e42b8db40c94.png" alt="gitee" id="gitee">
<script>
let ele=document.getElementById("gitee");
let loadImage;
ele.onload=function(){
loadImage="load image complete"
}
function getImageLoadResult(){
return loadImage
}
</script>
</body>
</html>
\ No newline at end of file
<html>
<head>
<title>gailan</title>
<style>
body{
width:2000px;
padding-right:170px;
padding-left: 170px;
border:5px solid blueviolet
}
</style>
</head>
<body>
This is the test page to test SetLoadWithOverviewMode interface
</body>
<script>
function getViewResult(){
let scaleNumber=window.visualViewport.scale;
return scaleNumber;
}
</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">
<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">
<link rel="shortcut icon" href ="favicon.ico" type="image/x-icon"/>
<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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册