Changeset 277206 in webkit
- Timestamp:
- May 7, 2021, 3:23:52 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/Platform/spi/Cocoa/AccessibilitySupportSPI.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/xcshareddata/xcschemes/TestWebKitAPI.xcscheme (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r277201 r277206 1 2021-05-07 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, reverting r277201. 4 https://bugs.webkit.org/show_bug.cgi?id=225542 5 6 Includes project file change. 7 8 Reverted changeset: 9 10 "[iOS] Make AccessibilityReduceMotion test case work on iOS" 11 https://bugs.webkit.org/show_bug.cgi?id=225244 12 https://trac.webkit.org/changeset/277201 13 1 14 2021-05-07 Brent Fulgham <bfulgham@apple.com> 2 15 -
trunk/Source/WebKit/Platform/spi/Cocoa/AccessibilitySupportSPI.h
r277201 r277206 41 41 #endif 42 42 43 #if PLATFORM(IOS_FAMILY)44 extern CFStringRef kAXSReduceMotionPreference;45 extern CFStringRef kAXSReduceMotionChangedNotification;46 #endif47 48 43 #if PLATFORM(IOS_FAMILY) && ENABLE(FULL_KEYBOARD_ACCESS) 49 44 extern CFStringRef kAXSFullKeyboardAccessEnabledNotification; -
trunk/Tools/ChangeLog
r277202 r277206 1 2021-05-07 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, reverting r277201. 4 https://bugs.webkit.org/show_bug.cgi?id=225542 5 6 Includes project file change. 7 8 Reverted changeset: 9 10 "[iOS] Make AccessibilityReduceMotion test case work on iOS" 11 https://bugs.webkit.org/show_bug.cgi?id=225244 12 https://trac.webkit.org/changeset/277201 13 1 14 2021-05-07 Carlos Garcia Campos <cgarcia@igalia.com> 2 15 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/xcshareddata/xcschemes/TestWebKitAPI.xcscheme
r277201 r277206 51 51 </BuildableReference> 52 52 </BuildableProductRunnable> 53 <CommandLineArguments>54 <CommandLineArgument55 argument = "--gtest_filter=WebKit.AccessibilityReduceMotion"56 isEnabled = "YES">57 </CommandLineArgument>58 </CommandLineArguments>59 53 </LaunchAction> 60 54 <ProfileAction -
trunk/Tools/TestWebKitAPI/Tests/WebKit/AccessibilityReduceMotion.mm
r277201 r277206 26 26 #import "config.h" 27 27 28 #if ENABLE(CFPREFS_DIRECT_MODE)28 #if WK_HAVE_C_SPI && ENABLE(CFPREFS_DIRECT_MODE) 29 29 30 30 #import "PlatformUtilities.h" 31 31 #import "TestWKWebView.h" 32 #import "WKWebViewConfigurationExtras.h"33 32 #import <WebKit/PreferenceObserver.h> 34 33 #import <WebKit/WKProcessPoolPrivate.h> 35 34 #import <WebKit/_WKProcessPoolConfiguration.h> 36 35 37 #if PLATFORM(MAC)38 36 #import <pal/spi/mac/HIServicesSPI.h> 39 #endif40 41 #if PLATFORM(IOS_FAMILY)42 #include <pal/spi/cocoa/AccessibilitySupportSPI.h>43 #include <wtf/SoftLinking.h>44 45 SOFT_LINK_LIBRARY(libAccessibility)46 SOFT_LINK_CONSTANT(libAccessibility, kAXSReduceMotionPreference, CFStringRef);47 SOFT_LINK_CONSTANT(libAccessibility, kAXSReduceMotionChangedNotification, CFStringRef);48 49 #define NOTIFICATION_CENTER CFNotificationCenterGetDarwinNotifyCenter()50 #define REDUCED_MOTION_PREFERENCE getkAXSReduceMotionPreference()51 #define REDUCED_MOTION_CHANGED_NOTIFICATION getkAXSReduceMotionChangedNotification()52 #define ACCESSIBILITY_DOMAIN CFSTR("com.apple.Accessibility")53 #else54 #define NOTIFICATION_CENTER CFNotificationCenterGetDistributedCenter()55 #define REDUCED_MOTION_PREFERENCE kAXInterfaceReduceMotionKey56 #define REDUCED_MOTION_CHANGED_NOTIFICATION kAXInterfaceReduceMotionStatusDidChangeNotification57 #define ACCESSIBILITY_DOMAIN CFSTR("com.apple.universalaccess")58 #endif59 37 60 38 static bool reduceMotionNotificationReceived = false; … … 73 51 @end 74 52 75 static void notificationCallback(CFNotificationCenterRef center, void *observer, CFNotificationName name, const void *object, CFDictionaryRef userInfo)76 {77 reduceMotionNotificationReceived = true;78 }79 80 53 TEST(WebKit, AccessibilityReduceMotion) 81 54 { 82 CFNotificationCenterAddObserver(NOTIFICATION_CENTER, nullptr, ¬ificationCallback, REDUCED_MOTION_CHANGED_NOTIFICATION, nullptr, CFNotificationSuspensionBehaviorDeliverImmediately); 55 RetainPtr<NSObject> accessibilityObserver = [[NSDistributedNotificationCenter defaultCenter] addObserverForName:(__bridge id)kAXInterfaceReduceMotionStatusDidChangeNotification object:nil queue:[NSOperationQueue currentQueue] usingBlock:^(NSNotification *note) { 56 reduceMotionNotificationReceived = true; 57 }]; 83 58 84 WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"WebProcessPlugInWithInternals" configureJSCForTesting:YES]; 85 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration addToWindow:YES]); 59 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 60 WKRetainPtr<WKContextRef> context = adoptWK(TestWebKitAPI::Util::createContextForInjectedBundleTest("InternalsInjectedBundleTest")); 61 configuration.get().processPool = (WKProcessPool *)context.get(); 62 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300) configuration:configuration.get() addToWindow:YES]); 86 63 87 CFPreferencesSetAppValue( REDUCED_MOTION_PREFERENCE, kCFBooleanFalse, ACCESSIBILITY_DOMAIN);64 CFPreferencesSetAppValue(kAXInterfaceReduceMotionKey, kCFBooleanFalse, CFSTR("com.apple.universalaccess")); 88 65 89 66 auto observer = adoptNS([[WKPreferenceObserverForTesting alloc] init]); … … 91 68 [webView synchronouslyLoadTestPageNamed:@"simple"]; 92 69 70 CFPreferencesSetAppValue(kAXInterfaceReduceMotionKey, kCFBooleanTrue, CFSTR("com.apple.universalaccess")); 71 72 TestWebKitAPI::Util::run(&receivedPreferenceNotification); 73 93 74 auto reduceMotion = [&] { 94 75 return [webView stringByEvaluatingJavaScript:@"window.internals.userPrefersReducedMotion()"].boolValue; 95 76 }; 77 78 [webView synchronouslyLoadTestPageNamed:@"simple"]; 96 79 97 ASSERT_FALSE(reduceMotion());98 99 reduceMotionNotificationReceived = false;100 101 CFPreferencesSetAppValue(REDUCED_MOTION_PREFERENCE, kCFBooleanTrue, ACCESSIBILITY_DOMAIN);102 103 TestWebKitAPI::Util::run(&receivedPreferenceNotification);104 80 TestWebKitAPI::Util::run(&reduceMotionNotificationReceived); 105 106 [webView synchronouslyLoadTestPageNamed:@"simple"];107 81 108 82 ASSERT_TRUE(reduceMotion()); 109 83 110 CFPreferencesSetAppValue( REDUCED_MOTION_PREFERENCE, nullptr, ACCESSIBILITY_DOMAIN);84 CFPreferencesSetAppValue(kAXInterfaceReduceMotionKey, nullptr, CFSTR("com.apple.universalaccess")); 111 85 112 CFNotificationCenterRemoveObserver(NOTIFICATION_CENTER, nullptr, REDUCED_MOTION_CHANGED_NOTIFICATION, nullptr);86 [[NSNotificationCenter defaultCenter] removeObserver:accessibilityObserver.get()]; 113 87 } 114 88
Note:
See TracChangeset
for help on using the changeset viewer.