Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0971e7a2270b21f25bac302361018c20175f445e
      
https://github.com/WebKit/WebKit/commit/0971e7a2270b21f25bac302361018c20175f445e
  Author: Cole Carley <[email protected]>
  Date:   2026-10-05 (Mon, 05 Oct 2026)

  Changed paths:
    A Tools/TestWebKitAPI/Helpers/cocoa/FindStateSnapshot.h
    A Tools/TestWebKitAPI/Helpers/cocoa/FindStateSnapshot.mm
    A Tools/TestWebKitAPI/Helpers/cocoa/FindTestFixtures.h
    A Tools/TestWebKitAPI/Helpers/cocoa/FindTestPage.h
    A Tools/TestWebKitAPI/Helpers/cocoa/FindTestPage.mm
    A Tools/TestWebKitAPI/Helpers/cocoa/PublicFindAPITester.h
    A Tools/TestWebKitAPI/Helpers/cocoa/PublicFindAPITester.mm
    M Tools/TestWebKitAPI/SourcesCocoa.txt
    A Tools/TestWebKitAPI/Tests/WebKit/WKWebView/FindPublicAPI.mm

  Log Message:
  -----------
  Add shared find-in-page test infrastructure and a harness for the public find 
API
https://bugs.webkit.org/show_bug.cgi?id=326093
rdar://189017819

Reviewed by Megan Gardner.

There is not enough test coverage for the find in page code, and
it is difficult to discover bugs because Safari does not use
some parts of each API. This is the first in a series of patches that
introduces one test harness for each of the API surfaces that we expose,
along with shared fixtures so that we can test the same scenarios with
each API.

This patch adds the shared infrastructure and the first harness,
PublicFindAPITester. A test uses a harness to interact with the WebView
of a FindTestPage, which is built from a tree of FrameSpecs. This allows
us to always know exactly which API we're testing and reduces the
complexity of defining new tests.

FindStateSnapshot captures the current state of the WebView after a find
operation has completed. This way, tests can check the state of things
that are not returned by the API, such as the scroll position or the
currently selected text.

* Tools/TestWebKitAPI/Helpers/cocoa/FindStateSnapshot.h: Added.
* Tools/TestWebKitAPI/Helpers/cocoa/FindStateSnapshot.mm: Added.
(TestWebKitAPI::captureFrameFindStates):
(TestWebKitAPI::installedTextIndicatorRect):
(TestWebKitAPI::FindStateSnapshot::capture):
(TestWebKitAPI::FindStateSnapshot::frame const):
(TestWebKitAPI::FindStateSnapshot::framesWithSelection const):
* Tools/TestWebKitAPI/Helpers/cocoa/FindTestFixtures.h: Added.
(TestWebKitAPI::FindTestFixtures::singleFrame):
(TestWebKitAPI::FindTestFixtures::sameOriginChild):
(TestWebKitAPI::FindTestFixtures::crossOriginChild):
(TestWebKitAPI::FindTestFixtures::nestedABA):
(TestWebKitAPI::FindTestFixtures::emptyChildFrames):
(TestWebKitAPI::FindTestFixtures::hiddenChildFrame):
(TestWebKitAPI::FindTestFixtures::matchOnlyInChild):
(TestWebKitAPI::FindTestFixtures::matchesInEveryFrame):
(TestWebKitAPI::FindTestFixtures::shadowDOM):
(TestWebKitAPI::FindTestFixtures::textControls):
(TestWebKitAPI::FindTestFixtures::contentEditable):
(TestWebKitAPI::FindTestFixtures::closedDetails):
(TestWebKitAPI::FindTestFixtures::hiddenUntilFound):
(TestWebKitAPI::FindTestFixtures::userSelectNone):
(TestWebKitAPI::FindTestFixtures::crossOriginChildWithCaptionedVideo):
(TestWebKitAPI::FindTestFixtures::captionedVideoResources):
(TestWebKitAPI::FindTestFixtures::crossOriginChildPDF):
(TestWebKitAPI::FindTestFixtures::pdfResources):
(TestWebKitAPI::FindTestFixtures::findInVideoConfiguration):
* Tools/TestWebKitAPI/Helpers/cocoa/FindTestPage.h: Added.
(TestWebKitAPI::FindTestPage::FindTestPage):
(TestWebKitAPI::FindTestPage::webView const):
* Tools/TestWebKitAPI/Helpers/cocoa/FindTestPage.mm: Added.
(TestWebKitAPI::childPath):
(TestWebKitAPI::addFrameSpecRoutes):
(TestWebKitAPI::routesForFrameTree):
(TestWebKitAPI::FindTestPage::FindTestPage):
(TestWebKitAPI::FindTestPage::load):
* Tools/TestWebKitAPI/Helpers/cocoa/PublicFindAPITester.h: Added.
* Tools/TestWebKitAPI/Helpers/cocoa/PublicFindAPITester.mm: Added.
(TestWebKitAPI::PublicFindAPITester::PublicFindAPITester):
(TestWebKitAPI::PublicFindAPITester::findString):
* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/FindPublicAPI.mm: Added.
(TestWebKitAPI::FindPublicAPI::configuration):
(TestWebKitAPI::INSTANTIATE_TEST_SUITE_P):
(TestWebKitAPI::TEST_P):

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



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

Reply via email to