Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f9ebc1a62a0e50f77013cb69ae9c0b15160981b1
https://github.com/WebKit/WebKit/commit/f9ebc1a62a0e50f77013cb69ae9c0b15160981b1
Author: Richard Robinson <[email protected]>
Date: 2026-09-08 (Tue, 08 Sep 2026)
Changed paths:
M Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.swift
M Tools/TestWebKitAPI/Helpers/cocoa/NetworkConnection.mm
M Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.h
M Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.mm
A Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.swift
M Tools/TestWebKitAPI/Helpers/cocoa/SafeBrowsingTestUtilities.h
M Tools/TestWebKitAPI/Helpers/cocoa/SafeBrowsingTestUtilities.mm
A Tools/TestWebKitAPI/Helpers/cocoa/SafeBrowsingTestUtilities.swift
M Tools/TestWebKitAPI/Helpers/cocoa/ScreenTimeExtras.h
A Tools/TestWebKitAPI/Helpers/cocoa/ScreenTimeExtras.mm
M Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.h
M Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.mm
M Tools/TestWebKitAPI/Helpers/cocoa/TestWKWebView.h
A Tools/TestWebKitAPI/Helpers/cocoa/TextExtractionTestingSPI.h
A Tools/TestWebKitAPI/Helpers/cocoa/WKWebView+Extras.swift
M Tools/TestWebKitAPI/PlatformCocoa.cmake
M Tools/TestWebKitAPI/SourcesCocoa.txt
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SafeBrowsing.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm
Log Message:
-----------
[Swift Testing] Add more affordances to make it easier to use Swift Testing
https://bugs.webkit.org/show_bug.cgi?id=323645
rdar://186880308
Reviewed by Zak Ridouh and Aditya Keerthi.
Add some helper functions and some fixes to make it easier to use WKWebView
with Swift Testing.
* Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.swift:
(HTTPServer.totalRequests):
* Tools/TestWebKitAPI/Helpers/cocoa/NetworkConnection.mm:
(TestWebKitAPI::Connection::terminate):
Connection::terminate asserted that cancelling produces no error, but the
error reported there describes the connection, not the cancellation: a
connection that failed its TLS handshake still reports "bad certificate"
once cancelled, and nw_connection_cancel cannot itself fail. This only
surfaced now because the Swift HTTPServer wrapper cancels at the end of
run(), while the C++ HTTPServer has no destructor and never tore
connections down.
* Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.h:
* Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.mm:
(TestWebKitAPI::testPDFDataWithLink):
(TestWebKitAPI::appendPDFBytes): Deleted.
* Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.swift: Added.
(TestPDFBuilder.pdfDataWithLink):
Declare TestPDFBuilder and annotate nullability.
* Tools/TestWebKitAPI/Helpers/cocoa/SafeBrowsingTestUtilities.h:
* Tools/TestWebKitAPI/Helpers/cocoa/SafeBrowsingTestUtilities.mm:
(+[DelayedLookupContext delayDuration]):
(+[DelayedLookupContext setDelayDuration:]):
(-[DelayedLookupContext lookUpURL:completionHandler:]):
(testSSBLookupContextClass):
* Tools/TestWebKitAPI/Helpers/cocoa/SafeBrowsingTestUtilities.swift: Added.
Drop the C++ guard, replacing the sole use of WTF::Seconds with NSTimeInterval,
and declare testSSBLookupContextClass.
* Tools/TestWebKitAPI/Helpers/cocoa/ScreenTimeExtras.h:
* Tools/TestWebKitAPI/Helpers/cocoa/ScreenTimeExtras.mm: Copied from
Tools/TestWebKitAPI/Helpers/cocoa/ScreenTimeExtras.h.
(testSTScreenTimeConfigurationClass):
Declare testSTScreenTimeConfigurationClass, and make the STWebpageController
category
named so Swift sees the setter.
* Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.h:
* Tools/TestWebKitAPI/Helpers/cocoa/TestNavigationDelegate.mm:
(-[TestNavigationDelegate waitForDidFinishNavigationWithCompletionHandler:]):
(-[WKWebView _test_waitForNextDidFinishNavigationWithCompletionHandler:]):
* Tools/TestWebKitAPI/Helpers/cocoa/TestWKWebView.h:
* Tools/TestWebKitAPI/Helpers/cocoa/TextExtractionTestingSPI.h: Copied from
Tools/TestWebKitAPI/Helpers/cocoa/ScreenTimeExtras.h.
* Tools/TestWebKitAPI/Helpers/cocoa/WKWebView+Extras.swift: Added.
(UnexpectedJavaScriptResult.description):
(WKWebView.load(_:baseURL:)):
(WKWebView.loadAndWait(_:)):
(WKWebView.load(testPageNamed:)):
(WKWebView.callJavaScript(_:)):
(WKWebView.elementMidpoint(_:)):
(WKWebView.nextPresentationUpdate):
* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
Add supporting infrastructure for Swift async.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SafeBrowsing.mm:
(TEST(SafeBrowsing, HangTimeout)):
(TEST(SafeBrowsing, PostResponse)):
(TEST(SafeBrowsing, PostResponseIframe)):
(TEST(SafeBrowsing, PostResponseServerSideRedirect)):
(TEST(SafeBrowsing, PostResponseInjectedBundleSkipsDecidePolicyForResponse)):
(TEST(SafeBrowsing, WarningShownAfterCOOPProcessSwapWithSkippedResponse)):
(TEST(SafeBrowsing,
WarningShownAfterCOOPProcessSwapWithSkippedResponseSlowLookup)):
(TEST(SafeBrowsing, WarningShownAfterCOOPProcessSwap)):
(TEST(SafeBrowsing, WarningShownAfterCOOPProcessSwapSlowLookup)):
(TEST(SafeBrowsing, WarningShownWhenLookupCompletesBeforeResponse)):
(TEST(SafeBrowsing, WarningShownAfterRedirectWithLateResult)):
(TEST(SafeBrowsing, PostTimeout)):
(TEST(SafeBrowsing, ModalDeferredDuringCheck)):
(TEST(SafeBrowsing, DeferredModalShownWhenProceedingThroughWarning)):
(TEST(SafeBrowsing, DeferredModalSuppressedWhenGoingBack)):
(TEST(SafeBrowsing, MultipleDeferredModalsShownInOrder)):
(TEST(SafeBrowsing, DeferredModalsClearedOnNavigation)):
(TEST(SafeBrowsing, AllModalTypesProperlyDeferred)):
(TEST(SafeBrowsing, DownloadDeferredAndBlockedBySafeBrowsing)):
(TEST(SafeBrowsing, DownloadDeferredAndBlockedBySafeBrowsingPostTimeout)):
(TEST(SafeBrowsing, CleanDownloadProceedsAfterSafeBrowsingCheck)):
(TEST(SafeBrowsing, SubframeDownloadBlockedBySafeBrowsing)):
(TEST(SafeBrowsing, NavigationActionDownloadDeferredBySafeBrowsing)):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm:
(TestWebKitAPI::(TextExtractionTests,
DelayedSafeBrowsingWarningBlocksTextExtraction)):
Update some tests accordingly.
Canonical link: https://commits.webkit.org/320666@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications