Title: [285870] trunk/Tools
Revision
285870
Author
beid...@apple.com
Date
2021-11-16 09:39:10 -0800 (Tue, 16 Nov 2021)

Log 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.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (285869 => 285870)


--- trunk/Tools/ChangeLog	2021-11-16 17:11:53 UTC (rev 285869)
+++ trunk/Tools/ChangeLog	2021-11-16 17:39:10 UTC (rev 285870)
@@ -1,3 +1,13 @@
+2021-11-16  Brady Eidson  <beid...@apple.com>
+
+        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.
+
 2021-11-16  Tyler Wilcock  <tyle...@apple.com>
 
         AX: Stop returning AccessibilityUIElements backed by a null pointer

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm (285869 => 285870)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm	2021-11-16 17:11:53 UTC (rev 285869)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm	2021-11-16 17:39:10 UTC (rev 285870)
@@ -32,8 +32,7 @@
 #import <WebKit/WKUIDelegatePrivate.h>
 #import <WebKit/_WKExperimentalFeature.h>
 
-// FIXME: These tests are still currently disabled on iOS while tooling issues with `run-api-tests` are resolved.
-#if PLATFORM(MAC)
+#if PLATFORM(MAC) || PLATFORM(IOS)
 
 static bool alertReceived = false;
 @interface NotificationPermissionDelegate : NSObject<WKUIDelegatePrivate>
@@ -65,15 +64,18 @@
 
 static RetainPtr<xpc_object_t> testWebPushDaemonPList(NSURL *storageLocation)
 {
+    auto currentDirectory = currentExecutableDirectory();
+
     auto plist = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
     xpc_dictionary_set_string(plist.get(), "_ManagedBy", "TestWebKitAPI");
     xpc_dictionary_set_string(plist.get(), "Label", "org.webkit.webpushtestdaemon");
     xpc_dictionary_set_bool(plist.get(), "LaunchOnlyOnce", true);
+    xpc_dictionary_set_bool(plist.get(), "RootedSimulatorPath", true);
     xpc_dictionary_set_string(plist.get(), "StandardErrorPath", [storageLocation URLByAppendingPathComponent:@"daemon_stderr"].path.fileSystemRepresentation);
 
     {
         auto environmentVariables = adoptNS(xpc_dictionary_create(nullptr, nullptr, 0));
-        xpc_dictionary_set_string(environmentVariables.get(), "DYLD_FRAMEWORK_PATH", currentExecutableDirectory().get().fileSystemRepresentation);
+        xpc_dictionary_set_string(environmentVariables.get(), "DYLD_FRAMEWORK_PATH", currentDirectory.get().fileSystemRepresentation);
         xpc_dictionary_set_value(plist.get(), "EnvironmentVariables", environmentVariables.get());
     }
     {
@@ -87,10 +89,7 @@
 #if PLATFORM(MAC)
         xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, executableLocation.get().fileSystemRepresentation);
 #else
-        // FIXME: These tests are still currently disabled on iOS while tooling issues with `run-api-tests` are resolved.
-        // Once enabled, this patch must point to the webpushd executable at a path that exists within
-        // the simulator runtime root.
-        xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, "/usr/local/bin/webkit-testing/webpushd");
+        xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, [currentDirectory URLByAppendingPathComponent:@"webpushd"].path.fileSystemRepresentation);
 #endif
         xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, "--machServiceName");
         xpc_array_set_string(programArguments.get(), XPC_ARRAY_APPEND, "org.webkit.webpushtestdaemon.service");
@@ -144,9 +143,15 @@
 {
     killFirstInstanceOfDaemon(@"webpushd");
 
-    EXPECT_TRUE([[NSFileManager defaultManager] fileExistsAtPath:tempDir.path]);
+    if (![[NSFileManager defaultManager] fileExistsAtPath:tempDir.path])
+        return;
+
     NSError *error = nil;
     [[NSFileManager defaultManager] removeItemAtURL:tempDir error:&error];
+
+    if (error)
+        NSLog(@"Error removing tempDir URL: %@", error);
+
     EXPECT_NULL(error);
 }
 
@@ -263,4 +268,4 @@
 
 } // namespace TestWebKitAPI
 
-#endif // PLATFORM(MAC)
+#endif // PLATFORM(MAC) || PLATFORM(IOS)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to