[webkit-changes] [WebKit/WebKit] d9fd3e: Introduce TestWebKitAPI mechanism for directly tes...

Brady Eidson noreply at github.com
Wed Oct 25 22:46:41 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d9fd3e0d1f7a2f914052383ccd29ac376b1f8895
      https://github.com/WebKit/WebKit/commit/d9fd3e0d1f7a2f914052383ccd29ac376b1f8895
  Author: Brady Eidson <beidson at apple.com>
  Date:   2023-10-25 (Wed, 25 Oct 2023)

  Changed paths:
    M Source/WebKit/Shared/Cocoa/CoreIPCData.serialization.in
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig
    M Tools/TestWebKitAPI/SourcesCocoa.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebKitCocoa/IPCSerialization.mm

  Log Message:
  -----------
  Introduce TestWebKitAPI mechanism for directly testing IPC serialization
https://bugs.webkit.org/show_bug.cgi?id=263703
rdar://117511848

Reviewed by Alex Christensen.

This patch introduces a framework to directly test serialization of object types that we know
we need to support coding for IPC, but might not have any indirect way to test.

The testing leverages IPC's support for MessageSenders to work without an IPC::Connection.
That support was originally added to support generated messages and encoding to our daemons,
but reusing it here fits nicely.

By using a test-specific MessageSender and sendWithAsyncReplyWithoutUsingIPCConnection, we coax
CoreIPC into encoding a message and decoding a reply the same way it does for actual IPC messaging.

The prime use-case for this technique is testing our Objective-C types as found in ArgumentCodersCocoa.mm
The CoreFoundation types in ArgumentCodersCF.mm are also a nice fit.

For the sake of introducing the mechanism at a high level, this patch only tests serialization of NSString.
With this framework introduced, testing other types will be trivial.

* Source/WebKit/Shared/Cocoa/CoreIPCData.serialization.in:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Configurations/TestWebKitAPI.xcconfig:
* Tools/TestWebKitAPI/SourcesCocoa.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/IPCSerialization.mm: Added.
(ObjCSerializationTester::performSendWithAsyncReplyWithoutUsingIPCConnection const):
(ObjCHolderForTesting::encode const):
(ObjCHolderForTesting::decode):
(operator==):
(BasicPingBackMessage::name):
(BasicPingBackMessage::asyncMessageReplyName):
(BasicPingBackMessage::BasicPingBackMessage):
(BasicPingBackMessage::arguments):
(TEST):

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




More information about the webkit-changes mailing list