diff --git a/ArkwebSchemeHandler/.gitignore b/ArkWebSchemeHandler/.gitignore
similarity index 100%
rename from ArkwebSchemeHandler/.gitignore
rename to ArkWebSchemeHandler/.gitignore
diff --git a/ArkWebSchemeHandler/AppScope/app.json5 b/ArkWebSchemeHandler/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..380216c4148a89ebb8eecf3cb191120fd624ceab
--- /dev/null
+++ b/ArkWebSchemeHandler/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2025 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.
+*/
+
+{
+ "app": {
+ "bundleName": "com.samples.arkwebschemehandler",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:layered_image",
+ "label": "$string:app_name"
+ }
+}
diff --git a/ArkwebSchemeHandler/AppScope/resources/base/element/string.json b/ArkWebSchemeHandler/AppScope/resources/base/element/string.json
similarity index 61%
rename from ArkwebSchemeHandler/AppScope/resources/base/element/string.json
rename to ArkWebSchemeHandler/AppScope/resources/base/element/string.json
index 4473b35b3f46248b60f681be27eba9821898cd3d..42a06f64bb1731e07c5b6a7aa98ea811ec09d3e9 100644
--- a/ArkwebSchemeHandler/AppScope/resources/base/element/string.json
+++ b/ArkWebSchemeHandler/AppScope/resources/base/element/string.json
@@ -2,7 +2,7 @@
"string": [
{
"name": "app_name",
- "value": "ArkwebSchemeHandler"
+ "value": "ArkWebSchemeHandler"
}
]
}
diff --git a/ArkwebSchemeHandler/AppScope/resources/base/media/background.png b/ArkWebSchemeHandler/AppScope/resources/base/media/background.png
similarity index 100%
rename from ArkwebSchemeHandler/AppScope/resources/base/media/background.png
rename to ArkWebSchemeHandler/AppScope/resources/base/media/background.png
diff --git a/ArkwebSchemeHandler/AppScope/resources/base/media/foreground.png b/ArkWebSchemeHandler/AppScope/resources/base/media/foreground.png
similarity index 100%
rename from ArkwebSchemeHandler/AppScope/resources/base/media/foreground.png
rename to ArkWebSchemeHandler/AppScope/resources/base/media/foreground.png
diff --git a/ArkwebSchemeHandler/AppScope/resources/base/media/layered_image.json b/ArkWebSchemeHandler/AppScope/resources/base/media/layered_image.json
similarity index 100%
rename from ArkwebSchemeHandler/AppScope/resources/base/media/layered_image.json
rename to ArkWebSchemeHandler/AppScope/resources/base/media/layered_image.json
diff --git a/ArkWebSchemeHandler/README.md b/ArkWebSchemeHandler/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..70cb67520727b54c92d338d84a441f5eddcf9942
--- /dev/null
+++ b/ArkWebSchemeHandler/README.md
@@ -0,0 +1,192 @@
+# 拦截Web组件发起的网络请求
+
+### 介绍
+
+1. 本示例通过使用arkweb_scheme_handler.h相关API实现对Web组件发出的请求进行拦截,并为被拦截的请求提供自定义的响应头以及响应体。
+2. 本工程主要实现了对以下指南文档中 https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/web/web-scheme-handler.md 示例代码片段的工程化,主要目标是实现指南中示例代码需要与sample工程文件同源。
+
+### 主页
+
+1. 本示例通过使用arkweb_scheme_handler.h相关API实现对Web组件发出的请求进行拦截,并为被拦截的请求提供自定义的响应头以及响应体。
+
+#### 效果预览
+
+| 主页 |
+|:----------------------:|
+| |
+
+#### 使用说明
+
+1. 打开DEMO进入首页,展示html。
+2. 点击各链接进入不同属性的拦截结果页面或读取结果页面。
+
+### 拦截视频资源
+
+#### 介绍
+
+1. 此处模块主要介绍通过Web组件,拦截视频资源请求,读取本地mp4文件。
+
+#### 效果预览
+
+| 拦截视频资源 |
+| ------------------------------------------------------------ |
+| |
+
+#### 使用说明
+
+1. 通过点击主页的“拦截视频资源请求,读取本地mp4文件”链接,拦截页面请求并跳转到此页面并展示本地的mp4文件。
+
+### 忽略csp检查并拦截
+
+#### 介绍
+
+1. 此处模块主要介绍通过Web组件,测试三方协议忽略csp检查,并成功拦截。
+
+#### 效果预览
+
+| 忽略csp检查并拦截 |
+| ------------------------------------------------------------ |
+| |
+
+#### 使用说明
+
+1. 通过点击主页的“测试三方协议忽略csp检查,并成功拦截”链接,展示被拦截的自定义scheme请求,该scheme需要遵循标准的scheme规则,允许忽略CSP检查。
+2. 如果要拦截自定义scheme的请求,需要提前将自定义scheme注册到Web内核。需要在Web组件初始化之前进行注册,Web组件初始化后再注册会失败。
+
+### 拦截ISOLATED属性
+
+#### 介绍
+
+1. 此处模块主要介绍通过Web组件,测试拦截设置ISOLATED属性的三方协议。
+
+#### 效果预览
+
+| 拦截ISOLATED属性 |
+| ------------------------------------------------------------ |
+| |
+
+#### 使用说明
+
+1. 通过点击主页的“测试拦截设置ISOLATED属性的三方协议”链接,展示被拦截的带有ISOLATED属性的自定义scheme请求,该scheme的请求必须从相同scheme加载的网页中发起。
+2. 如果要拦截自定义scheme的请求,需要提前将自定义scheme注册到Web内核。需要在Web组件初始化之前进行注册,Web组件初始化后再注册会失败。
+
+### 拦截LOCAL属性
+
+#### 介绍
+
+1. 此处模块主要介绍通过Web组件,测试拦截设置LOCAL属性的三方协议。
+
+#### 效果预览
+
+| 拦截LOCAL属性 |
+| ------------------------------------------------------------ |
+| |
+
+#### 使用说明
+
+1. 通过点击主页的“测试拦截设置LOCAL属性的三方协议”链接,展示被拦截的带有LOCAL属性的自定义scheme请求,该scheme需要遵循与“file” scheme一样的规则。
+2. 如果要拦截自定义scheme的请求,需要提前将自定义scheme注册到Web内核。需要在Web组件初始化之前进行注册,Web组件初始化后再注册会失败。
+
+### 拦截service worker
+
+#### 介绍
+
+1. 此处模块主要介绍通过Web组件,测试拦截service worker触发的请求。
+
+#### 效果预览
+
+| 拦截service worker |
+| ------------------------------------------------------------ |
+| |
+
+#### 使用说明
+
+1. 通过点击主页的“测试拦截service worker触发的请求”链接,展示被拦截的Web组件发出的scheme为“custom”的请求。
+2. 如果要拦截自定义scheme的请求,需要提前将自定义scheme注册到Web内核。需要在Web组件初始化之前进行注册,Web组件初始化后再注册会失败。
+
+### 测试读取blob类型http body stream
+
+#### 介绍
+
+1. 此处模块主要介绍通过Web组件,测试读取blob类型http body stream。
+
+#### 效果预览
+
+| 测试读取blob类型http body stream |
+| ------------------------------------------------------------ |
+| |
+
+#### 使用说明
+
+1. 通过点击主页的“测试读取blob类型http body stream”链接,跳转至post_data.html,通过"test xhr post"或"test xhr put"按键,创建blob类型的对应请求,并发送至服务端,在设备日志中可查看发送结果。
+
+### 测试读取chunked类型http body stream
+
+#### 介绍
+
+1. 此处模块主要介绍通过Web组件,测试读取chunked类型http body stream。
+
+#### 效果预览
+
+| 测试读取chunked类型http body stream |
+| ------------------------------------------------------------ |
+| |
+
+#### 使用说明
+
+1. 通过点击主页的“测试读取chunked类型http body stream”链接,跳转至pchunked_post_stream.html,通过"test post chunked http body"按键,创建chunked类型的请求,并以POST方式发送至服务端,在设备日志中可查看发送结果。
+
+### 工程目录
+
+
+```
+├── entry
+│ └── src
+│ └── main
+│ ├── cpp // C++代码区
+│ │ ├── CMakeLists.txt // CMAKE配置文件
+│ │ ├── hello.cpp // Native业务代码实现
+│ │ ├── rawfile_request.cpp // RawfileRequest实现
+│ │ ├── rawfile_request.h // RawfileRequest类
+│ │ └── types
+│ │ └── libentry // C++接口导出
+│ │ ├── Index.d.ts
+│ │ └── oh-package.json5
+│ ├── ets // ArkTS代码区
+│ │ ├── entryability
+│ │ │ └── EntryAbility.ets // 入口类
+│ │ ├── entrybackupability
+│ │ │ └── EntryBackupAbility.ets // 备份恢复框架
+│ │ └── pages
+│ │ └── Index.ets // 主页
+│ └── resources // 应用资源文件
+```
+### 相关权限
+
+不涉及。
+
+### 依赖
+
+不涉及。
+
+### 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+
+2. HarmonyOS系统:HarmonyOS 5.0.1 Release及以上。
+
+3. DevEco Studio版本:DevEco Studio 5.0.1 Release及以上。
+
+4. HarmonyOS SDK版本:HarmonyOS 5.0.1 Release及以上。
+
+### 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo /DocsSample_ArkWeb/ArkWebSchemeHandler > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/DocsSample_ArkWeb.git
+git pull origin master
+```
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/build-profile.json5 b/ArkWebSchemeHandler/build-profile.json5
similarity index 51%
rename from ArkwebSchemeHandler/build-profile.json5
rename to ArkWebSchemeHandler/build-profile.json5
index 537a8ef6fd113674c68f085dae75fbbb95880efb..b18e95875684b32ed3b08cac12a018606f00cd9b 100644
--- a/ArkwebSchemeHandler/build-profile.json5
+++ b/ArkWebSchemeHandler/build-profile.json5
@@ -1,6 +1,22 @@
-{
+/*
+ * Copyright (c) 2025 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.
+ */
+
+ {
"app": {
- "products": [
+ "signingConfigs": [],
+ "products": [
{
"name": "default",
"signingConfig": "default",
@@ -38,4 +54,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/ArkwebSchemeHandler/code-linter.json5 b/ArkWebSchemeHandler/code-linter.json5
similarity index 58%
rename from ArkwebSchemeHandler/code-linter.json5
rename to ArkWebSchemeHandler/code-linter.json5
index 073990fa45394e1f8e85d85418ee60a8953f9b99..5c4682f8164874ec7e9cb8f99ff8b3228ffbc126 100644
--- a/ArkwebSchemeHandler/code-linter.json5
+++ b/ArkWebSchemeHandler/code-linter.json5
@@ -1,3 +1,17 @@
+/*
+ * Copyright (c) 2025 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.
+ */
{
"files": [
"**/*.ets"
diff --git a/ArkwebSchemeHandler/entry/build-profile.json5 b/ArkWebSchemeHandler/entry/build-profile.json5
similarity index 53%
rename from ArkwebSchemeHandler/entry/build-profile.json5
rename to ArkWebSchemeHandler/entry/build-profile.json5
index 9b5904523a7e5027acf6469ed9bb91003daf0237..fea31f4580540c7c560b62bf531292c471c410f1 100644
--- a/ArkwebSchemeHandler/entry/build-profile.json5
+++ b/ArkWebSchemeHandler/entry/build-profile.json5
@@ -1,3 +1,18 @@
+/*
+ * Copyright (c) 2025 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.
+ */
+
{
"apiType": "stageMode",
"buildOption": {
diff --git a/ArkWebSchemeHandler/entry/hvigorfile.ts b/ArkWebSchemeHandler/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 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 { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkwebSchemeHandler/entry/obfuscation-rules.txt b/ArkWebSchemeHandler/entry/obfuscation-rules.txt
similarity index 100%
rename from ArkwebSchemeHandler/entry/obfuscation-rules.txt
rename to ArkWebSchemeHandler/entry/obfuscation-rules.txt
diff --git a/ArkWebSchemeHandler/entry/oh-package.json5 b/ArkWebSchemeHandler/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..118bdd4fe7699368a010e04c24f5bfc887cf1298
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/oh-package.json5
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2025 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.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {
+ "libentry.so": "file:./src/main/cpp/types/libentry"
+ }
+}
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/entry/src/main/cpp/CMakeLists.txt b/ArkWebSchemeHandler/entry/src/main/cpp/CMakeLists.txt
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/cpp/CMakeLists.txt
rename to ArkWebSchemeHandler/entry/src/main/cpp/CMakeLists.txt
diff --git a/ArkwebSchemeHandler/entry/src/main/cpp/hello.cpp b/ArkWebSchemeHandler/entry/src/main/cpp/hello.cpp
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/cpp/hello.cpp
rename to ArkWebSchemeHandler/entry/src/main/cpp/hello.cpp
diff --git a/ArkwebSchemeHandler/entry/src/main/cpp/rawfile_request.cpp b/ArkWebSchemeHandler/entry/src/main/cpp/rawfile_request.cpp
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/cpp/rawfile_request.cpp
rename to ArkWebSchemeHandler/entry/src/main/cpp/rawfile_request.cpp
diff --git a/ArkwebSchemeHandler/entry/src/main/cpp/rawfile_request.h b/ArkWebSchemeHandler/entry/src/main/cpp/rawfile_request.h
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/cpp/rawfile_request.h
rename to ArkWebSchemeHandler/entry/src/main/cpp/rawfile_request.h
diff --git a/ArkwebSchemeHandler/entry/src/main/cpp/types/libentry/Index.d.ts b/ArkWebSchemeHandler/entry/src/main/cpp/types/libentry/Index.d.ts
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/cpp/types/libentry/Index.d.ts
rename to ArkWebSchemeHandler/entry/src/main/cpp/types/libentry/Index.d.ts
diff --git a/ArkwebSchemeHandler/entry/src/main/cpp/types/libentry/oh-package.json5 b/ArkWebSchemeHandler/entry/src/main/cpp/types/libentry/oh-package.json5
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/cpp/types/libentry/oh-package.json5
rename to ArkWebSchemeHandler/entry/src/main/cpp/types/libentry/oh-package.json5
diff --git a/ArkwebSchemeHandler/entry/src/main/ets/entryability/EntryAbility.ets b/ArkWebSchemeHandler/entry/src/main/ets/entryability/EntryAbility.ets
similarity index 61%
rename from ArkwebSchemeHandler/entry/src/main/ets/entryability/EntryAbility.ets
rename to ArkWebSchemeHandler/entry/src/main/ets/entryability/EntryAbility.ets
index 2969788642fbedf6f36fd9941f76719783ae6f19..ecc7a5eb82402045f42ecd578d0b7335ba963a53 100644
--- a/ArkwebSchemeHandler/entry/src/main/ets/entryability/EntryAbility.ets
+++ b/ArkWebSchemeHandler/entry/src/main/ets/entryability/EntryAbility.ets
@@ -1,3 +1,18 @@
+/*
+* Copyright (c) 2025 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 { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { window } from '@kit.ArkUI';
diff --git a/ArkwebSchemeHandler/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkWebSchemeHandler/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
similarity index 45%
rename from ArkwebSchemeHandler/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
rename to ArkWebSchemeHandler/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
index 8e4de99282050bad799ac892eb85ac5449364a51..48fcfc36922b540f93f6de56c15880c8db6bb2a5 100644
--- a/ArkwebSchemeHandler/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
+++ b/ArkWebSchemeHandler/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -1,3 +1,18 @@
+/*
+* Copyright (c) 2025 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 { hilog } from '@kit.PerformanceAnalysisKit';
import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
diff --git a/ArkwebSchemeHandler/entry/src/main/ets/pages/Index.ets b/ArkWebSchemeHandler/entry/src/main/ets/pages/Index.ets
similarity index 55%
rename from ArkwebSchemeHandler/entry/src/main/ets/pages/Index.ets
rename to ArkWebSchemeHandler/entry/src/main/ets/pages/Index.ets
index ba2e14ecd149aadd9a5687eb47a1b0f792f3b33c..30cb9f3a7999fbb248a669f6b91d82d8dae00dcc 100644
--- a/ArkwebSchemeHandler/entry/src/main/ets/pages/Index.ets
+++ b/ArkWebSchemeHandler/entry/src/main/ets/pages/Index.ets
@@ -1,3 +1,18 @@
+/*
+* Copyright (c) 2025 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 testNapi from 'libentry.so';
import { webview } from '@kit.ArkWeb';
import { resourceManager } from '@kit.LocalizationKit';
@@ -12,7 +27,7 @@ struct Index {
build() {
Row() {
Column() {
- Button("goback").onClick( event => {
+ Button($r('app.string.go_back')).onClick( event => {
this.mycontroller.backward();
})
diff --git a/ArkwebSchemeHandler/entry/src/main/module.json5 b/ArkWebSchemeHandler/entry/src/main/module.json5
similarity index 69%
rename from ArkwebSchemeHandler/entry/src/main/module.json5
rename to ArkWebSchemeHandler/entry/src/main/module.json5
index 6547f5ccaaad79b157a9539a06b87d8caaea9e1b..4ab1161334e66e8ab7dcb6aeb51e1b9e8383feb0 100644
--- a/ArkwebSchemeHandler/entry/src/main/module.json5
+++ b/ArkWebSchemeHandler/entry/src/main/module.json5
@@ -1,4 +1,18 @@
-{
+/*
+ * Copyright (c) 2025 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.
+ */
+ {
"module": {
"name": "entry",
"type": "entry",
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/base/element/color.json b/ArkWebSchemeHandler/entry/src/main/resources/base/element/color.json
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/base/element/color.json
rename to ArkWebSchemeHandler/entry/src/main/resources/base/element/color.json
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/base/element/float.json b/ArkWebSchemeHandler/entry/src/main/resources/base/element/float.json
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/base/element/float.json
rename to ArkWebSchemeHandler/entry/src/main/resources/base/element/float.json
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/base/element/string.json b/ArkWebSchemeHandler/entry/src/main/resources/base/element/string.json
similarity index 69%
rename from ArkwebSchemeHandler/entry/src/main/resources/base/element/string.json
rename to ArkWebSchemeHandler/entry/src/main/resources/base/element/string.json
index f94595515a99e0c828807e243494f57f09251930..f87c1e22bcded55626fbf8b4ebeace8f575a5d24 100644
--- a/ArkwebSchemeHandler/entry/src/main/resources/base/element/string.json
+++ b/ArkWebSchemeHandler/entry/src/main/resources/base/element/string.json
@@ -10,7 +10,11 @@
},
{
"name": "EntryAbility_label",
- "value": "label"
+ "value": "ArkWebSchemeHandler"
+ },
+ {
+ "name": "go_back",
+ "value": "go back"
}
]
}
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/base/media/background.png b/ArkWebSchemeHandler/entry/src/main/resources/base/media/background.png
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/base/media/background.png
rename to ArkWebSchemeHandler/entry/src/main/resources/base/media/background.png
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/base/media/foreground.png b/ArkWebSchemeHandler/entry/src/main/resources/base/media/foreground.png
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/base/media/foreground.png
rename to ArkWebSchemeHandler/entry/src/main/resources/base/media/foreground.png
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/base/media/layered_image.json b/ArkWebSchemeHandler/entry/src/main/resources/base/media/layered_image.json
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/base/media/layered_image.json
rename to ArkWebSchemeHandler/entry/src/main/resources/base/media/layered_image.json
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/base/media/startIcon.png b/ArkWebSchemeHandler/entry/src/main/resources/base/media/startIcon.png
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/base/media/startIcon.png
rename to ArkWebSchemeHandler/entry/src/main/resources/base/media/startIcon.png
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/base/profile/backup_config.json b/ArkWebSchemeHandler/entry/src/main/resources/base/profile/backup_config.json
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/base/profile/backup_config.json
rename to ArkWebSchemeHandler/entry/src/main/resources/base/profile/backup_config.json
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/base/profile/main_pages.json b/ArkWebSchemeHandler/entry/src/main/resources/base/profile/main_pages.json
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/base/profile/main_pages.json
rename to ArkWebSchemeHandler/entry/src/main/resources/base/profile/main_pages.json
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/dark/element/color.json b/ArkWebSchemeHandler/entry/src/main/resources/dark/element/color.json
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/dark/element/color.json
rename to ArkWebSchemeHandler/entry/src/main/resources/dark/element/color.json
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/cat.svg b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/cat.svg
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/rawfile/cat.svg
rename to ArkWebSchemeHandler/entry/src/main/resources/rawfile/cat.svg
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/chunked_post_stream.html b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/chunked_post_stream.html
similarity index 54%
rename from ArkwebSchemeHandler/entry/src/main/resources/rawfile/chunked_post_stream.html
rename to ArkWebSchemeHandler/entry/src/main/resources/rawfile/chunked_post_stream.html
index a1d905f01967aa6be6c024a6dcd19a7b7f15e752..a4f7a11242619ba582c56c90bf0298a480da106d 100644
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/chunked_post_stream.html
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/chunked_post_stream.html
@@ -1,3 +1,18 @@
+
+
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/csp_bypassing.html b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/csp_bypassing.html
similarity index 40%
rename from ArkwebSchemeHandler/entry/src/main/resources/rawfile/csp_bypassing.html
rename to ArkWebSchemeHandler/entry/src/main/resources/rawfile/csp_bypassing.html
index 29880a7e0a63d35e3a4bc2c574e621f43244be3b..616b8e984716579bfd189e96f2522ba9238e2c1d 100644
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/csp_bypassing.html
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/csp_bypassing.html
@@ -1,3 +1,18 @@
+
+
diff --git a/ArkWebSchemeHandler/entry/src/main/resources/rawfile/csp_script.js b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/csp_script.js
new file mode 100644
index 0000000000000000000000000000000000000000..07a301212fc48d7bc73d81f7e441c9aba461f07f
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/csp_script.js
@@ -0,0 +1,19 @@
+/*
+* Copyright (c) 2025 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.
+*/
+
+const body = document.body;
+const element = document.createElement('div');
+element.textContent = 'csp_script.js bypass the csp rules';
+body.appendChild(element);
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/isolated.html b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/isolated.html
similarity index 35%
rename from ArkwebSchemeHandler/entry/src/main/resources/rawfile/isolated.html
rename to ArkWebSchemeHandler/entry/src/main/resources/rawfile/isolated.html
index 2afa59bd1af02febe1486f8a1300f1bf8e2ab28f..0ef20f02ff5c3ce6ca5094d78fd54cddabb476b5 100644
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/isolated.html
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/isolated.html
@@ -1,3 +1,18 @@
+
+
diff --git a/ArkWebSchemeHandler/entry/src/main/resources/rawfile/isolated_script.js b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/isolated_script.js
new file mode 100644
index 0000000000000000000000000000000000000000..e97a5f9602d358e549e099823560af002bd8c066
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/isolated_script.js
@@ -0,0 +1,17 @@
+/*
+* Copyright (c) 2025 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.
+*/
+
+const element = document.getElementById('isolated_test');
+element.textContent = 'isolated_script.js not blocked';
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/local.html b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/local.html
similarity index 34%
rename from ArkwebSchemeHandler/entry/src/main/resources/rawfile/local.html
rename to ArkWebSchemeHandler/entry/src/main/resources/rawfile/local.html
index 0eac2f0841f7dd680c248a5d72cc19f0d6d24327..5a90787ee61f981663b7111383db01908e5c68af 100644
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/local.html
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/local.html
@@ -1,3 +1,18 @@
+
+
diff --git a/ArkWebSchemeHandler/entry/src/main/resources/rawfile/local_script.js b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/local_script.js
new file mode 100644
index 0000000000000000000000000000000000000000..94bcdac42f7805f45ee9266943f600a14dee71af
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/local_script.js
@@ -0,0 +1,17 @@
+/*
+* Copyright (c) 2025 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.
+*/
+
+const element = document.getElementById('local_test');
+element.textContent = 'local_script.js not blocked.';
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/post_data.html b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/post_data.html
similarity index 66%
rename from ArkwebSchemeHandler/entry/src/main/resources/rawfile/post_data.html
rename to ArkWebSchemeHandler/entry/src/main/resources/rawfile/post_data.html
index 129191629914612c30cf49d19c9b8dedcdaf17a7..fa62fceb7e45e2c134121a866944686c47f4dbfc 100644
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/post_data.html
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/post_data.html
@@ -1,3 +1,18 @@
+
+
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/service_worker.html b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/service_worker.html
similarity index 47%
rename from ArkwebSchemeHandler/entry/src/main/resources/rawfile/service_worker.html
rename to ArkWebSchemeHandler/entry/src/main/resources/rawfile/service_worker.html
index b61ccd83e4c2b652c12917a5687f0aa8f2524d6a..c9f84b397596073642f4d33c29731bdcdc766de0 100644
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/service_worker.html
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/service_worker.html
@@ -1,3 +1,18 @@
+
+
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/sw.js b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/sw.js
similarity index 32%
rename from ArkwebSchemeHandler/entry/src/main/resources/rawfile/sw.js
rename to ArkWebSchemeHandler/entry/src/main/resources/rawfile/sw.js
index 6364cc4d75820652afcfe6f5eda799a7570c79c0..d1f18a5f0df928d07406d30bb45da0f23519a0cb 100644
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/sw.js
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/sw.js
@@ -1,3 +1,18 @@
+/*
+* Copyright (c) 2025 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.
+*/
+
self.addEventListener('install', event => {
console.log('v1 installing');
event.waitUntil(
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/test.html b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/test.html
similarity index 59%
rename from ArkwebSchemeHandler/entry/src/main/resources/rawfile/test.html
rename to ArkWebSchemeHandler/entry/src/main/resources/rawfile/test.html
index 95a83e1166ec3f3d2f0aeac7520fc38b66b8624b..430349d6993788f8f9b3110d9b07334b4bc60c5c 100644
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/test.html
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/test.html
@@ -1,3 +1,18 @@
+
+
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/test.mp4 b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/test.mp4
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/rawfile/test.mp4
rename to ArkWebSchemeHandler/entry/src/main/resources/rawfile/test.mp4
diff --git a/ArkWebSchemeHandler/entry/src/main/resources/rawfile/video.html b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/video.html
new file mode 100644
index 0000000000000000000000000000000000000000..d036984efd0b1633a80a5ca92808fbf6e5e201e9
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/video.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/xhr b/ArkWebSchemeHandler/entry/src/main/resources/rawfile/xhr
similarity index 100%
rename from ArkwebSchemeHandler/entry/src/main/resources/rawfile/xhr
rename to ArkWebSchemeHandler/entry/src/main/resources/rawfile/xhr
diff --git a/ArkWebSchemeHandler/entry/src/mock/mock-config.json5 b/ArkWebSchemeHandler/entry/src/mock/mock-config.json5
new file mode 100755
index 0000000000000000000000000000000000000000..b9a78e201535765168a92d3543c690273ecdc019
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025 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.
+ */
+
+{
+}
\ No newline at end of file
diff --git a/ArkWebSchemeHandler/entry/src/ohosTest/ets/test/Ability.test.ets b/ArkWebSchemeHandler/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..82c3ede8034d34fb9326e71fb6d2a0610ce2aa35
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2025 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit';
+import { UIAbility, Want } from '@kit.AbilityKit';
+
+const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+const bundleName = abilityDelegatorRegistry.getArguments().bundleName;
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+
+ /*
+ * 打开应用,点击 测试三方协议忽略csp检查,并成功拦截 按钮
+ * 拦截自定义的忽略了csp属性的scheme请求。
+ */
+ it('loadTestHtml', 0, async (done: Function) => {
+ console.info('uitest: loadTestHtml begin');
+ const want: Want = {
+ bundleName: bundleName,
+ abilityName: 'EntryAbility'
+ };
+ await delegator.startAbility(want);
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
+ console.info('get top ability');
+ expect(ability.context.abilityInfo.name).assertEqual('EntryAbility');
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('test.html');
+
+ await driver.pressBack();
+ await driver.delayMs(1000);
+ console.info('uitest: loadTestHtml end');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ArkWebSchemeHandler/entry/src/ohosTest/ets/test/List.test.ets b/ArkWebSchemeHandler/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..1eac52fcebe8958e19a7b8fed2e8f39c520a3e42
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 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 abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkWebSchemeHandler/entry/src/ohosTest/module.json5 b/ArkWebSchemeHandler/entry/src/ohosTest/module.json5
new file mode 100755
index 0000000000000000000000000000000000000000..9983b2ba4e55e31a172f0328c82c9a75bfa00ded
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/src/ohosTest/module.json5
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 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.
+ */
+
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkWebSchemeHandler/entry/src/test/List.test.ets b/ArkWebSchemeHandler/entry/src/test/List.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..f1186b1f53c3a70930921c5dbd1417332bec56c9
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/src/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 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 localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkWebSchemeHandler/entry/src/test/LocalUnit.test.ets b/ArkWebSchemeHandler/entry/src/test/LocalUnit.test.ets
new file mode 100755
index 0000000000000000000000000000000000000000..7fc57c77dbf76d8df08a2b802a55b948e3fcf968
--- /dev/null
+++ b/ArkWebSchemeHandler/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/hvigor/hvigor-config.json5 b/ArkWebSchemeHandler/hvigor/hvigor-config.json5
similarity index 68%
rename from ArkwebSchemeHandler/hvigor/hvigor-config.json5
rename to ArkWebSchemeHandler/hvigor/hvigor-config.json5
index 1e473e424320d4e68b16737b289f5c851bb19d36..65dd6e421ed1979c8ab9b0f138616e0cd46889d9 100644
--- a/ArkwebSchemeHandler/hvigor/hvigor-config.json5
+++ b/ArkWebSchemeHandler/hvigor/hvigor-config.json5
@@ -1,3 +1,18 @@
+/*
+* Copyright (c) 2025 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.
+*/
+
{
"modelVersion": "5.0.1",
"dependencies": {
diff --git a/ArkWebSchemeHandler/hvigorfile.ts b/ArkWebSchemeHandler/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..2a5e543f190732c159beb574dfc9fa37bc94e156
--- /dev/null
+++ b/ArkWebSchemeHandler/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 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 { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWebSchemeHandler/oh-package.json5 b/ArkWebSchemeHandler/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..14655ea1c07e1b7b8b8eb3d9f6813577b90f6a0f
--- /dev/null
+++ b/ArkWebSchemeHandler/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 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.
+ */
+
+{
+ "modelVersion": "5.0.1",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.19",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/ArkWebSchemeHandler/ohosTest.md b/ArkWebSchemeHandler/ohosTest.md
new file mode 100755
index 0000000000000000000000000000000000000000..38a2a207a1844b6e2566fefab73fa4412874fe23
--- /dev/null
+++ b/ArkWebSchemeHandler/ohosTest.md
@@ -0,0 +1,4 @@
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+| ----------------- | ------------ | ------------ | ---------------- | -------- | -------- |
+| Web组件的加载html | 设备运转正常 | 应用启动成功 | 加载首页html成功 | Yes | Pass |
+
diff --git a/ArkwebSchemeHandler/screenshots/ISOLATED.png b/ArkWebSchemeHandler/screenshots/ISOLATED.png
similarity index 100%
rename from ArkwebSchemeHandler/screenshots/ISOLATED.png
rename to ArkWebSchemeHandler/screenshots/ISOLATED.png
diff --git a/ArkwebSchemeHandler/screenshots/LOCAL.png b/ArkWebSchemeHandler/screenshots/LOCAL.png
similarity index 100%
rename from ArkwebSchemeHandler/screenshots/LOCAL.png
rename to ArkWebSchemeHandler/screenshots/LOCAL.png
diff --git a/ArkwebSchemeHandler/screenshots/blob.png b/ArkWebSchemeHandler/screenshots/blob.png
similarity index 100%
rename from ArkwebSchemeHandler/screenshots/blob.png
rename to ArkWebSchemeHandler/screenshots/blob.png
diff --git a/ArkwebSchemeHandler/screenshots/chunked.png b/ArkWebSchemeHandler/screenshots/chunked.png
similarity index 100%
rename from ArkwebSchemeHandler/screenshots/chunked.png
rename to ArkWebSchemeHandler/screenshots/chunked.png
diff --git a/ArkwebSchemeHandler/screenshots/csp.png b/ArkWebSchemeHandler/screenshots/csp.png
similarity index 100%
rename from ArkwebSchemeHandler/screenshots/csp.png
rename to ArkWebSchemeHandler/screenshots/csp.png
diff --git a/ArkwebSchemeHandler/screenshots/home.png b/ArkWebSchemeHandler/screenshots/home.png
similarity index 100%
rename from ArkwebSchemeHandler/screenshots/home.png
rename to ArkWebSchemeHandler/screenshots/home.png
diff --git a/ArkwebSchemeHandler/screenshots/mp4.png b/ArkWebSchemeHandler/screenshots/mp4.png
similarity index 100%
rename from ArkwebSchemeHandler/screenshots/mp4.png
rename to ArkWebSchemeHandler/screenshots/mp4.png
diff --git a/ArkwebSchemeHandler/screenshots/service_worker.png b/ArkWebSchemeHandler/screenshots/service_worker.png
similarity index 100%
rename from ArkwebSchemeHandler/screenshots/service_worker.png
rename to ArkWebSchemeHandler/screenshots/service_worker.png
diff --git a/ArkwebSchemeHandler/AppScope/app.json5 b/ArkwebSchemeHandler/AppScope/app.json5
deleted file mode 100644
index 6c6d6b856fcc951ff4d5db5ed8479774532b78c2..0000000000000000000000000000000000000000
--- a/ArkwebSchemeHandler/AppScope/app.json5
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "app": {
- "bundleName": "com.example.arkwebschemehandler",
- "vendor": "example",
- "versionCode": 1000000,
- "versionName": "1.0.0",
- "icon": "$media:layered_image",
- "label": "$string:app_name"
- }
-}
diff --git a/ArkwebSchemeHandler/README.md b/ArkwebSchemeHandler/README.md
deleted file mode 100644
index aeae1ea7a82212e0c340875002a6e6728dc56144..0000000000000000000000000000000000000000
--- a/ArkwebSchemeHandler/README.md
+++ /dev/null
@@ -1,63 +0,0 @@
-# 拦截Web组件发起的网络请求
-
-### 介绍
-本示例通过使用arkweb_scheme_handler.h相关API实现对Web组件发出的请求进行拦截,并为被拦截的请求提供自定义的响应头以及响应体。
-
-### 效果预览
-
-| 主页 | 拦截视频资源 |
-|:--------------------------------------:|:-----------------------------------------:|
-|  |  |
-| 忽略csp检查并拦截 | 拦截ISOLATED属性 |
-|  |  |
-| 拦截LOCAL属性 | 拦截service worker
-|  | 
-| 测试读取blob类型 | 测试读取chunked类型 |
-|  |  |
-
-### 使用说明
-1. 打开DEMO进入首页,展示html。
-2. 点击各链接进入不同属性的拦截结果页面或读取结果页面。
-
-### 工程目录
-
-
-```
-├── entry
-│ └── src
-│ └── main
-│ ├── cpp // C++代码区
-│ │ ├── CMakeLists.txt // CMAKE配置文件
-│ │ ├── hello.cpp // Native业务代码实现
-│ │ ├── rawfile_request.cpp // RawfileRequest实现
-│ │ ├── rawfile_request.h // RawfileRequest类
-│ │ └── types
-│ │ └── libentry // C++接口导出
-│ │ ├── Index.d.ts
-│ │ └── oh-package.json5
-│ ├── ets // ArkTS代码区
-│ │ ├── entryability
-│ │ │ └── EntryAbility.ets // 入口类
-│ │ ├── entrybackupability
-│ │ │ └── EntryBackupAbility.ets // 备份恢复框架
-│ │ └── pages
-│ │ └── Index.ets // 主页
-│ └── resources // 应用资源文件
-```
-### 相关权限
-
-不涉及。
-
-### 依赖
-
-不涉及。
-
-### 约束与限制
-
-1. 本示例仅支持标准系统上运行,支持设备:华为手机。
-
-2. HarmonyOS系统:HarmonyOS 5.0.1 Release及以上。
-
-3. DevEco Studio版本:DevEco Studio 5.0.1 Release及以上。
-
-4. HarmonyOS SDK版本:HarmonyOS 5.0.1 Release及以上。
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/entry/hvigorfile.ts b/ArkwebSchemeHandler/entry/hvigorfile.ts
deleted file mode 100644
index c6edcd90486dd5a853cf7d34c8647f08414ca7a3..0000000000000000000000000000000000000000
--- a/ArkwebSchemeHandler/entry/hvigorfile.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { hapTasks } from '@ohos/hvigor-ohos-plugin';
-
-export default {
- system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
- plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
-}
diff --git a/ArkwebSchemeHandler/entry/oh-package.json5 b/ArkwebSchemeHandler/entry/oh-package.json5
deleted file mode 100644
index 54cb066266f9993f5a023f2ac5a8dfc5d2574643..0000000000000000000000000000000000000000
--- a/ArkwebSchemeHandler/entry/oh-package.json5
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "name": "entry",
- "version": "1.0.0",
- "description": "Please describe the basic information.",
- "main": "",
- "author": "",
- "license": "",
- "dependencies": {
- "libentry.so": "file:./src/main/cpp/types/libentry"
- }
-}
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/csp_script.js b/ArkwebSchemeHandler/entry/src/main/resources/rawfile/csp_script.js
deleted file mode 100644
index 690e53ae751bde9c8754fccea4c79de618fe88e8..0000000000000000000000000000000000000000
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/csp_script.js
+++ /dev/null
@@ -1,4 +0,0 @@
-const body = document.body;
-const element = document.createElement('div');
-element.textContent = 'csp_script.js bypass the csp rules';
-body.appendChild(element);
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/isolated_script.js b/ArkwebSchemeHandler/entry/src/main/resources/rawfile/isolated_script.js
deleted file mode 100644
index 055dc32e85df564ff62df1d2612a77a26e337374..0000000000000000000000000000000000000000
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/isolated_script.js
+++ /dev/null
@@ -1,2 +0,0 @@
-const element = document.getElementById('isolated_test');
-element.textContent = 'isolated_script.js not blocked';
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/local_script.js b/ArkwebSchemeHandler/entry/src/main/resources/rawfile/local_script.js
deleted file mode 100644
index f144ed3e745686edc5f01b797080338f52720c5e..0000000000000000000000000000000000000000
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/local_script.js
+++ /dev/null
@@ -1,2 +0,0 @@
-const element = document.getElementById('local_test');
-element.textContent = 'local_script.js not blocked.';
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/video.html b/ArkwebSchemeHandler/entry/src/main/resources/rawfile/video.html
deleted file mode 100644
index 1fe9e79502fb96ba7d1d68d89256b2f531ad5956..0000000000000000000000000000000000000000
--- a/ArkwebSchemeHandler/entry/src/main/resources/rawfile/video.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ArkwebSchemeHandler/hvigorfile.ts b/ArkwebSchemeHandler/hvigorfile.ts
deleted file mode 100644
index f3cb9f1a87a81687554a76283af8df27d8bda775..0000000000000000000000000000000000000000
--- a/ArkwebSchemeHandler/hvigorfile.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { appTasks } from '@ohos/hvigor-ohos-plugin';
-
-export default {
- system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
- plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
-}
diff --git a/ArkwebSchemeHandler/oh-package.json5 b/ArkwebSchemeHandler/oh-package.json5
deleted file mode 100644
index ac964364609c9e2e4205e46a2b0f2cbccf4e3045..0000000000000000000000000000000000000000
--- a/ArkwebSchemeHandler/oh-package.json5
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "modelVersion": "5.0.1",
- "description": "Please describe the basic information.",
- "dependencies": {
- },
- "devDependencies": {
- }
-}
diff --git a/README.md b/README.md
index a1263e2fb31efa25fa0999302597e62bc95f1f23..98edb9ddb70ba5567278a771dee8be1f843275d1 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
## 目录
-* [ArkwebSchemeHandler: 拦截Web组件发起的网络请求](ArkwebSchemeHandler)
+* [ArkWebSchemeHandler: 拦截Web组件发起的网络请求](ArkWebSchemeHandler)
## 使用说明