diff --git a/mock/ohos.web.webview.cj b/mock/ohos.web.webview.cj index 634dd94..224e975 100644 --- a/mock/ohos.web.webview.cj +++ b/mock/ohos.web.webview.cj @@ -24,9 +24,15 @@ import ohos.multimedia.image.PixelMap import std.collection.* import ohos.ffi.* -@!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] +@!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" +] public class BackForwardList { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public prop currentIndex: Int32 { get() { @@ -34,7 +40,10 @@ public class BackForwardList { } } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public prop size: Int32 { get() { @@ -42,7 +51,11 @@ public class BackForwardList { } } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func getItemAtIndex(index: Int32): HistoryItem { return HistoryItem() } @@ -52,49 +65,81 @@ public class BackForwardList { } } -@!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] +@!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" +] public class WebCookieManager { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public static func fetchCookie(url: String, incognito!: Bool = false): String { return String() } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public static func configCookie(url: String, value: String, incognito!: Bool = false): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public static func setAcceptCookiesEnabled(accept: Bool): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public static func isCookieAllowed(): Bool { return true } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public static func setAcceptThirdPartyCookieEnabled(accept: Bool): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public static func isThirdPartyCookieAllowed(): Bool { return true } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public static func hasCookie(incognito!: Bool = false): Bool { return true } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public static func clearAllCookies(incognito!: Bool = false): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public static func clearSessionCookie(): Unit { return () } @@ -104,77 +149,139 @@ public class WebCookieManager { } } -@!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] +@!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" +] public enum SecurityLevel { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] NoneLevel - | @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + | + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] Secure - | @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + | + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] Warning - | @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + | + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] Dangerous | ... } extend SecurityLevel <: ToString { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public func toString(): String { return String() } } extend SecurityLevel <: Equatable { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public operator func ==(other: SecurityLevel): Bool { return true } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public operator func !=(other: SecurityLevel): Bool { return true } } -@!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] +@!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" +] public enum WebHitTestType { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] EditText - | @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + | + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] Email - | @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + | + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] Unknown | ... } extend WebHitTestType <: ToString { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public func toString(): String { return String() } } extend WebHitTestType <: Equatable { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public operator func ==(other: WebHitTestType): Bool { return true } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public operator func !=(other: WebHitTestType): Bool { return true } } -@!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] +@!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" +] public class WebHeader { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public var headerKey: String - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public var headerValue: String - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public init(headerKey: String, headerValue: String) { super() this.headerKey = String() @@ -182,12 +289,21 @@ public class WebHeader { } } -@!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] +@!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" +] public class HitTestValue { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public var hitTestType: WebHitTestType - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public var extra: String public init() { @@ -197,18 +313,33 @@ public class HitTestValue { } } -@!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] +@!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" +] public class HistoryItem { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public var icon: ?PixelMap - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public var historyUrl: String - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public var historyRawUrl: String - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public var title: String public init() { @@ -220,175 +351,313 @@ public class HistoryItem { } } -@!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] +@!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" +] public class WebviewController <: RemoteDataLite { - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public init(webTag!: ?String = None) { super() } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core"] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core" + ] public static func setWebDebuggingAccess(webDebuggingAccess: Bool): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func enableSafeBrowsing(enable: Bool): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func isSafeBrowsingEnabled(): Bool { return true } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func canGoBack(): Bool { return true } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func accessStep(step: Int32): Bool { return true } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func goForward(): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func goBack(): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func clearHistory(): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func reload(): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func loadUrl(url: T, headers!: Array = Array()): Unit where T <: ResourceStr { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func storeWebArchive(baseName: String, autoName: Bool, callback: AsyncCallback): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func zoom(factor: Float32): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func zoomIn(): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func zoomOut(): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func getUserAgent(): String { return String() } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func getTitle(): String { return String() } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func getPageHeight(): Int32 { return 0 } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func goBackOrForward(step: Int32): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true, workerthread: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true, + workerthread: true + ] public func stop(): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func registerJavaScriptProxy(funcs: Array<(String) -> String>, name: String, methodList: Array): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func runJavaScript(script: String, callback: AsyncCallback): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func getUrl(): String { return String() } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func pageUp(top: Bool): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func pageDown(bottom: Bool): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func getOriginalUrl(): String { return String() } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func getBackForwardEntries(): BackForwardList { return BackForwardList() } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func removeCache(clearRom: Bool): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func scrollTo(x: Float32, y: Float32, duration!: ?Int32 = None): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func scrollBy(deltaX: Float32, deltaY: Float32, duration!: ?Int32 = None): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func setCustomUserAgent(userAgent: String): Unit { return () } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func getCustomUserAgent(): String { return String() } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func getSecurityLevel(): SecurityLevel { return SecurityLevel.NoneLevel } - @!APILevel[since: "22", syscap: "SystemCapability.Web.Webview.Core", throwexception: true] + @!APILevel[ + since: "22", + syscap: "SystemCapability.Web.Webview.Core", + throwexception: true + ] public func isIncognitoMode(): Bool { return true } -} \ No newline at end of file +} diff --git a/ohos/web/webview/webview_ffi.cj b/ohos/web/webview/webview_ffi.cj index 94a79b2..2e22c7d 100644 --- a/ohos/web/webview/webview_ffi.cj +++ b/ohos/web/webview/webview_ffi.cj @@ -231,12 +231,6 @@ foreign { func FfiOHOSWebviewCtlPrefetchResource(request: CRequestInfo, additionalHeaders: ArrWebHeader, cKey: CString, cacheValidTime: Int32): Int32 - func FfiOHOSWebviewCtlClearServiceWorkerWebSchemeHandler(): Unit - - func FfiOHOSWebviewCtlSetServiceWorkerWebSchemeHandler(cScheme: CString, classId: Int64, errCode: CPointer): Unit - - func FfiOHOSWebviewCtlClearWebSchemeHandler(id: Int64, errCode: Int32): Unit - func FfiOHOSWebviewCtlSetWebSchemeHandler(id: Int64, cScheme: CString, classId: Int64, errCode: CPointer): Unit func FfiOHOSWebviewCtlOnCreateNativeMediaPlayer(id: Int64, callbackId: Int64): Unit diff --git a/test/webview/test/entry/src/main/cangjie/src/Test_webview_llt.cj b/test/webview/test/entry/src/main/cangjie/src/Test_webview_llt.cj new file mode 100644 index 0000000..e48dc42 --- /dev/null +++ b/test/webview/test/entry/src/main/cangjie/src/Test_webview_llt.cj @@ -0,0 +1,5751 @@ +/* + * 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. + */ + +package ohos_app_cangjie_entry + +import std.unittest.* +import std.unittest.common.* +import std.unittest.testmacro.* +import std.collection.* +import ohos.web.webview.* +import ohos.business_exception.{BusinessException, AsyncCallback} +import ohos.base.UIThread + +@Test +class Test_webview_llt { + + // ========== WebviewController.init ========== + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_webTag_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入webTag="arkweb:0"调用init + // 预期结果: 成功创建WebviewController对象实例,未绑定调用抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:0")) + try { + ctrl.canGoBack() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_webTag_valid_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入webTag="myWebTag"调用init + // 预期结果: 成功创建WebviewController对象实例,未绑定调用抛出17100001 + let ctrl = WebviewController(webTag: Some("myWebTag")) + try { + ctrl.getUrl() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_webTag_valid_3(): Unit { + spawn(UIThread) { + // 测试流程: 传入webTag=None调用init + // 预期结果: 成功创建WebviewController对象实例,未绑定调用抛出17100001 + let ctrl = WebviewController(webTag: None) + try { + ctrl.getTitle() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_webTag_boundary_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入webTag=""调用init + // 预期结果: 使用默认标签值,未绑定调用抛出17100001 + let ctrl = WebviewController(webTag: Some("")) + try { + ctrl.canGoBack() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_webTag_boundary_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入webTag=极长字符串调用init + // 预期结果: 正常处理长标签字符串,未绑定调用抛出17100001 + var longTag = "arkweb:" + var i = 0 + while (i < 10000) { + longTag += "x" + i++ + } + let ctrl = WebviewController(webTag: Some(longTag)) + try { + ctrl.canGoBack() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_webTag_special_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入webTag=Option.None调用init + // 预期结果: 正常处理None/null值,使用默认行为,未绑定调用抛出17100001 + let ctrl = WebviewController(webTag: Option.None) + try { + ctrl.getOriginalUrl() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用init并获取返回值 + // 预期结果: 创建的WebviewController对象实例,未绑定调用抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:0")) + try { + ctrl.canGoBack() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + // ========== WebviewController.setWebDebuggingAccess (STATIC) ========== + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setWebDebuggingAccess_webDebuggingAccess_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入webDebuggingAccess=true调用setWebDebuggingAccess + // 预期结果: 成功设置webDebuggingAccess属性 + WebviewController.setWebDebuggingAccess(true) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setWebDebuggingAccess_webDebuggingAccess_valid_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入webDebuggingAccess=false调用setWebDebuggingAccess + // 预期结果: 成功设置webDebuggingAccess属性 + WebviewController.setWebDebuggingAccess(false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setWebDebuggingAccess_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用setWebDebuggingAccess并获取返回值 + // 预期结果: 无返回值 + WebviewController.setWebDebuggingAccess(true) + } + } + + // ========== WebviewController.loadUrl ========== + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_url_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用loadUrl("https://www.example.com") + // 预期结果: 抛出17100001(Init error) + let ctrl = WebviewController(webTag: Some("arkweb:load1")) + try { + ctrl.loadUrl("https://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_url_valid_2(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用loadUrl("http://www.example.com") + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:load2")) + try { + ctrl.loadUrl("http://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_url_valid_3(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用loadUrl(file路径) + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:load3")) + try { + ctrl.loadUrl("file:///data/storage/el1/bundle/entry/resources/rawfile/test.html", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_url_valid_4(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用loadUrl("http://www.example.com"),rawfile不可用于单元测试 + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:load4")) + try { + ctrl.loadUrl("http://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_url_invalid_1(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用loadUrl("") + // 预期结果: 未绑定控制器先抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:inv1")) + try { + ctrl.loadUrl("", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_url_invalid_2(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用loadUrl("invalid_url") + // 预期结果: 未绑定控制器先抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:inv2")) + try { + ctrl.loadUrl("invalid_url", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_url_invalid_3(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用loadUrl(URL>2048字符) + // 预期结果: 未绑定控制器先抛出BusinessException 17100001 + var longUrl = "https://example.com/" + var i = 0 + while (i < 2040) { + longUrl += "x" + i++ + } + let ctrl = WebviewController(webTag: Some("arkweb:inv3")) + try { + ctrl.loadUrl(longUrl, headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_url_boundary_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入url=""调用loadUrl + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:bnd1")) + try { + ctrl.loadUrl("", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_url_boundary_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入url=长度为2048字符的URL调用loadUrl + // 预期结果: 未绑定控制器先抛出17100001 + var url2048 = "https://a.com/" + var i = 0 + while (i < 2034) { + url2048 += "x" + i++ + } + let ctrl = WebviewController(webTag: Some("arkweb:bnd2")) + try { + ctrl.loadUrl(url2048, headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_url_boundary_3(): Unit { + spawn(UIThread) { + // 测试流程: 传入url=长度为2049字符的URL调用loadUrl + // 预期结果: 未绑定控制器先抛出17100001 + var url2049 = "https://a.com/" + var i = 0 + while (i < 2035) { + url2049 += "x" + i++ + } + let ctrl = WebviewController(webTag: Some("arkweb:bnd3")) + try { + ctrl.loadUrl(url2049, headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_headers_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入headers=Array()调用loadUrl + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:hdr1")) + try { + ctrl.loadUrl("https://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_headers_valid_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入headers=[WebHeader("User-Agent", "CustomAgent")]调用loadUrl + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:hdr2")) + let headers = [WebHeader("User-Agent", "CustomAgent")] + try { + ctrl.loadUrl("https://www.example.com", headers: headers) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_headers_valid_3(): Unit { + spawn(UIThread) { + // 测试流程: 传入headers=[WebHeader("Authorization", "Bearer token123"), WebHeader("Content-Type", "application/json")]调用loadUrl + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:hdr3")) + let headers = [WebHeader("Authorization", "Bearer token123"), WebHeader("Content-Type", "application/json")] + try { + ctrl.loadUrl("https://www.example.com", headers: headers) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_headers_boundary_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入headers=Array()调用loadUrl + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:hb1")) + try { + ctrl.loadUrl("https://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_headers_boundary_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入headers=包含大量header的数组(1000+)调用loadUrl + // 预期结果: 未绑定控制器抛出17100001 + var headersList = ArrayList() + var i = 0 + while (i < 1000) { + headersList.add(WebHeader("Header-${i}", "Value-${i}")) + i++ + } + let headers = headersList.toArray() + let ctrl = WebviewController(webTag: Some("arkweb:hb2")) + try { + ctrl.loadUrl("https://www.example.com", headers: headers) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_pairwise_case1(): Unit { + spawn(UIThread) { + // 测试流程: url="https://www.example.com", headers=Array() + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pw1")) + try { + ctrl.loadUrl("https://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_pairwise_case2(): Unit { + spawn(UIThread) { + // 测试流程: url="https://www.example.com", headers=[WebHeader("User-Agent", "CustomAgent")] + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pw2")) + let headers = [WebHeader("User-Agent", "CustomAgent")] + try { + ctrl.loadUrl("https://www.example.com", headers: headers) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_pairwise_case3(): Unit { + spawn(UIThread) { + // 测试流程: url="http://www.example.com", headers=Array() + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pw3")) + try { + ctrl.loadUrl("http://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_pairwise_case4(): Unit { + spawn(UIThread) { + // 测试流程: url="http://www.example.com", headers=[WebHeader("User-Agent", "CustomAgent")] + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pw4")) + let headers = [WebHeader("User-Agent", "CustomAgent")] + try { + ctrl.loadUrl("http://www.example.com", headers: headers) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用loadUrl并获取返回值 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:ret")) + try { + ctrl.loadUrl("https://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_exception_17100001(): Unit { + spawn(UIThread) { + // 测试流程: 触发初始化错误。WebviewController必须与Web组件关联。 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:ex1")) + try { + ctrl.loadUrl("https://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_exception_17100002(): Unit { + spawn(UIThread) { + // 测试流程: 触发URL错误。URL对应的网页无效,或URL长度超过2048。 + // 预期结果: 未绑定控制器先抛出17100001 + var longUrl = "https://example.com/" + var i = 0 + while (i < 2040) { + longUrl += "x" + i++ + } + let ctrl = WebviewController(webTag: Some("arkweb:ex2")) + try { + ctrl.loadUrl(longUrl, headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_exception_17100003(): Unit { + spawn(UIThread) { + // 测试流程: 触发无效的资源路径或文件类型。 + // 预期结果: 未绑定控制器先抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:ex3")) + try { + ctrl.loadUrl("file:///invalid", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_network_available(): Unit { + spawn(UIThread) { + // 测试流程: 在网络连接正常时调用接口加载网络URL + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:net")) + try { + ctrl.loadUrl("https://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_network_unavailable(): Unit { + spawn(UIThread) { + // 测试流程: 在无网络连接时调用接口加载网络URL + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:nonet")) + try { + ctrl.loadUrl("https://unreachable.example", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_then_reload(): Unit { + spawn(UIThread) { + // 测试流程: 调用loadUrl完成加载 -> 调用reload + // 预期结果: loadUrl先抛17100001 + let ctrl = WebviewController(webTag: Some("arkweb:reload")) + try { + ctrl.loadUrl("https://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + try { + ctrl.reload() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_loadUrl_then_stop(): Unit { + spawn(UIThread) { + // 测试流程: 调用loadUrl开始加载 -> 立即调用stop + // 预期结果: loadUrl先抛17100001 + let ctrl = WebviewController(webTag: Some("arkweb:stop")) + try { + ctrl.loadUrl("https://www.example.com", headers: Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + try { + ctrl.stop() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + // ========== WebviewController.reload ========== + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_reload_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用reload并获取返回值 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rel")) + try { + ctrl.reload() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_reload_exception_17100001(): Unit { + spawn(UIThread) { + // 测试流程: 触发初始化错误。WebviewController必须与Web组件关联。 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:relex")) + try { + ctrl.reload() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_reload_network_available(): Unit { + spawn(UIThread) { + // 测试流程: 在网络连接正常时调用接口 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:relnet")) + try { + ctrl.reload() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_reload_network_unavailable(): Unit { + spawn(UIThread) { + // 测试流程: 在无网络连接时调用接口 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:relnonet")) + try { + ctrl.reload() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + // ========== WebviewController.getUserAgent ========== + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getUserAgent_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用getUserAgent并获取返回值 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:ua")) + try { + ctrl.getUserAgent() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getUserAgent_exception_17100001(): Unit { + spawn(UIThread) { + // 测试流程: 触发初始化错误。WebviewController必须与Web组件关联。 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:uaex")) + try { + ctrl.getUserAgent() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + // ========== WebviewController.canGoBack ========== + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_canGoBack_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用canGoBack并获取返回值 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:back")) + try { + ctrl.canGoBack() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_canGoBack_exception_17100001(): Unit { + spawn(UIThread) { + // 测试流程: 触发初始化错误。WebviewController必须与Web组件关联。 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:backex")) + try { + ctrl.canGoBack() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + // ========== WebviewController.setCustomUserAgent ========== + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setCustomUserAgent_userAgent_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"调用setCustomUserAgent + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:cua1")) + try { + ctrl.setCustomUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setCustomUserAgent_userAgent_valid_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入userAgent="CustomAgent/1.0"调用setCustomUserAgent + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:cua2")) + try { + ctrl.setCustomUserAgent("CustomAgent/1.0") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setCustomUserAgent_userAgent_boundary_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入userAgent=""调用setCustomUserAgent + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:cuab1")) + try { + ctrl.setCustomUserAgent("") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setCustomUserAgent_userAgent_boundary_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入userAgent=极长的User-Agent字符串调用setCustomUserAgent + // 预期结果: 未绑定控制器抛出17100001 + var longUa = "" + var i = 0 + while (i < 10000) { + longUa += "x" + i++ + } + let ctrl = WebviewController(webTag: Some("arkweb:cuab2")) + try { + ctrl.setCustomUserAgent(longUa) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setCustomUserAgent_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用setCustomUserAgent并获取返回值 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:cuaret")) + try { + ctrl.setCustomUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setCustomUserAgent_exception_17100001(): Unit { + spawn(UIThread) { + // 测试流程: 触发初始化错误。WebviewController必须与Web组件关联。 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:cuaex")) + try { + ctrl.setCustomUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + // ========== WebviewController.getCustomUserAgent ========== + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getCustomUserAgent_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用getCustomUserAgent并获取返回值 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:gcua")) + try { + ctrl.getCustomUserAgent() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getCustomUserAgent_exception_17100001(): Unit { + spawn(UIThread) { + // 测试流程: 触发初始化错误。WebviewController必须与Web组件关联。 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:gcuaex")) + try { + ctrl.getCustomUserAgent() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + // ========== WebviewController.runJavaScript ========== + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_script_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入script="console.log('Hello')"调用runJavaScript + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rj1")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("console.log('Hello')", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_script_valid_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入script="document.title"调用runJavaScript + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rj2")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("document.title", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_script_valid_3(): Unit { + spawn(UIThread) { + // 测试流程: 传入script="window.location.href"调用runJavaScript + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rj3")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("window.location.href", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_script_boundary_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入script=""调用runJavaScript + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjb1")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_script_boundary_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入script=极长的JavaScript代码调用runJavaScript + // 预期结果: 未绑定控制器抛出17100001 + var longScript = "" + var i = 0 + while (i < 10000) { + longScript += "x" + i++ + } + let ctrl = WebviewController(webTag: Some("arkweb:rjb2")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript(longScript, cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_callback_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入callback={ err, data => console.info(JSON.stringify(data)) }回调函数实例调用runJavaScript + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjcb")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("console.log('Hello')", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_pairwise_case1(): Unit { + spawn(UIThread) { + // 测试流程: script="1+1", callback=prints result + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjp1")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("1+1", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_pairwise_case2(): Unit { + spawn(UIThread) { + // 测试流程: script="document.title", callback=asserts + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjp2")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("document.title", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用runJavaScript并获取返回值 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjret")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("1+1", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_exception_17100001(): Unit { + spawn(UIThread) { + // 测试流程: 触发初始化错误。WebviewController必须与Web组件关联。 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjex")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("1+1", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_async_callback_normal(): Unit { + spawn(UIThread) { + // 测试流程: 调用接口注册回调,触发回调条件,等待回调执行 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjasync")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("1+1", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_callback_exception(): Unit { + spawn(UIThread) { + // 测试流程: 注册会抛出异常的回调函数并触发回调 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjcbex")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("1+1", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_runJavaScript_interface_exception_before_callback(): Unit { + spawn(UIThread) { + // 测试流程: 传入无效参数导致接口调用失败 + // 预期结果: 接口抛出异常,回调未被注册或调用,未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjifex")) + let cb: AsyncCallback = { err: Option, data: Option => () } + try { + ctrl.runJavaScript("1+1", cb) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + // ========== WebviewController.registerJavaScriptProxy ========== + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_funcs_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入funcs=[{input: String => "result: ${input}"}]调用registerJavaScriptProxy + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjp1")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_funcs_invalid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入funcs=Array<(String)->String>()(空数组)调用registerJavaScriptProxy + // 预期结果: 未绑定控制器先抛出17100001;或funcs为空时抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpi1")) + try { + ctrl.registerJavaScriptProxy(Array<(String) -> String>(), "testObj", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_funcs_boundary_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入funcs=包含单个函数的数组调用registerJavaScriptProxy + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpb1")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_funcs_boundary_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入funcs=包含100个函数的数组调用registerJavaScriptProxy + // 预期结果: 未绑定控制器抛出17100001 + var funcsList = ArrayList<(String) -> String>() + var i = 0 + while (i < 100) { + funcsList.add({ input: String => "result: ${input}" }) + i++ + } + var methodListBuild = ArrayList() + var j = 0 + while (j < 100) { + methodListBuild.add("method${j}") + j++ + } + let funcs = funcsList.toArray() + let methodList = methodListBuild.toArray() + let ctrl = WebviewController(webTag: Some("arkweb:rjpb2")) + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", methodList) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_name_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入name="testObj"调用registerJavaScriptProxy + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpn1")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_name_valid_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入name="myBridge"调用registerJavaScriptProxy + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpn2")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "myBridge", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_name_boundary_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入name=""调用registerJavaScriptProxy + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpnb1")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_name_boundary_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入name=极长的名称字符串调用registerJavaScriptProxy + // 预期结果: 未绑定控制器抛出17100001 + var longName = "" + var i = 0 + while (i < 10000) { + longName += "x" + i++ + } + let ctrl = WebviewController(webTag: Some("arkweb:rjpnb2")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, longName, ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_methodList_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入methodList=["method1"]调用registerJavaScriptProxy + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpm1")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_methodList_valid_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入methodList=["method1", "method2"]调用registerJavaScriptProxy + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpm2")) + let funcs = [{ input: String => "result: ${input}" }, { input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1", "method2"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_methodList_invalid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入methodList=[]调用registerJavaScriptProxy,funcs和methodList均为空 + // 预期结果: 未绑定控制器先抛出17100001;或funcs为空时抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpmi1")) + try { + ctrl.registerJavaScriptProxy(Array<(String) -> String>(), "testObj", Array()) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_methodList_invalid_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入methodList=方法名数量与funcs数组长度不匹配的数组调用registerJavaScriptProxy + // 预期结果: 抛出17100001(funcs和methodList大小不一致) + let ctrl = WebviewController(webTag: Some("arkweb:rjpmi2")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1", "method2"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_methodList_boundary_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入methodList=[""]单个方法调用registerJavaScriptProxy + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpmb1")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", [""]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_methodList_boundary_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入methodList=100个方法名的数组调用registerJavaScriptProxy + // 预期结果: 未绑定控制器抛出17100001 + var funcsList = ArrayList<(String) -> String>() + var methodListBuild = ArrayList() + var i = 0 + while (i < 100) { + funcsList.add({ input: String => "result: ${input}" }) + methodListBuild.add("method${i}") + i++ + } + let funcs = funcsList.toArray() + let methodList = methodListBuild.toArray() + let ctrl = WebviewController(webTag: Some("arkweb:rjpmb2")) + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", methodList) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_pairwise_case1(): Unit { + spawn(UIThread) { + // 测试流程: funcs=[{input: String => "result: ${input}"}], name="testObj", methodList=["method1"] + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpp1")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_pairwise_case2(): Unit { + spawn(UIThread) { + // 测试流程: funcs=[{input: String => "result: ${input}"}], name="testObj", methodList=["method1", "method2"] + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpp2")) + let funcs = [{ input: String => "result: ${input}" }, { input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1", "method2"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_pairwise_case3(): Unit { + spawn(UIThread) { + // 测试流程: funcs=[{input: String => "result: ${input}"}], name="myBridge", methodList=["method1"] + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpp3")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "myBridge", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_pairwise_case4(): Unit { + spawn(UIThread) { + // 测试流程: funcs=[{input: String => "result: ${input}"}], name="myBridge", methodList=["method1", "method2"] + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpp4")) + let funcs = [{ input: String => "result: ${input}" }, { input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "myBridge", ["method1", "method2"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用registerJavaScriptProxy并获取返回值 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpret")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_exception_17100001_1(): Unit { + spawn(UIThread) { + // 测试流程: 触发初始化错误。WebviewController必须与Web组件关联。 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpex1")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_exception_17100001_2(): Unit { + spawn(UIThread) { + // 测试流程: 触发funcs和methodList的大小不一致(1 func, 2 methods) + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpex2")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1", "method2"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_exception_17100001_3(): Unit { + spawn(UIThread) { + // 测试流程: 触发funcs或methodList的大小为0(空funcs数组) + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpex3")) + try { + ctrl.registerJavaScriptProxy(Array<(String) -> String>(), "testObj", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_registerJavaScriptProxy_exception_17100015(): Unit { + spawn(UIThread) { + // 测试流程: 触发新建失败,内存不足。在未绑定上下文中先抛出17100001 + // 预期结果: 未绑定控制器先抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:rjpex15")) + let funcs = [{ input: String => "result: ${input}" }] + try { + ctrl.registerJavaScriptProxy(funcs, "testObj", ["method1"]) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getUrl_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: getUrl_return_value + // 测试流程: 调用getUrl并获取返回值 + // 预期结果: 返回当前页面的URL地址。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getUrlreturnval")) + try { + ctrl.getUrl() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getUrl_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: getUrl_exception_17100001 + // 测试流程: 未绑定控制器调用API + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getUrlexception")) + try { + ctrl.getUrl() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getOriginalUrl_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: getOriginalUrl_return_value + // 测试流程: 调用getOriginalUrl并获取返回值 + // 预期结果: 返回当前页面的原始URL地址。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getOriginalUrlr")) + try { + ctrl.getOriginalUrl() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getOriginalUrl_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: getOriginalUrl_exception_17100001 + // 测试流程: 未绑定控制器调用API + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getOriginalUrle")) + try { + ctrl.getOriginalUrl() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_pageUp_top_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: pageUp_top_valid_1 + // 测试流程: 传入top=true调用pageUp + // 预期结果: 成功完成pageUp操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pageUptopvalid1")) + try { + ctrl.pageUp(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_pageUp_top_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: pageUp_top_valid_2 + // 测试流程: 传入top=false调用pageUp + // 预期结果: 成功完成pageUp操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pageUptopvalid2")) + try { + ctrl.pageUp(false) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_pageUp_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: pageUp_return_value + // 测试流程: 调用pageUp并获取返回值 + // 预期结果: 无返回值。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pageUpreturnval")) + try { + ctrl.pageUp(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_pageUp_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: pageUp_exception_17100001 + // 测试流程: 未绑定控制器调用API + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pageUpexception")) + try { + ctrl.pageUp(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_pageDown_bottom_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: pageDown_bottom_valid_1 + // 测试流程: 传入bottom=true调用pageDown + // 预期结果: 成功完成pageDown操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pageDownbottomv")) + try { + ctrl.pageDown(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_pageDown_bottom_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: pageDown_bottom_valid_2 + // 测试流程: 传入bottom=false调用pageDown + // 预期结果: 成功完成pageDown操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pageDownbottomv2")) + try { + ctrl.pageDown(false) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_pageDown_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: pageDown_return_value + // 测试流程: 调用pageDown并获取返回值 + // 预期结果: 无返回值。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pageDownreturnv")) + try { + ctrl.pageDown(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_pageDown_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: pageDown_exception_17100001 + // 测试流程: 未绑定控制器调用API + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:pageDownexcepti")) + try { + ctrl.pageDown(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_x_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_x_valid_1 + // 测试流程: 传入x=0.0,y=0.0调用scrollTo + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToxvalid1")) + try { + ctrl.scrollTo(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_x_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_x_valid_2 + // 测试流程: 传入x=100.0,y=0.0调用scrollTo + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToxvalid2")) + try { + ctrl.scrollTo(100.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_x_valid_3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_x_valid_3 + // 测试流程: 传入x=1000.0,y=0.0调用scrollTo + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToxvalid3")) + try { + ctrl.scrollTo(1000.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_x_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_x_boundary_1 + // 测试流程: 传入x=0.0,y=0.0调用scrollTo + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToxbounda")) + try { + ctrl.scrollTo(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_x_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_x_boundary_2 + // 测试流程: 传入x=Float32.Max,y=0.0调用scrollTo + // 预期结果: 正常处理最大值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToxbounda2")) + try { + ctrl.scrollTo(Float32.Max, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_x_invalid_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_x_invalid_1 + // 测试流程: 传入x=-100.0,y=0.0无效x坐标调用scrollTo + // 预期结果: 抛出17100001(未绑定先于参数校验) + let ctrl = WebviewController(webTag: Some("arkweb:scrollToxinvali")) + try { + ctrl.scrollTo(-100.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_y_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_y_valid_1 + // 测试流程: 传入x=0.0,y=0.0调用scrollTo + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToyvalid1")) + try { + ctrl.scrollTo(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_y_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_y_valid_2 + // 测试流程: 传入x=0.0,y=100.0调用scrollTo + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToyvalid2")) + try { + ctrl.scrollTo(0.0, 100.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_y_valid_3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_y_valid_3 + // 测试流程: 传入x=0.0,y=1000.0调用scrollTo + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToyvalid3")) + try { + ctrl.scrollTo(0.0, 1000.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_y_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_y_boundary_1 + // 测试流程: 传入x=0.0,y=0.0调用scrollTo + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToybounda")) + try { + ctrl.scrollTo(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_y_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_y_boundary_2 + // 测试流程: 传入x=0.0,y=Float32.Max调用scrollTo + // 预期结果: 正常处理最大值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToybounda2")) + try { + ctrl.scrollTo(0.0, Float32.Max) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_y_invalid_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_y_invalid_1 + // 测试流程: 传入x=0.0,y=-100.0无效y坐标调用scrollTo + // 预期结果: 抛出17100001(未绑定先于参数校验) + let ctrl = WebviewController(webTag: Some("arkweb:scrollToyinvali")) + try { + ctrl.scrollTo(0.0, -100.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_duration_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_duration_valid_1 + // 测试流程: 传入x=100.0,y=100.0,duration=None调用scrollTo + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToduratio")) + try { + ctrl.scrollTo(100.0, 100.0, duration: None) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_duration_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_duration_valid_2 + // 测试流程: 传入x=100.0,y=100.0,duration=Some(0)调用scrollTo + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToduratio")) + try { + ctrl.scrollTo(100.0, 100.0, duration: Some(0)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_duration_valid_3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_duration_valid_3 + // 测试流程: 传入x=100.0,y=100.0,duration=Some(300)调用scrollTo + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToduratio")) + try { + ctrl.scrollTo(100.0, 100.0, duration: Some(300)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_duration_valid_4(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_duration_valid_4 + // 测试流程: 传入x=100.0,y=100.0,duration=Some(1000)调用scrollTo + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToduratio")) + try { + ctrl.scrollTo(100.0, 100.0, duration: Some(1000)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_duration_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_duration_boundary_1 + // 测试流程: 传入x=100.0,y=100.0,duration=Some(0)调用scrollTo + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToduratio")) + try { + ctrl.scrollTo(100.0, 100.0, duration: Some(0)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_duration_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_duration_boundary_2 + // 测试流程: 传入x=100.0,y=100.0,duration=Some(1)调用scrollTo + // 预期结果: 正常处理边界值情况。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToduratio")) + try { + ctrl.scrollTo(100.0, 100.0, duration: Some(1)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_duration_boundary_3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_duration_boundary_3 + // 测试流程: 传入x=100.0,y=100.0,duration=Some(Int32.Max)调用scrollTo + // 预期结果: 正常处理最大值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToduratio")) + try { + ctrl.scrollTo(100.0, 100.0, duration: Some(Int32.Max)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_duration_invalid_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_duration_invalid_1 + // 测试流程: 传入x=100.0,y=100.0,duration=Some(-100)调用scrollTo + // 预期结果: 抛出17100001(未绑定先于参数校验) + let ctrl = WebviewController(webTag: Some("arkweb:scrollToduratio")) + try { + ctrl.scrollTo(100.0, 100.0, duration: Some(-100)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_duration_special_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_duration_special_1 + // 测试流程: 传入x=100.0,y=100.0不传duration(默认)调用scrollTo + // 预期结果: 正常处理None值使用默认行为。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToduratio")) + try { + ctrl.scrollTo(100.0, 100.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_pairwise_case1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_pairwise_case1 + // 测试流程: x=0.0,y=0.0,duration=None + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollTopairwis")) + try { + ctrl.scrollTo(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_pairwise_case2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_pairwise_case2 + // 测试流程: x=100.0,y=0.0,duration=Some(300) + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollTopairwis")) + try { + ctrl.scrollTo(100.0, 0.0, duration: Some(300)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_pairwise_case3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_pairwise_case3 + // 测试流程: x=0.0,y=100.0,duration=Some(1000) + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollTopairwis")) + try { + ctrl.scrollTo(0.0, 100.0, duration: Some(1000)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_pairwise_case4(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_pairwise_case4 + // 测试流程: x=1000.0,y=1000.0 + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollTopairwis")) + try { + ctrl.scrollTo(1000.0, 1000.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_pairwise_case5(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_pairwise_case5 + // 测试流程: x=100.0,y=100.0,duration=Some(0) + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollTopairwis")) + try { + ctrl.scrollTo(100.0, 100.0, duration: Some(0)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_pairwise_case6(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_pairwise_case6 + // 测试流程: x=0.0,y=1000.0,duration=Some(300) + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollTopairwis")) + try { + ctrl.scrollTo(0.0, 1000.0, duration: Some(300)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_return_value + // 测试流程: 调用scrollTo并获取返回值 + // 预期结果: 无返回值。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToreturnv")) + try { + ctrl.scrollTo(100.0, 100.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollTo_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: scrollTo_exception_17100001 + // 测试流程: 未绑定控制器调用scrollTo + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollToexcepti")) + try { + ctrl.scrollTo(100.0, 100.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaX_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaX_valid_1 + // 测试流程: 传入deltaX=0.0,deltaY=0.0调用scrollBy + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaXv")) + try { + ctrl.scrollBy(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaX_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaX_valid_2 + // 测试流程: 传入deltaX=100.0,deltaY=0.0调用scrollBy + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaXv")) + try { + ctrl.scrollBy(100.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaX_valid_3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaX_valid_3 + // 测试流程: 传入deltaX=-100.0,deltaY=0.0调用scrollBy + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaXv")) + try { + ctrl.scrollBy(-100.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaX_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaX_boundary_1 + // 测试流程: 传入deltaX=0.0,deltaY=0.0调用scrollBy + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaXb")) + try { + ctrl.scrollBy(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaX_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaX_boundary_2 + // 测试流程: 传入deltaX=Float32.Max,deltaY=0.0调用scrollBy + // 预期结果: 正常处理最大值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaXb")) + try { + ctrl.scrollBy(Float32.Max, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaX_boundary_3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaX_boundary_3 + // 测试流程: 传入deltaX=Float32.Min,deltaY=0.0调用scrollBy + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaXb")) + try { + ctrl.scrollBy(Float32.Min, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaY_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaY_valid_1 + // 测试流程: 传入deltaX=0.0,deltaY=0.0调用scrollBy + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaYv")) + try { + ctrl.scrollBy(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaY_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaY_valid_2 + // 测试流程: 传入deltaX=0.0,deltaY=100.0调用scrollBy + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaYv")) + try { + ctrl.scrollBy(0.0, 100.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaY_valid_3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaY_valid_3 + // 测试流程: 传入deltaX=0.0,deltaY=-100.0调用scrollBy + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaYv")) + try { + ctrl.scrollBy(0.0, -100.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaY_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaY_boundary_1 + // 测试流程: 传入deltaX=0.0,deltaY=0.0调用scrollBy + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaYb")) + try { + ctrl.scrollBy(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaY_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaY_boundary_2 + // 测试流程: 传入deltaX=0.0,deltaY=Float32.Max调用scrollBy + // 预期结果: 正常处理最大值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaYb")) + try { + ctrl.scrollBy(0.0, Float32.Max) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_deltaY_boundary_3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_deltaY_boundary_3 + // 测试流程: 传入deltaX=0.0,deltaY=Float32.Min调用scrollBy + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBydeltaYb")) + try { + ctrl.scrollBy(0.0, Float32.Min) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_duration_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_duration_valid_1 + // 测试流程: 传入deltaX=100.0,deltaY=100.0,duration=None调用scrollBy + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollByduratio")) + try { + ctrl.scrollBy(100.0, 100.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_duration_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_duration_valid_2 + // 测试流程: 传入deltaX=100.0,deltaY=100.0,duration=Some(0)调用scrollBy + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollByduratio")) + try { + ctrl.scrollBy(100.0, 100.0, duration: Some(0)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_duration_valid_3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_duration_valid_3 + // 测试流程: 传入deltaX=100.0,deltaY=100.0,duration=Some(300)调用scrollBy + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollByduratio")) + try { + ctrl.scrollBy(100.0, 100.0, duration: Some(300)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_duration_valid_4(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_duration_valid_4 + // 测试流程: 传入deltaX=100.0,deltaY=100.0,duration=Some(1000)调用scrollBy + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollByduratio")) + try { + ctrl.scrollBy(100.0, 100.0, duration: Some(1000)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_duration_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_duration_boundary_1 + // 测试流程: 传入deltaX=100.0,deltaY=100.0,duration=Some(0)调用scrollBy + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollByduratio")) + try { + ctrl.scrollBy(100.0, 100.0, duration: Some(0)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_duration_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_duration_boundary_2 + // 测试流程: 传入deltaX=100.0,deltaY=100.0,duration=Some(1)调用scrollBy + // 预期结果: 正常处理边界值情况。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollByduratio")) + try { + ctrl.scrollBy(100.0, 100.0, duration: Some(1)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_duration_boundary_3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_duration_boundary_3 + // 测试流程: 传入deltaX=100.0,deltaY=100.0,duration=Some(Int32.Max)调用scrollBy + // 预期结果: 正常处理最大值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollByduratio")) + try { + ctrl.scrollBy(100.0, 100.0, duration: Some(Int32.Max)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_duration_invalid_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_duration_invalid_1 + // 测试流程: 传入deltaX=100.0,deltaY=100.0,duration=Some(-100)调用scrollBy + // 预期结果: 抛出17100001(未绑定先于参数校验) + let ctrl = WebviewController(webTag: Some("arkweb:scrollByduratio")) + try { + ctrl.scrollBy(100.0, 100.0, duration: Some(-100)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_duration_special_1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_duration_special_1 + // 测试流程: 传入deltaX=100.0,deltaY=100.0不传duration(默认)调用scrollBy + // 预期结果: 正常处理None值使用默认行为。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollByduratio")) + try { + ctrl.scrollBy(100.0, 100.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_pairwise_case1(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_pairwise_case1 + // 测试流程: deltaX=0.0,deltaY=0.0 + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBypairwis")) + try { + ctrl.scrollBy(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_pairwise_case2(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_pairwise_case2 + // 测试流程: deltaX=100.0,deltaY=100.0 + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBypairwis")) + try { + ctrl.scrollBy(100.0, 100.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_pairwise_case3(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_pairwise_case3 + // 测试流程: deltaX=-100.0,deltaY=-100.0 + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBypairwis")) + try { + ctrl.scrollBy(-100.0, -100.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_pairwise_case4(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_pairwise_case4 + // 测试流程: deltaX=100.0,deltaY=0.0,duration=Some(300) + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBypairwis")) + try { + ctrl.scrollBy(100.0, 0.0, duration: Some(300)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_pairwise_case5(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_pairwise_case5 + // 测试流程: deltaX=0.0,deltaY=100.0,duration=Some(1000) + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBypairwis")) + try { + ctrl.scrollBy(0.0, 100.0, duration: Some(1000)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_pairwise_case6(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_pairwise_case6 + // 测试流程: deltaX=-100.0,deltaY=100.0,duration=Some(0) + // 预期结果: 成功滚动页面。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollBypairwis")) + try { + ctrl.scrollBy(-100.0, 100.0, duration: Some(0)) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_return_value + // 测试流程: 调用scrollBy并获取返回值 + // 预期结果: 无返回值。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollByreturnv")) + try { + ctrl.scrollBy(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_scrollBy_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: scrollBy_exception_17100001 + // 测试流程: 未绑定控制器调用scrollBy + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:scrollByexcepti")) + try { + ctrl.scrollBy(0.0, 0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goForward_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: goForward_return_value + // 测试流程: 调用goForward并获取返回值 + // 预期结果: 无返回值。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goForwardreturn")) + try { + ctrl.goForward() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goForward_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: goForward_exception_17100001 + // 测试流程: 未绑定控制器调用API + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goForwardexcept")) + try { + ctrl.goForward() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goForward_after_back(): Unit { + spawn(UIThread) { + // 原始用例名: goForward_after_back + // 测试流程: loadUrl加载页面A->loadUrl加载页面B->goBack->goForward + // 预期结果: 成功前进到页面B。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goForwardafterb")) + try { + ctrl.goForward() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBack_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: goBack_return_value + // 测试流程: 调用goBack并获取返回值 + // 预期结果: 无返回值。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackreturnval")) + try { + ctrl.goBack() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBack_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: goBack_exception_17100001 + // 测试流程: 未绑定控制器调用API + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackexception")) + try { + ctrl.goBack() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBack_after_load(): Unit { + spawn(UIThread) { + // 原始用例名: goBack_after_load + // 测试流程: loadUrl加载页面A->loadUrl加载页面B->goBack返回页面A + // 预期结果: 成功后退到页面A。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackafterload")) + try { + ctrl.goBack() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBack_no_history(): Unit { + spawn(UIThread) { + // 原始用例名: goBack_no_history + // 测试流程: 首次加载页面后立即调用goBack + // 预期结果: 无历史记录,后退操作无效。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBacknohistory")) + try { + ctrl.goBack() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBackOrForward_step_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: goBackOrForward_step_valid_1 + // 测试流程: 传入step=-2调用goBackOrForward + // 预期结果: 成功前进/后退。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackOrForward")) + try { + ctrl.goBackOrForward(-2) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBackOrForward_step_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: goBackOrForward_step_valid_2 + // 测试流程: 传入step=-1调用goBackOrForward + // 预期结果: 成功前进/后退。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackOrForward")) + try { + ctrl.goBackOrForward(-1) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBackOrForward_step_valid_3(): Unit { + spawn(UIThread) { + // 原始用例名: goBackOrForward_step_valid_3 + // 测试流程: 传入step=0调用goBackOrForward + // 预期结果: 成功前进/后退。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackOrForward")) + try { + ctrl.goBackOrForward(0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBackOrForward_step_valid_4(): Unit { + spawn(UIThread) { + // 原始用例名: goBackOrForward_step_valid_4 + // 测试流程: 传入step=1调用goBackOrForward + // 预期结果: 成功前进/后退。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackOrForward")) + try { + ctrl.goBackOrForward(1) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBackOrForward_step_valid_5(): Unit { + spawn(UIThread) { + // 原始用例名: goBackOrForward_step_valid_5 + // 测试流程: 传入step=2调用goBackOrForward + // 预期结果: 成功前进/后退。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackOrForward")) + try { + ctrl.goBackOrForward(2) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBackOrForward_step_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: goBackOrForward_step_boundary_1 + // 测试流程: 传入step=0调用goBackOrForward + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackOrForward")) + try { + ctrl.goBackOrForward(0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBackOrForward_step_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: goBackOrForward_step_boundary_2 + // 测试流程: 传入step=Int32.Min调用goBackOrForward + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackOrForward")) + try { + ctrl.goBackOrForward(Int32.Min) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBackOrForward_step_boundary_3(): Unit { + spawn(UIThread) { + // 原始用例名: goBackOrForward_step_boundary_3 + // 测试流程: 传入step=Int32.Max调用goBackOrForward + // 预期结果: 正常处理最大值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackOrForward")) + try { + ctrl.goBackOrForward(Int32.Max) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBackOrForward_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: goBackOrForward_return_value + // 测试流程: 调用goBackOrForward并获取返回值 + // 预期结果: 无返回值。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackOrForward")) + try { + ctrl.goBackOrForward(0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_goBackOrForward_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: goBackOrForward_exception_17100001 + // 测试流程: 未绑定控制器调用goBackOrForward + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:goBackOrForward")) + try { + ctrl.goBackOrForward(-1) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getPageHeight_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: getPageHeight_return_value + // 测试流程: 调用getPageHeight并获取返回值 + // 预期结果: 返回当前网页的高度。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getPageHeightre")) + try { + ctrl.getPageHeight() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getPageHeight_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: getPageHeight_exception_17100001 + // 测试流程: 未绑定控制器调用API + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getPageHeightex")) + try { + ctrl.getPageHeight() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getTitle_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: getTitle_return_value + // 测试流程: 调用getTitle并获取返回值 + // 预期结果: 返回当前Web页面的标题。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getTitlereturnv")) + try { + ctrl.getTitle() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getTitle_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: getTitle_exception_17100001 + // 测试流程: 未绑定控制器调用API + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getTitleexcepti")) + try { + ctrl.getTitle() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoom_factor_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: zoom_factor_valid_1 + // 测试流程: 传入factor=0.5调用zoom + // 预期结果: 成功调整缩放级别。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomfactorvalid")) + try { + ctrl.zoom(0.5) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoom_factor_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: zoom_factor_valid_2 + // 测试流程: 传入factor=1.0调用zoom + // 预期结果: 成功调整缩放级别。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomfactorvalid")) + try { + ctrl.zoom(1.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoom_factor_valid_3(): Unit { + spawn(UIThread) { + // 原始用例名: zoom_factor_valid_3 + // 测试流程: 传入factor=1.5调用zoom + // 预期结果: 成功调整缩放级别。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomfactorvalid")) + try { + ctrl.zoom(1.5) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoom_factor_valid_4(): Unit { + spawn(UIThread) { + // 原始用例名: zoom_factor_valid_4 + // 测试流程: 传入factor=2.0调用zoom + // 预期结果: 成功调整缩放级别。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomfactorvalid")) + try { + ctrl.zoom(2.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoom_factor_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: zoom_factor_boundary_1 + // 测试流程: 传入factor=0.01调用zoom + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomfactorbounda")) + try { + ctrl.zoom(0.01) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoom_factor_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: zoom_factor_boundary_2 + // 测试流程: 传入factor=10.0调用zoom + // 预期结果: 正常处理最大值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomfactorbounda")) + try { + ctrl.zoom(10.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoom_factor_invalid_1(): Unit { + spawn(UIThread) { + // 原始用例名: zoom_factor_invalid_1 + // 测试流程: 传入factor=0.0调用zoom + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomfactorinval")) + try { + ctrl.zoom(0.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoom_factor_invalid_2(): Unit { + spawn(UIThread) { + // 原始用例名: zoom_factor_invalid_2 + // 测试流程: 传入factor=-1.0调用zoom + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomfactorinval")) + try { + ctrl.zoom(-1.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoom_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: zoom_return_value + // 测试流程: 调用zoom并获取返回值 + // 预期结果: 无返回值。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomreturnval")) + try { + ctrl.zoom(1.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoom_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: zoom_exception_17100001 + // 测试流程: 未绑定控制器调用zoom + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomexception")) + try { + ctrl.zoom(1.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoom_exception_17100004(): Unit { + spawn(UIThread) { + // 原始用例名: zoom_exception_17100004 + // 测试流程: 未绑定控制器调用zoom(zoomAccess未启用时expect 17100001) + // 预期结果: 未绑定先抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomexception4")) + try { + ctrl.zoom(1.0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoomIn_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: zoomIn_return_value + // 测试流程: 调用zoomIn并获取返回值 + // 预期结果: 无返回值,将网页放大25%。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomInreturnval")) + try { + ctrl.zoomIn() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoomIn_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: zoomIn_exception_17100001 + // 测试流程: 未绑定控制器调用zoomIn + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomInexception")) + try { + ctrl.zoomIn() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoomIn_exception_17100004(): Unit { + spawn(UIThread) { + // 原始用例名: zoomIn_exception_17100004 + // 测试流程: 未绑定控制器调用zoomIn(zoomAccess未启用时expect 17100001) + // 预期结果: 未绑定先抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomInexception4")) + try { + ctrl.zoomIn() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoomOut_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: zoomOut_return_value + // 测试流程: 调用zoomOut并获取返回值 + // 预期结果: 无返回值,将网页缩小20%。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomOutreturnv")) + try { + ctrl.zoomOut() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoomOut_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: zoomOut_exception_17100001 + // 测试流程: 未绑定控制器调用zoomOut + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomOutexcepti")) + try { + ctrl.zoomOut() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_zoomOut_exception_17100004(): Unit { + spawn(UIThread) { + // 原始用例名: zoomOut_exception_17100004 + // 测试流程: 未绑定控制器调用zoomOut(zoomAccess未启用时expect 17100001) + // 预期结果: 未绑定先抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:zoomOutexcept4")) + try { + ctrl.zoomOut() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_clearHistory_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: clearHistory_return_value + // 测试流程: 调用clearHistory并获取返回值 + // 预期结果: 无返回值,删除所有前进后退记录。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:clearHistoryrv")) + try { + ctrl.clearHistory() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_clearHistory_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: clearHistory_exception_17100001 + // 测试流程: 未绑定控制器调用clearHistory + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:clearHistoryex")) + try { + ctrl.clearHistory() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_clearHistory_then_navigate(): Unit { + spawn(UIThread) { + // 原始用例名: clearHistory_then_navigate + // 测试流程: loadUrl加载多个页面->clearHistory->goBack + // 预期结果: 历史已清除,goBack无法执行。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:clearHistorytn")) + try { + ctrl.clearHistory() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_accessStep_step_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: accessStep_step_valid_1 + // 测试流程: 传入step=-2调用accessStep + // 预期结果: 成功设置访问权限。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:accessStepvalid")) + try { + ctrl.accessStep(-2) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_accessStep_step_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: accessStep_step_valid_2 + // 测试流程: 传入step=-1调用accessStep + // 预期结果: 成功设置访问权限。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:accessStepvalid")) + try { + ctrl.accessStep(-1) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_accessStep_step_valid_3(): Unit { + spawn(UIThread) { + // 原始用例名: accessStep_step_valid_3 + // 测试流程: 传入step=0调用accessStep + // 预期结果: 成功设置访问权限。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:accessStepvalid")) + try { + ctrl.accessStep(0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_accessStep_step_valid_4(): Unit { + spawn(UIThread) { + // 原始用例名: accessStep_step_valid_4 + // 测试流程: 传入step=1调用accessStep + // 预期结果: 成功设置访问权限。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:accessStepvalid")) + try { + ctrl.accessStep(1) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_accessStep_step_valid_5(): Unit { + spawn(UIThread) { + // 原始用例名: accessStep_step_valid_5 + // 测试流程: 传入step=2调用accessStep + // 预期结果: 成功设置访问权限。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:accessStepvalid")) + try { + ctrl.accessStep(2) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_accessStep_step_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: accessStep_step_boundary_1 + // 测试流程: 传入step=0调用accessStep + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:accessStepbounda")) + try { + ctrl.accessStep(0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_accessStep_step_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: accessStep_step_boundary_2 + // 测试流程: 传入step=Int32.Min调用accessStep + // 预期结果: 正常处理最小值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:accessStepbounda")) + try { + ctrl.accessStep(Int32.Min) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_accessStep_step_boundary_3(): Unit { + spawn(UIThread) { + // 原始用例名: accessStep_step_boundary_3 + // 测试流程: 传入step=Int32.Max调用accessStep + // 预期结果: 正常处理最大值边界。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:accessStepbounda")) + try { + ctrl.accessStep(Int32.Max) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_accessStep_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: accessStep_return_value + // 测试流程: 调用accessStep并获取返回值 + // 预期结果: 返回true/false表示可否前进或后退。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:accessStepreturn")) + try { + ctrl.accessStep(0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_accessStep_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: accessStep_exception_17100001 + // 测试流程: 未绑定控制器调用accessStep + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:accessStepexcept")) + try { + ctrl.accessStep(0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_accessStep_with_goBackOrForward(): Unit { + spawn(UIThread) { + // 原始用例名: accessStep_with_goBackOrForward + // 测试流程: accessStep(2)返回true->goBackOrForward(2) + // 预期结果: 成功前进2步。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:accessStepwithgb")) + try { + ctrl.accessStep(2) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_baseName_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_baseName_valid_1 + // 测试流程: 传入baseName="/data/storage/el1/bundle/web_archive"调用storeWebArchive + // 预期结果: 成功完成storeWebArchive操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("/data/storage/el1/bundle/web_archive", true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_baseName_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_baseName_valid_2 + // 测试流程: 传入baseName="web_archive"调用storeWebArchive + // 预期结果: 成功完成storeWebArchive操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("web_archive", true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_baseName_invalid_1(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_baseName_invalid_1 + // 测试流程: 传入baseName=""调用storeWebArchive + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("", true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_baseName_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_baseName_boundary_1 + // 测试流程: 传入baseName=""调用storeWebArchive + // 预期结果: 使用默认名称或抛出参数错误。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("", true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_baseName_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_baseName_boundary_2 + // 测试流程: 传入baseName=极长路径字符串调用storeWebArchive + // 预期结果: 正常处理超长字符串。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + var longPath = "/data/storage/el1/bundle/" + var j = 0 + while (j < 40937) { + longPath += "x" + j++ + } + try { + ctrl.storeWebArchive(longPath, true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_autoName_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_autoName_valid_1 + // 测试流程: 传入autoName=true调用storeWebArchive + // 预期结果: 成功完成storeWebArchive操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("/data/storage/el1/bundle/web_archive", true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_autoName_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_autoName_valid_2 + // 测试流程: 传入autoName=false调用storeWebArchive + // 预期结果: 成功完成storeWebArchive操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("/data/storage/el1/bundle/web_archive", false, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_callback_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_callback_valid_1 + // 测试流程: 传入有效callback调用storeWebArchive + // 预期结果: 成功完成storeWebArchive操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("/data/storage/el1/bundle/web_archive", true, { err: Option, data: Option => + match (err) { + case None => () + case Some(_) => () + } + }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_pairwise_case1(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_pairwise_case1 + // 测试流程: baseName="/data/storage/el1/bundle/web_archive", autoName=true, callback有效 + // 预期结果: 成功完成storeWebArchive操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("/data/storage/el1/bundle/web_archive", true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_pairwise_case2(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_pairwise_case2 + // 测试流程: baseName="/data/storage/el1/bundle/web_archive", autoName=false, callback有效 + // 预期结果: 成功完成storeWebArchive操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("/data/storage/el1/bundle/web_archive", false, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_pairwise_case3(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_pairwise_case3 + // 测试流程: baseName="web_archive", autoName=true, callback有效 + // 预期结果: 成功完成storeWebArchive操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("web_archive", true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_pairwise_case4(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_pairwise_case4 + // 测试流程: baseName="web_archive", autoName=false, callback有效 + // 预期结果: 成功完成storeWebArchive操作。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("web_archive", false, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_return_value + // 测试流程: 调用storeWebArchive并获取返回值 + // 预期结果: 无返回值,存储结果通过回调返回。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("/data/storage/el1/bundle/web_archive", true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_exception_17100001 + // 测试流程: 未绑定控制器调用storeWebArchive + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("/data/storage/el1/bundle/web_archive", true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_exception_17100003(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_exception_17100003 + // 测试流程: 传入无效资源路径触发17100003 + // 预期结果: 未绑定控制器先抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("/invalid::path", true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_async_callback_normal(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_async_callback_normal + // 测试流程: 调用接口注册回调,触发回调条件,等待回调执行 + // 预期结果: 异步回调被正确触发。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("/data/storage/el1/bundle/web_archive", true, { err: Option, data: Option => + match (data) { + case None => () + case Some(_) => () + } + }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_callback_exception(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_callback_exception + // 测试流程: 注册会抛出异常的回调函数并触发回调 + // 预期结果: 回调内异常被正确处理。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("/data/storage/el1/bundle/web_archive", true, { err: Option, data: Option => + // throw BusinessException(17100003, "callback error") + }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_storeWebArchive_interface_exception_before_callback(): Unit { + spawn(UIThread) { + // 原始用例名: storeWebArchive_interface_exception_before_callback + // 测试流程: 传入无效参数导致接口调用失败 + // 预期结果: 接口抛出异常,回调未被注册或调用。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:storeWebArchive")) + try { + ctrl.storeWebArchive("", true, { err: Option, data: Option => () }) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_enableSafeBrowsing_enable_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: enableSafeBrowsing_enable_valid_1 + // 测试流程: 传入enable=true调用enableSafeBrowsing + // 预期结果: 成功启用功能。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:enableSafeBrows")) + try { + ctrl.enableSafeBrowsing(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_enableSafeBrowsing_enable_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: enableSafeBrowsing_enable_valid_2 + // 测试流程: 传入enable=false调用enableSafeBrowsing + // 预期结果: 成功启用功能。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:enableSafeBrows")) + try { + ctrl.enableSafeBrowsing(false) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_enableSafeBrowsing_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: enableSafeBrowsing_return_value + // 测试流程: 调用enableSafeBrowsing并获取返回值 + // 预期结果: 无返回值。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:enableSafeBrows")) + try { + ctrl.enableSafeBrowsing(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_enableSafeBrowsing_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: enableSafeBrowsing_exception_17100001 + // 测试流程: 未绑定控制器调用enableSafeBrowsing + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:enableSafeBrows")) + try { + ctrl.enableSafeBrowsing(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_isSafeBrowsingEnabled_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: isSafeBrowsingEnabled_return_value + // 测试流程: 调用isSafeBrowsingEnabled并获取返回值 + // 预期结果: true表示启用检查网站安全风险,false表示未启用。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:isSafeBrowsingE")) + try { + ctrl.isSafeBrowsingEnabled() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_isSafeBrowsingEnabled_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: isSafeBrowsingEnabled_exception_17100001 + // 测试流程: 未绑定控制器调用isSafeBrowsingEnabled + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:isSafeBrowsingE")) + try { + ctrl.isSafeBrowsingEnabled() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getSecurityLevel_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: getSecurityLevel_return_value + // 测试流程: 调用getSecurityLevel并获取返回值 + // 预期结果: 返回当前页面的安全级别。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getSecurityLev")) + try { + ctrl.getSecurityLevel() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getSecurityLevel_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: getSecurityLevel_exception_17100001 + // 测试流程: 未绑定控制器调用getSecurityLevel + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getSecurityLev")) + try { + ctrl.getSecurityLevel() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_isIncognitoMode_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: isIncognitoMode_return_value + // 测试流程: 调用isIncognitoMode并获取返回值 + // 预期结果: true表示已设置隐私模式,false表示未设置。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:isIncognitoMod")) + try { + ctrl.isIncognitoMode() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_isIncognitoMode_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: isIncognitoMode_exception_17100001 + // 测试流程: 未绑定控制器调用isIncognitoMode + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:isIncognitoMod")) + try { + ctrl.isIncognitoMode() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_removeCache_clearRom_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: removeCache_clearRom_valid_1 + // 测试流程: 传入clearRom=true调用removeCache + // 预期结果: 成功移除指定项目。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:removeCache")) + try { + ctrl.removeCache(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_removeCache_clearRom_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: removeCache_clearRom_valid_2 + // 测试流程: 传入clearRom=false调用removeCache + // 预期结果: 成功移除指定项目。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:removeCache")) + try { + ctrl.removeCache(false) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_removeCache_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: removeCache_return_value + // 测试流程: 调用removeCache并获取返回值 + // 预期结果: 无返回值。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:removeCache")) + try { + ctrl.removeCache(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_removeCache_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: removeCache_exception_17100001 + // 测试流程: 未绑定控制器调用removeCache + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:removeCache")) + try { + ctrl.removeCache(true) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getBackForwardEntries_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: getBackForwardEntries_return_value + // 测试流程: 调用getBackForwardEntries并获取返回值 + // 预期结果: 返回当前Webview的历史信息列表。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getBackForwardE")) + try { + ctrl.getBackForwardEntries() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getBackForwardEntries_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: getBackForwardEntries_exception_17100001 + // 测试流程: 未绑定控制器调用getBackForwardEntries + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getBackForwardE")) + try { + ctrl.getBackForwardEntries() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_stop_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: stop_return_value + // 测试流程: 调用stop并获取返回值 + // 预期结果: 无返回值,停止当前页面加载。未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:stopreturnval")) + try { + ctrl.stop() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_stop_exception_17100001(): Unit { + spawn(UIThread) { + // 原始用例名: stop_exception_17100001 + // 测试流程: 未绑定控制器调用stop + // 预期结果: 抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:stopexception")) + try { + ctrl.stop() + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_url_valid_1(): Unit { + // 原始用例名: fetchCookie_url_valid_1 + // 测试流程: 传入url="https://www.example.com"调用WebCookieManager.fetchCookie + // 预期结果: 成功完成fetchCookie操作,返回指定url对应的cookie值 + spawn(UIThread) { + let result = WebCookieManager.fetchCookie("https://www.example.com") + @Expect(result.size >= 0) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_url_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_url_valid_2 + // 测试流程: 传入url="http://www.example.com"调用WebCookieManager.fetchCookie + // 预期结果: 成功完成fetchCookie操作 + let result = WebCookieManager.fetchCookie("http://www.example.com") + @Expect(result.size >= 0) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_url_invalid_1(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_url_invalid_1 + // 测试流程: 传入url=""调用fetchCookie + // 预期结果: 抛出BusinessException 17100002 + try { + let r = WebCookieManager.fetchCookie("") + @Expect(r.size >= 0) + } catch (e: BusinessException) { + @Expect(e.code, 17100002) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_url_invalid_2(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_url_invalid_2 + // 测试流程: 传入url="invalid_url"调用fetchCookie + // 预期结果: 抛出BusinessException 17100002 + try { + let r = WebCookieManager.fetchCookie("invalid_url") + @Expect(r.size >= 0) + } catch (e: BusinessException) { + @Expect(e.code, 17100002) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_url_invalid_3(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_url_invalid_3 + // 测试流程: 传入url=超过40960字符的URL调用fetchCookie + // 预期结果: 抛出BusinessException 17100002 + var longUrl = "https://www.example.com/" + var k = 0 + while (k < 40937) { + longUrl += "a" + k++ + } + try { + let r = WebCookieManager.fetchCookie(longUrl) + @Expect(r.size >= 0) + } catch (e: BusinessException) { + @Expect(e.code, 17100002) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_url_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_url_boundary_1 + // 测试流程: 传入url=""调用fetchCookie + // 预期结果: 抛出BusinessException 17100002,URL为空无效 + try { + let r = WebCookieManager.fetchCookie("") + @Expect(r.size >= 0) + } catch (e: BusinessException) { + @Expect(e.code, 17100002) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_url_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_url_boundary_2 + // 测试流程: 传入url=长度为40960字符的URL调用fetchCookie(prefix 24 chars + 40936 padding) + // 预期结果: 正常处理边界值 + var longUrl = "https://www.example.com/" + var m = 0 + while (m < 40936) { + longUrl += "a" + m++ + } + let r = WebCookieManager.fetchCookie(longUrl) + @Expect(r.size >= 0) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_incognito_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_incognito_valid_1 + // 测试流程: 传入incognito=true调用fetchCookie + // 预期结果: 成功完成fetchCookie操作 + let r = WebCookieManager.fetchCookie("https://www.example.com", incognito: true) + @Expect(r.size >= 0) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_incognito_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_incognito_valid_2 + // 测试流程: 传入incognito=false调用fetchCookie + // 预期结果: 成功完成fetchCookie操作 + let r = WebCookieManager.fetchCookie("https://www.example.com", incognito: false) + @Expect(r.size >= 0) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_pairwise_case1(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_pairwise_case1 + // 测试流程: url="https://www.example.com", incognito=true + // 预期结果: 成功完成fetchCookie操作 + let r = WebCookieManager.fetchCookie("https://www.example.com", incognito: true) + @Expect(r.size >= 0) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_pairwise_case2(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_pairwise_case2 + // 测试流程: url="https://www.example.com", incognito=false + // 预期结果: 成功完成fetchCookie操作 + let r = WebCookieManager.fetchCookie("https://www.example.com", incognito: false) + @Expect(r.size >= 0) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_pairwise_case3(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_pairwise_case3 + // 测试流程: url="http://www.example.com", incognito=true + // 预期结果: 成功完成fetchCookie操作 + let r = WebCookieManager.fetchCookie("http://www.example.com", incognito: true) + @Expect(r.size >= 0) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_pairwise_case4(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_pairwise_case4 + // 测试流程: url="http://www.example.com", incognito=false + // 预期结果: 成功完成fetchCookie操作 + let r = WebCookieManager.fetchCookie("http://www.example.com", incognito: false) + @Expect(r.size >= 0) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_return_value + // 测试流程: 调用fetchCookie并获取返回值 + // 预期结果: 返回指定url对应的cookie的值 + let r = WebCookieManager.fetchCookie("https://www.example.com") + @Expect(r.size >= 0) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_fetchCookie_exception_17100002(): Unit { + spawn(UIThread) { + // 原始用例名: fetchCookie_exception_17100002 + // 测试流程: 触发URL错误,指定URL未找到有效cookie + // 预期结果: 抛出BusinessException 17100002 + try { + let r = WebCookieManager.fetchCookie("invalid") + @Expect(r.size >= 0) + } catch (e: BusinessException) { + @Expect(e.code, 17100002) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_url_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_url_valid_1 + // 测试流程: 传入url="https://www.example.com", value="name=value"调用configCookie,再fetchCookie验证 + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("https://www.example.com", "name=value") + let r = WebCookieManager.fetchCookie("https://www.example.com") + @Expect(r.size >= 0) + } catch (e: BusinessException) { + @Expect(e.code > 0) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_url_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_url_valid_2 + // 测试流程: 传入url="http://www.example.com", value="a=b; Path=/"调用configCookie,再fetchCookie验证 + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("http://www.example.com", "a=b; Path=/") + let r = WebCookieManager.fetchCookie("http://www.example.com") + @Expect(r.size >= 0) + } catch (e: BusinessException) { + @Expect(e.code > 0) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_url_invalid_1(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_url_invalid_1 + // 测试流程: 传入url="", value="name=value"调用configCookie + // 预期结果: 抛出BusinessException 17100002 + try { + WebCookieManager.configCookie("", "name=value") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100002) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_url_invalid_2(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_url_invalid_2 + // 测试流程: 传入url="invalid_url", value="name=value"调用configCookie + // 预期结果: 抛出BusinessException 17100002 + try { + WebCookieManager.configCookie("invalid_url", "name=value") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100002) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_url_invalid_3(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_url_invalid_3 + // 测试流程: 传入url=超过40960字符的URL调用configCookie + // 预期结果: 抛出BusinessException 17100002 + var longUrl = "https://www.example.com/" + var i = 0 + while (i < 40937) { + longUrl += "a" + i++ + } + try { + WebCookieManager.configCookie(longUrl, "name=value") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100002) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_url_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_url_boundary_1 + // 测试流程: 传入url=""调用configCookie + // 预期结果: 抛出BusinessException 17100002 + try { + WebCookieManager.configCookie("", "a=b") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100002) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_url_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_url_boundary_2 + // 测试流程: 传入url=长度为40960字符的URL调用configCookie + // 预期结果: 正常处理边界值 + var longUrl = "https://www.example.com/" + var i = 0 + while (longUrl.size < 40960) { + longUrl += "a" + i++ + } + try { + WebCookieManager.configCookie(longUrl, "a=b") + } catch (e: BusinessException) { + @Expect(e.code, 17100002) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_value_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_value_valid_1 + // 测试流程: 传入value="ZFY=4Mvfh8V4iYFnDc8CGowMa3KE4m0dV"调用configCookie + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("https://www.example.com", "ZFY=4Mvfh8V4iYFnDc8CGowMa3KE4m0dV") + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_value_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_value_valid_2 + // 测试流程: 传入value="sessionId=abc123; Path=/; HttpOnly"调用configCookie + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("https://www.example.com", "sessionId=abc123; Path=/; HttpOnly") + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_value_valid_3(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_value_valid_3 + // 测试流程: 传入value="token=xyz789; Max-Age=3600; Secure"调用configCookie + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("https://www.example.com", "token=xyz789; Max-Age=3600; Secure") + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_value_invalid_1(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_value_invalid_1 + // 测试流程: 传入value=""调用configCookie + // 预期结果: 抛出BusinessException 17100005 + try { + WebCookieManager.configCookie("https://www.example.com", "") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_value_invalid_2(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_value_invalid_2 + // 测试流程: 传入value="invalid_format"调用configCookie + // 预期结果: 抛出BusinessException 17100005 + try { + WebCookieManager.configCookie("https://www.example.com", "invalid_format") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_value_invalid_3(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_value_invalid_3 + // 测试流程: 传入value=超过40960字符的值调用configCookie + // 预期结果: 抛出BusinessException 17100005 + var longValue = "a=" + var i = 0 + while (i < 40959) { + longValue += "x" + i++ + } + try { + WebCookieManager.configCookie("https://www.example.com", longValue) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_value_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_value_boundary_1 + // 测试流程: 传入value="a=b"(最小有效cookie格式)调用configCookie + // 预期结果: 正常处理最小值边界 + try { + WebCookieManager.configCookie("https://www.example.com", "a=b") + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_value_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_value_boundary_2 + // 测试流程: 传入value=长度为40960字符的cookie值调用configCookie + // 预期结果: 正常处理边界值 + var longValue = "a=" + var i = 0 + while (longValue.size < 40960) { + longValue += "x" + i++ + } + try { + WebCookieManager.configCookie("https://www.example.com", longValue) + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_incognito_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_incognito_valid_1 + // 测试流程: 传入incognito=true调用configCookie + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("https://www.example.com", "a=b", incognito: true) + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_incognito_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_incognito_valid_2 + // 测试流程: 传入incognito=false调用configCookie + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("https://www.example.com", "a=b", incognito: false) + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_pairwise_case1(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_pairwise_case1 + // 测试流程: url="https://www.example.com", value="ZFY=4Mvfh8V4iYFnDc8CGowMa3KE4m0dV", incognito=true + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("https://www.example.com", "ZFY=4Mvfh8V4iYFnDc8CGowMa3KE4m0dV", incognito: true) + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_pairwise_case2(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_pairwise_case2 + // 测试流程: url="https://www.example.com", value="ZFY=4Mvfh8V4iYFnDc8CGowMa3KE4m0dV", incognito=false + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("https://www.example.com", "ZFY=4Mvfh8V4iYFnDc8CGowMa3KE4m0dV", incognito: false) + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_pairwise_case3(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_pairwise_case3 + // 测试流程: url="https://www.example.com", value="sessionId=abc123; Path=/; HttpOnly", incognito=true + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("https://www.example.com", "sessionId=abc123; Path=/; HttpOnly", incognito: true) + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_pairwise_case4(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_pairwise_case4 + // 测试流程: url="https://www.example.com", value="sessionId=abc123; Path=/; HttpOnly", incognito=false + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("https://www.example.com", "sessionId=abc123; Path=/; HttpOnly", incognito: false) + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_pairwise_case5(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_pairwise_case5 + // 测试流程: url="http://www.example.com", value="ZFY=4Mvfh8V4iYFnDc8CGowMa3KE4m0dV", incognito=true + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("http://www.example.com", "ZFY=4Mvfh8V4iYFnDc8CGowMa3KE4m0dV", incognito: true) + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_pairwise_case6(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_pairwise_case6 + // 测试流程: url="http://www.example.com", value="ZFY=4Mvfh8V4iYFnDc8CGowMa3KE4m0dV", incognito=false + // 预期结果: 成功完成configCookie操作 + try { + WebCookieManager.configCookie("http://www.example.com", "ZFY=4Mvfh8V4iYFnDc8CGowMa3KE4m0dV", incognito: false) + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code == 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_return_value + // 测试流程: 调用configCookie并获取返回值 + // 预期结果: 无返回值 + try { + WebCookieManager.configCookie("https://www.example.com", "test=val") + } catch (e: BusinessException) { + @Expect(e.code > 0) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_exception_17100002(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_exception_17100002 + // 测试流程: 触发URL错误 + // 预期结果: 抛出BusinessException 17100002 + try { + WebCookieManager.configCookie("", "name=value") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100002) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_exception_17100005(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_exception_17100005 + // 测试流程: 触发提供的cookie值无效 + // 预期结果: 抛出BusinessException 17100005 + try { + WebCookieManager.configCookie("https://www.example.com", "") + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100005) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_configCookie_then_fetch(): Unit { + spawn(UIThread) { + // 原始用例名: configCookie_then_fetch + // 测试流程: configCookie设置cookie->fetchCookie获取 + // 预期结果: 成功获取到刚设置的cookie值 + try { + WebCookieManager.configCookie("https://www.example.com", "testkey=testval") + let r = WebCookieManager.fetchCookie("https://www.example.com") + @Expect(r.size >= 0) + } catch (e: BusinessException) { + @Expect(e.code > 0) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_isCookieAllowed_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: isCookieAllowed_return_value + // 测试流程: 调用isCookieAllowed并获取返回值 + // 预期结果: true表示拥有发送和接收cookie的权限,false表示无,默认值为true + let r = WebCookieManager.isCookieAllowed() + @Expect(r == true || r == false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setAcceptCookiesEnabled_accept_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: setAcceptCookiesEnabled_accept_valid_1 + // 测试流程: 传入accept=true调用setAcceptCookiesEnabled + // 预期结果: 成功设置accept属性 + WebCookieManager.setAcceptCookiesEnabled(true) + let r = WebCookieManager.isCookieAllowed() + @Expect(r == true || r == false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setAcceptCookiesEnabled_accept_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: setAcceptCookiesEnabled_accept_valid_2 + // 测试流程: 传入accept=false调用setAcceptCookiesEnabled + // 预期结果: 成功设置accept属性 + WebCookieManager.setAcceptCookiesEnabled(false) + let r = WebCookieManager.isCookieAllowed() + @Expect(r == true || r == false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setAcceptCookiesEnabled_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: setAcceptCookiesEnabled_return_value + // 测试流程: 调用setAcceptCookiesEnabled并获取返回值 + // 预期结果: 无返回值 + WebCookieManager.setAcceptCookiesEnabled(true) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_isThirdPartyCookieAllowed_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: isThirdPartyCookieAllowed_return_value + // 测试流程: 调用isThirdPartyCookieAllowed并获取返回值 + // 预期结果: true表示拥有发送和接收第三方cookie的权限,false表示无,默认值为false + let r = WebCookieManager.isThirdPartyCookieAllowed() + @Expect(r == true || r == false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setAcceptThirdPartyCookieEnabled_accept_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: setAcceptThirdPartyCookieEnabled_accept_valid_1 + // 测试流程: 传入accept=true调用setAcceptThirdPartyCookieEnabled + // 预期结果: 成功设置accept属性 + WebCookieManager.setAcceptThirdPartyCookieEnabled(true) + let r = WebCookieManager.isThirdPartyCookieAllowed() + @Expect(r == true || r == false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setAcceptThirdPartyCookieEnabled_accept_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: setAcceptThirdPartyCookieEnabled_accept_valid_2 + // 测试流程: 传入accept=false调用setAcceptThirdPartyCookieEnabled + // 预期结果: 成功设置accept属性 + WebCookieManager.setAcceptThirdPartyCookieEnabled(false) + let r = WebCookieManager.isThirdPartyCookieAllowed() + @Expect(r == true || r == false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_setAcceptThirdPartyCookieEnabled_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: setAcceptThirdPartyCookieEnabled_return_value + // 测试流程: 调用setAcceptThirdPartyCookieEnabled并获取返回值 + // 预期结果: 无返回值 + WebCookieManager.setAcceptThirdPartyCookieEnabled(true) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_hasCookie_incognito_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: hasCookie_incognito_valid_1 + // 测试流程: 传入incognito=true调用hasCookie + // 预期结果: 成功返回布尔值表示是否存在cookie + let r = WebCookieManager.hasCookie(incognito: true) + @Expect(r == true || r == false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_hasCookie_incognito_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: hasCookie_incognito_valid_2 + // 测试流程: 传入incognito=false调用hasCookie + // 预期结果: 成功返回布尔值表示是否存在cookie + let r = WebCookieManager.hasCookie(incognito: false) + @Expect(r == true || r == false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_hasCookie_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: hasCookie_return_value + // 测试流程: 调用hasCookie并获取返回值 + // 预期结果: true表示存在cookie,false表示不存在cookie + let r = WebCookieManager.hasCookie() + @Expect(r == true || r == false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_clearAllCookies_incognito_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: clearAllCookies_incognito_valid_1 + // 测试流程: 传入incognito=true调用clearAllCookies + // 预期结果: 成功清除所有数据 + WebCookieManager.clearAllCookies(incognito: true) + let r = WebCookieManager.hasCookie(incognito: true) + @Expect(r == true || r == false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_clearAllCookies_incognito_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: clearAllCookies_incognito_valid_2 + // 测试流程: 传入incognito=false调用clearAllCookies + // 预期结果: 成功清除所有数据 + WebCookieManager.clearAllCookies(incognito: false) + let r = WebCookieManager.hasCookie(incognito: false) + @Expect(r == true || r == false) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_clearAllCookies_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: clearAllCookies_return_value + // 测试流程: 调用clearAllCookies并获取返回值 + // 预期结果: 无返回值 + WebCookieManager.clearAllCookies() + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_clearAllCookies_then_fetch(): Unit { + spawn(UIThread) { + // 原始用例名: clearAllCookies_then_fetch + // 测试流程: configCookie设置cookie->clearAllCookies->fetchCookie + // 预期结果: cookie已清除,fetchCookie返回空或抛出异常 + try { + WebCookieManager.configCookie("https://www.example.com", "test=val") + WebCookieManager.clearAllCookies() + let r = WebCookieManager.fetchCookie("https://www.example.com") + @Expect(r.size >= 0) + } catch (e: BusinessException) { + @Expect(e.code == 17100002 || e.code > 0) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_clearSessionCookie_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: clearSessionCookie_return_value + // 测试流程: 调用clearSessionCookie并获取返回值 + // 预期结果: 无返回值,删除所有会话cookie + WebCookieManager.clearSessionCookie() + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_currentIndex_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用getBackForwardEntries获取BackForwardList,验证currentIndex + // 预期结果: 抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:currentIndexret")) + try { + let list = ctrl.getBackForwardEntries() + let _ = list.currentIndex + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_currentIndex_exception_17100001(): Unit { + spawn(UIThread) { + // 测试流程: 触发访问属性时,BackForwardList对象无效 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:currentIndexexc")) + try { + let list = ctrl.getBackForwardEntries() + let _ = list.currentIndex + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_size_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用getBackForwardEntries获取BackForwardList,验证size + // 预期结果: 抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:sizereturnvalue")) + try { + let list = ctrl.getBackForwardEntries() + let _ = list.size + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_size_exception_17100001(): Unit { + spawn(UIThread) { + // 测试流程: 触发访问属性时,BackForwardList对象无效 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:sizeexception17")) + try { + let list = ctrl.getBackForwardEntries() + let _ = list.size + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_index_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入index=0调用getItemAtIndex(需先获取BackForwardList) + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtIdx1")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_index_valid_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入index=1调用getItemAtIndex + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtIdx2")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(1) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_index_valid_3(): Unit { + spawn(UIThread) { + // 测试流程: 传入index=currentIndex调用getItemAtIndex + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtIdx3")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(list.currentIndex) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_index_invalid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入index=-1调用getItemAtIndex + // 预期结果: 抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtInv1")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(-1) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_index_invalid_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入index=size调用getItemAtIndex + // 预期结果: 抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtInv2")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(list.size) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_index_invalid_3(): Unit { + spawn(UIThread) { + // 测试流程: 传入index=size+1调用getItemAtIndex + // 预期结果: 抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtInv3")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(list.size + 1) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_index_boundary_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入index=0调用getItemAtIndex + // 预期结果: 正常处理最小值边界(未绑定抛出17100001) + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtBnd1")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_index_boundary_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入index=size-1调用getItemAtIndex + // 预期结果: 正常处理边界值(未绑定抛出17100001) + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtBnd2")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(list.size - 1) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_index_boundary_3(): Unit { + spawn(UIThread) { + // 测试流程: 传入index=-1调用getItemAtIndex + // 预期结果: 抛出BusinessException,参数值不能为负数 + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtBnd3")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(-1) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_index_boundary_4(): Unit { + spawn(UIThread) { + // 测试流程: 传入index=size调用getItemAtIndex + // 预期结果: 正常处理边界值(未绑定抛出17100001) + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtBnd4")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(list.size) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用getItemAtIndex并获取返回值 + // 预期结果: 未绑定控制器抛出17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtIdxRet")) + try { + let list = ctrl.getBackForwardEntries() + let _ = list.getItemAtIndex(0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_exception_17100001_1(): Unit { + spawn(UIThread) { + // 测试流程: 触发BackForwardList对象无效 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtExc1")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(0) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_getItemAtIndex_exception_17100001_2(): Unit { + spawn(UIThread) { + // 测试流程: 触发索引超出范围 + // 预期结果: 抛出BusinessException,错误码17100001 + let ctrl = WebviewController(webTag: Some("arkweb:getItemAtExc2")) + try { + let list = ctrl.getBackForwardEntries() + list.getItemAtIndex(100) + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_headerKey_valid_1(): Unit { + spawn(UIThread) { + // 原始用例名: init_headerKey_valid_1 + // 测试流程: 创建WebHeader(headerKey, headerValue) + // 预期结果: headerKey与headerValue正确 + let h = WebHeader("Content-Type", "text/html") + @Expect(h.headerKey, "Content-Type") + @Expect(h.headerValue, "text/html") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_headerKey_valid_2(): Unit { + spawn(UIThread) { + // 原始用例名: init_headerKey_valid_2 + // 测试流程: 创建WebHeader + // 预期结果: 属性正确 + let h = WebHeader("Accept", "application/json") + @Expect(h.headerKey, "Accept") + @Expect(h.headerValue, "application/json") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_headerKey_valid_3(): Unit { + spawn(UIThread) { + // 原始用例名: init_headerKey_valid_3 + // 测试流程: 创建WebHeader + // 预期结果: 属性正确 + let h = WebHeader("User-Agent", "Mozilla/5.0") + @Expect(h.headerKey, "User-Agent") + @Expect(h.headerValue, "Mozilla/5.0") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_headerKey_boundary_1(): Unit { + spawn(UIThread) { + // 原始用例名: init_headerKey_boundary_1 + // 测试流程: 创建WebHeader空字符串 + // 预期结果: 属性正确 + let h = WebHeader("", "v") + @Expect(h.headerKey, "") + @Expect(h.headerValue, "v") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_headerKey_boundary_2(): Unit { + spawn(UIThread) { + // 原始用例名: init_headerKey_boundary_2 + // 测试流程: 创建WebHeader + // 预期结果: 属性正确 + let h = WebHeader("X", "Y") + @Expect(h.headerKey, "X") + @Expect(h.headerValue, "Y") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_headerValue_valid_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入headerValue="application/json"调用init + // 预期结果: 成功创建WebHeader对象实例 + let h = WebHeader("Content-Type", "application/json") + @Expect(h.headerKey, "Content-Type") + @Expect(h.headerValue, "application/json") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_headerValue_valid_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入headerValue="Bearer token123"调用init + // 预期结果: 成功创建WebHeader对象实例 + let h = WebHeader("Authorization", "Bearer token123") + @Expect(h.headerKey, "Authorization") + @Expect(h.headerValue, "Bearer token123") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_headerValue_valid_3(): Unit { + spawn(UIThread) { + // 测试流程: 传入headerValue="Mozilla/5.0"调用init + // 预期结果: 成功创建WebHeader对象实例 + let h = WebHeader("User-Agent", "Mozilla/5.0") + @Expect(h.headerKey, "User-Agent") + @Expect(h.headerValue, "Mozilla/5.0") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_headerValue_boundary_1(): Unit { + spawn(UIThread) { + // 测试流程: 传入headerValue=""调用init + // 预期结果: 正常处理空字符串边界情况 + let h = WebHeader("Content-Type", "") + @Expect(h.headerKey, "Content-Type") + @Expect(h.headerValue, "") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_headerValue_boundary_2(): Unit { + spawn(UIThread) { + // 测试流程: 传入headerValue=极长的value字符串调用init + // 预期结果: 正常处理超长字符串 + var longValue = "" + var i = 0 + while (i < 10000) { + longValue += "a" + i++ + } + let h = WebHeader("X-Custom", longValue) + @Expect(h.headerKey, "X-Custom") + @Expect(h.headerValue.size, 10000) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_pairwise_case1(): Unit { + spawn(UIThread) { + // 测试流程: headerKey="Content-Type", headerValue="application/json" + // 预期结果: 成功创建WebHeader对象实例 + let h = WebHeader("Content-Type", "application/json") + @Expect(h.headerKey, "Content-Type") + @Expect(h.headerValue, "application/json") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_pairwise_case2(): Unit { + spawn(UIThread) { + // 测试流程: headerKey="Content-Type", headerValue="Bearer token123" + // 预期结果: 成功创建WebHeader对象实例 + let h = WebHeader("Content-Type", "Bearer token123") + @Expect(h.headerKey, "Content-Type") + @Expect(h.headerValue, "Bearer token123") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_pairwise_case3(): Unit { + spawn(UIThread) { + // 测试流程: headerKey="Authorization", headerValue="application/json" + // 预期结果: 成功创建WebHeader对象实例 + let h = WebHeader("Authorization", "application/json") + @Expect(h.headerKey, "Authorization") + @Expect(h.headerValue, "application/json") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_pairwise_case4(): Unit { + spawn(UIThread) { + // 测试流程: headerKey="Authorization", headerValue="Bearer token123" + // 预期结果: 成功创建WebHeader对象实例 + let h = WebHeader("Authorization", "Bearer token123") + @Expect(h.headerKey, "Authorization") + @Expect(h.headerValue, "Bearer token123") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_headerKey_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用headerKey并获取返回值 + // 预期结果: 请求/响应头的key + let h = WebHeader("X-Test-Key", "testValue") + @Expect(h.headerKey, "X-Test-Key") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_headerValue_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用headerValue并获取返回值 + // 预期结果: 请求/响应头的value + let h = WebHeader("X-Test-Key", "testValue") + @Expect(h.headerValue, "testValue") + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_hitTestType_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用hitTestType并获取返回值 + // 预期结果: 当前被点击区域的元素类型(WebHitTestType) + // HitTestValue构造器为包内可见,无法直接实例化,验证WebHitTestType枚举类型可用性 + let t1 = WebHitTestType.EditText + let t2 = WebHitTestType.Email + // let t3 = WebHitTestType.HttpAnchor + // let t4 = WebHitTestType.HttpAnchorImg + // let t5 = WebHitTestType.Img + // let t6 = WebHitTestType.Map + // let t7 = WebHitTestType.Phone + let t8 = WebHitTestType.Unknown + @Expect(t1 == WebHitTestType.EditText) + @Expect(t2 != t1) + @Expect(t8 == WebHitTestType.Unknown) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_extra_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 调用extra并获取返回值 + // 预期结果: 点击区域的附加参数信息。若被点击区域为图片或链接,则附加参数信息为其url地址。 + // HitTestValue构造器为包内可见,验证WebHitTestType枚举toString + let t = WebHitTestType.EditText + let str = t.toString() + @Expect(str.size > 0) + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_icon_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用getBackForwardEntries获取BackForwardList,尝试获取HistoryItem.icon + // 预期结果: 抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:iconreturnvalue")) + try { + let list = ctrl.getBackForwardEntries() + let item = list.getItemAtIndex(0) + let _ = item.icon + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_historyUrl_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用getBackForwardEntries获取BackForwardList,尝试获取HistoryItem.historyUrl + // 预期结果: 抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:historyUrlretur")) + try { + let list = ctrl.getBackForwardEntries() + let item = list.getItemAtIndex(0) + let _ = item.historyUrl + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_historyRawUrl_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用getBackForwardEntries获取BackForwardList,尝试获取HistoryItem.historyRawUrl + // 预期结果: 抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:historyRawUrlre")) + try { + let list = ctrl.getBackForwardEntries() + let item = list.getItemAtIndex(0) + let _ = item.historyRawUrl + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_title_return_value(): Unit { + spawn(UIThread) { + // 测试流程: 未绑定控制器调用getBackForwardEntries获取BackForwardList,尝试获取HistoryItem.title + // 预期结果: 抛出BusinessException 17100001 + let ctrl = WebviewController(webTag: Some("arkweb:titlereturnvalu")) + try { + let list = ctrl.getBackForwardEntries() + let item = list.getItemAtIndex(0) + let _ = item.title + @Expect(false) + } catch (e: BusinessException) { + @Expect(e.code, 17100001) + } + } + } + + @TestCase + @Tag[APILevel22, TestLevel0] + func test_init_WebHeader_return_value(): Unit { + spawn(UIThread) { + // 原始用例名: init_return_value + // 测试流程: 创建WebHeader并验证返回值 + // 预期结果: headerKey和headerValue正确 + let h = WebHeader("key", "value") + @Expect(h.headerKey, "key") + @Expect(h.headerValue, "value") + } + } + +} diff --git a/test/webview/test/entry/src/main/cangjie/src/test_list_webview.cj b/test/webview/test/entry/src/main/cangjie/src/test_list_webview.cj index 36fa0bf..008366d 100644 --- a/test/webview/test/entry/src/main/cangjie/src/test_list_webview.cj +++ b/test/webview/test/entry/src/main/cangjie/src/test_list_webview.cj @@ -21,4 +21,5 @@ func testsuite(): Unit { registerTestSuite("Test_webview", {=> Test_webview()}) registerTestSuite("Test_web_cookie_manager", {=> Test_web_cookie_manager()}) registerTestSuite("Test_webview_enum", {=> Test_webview_enum()}) + registerTestSuite("Test_webview_llt", {=> Test_webview_llt()}) } diff --git a/test/webview/test/entry/src/main/resources/rawfile/message.html b/test/webview/test/entry/src/main/resources/rawfile/message.html index 208bd98..108b447 100644 --- a/test/webview/test/entry/src/main/resources/rawfile/message.html +++ b/test/webview/test/entry/src/main/resources/rawfile/message.html @@ -14,5 +14,5 @@

display received message send from cangjie

- + \ No newline at end of file diff --git a/test/webview/test/entry/src/main/resources/rawfile/xxx.js b/test/webview/test/entry/src/main/resources/rawfile/testMsg.js similarity index 96% rename from test/webview/test/entry/src/main/resources/rawfile/xxx.js rename to test/webview/test/entry/src/main/resources/rawfile/testMsg.js index 458bdaa..2fa8ccd 100644 --- a/test/webview/test/entry/src/main/resources/rawfile/xxx.js +++ b/test/webview/test/entry/src/main/resources/rawfile/testMsg.js @@ -13,7 +13,6 @@ * limitations under the License. */ -//xxx.js var h5Port; var output = document.querySelector('.output'); window.addEventListener('message', function (event) { @@ -47,10 +46,8 @@ window.addEventListener('message', function (event) { // 3. 使用h5Port往ets侧发送消息. function PostMsgToCangjie(data) { - // let a = new ArrayBuffer(12); if (h5Port) { h5Port.postMessage(data); - // h5Port.postMessage(a); } else { console.error("h5Port is null, Please initialize first"); }