⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 285870 in webkit


Ignore:
Timestamp:
Nov 16, 2021, 9:39:10 AM (5 years ago)
Author:
beidson@apple.com
Message:

Enable webpushd tests in the iOS simulator.
https://bugs.webkit.org/show_bug.cgi?id=233149

Reviewed by Alex Christensen.

  • TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:

(TestWebKitAPI::testWebPushDaemonPList): Add a key to allow an OSLaunchdJob executable to break out of the simulator runtime root.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r285859 r285870  
     12021-11-16  Brady Eidson  <beidson@apple.com>
     2
     3        Enable webpushd tests in the iOS simulator.
     4        https://bugs.webkit.org/show_bug.cgi?id=233149
     5
     6        Reviewed by Alex Christensen.
     7
     8        * TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
     9        (TestWebKitAPI::testWebPushDaemonPList): Add a key to allow an OSLaunchdJob executable to break out of the simulator runtime root.
     10
    1112021-11-16  Tyler Wilcock  <tyler_w@apple.com>
    212
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm

    r285799 r285870  
    3333#import <WebKit/_WKExperimentalFeature.h>
    3434
    35 // FIXME: These tests are still currently disabled on iOS while tooling issues with `run-api-tests` are resolved.
    36 #if PLATFORM(MAC)
     35#if PLATFORM(MAC) || PLATFORM(IOS)
    3736
    3837static bool alertReceived = false;
     
    6665static RetainPtr<xpc_object_t> testWebPushDaemonPList(NSURL *storageLocation)
    6766{
     67    auto currentDirectory = currentExecutableDirectory();
     68
    6869    auto plist = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
    6970    xpc_dictionary_set_string(plist.get(), "_ManagedBy", "TestWebKitAPI");
    7071    xpc_dictionary_set_string(plist.get(), "Label", "org.webkit.webpushtestdaemon");
    7172    xpc_dictionary_set_bool(plist.get(), "LaunchOnlyOnce", true);
     73    xpc_dictionary_set_bool(plist.get(), "RootedSimulatorPath", true);
    7274    xpc_dictionary_set_string(plist.get(), "StandardErrorPath", [storageLocation URLByAppendingPathComponent:@"daemon_stderr"].path.fileSystemRepresentation);
    7375
    7476    {
    7577        auto environmentVariables = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
    76         xpc_dictionary_set_string(environmentVariables.get(), "DYLD_FRAMEWORK_PATH", currentExecutableDirectory().get().fileSystemRepresentation);
     78        xpc_dictionary_set_string(environmentVariables.get(), "DYLD_FRAMEWORK_PATH", currentDirectory.get().fileSystemRepresentation);
    7779        xpc_dictionary_set_value(plist.get(), "EnvironmentVariables", environmentVariables.get());
    7880    }
     
    8890        xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, executableLocation.get().fileSystemRepresentation);
    8991#else
    90         // FIXME: These tests are still currently disabled on iOS while tooling issues with `run-api-tests` are resolved.
    91         // Once enabled, this patch must point to the webpushd executable at a path that exists within
    92         // the simulator runtime root.
    93         xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, "/usr/local/bin/webkit-testing/webpushd");
     92        xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, [currentDirectory URLByAppendingPathComponent:@"webpushd"].path.fileSystemRepresentation);
    9493#endif
    9594        xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, "--machServiceName");
     
    145144    killFirstInstanceOfDaemon(@"webpushd");
    146145
    147     EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:tempDir.path]);
     146    if (![[NSFileManager defaultManager] fileExistsAtPath:tempDir.path])
     147        return;
     148
    148149    NSError *error = nil;
    149150    [[NSFileManager defaultManager] removeItemAtURL:tempDir error:&error];
     151
     152    if (error)
     153        NSLog(@"Error removing tempDir URL: %@", error);
     154
    150155    EXPECT_NULL(error);
    151156}
     
    264269} // namespace TestWebKitAPI
    265270
    266 #endif // PLATFORM(MAC)
     271#endif // PLATFORM(MAC) || PLATFORM(IOS)
Note: See TracChangeset for help on using the changeset viewer.