SIGN IN SIGN UP

[Swift Testing] Add helpers for writing site isolation tests

https://bugs.webkit.org/show_bug.cgi?id=326293
rdar://189145614

Reviewed by Richard Robinson.

The site isolation API tests share helpers in SiteIsolationTestUtilities.h that Swift can't call. Add Swift counterparts,
so that site isolation tests can be written with Swift Testing. See https://webkit.org/b/326295 for tests that use them.

* Tools/TestWebKitAPI/Helpers/cocoa/Foundation+Extras.swift:
(ConditionTimedOut.description):
(waitForCondition(_:timeout:_:)): Moved from TextExtractionTests.swift so that other tests can use it. It throws
ConditionTimedOut on timeout, since the helpers library can't record a Swift Testing issue.
* Tools/TestWebKitAPI/Helpers/cocoa/SiteIsolationTestUtilities.swift: Added.
(WKWebViewConfiguration.init(httpsProxyFor:)):
(siteIsolatedWebViewAndDelegate(configuration:frame:)):
(WebViewWithFocusedCrossOriginIframe.mainFrameHTML):
(WebViewWithFocusedCrossOriginIframe.init(configuration:)):
(WKWebView.setSelection(in:script:expecting:)):
(WKWebView.firstChildFrame):
* Tools/TestWebKitAPI/Helpers/cocoa/TestWKWebView.h: Point the frame variants of the synchronous JavaScript evaluation
helpers at callJavaScript(returning:in:_:).
* Tools/TestWebKitAPI/Helpers/cocoa/WKWebView+Extras.swift:
(WKWebView.callJavaScript(returning:in:_:)):
(WKWebView.callJavaScript(in:_:)): Take the frame to call the function body in.
* Tools/TestWebKitAPI/PlatformCocoa.cmake:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.swift:
(waitForCondition(_:timeout:_:)): Deleted.

Canonical link: https://commits.webkit.org/322763@main
Z
Zak Ridouh committed
fc3fbc51144216c80ebbbc06d60e407047e75d39
Parent: 0ceeba5