Title: [277206] trunk
Revision
277206
Author
commit-qu...@webkit.org
Date
2021-05-07 15:23:52 -0700 (Fri, 07 May 2021)

Log Message

Unreviewed, reverting r277201.
https://bugs.webkit.org/show_bug.cgi?id=225542

Includes project file change.

Reverted changeset:

"[iOS] Make AccessibilityReduceMotion test case work on iOS"
https://bugs.webkit.org/show_bug.cgi?id=225244
https://trac.webkit.org/changeset/277201

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (277205 => 277206)


--- trunk/Source/WebKit/ChangeLog	2021-05-07 22:05:22 UTC (rev 277205)
+++ trunk/Source/WebKit/ChangeLog	2021-05-07 22:23:52 UTC (rev 277206)
@@ -1,3 +1,16 @@
+2021-05-07  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, reverting r277201.
+        https://bugs.webkit.org/show_bug.cgi?id=225542
+
+        Includes project file change.
+
+        Reverted changeset:
+
+        "[iOS] Make AccessibilityReduceMotion test case work on iOS"
+        https://bugs.webkit.org/show_bug.cgi?id=225244
+        https://trac.webkit.org/changeset/277201
+
 2021-05-07  Brent Fulgham  <bfulg...@apple.com>
 
         [iOS] Make AccessibilityReduceMotion test case work on iOS

Modified: trunk/Source/WebKit/Platform/spi/Cocoa/AccessibilitySupportSPI.h (277205 => 277206)


--- trunk/Source/WebKit/Platform/spi/Cocoa/AccessibilitySupportSPI.h	2021-05-07 22:05:22 UTC (rev 277205)
+++ trunk/Source/WebKit/Platform/spi/Cocoa/AccessibilitySupportSPI.h	2021-05-07 22:23:52 UTC (rev 277206)
@@ -40,11 +40,6 @@
 extern CFStringRef _AXSCopyPathForAccessibilityBundle(CFStringRef bundle);
 #endif
 
-#if PLATFORM(IOS_FAMILY)
-extern CFStringRef kAXSReduceMotionPreference;
-extern CFStringRef kAXSReduceMotionChangedNotification;
-#endif
-
 #if PLATFORM(IOS_FAMILY) && ENABLE(FULL_KEYBOARD_ACCESS)
 extern CFStringRef kAXSFullKeyboardAccessEnabledNotification;
 extern Boolean _AXSFullKeyboardAccessEnabled();

Modified: trunk/Tools/ChangeLog (277205 => 277206)


--- trunk/Tools/ChangeLog	2021-05-07 22:05:22 UTC (rev 277205)
+++ trunk/Tools/ChangeLog	2021-05-07 22:23:52 UTC (rev 277206)
@@ -1,3 +1,16 @@
+2021-05-07  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, reverting r277201.
+        https://bugs.webkit.org/show_bug.cgi?id=225542
+
+        Includes project file change.
+
+        Reverted changeset:
+
+        "[iOS] Make AccessibilityReduceMotion test case work on iOS"
+        https://bugs.webkit.org/show_bug.cgi?id=225244
+        https://trac.webkit.org/changeset/277201
+
 2021-05-07  Carlos Garcia Campos  <cgar...@igalia.com>
 
         Do not try to remove and already removed node while deleting selection

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/xcshareddata/xcschemes/TestWebKitAPI.xcscheme (277205 => 277206)


--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/xcshareddata/xcschemes/TestWebKitAPI.xcscheme	2021-05-07 22:05:22 UTC (rev 277205)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/xcshareddata/xcschemes/TestWebKitAPI.xcscheme	2021-05-07 22:23:52 UTC (rev 277206)
@@ -50,12 +50,6 @@
             ReferencedContainer = "container:TestWebKitAPI.xcodeproj">
          </BuildableReference>
       </BuildableProductRunnable>
-      <CommandLineArguments>
-         <CommandLineArgument
-            argument = "--gtest_filter=WebKit.AccessibilityReduceMotion"
-            isEnabled = "YES">
-         </CommandLineArgument>
-      </CommandLineArguments>
    </LaunchAction>
    <ProfileAction
       buildConfiguration = "Release"

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm (277205 => 277206)


--- trunk/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm	2021-05-07 22:05:22 UTC (rev 277205)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm	2021-05-07 22:23:52 UTC (rev 277206)
@@ -25,38 +25,16 @@
 
 #import "config.h"
 
-#if ENABLE(CFPREFS_DIRECT_MODE)
+#if WK_HAVE_C_SPI && ENABLE(CFPREFS_DIRECT_MODE)
 
 #import "PlatformUtilities.h"
 #import "TestWKWebView.h"
-#import "WKWebViewConfigurationExtras.h"
 #import <WebKit/PreferenceObserver.h>
 #import <WebKit/WKProcessPoolPrivate.h>
 #import <WebKit/_WKProcessPoolConfiguration.h>
 
-#if PLATFORM(MAC)
 #import <pal/spi/mac/HIServicesSPI.h>
-#endif
 
-#if PLATFORM(IOS_FAMILY)
-#include <pal/spi/cocoa/AccessibilitySupportSPI.h>
-#include <wtf/SoftLinking.h>
-
-SOFT_LINK_LIBRARY(libAccessibility)
-SOFT_LINK_CONSTANT(libAccessibility, kAXSReduceMotionPreference, CFStringRef);
-SOFT_LINK_CONSTANT(libAccessibility, kAXSReduceMotionChangedNotification, CFStringRef);
-
-#define NOTIFICATION_CENTER CFNotificationCenterGetDarwinNotifyCenter()
-#define REDUCED_MOTION_PREFERENCE getkAXSReduceMotionPreference()
-#define REDUCED_MOTION_CHANGED_NOTIFICATION getkAXSReduceMotionChangedNotification()
-#define ACCESSIBILITY_DOMAIN CFSTR("com.apple.Accessibility")
-#else
-#define NOTIFICATION_CENTER CFNotificationCenterGetDistributedCenter()
-#define REDUCED_MOTION_PREFERENCE kAXInterfaceReduceMotionKey
-#define REDUCED_MOTION_CHANGED_NOTIFICATION kAXInterfaceReduceMotionStatusDidChangeNotification
-#define ACCESSIBILITY_DOMAIN CFSTR("com.apple.universalaccess")
-#endif
-
 static bool reduceMotionNotificationReceived = false;
 static bool receivedPreferenceNotification = false;
 
@@ -72,44 +50,40 @@
 }
 @end
 
-static void notificationCallback(CFNotificationCenterRef center, void *observer, CFNotificationName name, const void *object, CFDictionaryRef userInfo)
-{
-    reduceMotionNotificationReceived = true;
-}
-
 TEST(WebKit, AccessibilityReduceMotion)
 {
-    CFNotificationCenterAddObserver(NOTIFICATION_CENTER, nullptr, &notificationCallback, REDUCED_MOTION_CHANGED_NOTIFICATION, nullptr, CFNotificationSuspensionBehaviorDeliverImmediately);
+    RetainPtr<NSObject> accessibilityObserver = [[NSDistributedNotificationCenter defaultCenter] addObserverForName:(__bridge id)kAXInterfaceReduceMotionStatusDidChangeNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *note) {
+        reduceMotionNotificationReceived = true;
+    }];
 
-    WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES];
-    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration addToWindow:YES]);
+    auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    WKRetainPtr<WKContextRef> context = adoptWK(TestWebKitAPI::Util::createContextForInjectedBundleTest("InternalsInjectedBundleTest"));
+    configuration.get().processPool = (WKProcessPool *)context.get();
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get() addToWindow:YES]);
 
-    CFPreferencesSetAppValue(REDUCED_MOTION_PREFERENCE, kCFBooleanFalse, ACCESSIBILITY_DOMAIN);
+    CFPreferencesSetAppValue(kAXInterfaceReduceMotionKey, kCFBooleanFalse, CFSTR("com.apple.universalaccess"));
 
     auto observer = adoptNS([[WKPreferenceObserverForTesting alloc] init]);
 
     [webView synchronouslyLoadTestPageNamed:@"simple"];
 
+    CFPreferencesSetAppValue(kAXInterfaceReduceMotionKey, kCFBooleanTrue, CFSTR("com.apple.universalaccess"));
+
+    TestWebKitAPI::Util::run(&receivedPreferenceNotification);
+
     auto reduceMotion = [&] {
         return [webView stringByEvaluatingJavaScript:@"window.internals.userPrefersReducedMotion()"].boolValue;
     };
+    
+    [webView synchronouslyLoadTestPageNamed:@"simple"];
 
-    ASSERT_FALSE(reduceMotion());
-
-    reduceMotionNotificationReceived = false;
-
-    CFPreferencesSetAppValue(REDUCED_MOTION_PREFERENCE, kCFBooleanTrue, ACCESSIBILITY_DOMAIN);
-
-    TestWebKitAPI::Util::run(&receivedPreferenceNotification);
     TestWebKitAPI::Util::run(&reduceMotionNotificationReceived);
 
-    [webView synchronouslyLoadTestPageNamed:@"simple"];
-
     ASSERT_TRUE(reduceMotion());
 
-    CFPreferencesSetAppValue(REDUCED_MOTION_PREFERENCE, nullptr, ACCESSIBILITY_DOMAIN);
+    CFPreferencesSetAppValue(kAXInterfaceReduceMotionKey, nullptr, CFSTR("com.apple.universalaccess"));
 
-    CFNotificationCenterRemoveObserver(NOTIFICATION_CENTER, nullptr, REDUCED_MOTION_CHANGED_NOTIFICATION, nullptr);
+    [[NSNotificationCenter defaultCenter] removeObserver:accessibilityObserver.get()];
 }
 
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to