Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6a0859ef07633c8fd3a204717e090eece8122aa4
      
https://github.com/WebKit/WebKit/commit/6a0859ef07633c8fd3a204717e090eece8122aa4
  Author: Richard Robinson <[email protected]>
  Date:   2026-09-15 (Tue, 15 Sep 2026)

  Changed paths:
    M Tools/Scripts/webkitpy/api_tests/allowlist.txt
    M Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.h
    M Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.mm
    M Tools/TestWebKitAPI/Helpers/cocoa/PDFTestHelpers.swift
    M Tools/TestWebKitAPI/PlatformCocoa.cmake
    M Tools/TestWebKitAPI/SourcesCocoa.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    R Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm
    A Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.swift

  Log Message:
  -----------
  [Text Extraction] Convert Text Extraction tests to Swift Testing
https://bugs.webkit.org/show_bug.cgi?id=323590
rdar://186829531

Reviewed by Wenson Hsieh.

Convert these tests to Swift Testing.

* Tools/Scripts/webkitpy/api_tests/allowlist.txt:

* 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/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):

Add supporting infrastructure.

* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* 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)):

Update some existing tests.

* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.mm: Removed.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.swift: Added.
(Swift.jsHandleWorld):
(Swift.unfilteredConfiguration):
(Swift.extractNodeIdentifier(_:_:)):
(Swift.enterBackground(_:)):
(WKWebView.debugText(_:)):
(NavigationFailureWaiter.continuation):
(NavigationFailureWaiter.error):
(NavigationFailureWaiter.fail(with:)):
(NavigationFailureWaiter.wait() async -> (any Error:)):
(SubframeCollector.frames):
(SubframeCollector.install(on:)):
(matchesMediaQuery(_:_:)):
(isSmallScreenDevice):
(load(_:using:)):
(makeUnifiedPDFWebView):
(WKWebView.load(pdf:baseURL:)):
(testPDFData):
(decodeJSONObject(_:)):
(subFrameMarkup(_:)):
(makeSubframeServer(_:sameOriginButtonText:)):
(plainHTMLConfiguration):
(TextExtractionTests.selectPopupMenu):
(TextExtractionTests.interactionDebugDescription):
(TextExtractionTests.interactionDescriptionUsesAdjacentTextForUnlabeledIcon):
(TextExtractionTests.interactionDescriptionAndSearchTextForLabellessIcons):
(TextExtractionTests.interactionDescriptionIncludesAssociatedLabelText):
(TextExtractionTests.interactionClicksThroughOccludingOverlay):
(TextExtractionTests.interactionWithSearchTextSpanningBlockBoundary):
(TextExtractionTests.interactionDebugDescriptionWithStaleNodeIdentifier):
(TextExtractionTests.interactionDebugDescriptionWithUnresolvableNodeIdentifier):
(TextExtractionTests.interactionDebugDescriptionWithoutTargetElement):
(TextExtractionTests.interactionResultSummary):
(TextExtractionTests.interactionSearchTextMatchesAccessibilityLabel):
(TextExtractionTests.interactionRemapsStaleNodeIdentifier):
(TextExtractionTests.interactionRemapsStaleNodeIdentifierWithURL):
(TextExtractionTests.interactionReportsStaleNodeWhenRemapCandidateIsAlsoStale):
(TextExtractionTests.targetNodeAndClientAttributes):
(TextExtractionTests.targetNodeWithSameOriginSubframe):
(TextExtractionTests.includeTagNamePrefixesContentBlocks):
(TextExtractionTests.includeTagNameTagsBlockWithOnlyInlineContent):
(TextExtractionTests.includeTagNameDisabledByDefault):
(TextExtractionTests.includeTagNameCollapsesMixedInlineAndBlockContent):
(TextExtractionTests.includeTagNameDropsEmptyAndWhitespaceBlocks):
(TextExtractionTests.includeTagNameKeepsSemanticLabelForStructuralContainers):
(TextExtractionTests.includeTagNameFlattensInlineElementsIntoBlockText):
(TextExtractionTests.extractFromDocumentWithoutBody):
(TextExtractionTests.replacementStrings):
(TextExtractionTests.replacementStringsLongestMatchWins):
(TextExtractionTests.replacementStringsCaseAndQuoteInsensitive):
(TextExtractionTests.replacementStringsDiacriticInsensitive):
(TextExtractionTests.replacementStringsWordBoundaries):
(TextExtractionTests.replacementStringsAppliedToInteractionDescription):
(TextExtractionTests.visibleTextOnly):
(TextExtractionTests.zeroWordLimit):
(TextExtractionTests.skipNearlyTransparentContentByDefault):
(TextExtractionTests.extractTransparentCheckboxOverVisualProxy):
(TextExtractionTests.extractTransparentOneTimeCodeFieldOverVisualProxies):
(TextExtractionTests.minimalHTMLOutput):
(TextExtractionTests.nestedDetailsDoesNotHang):
(TextExtractionTests.filterOptions):
(TextExtractionTests.filterRedundantTextInLinks):
(TextExtractionTests.nodesToSkip):
(TextExtractionTests.requestJSHandleForNodeIdentifier):
(TextExtractionTests.requestJSHandleForStaleNodeIdentifier):
(TextExtractionTests.requestJSHandleForNodeIdentifierCaseSensitive):
(TextExtractionTests.requestContainerJSHandleForNodeIdentifier):
(TextExtractionTests.requestContainerJSHandleForSearchTexts):
(TextExtractionTests.requestContainerJSHandleForSearchTextsFallsBackToBodyWhenTargetMisses):
(TextExtractionTests.requestJSHandleForNodeInDetachedSubframe):
(TextExtractionTests.resolveTargetNodeFromSelectorData):
(TextExtractionTests.clickInteractionWithElementHandle):
(TextExtractionTests.clickInteractionWithTextOnly):
(TextExtractionTests.scrollToRevealFallsBackToFullDocumentWhenNodeMisses):
(TextExtractionTests.clickInteractionWhileInBackground):
(TextExtractionTests.invalidURLsAreSkipped):
(TextExtractionTests.authorShadowDOMText):
(clickInteractionWithExtractionContext):
(shortenURLsWithTopHostName):
(extractionContextPrefersInteractiveElement):
(resultOrigin):
(subframeInteractions):
(subframeOriginInDebugText):
(requestFrameInfoForNodeIdentifier):
(hoverInteractionWithTextOnly):
(hoverInteractionWithExtractionContext):
(hoverDoesNotClick):
(interactedElementBounds):
(keyPressInsertsCharactersInOrder):
(keyPressInsertsBracketCharacters):
(clickInteractionWithStalledDisplayLink):
(desktopClassHardwareEmulationInDesktopContentMode):
(extractFromPDFAsMarkdown):
(extractFromPDFAsTextTree):
(extractFromPDFAsHTML):
(extractFromPDFAsJSON):
(extractFromPDFAsPlainText):
(extractFromPDFLink):
(filteringRules):
(filteringRulesAreIsolated):
(filterExtractedStringPassthrough):
(filterExtractedStringRulesApplied):
(filterExtractedStringRulesTruncates):
(filterExtractedStringEmptyInput):
(requestTextExtractionInSVGDocument):
(safeBrowsingWarningBlocksTextExtraction):
(delayedSafeBrowsingWarningBlocksTextExtraction):
(backgroundTextExtractionBlocksUserMediatedHTTPFallback):
(screenTimeBlocksTextExtraction):

Canonical link: https://commits.webkit.org/321145@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to