Diff
Modified: trunk/LayoutTests/ChangeLog (206644 => 206645)
--- trunk/LayoutTests/ChangeLog 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/LayoutTests/ChangeLog 2016-09-30 18:39:30 UTC (rev 206645)
@@ -1,3 +1,13 @@
+2016-09-30 Megan Gardner <[email protected]>
+
+ Make it possible to test web-related user-interface features
+ https://bugs.webkit.org/show_bug.cgi?id=162657
+
+ Reviewed by Simon Fraser.
+
+ * fast/events/touch/ios/long-press-on-image-expected.txt: Added.
+ * fast/events/touch/ios/long-press-on-image.html: Added.
+
2016-09-30 Said Abou-Hallawa <[email protected]>
Change the MemoryCache and CachedResource adjustSize functions to take a long argument
Added: trunk/LayoutTests/fast/events/touch/ios/long-press-on-image-expected.txt (0 => 206645)
--- trunk/LayoutTests/fast/events/touch/ios/long-press-on-image-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-on-image-expected.txt 2016-09-30 18:39:30 UTC (rev 206645)
@@ -0,0 +1,5 @@
+Available Actions:
+Save Image
+Copy
+Cancel
+PASS
Added: trunk/LayoutTests/fast/events/touch/ios/long-press-on-image.html (0 => 206645)
--- trunk/LayoutTests/fast/events/touch/ios/long-press-on-image.html (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/long-press-on-image.html 2016-09-30 18:39:30 UTC (rev 206645)
@@ -0,0 +1,64 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function getUIScript()
+ {
+ return `
+ (function() {
+ uiController.longPressAtPoint(30, 20, function() {
+ uiController.uiScriptComplete(JSON.stringify(uiController.contentsOfUserInterfaceItem('actionSheet')));
+ });
+ })();`
+ }
+
+ function runTest()
+ {
+ if (!testRunner.runUIScript)
+ return;
+
+ var target = document.getElementById('target');
+ if (testRunner.runUIScript) {
+ testRunner.runUIScript(getUIScript(), function(result) {
+ var actionDictionary = JSON.parse(result);
+ var actionStrings = actionDictionary.actionSheet;
+ var output = '';
+ if (actionStrings[0] == 'Save Image' && actionStrings[1] == 'Copy' && actionStrings[2] == 'Cancel') {
+ output += 'Available Actions: <br>';
+ output += actionStrings.join('<br>');
+ output += '<br>';
+ output += 'PASS';
+ }
+ else
+ output = 'FAIL'
+
+ document.getElementById('target').innerHTML = output;
+ testRunner.notifyDone();
+ });
+ }
+ }
+
+ window.addEventListener('load', runTest, false);
+ </script>
+ <style>
+ #target {
+ height: 100px;
+ width: 200px;
+ background-color: silver;
+ }
+ </style>
+ <meta name="viewport" content="initial-scale=1">
+</head>
+<body>
+<div id="target">
+ <img src="" width="320" height="240" alt="Dice">
+ This test requires UIScriptController to run.
+</div>
+</body>
+</html>
Modified: trunk/Source/WebKit2/ChangeLog (206644 => 206645)
--- trunk/Source/WebKit2/ChangeLog 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Source/WebKit2/ChangeLog 2016-09-30 18:39:30 UTC (rev 206645)
@@ -1,3 +1,27 @@
+2016-09-30 Megan Gardner <[email protected]>
+
+ Make it possible to test web-related user-interface features
+ https://bugs.webkit.org/show_bug.cgi?id=162657
+
+ Reviewed by Simon Fraser.
+
+ Added the ability to pull the strings from an Action Sheet and pass them to
+ test scripts to make sure we are giving the correct available actions for
+ the item we are interacting with.
+ Added a test for long press on an image, and used the sheet scraping functionality
+ to make sure that the correct actions were being displayed.
+ Test for previous patch, Changeset 205915; Bug 161761
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _contentsOfUserInterfaceItem:]):
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+ * UIProcess/ios/WKActionSheetAssistant.h:
+ * UIProcess/ios/WKActionSheetAssistant.mm:
+ (-[WKActionSheetAssistant currentAvailableActionStrings]):
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView _contentsOfUserInterfaceItem:]):
+
2016-09-27 Anders Carlsson <[email protected]>
Remove a couple of unused members from PlatformKeyboardEvent
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (206644 => 206645)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2016-09-30 18:39:30 UTC (rev 206645)
@@ -4519,6 +4519,11 @@
[_contentView selectFormAccessoryPickerRow:rowIndex];
}
+- (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem
+{
+ return [_contentView _contentsOfUserInterfaceItem:(NSString *)userInterfaceItem];
+}
+
- (void)didStartFormControlInteraction
{
// For subclasses to override.
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (206644 => 206645)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2016-09-30 18:39:30 UTC (rev 206645)
@@ -263,6 +263,7 @@
- (void)keyboardAccessoryBarPrevious WK_API_AVAILABLE(ios(10.0));
- (void)dismissFormAccessoryView WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)selectFormAccessoryPickerRow:(int)rowIndex WK_API_AVAILABLE(ios(WK_IOS_TBA));
+- (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)didStartFormControlInteraction WK_API_AVAILABLE(ios(WK_IOS_TBA));
- (void)didEndFormControlInteraction WK_API_AVAILABLE(ios(WK_IOS_TBA));
Modified: trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h (206644 => 206645)
--- trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.h 2016-09-30 18:39:30 UTC (rev 206645)
@@ -72,6 +72,7 @@
- (RetainPtr<NSArray>)defaultActionsForLinkSheet:(_WKActivatedElementInfo *)elementInfo;
- (RetainPtr<NSArray>)defaultActionsForImageSheet:(_WKActivatedElementInfo *)elementInfo;
- (BOOL)isShowingSheet;
+- (NSArray *)currentAvailableActionTitles;
@end
#endif // PLATFORM(IOS)
Modified: trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm (206644 => 206645)
--- trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Source/WebKit2/UIProcess/ios/WKActionSheetAssistant.mm 2016-09-30 18:39:30 UTC (rev 206645)
@@ -213,6 +213,19 @@
return _interactionSheet != nil;
}
+- (NSArray *)currentAvailableActionTitles
+{
+ if (!_interactionSheet)
+ return @[];
+
+ NSMutableArray *array = [NSMutableArray array];
+
+ for (UIAlertAction *action in _interactionSheet.get().actions)
+ [array addObject:action.title];
+
+ return array;
+}
+
- (void)_createSheetWithElementActions:(NSArray *)actions showLinkTitle:(BOOL)showLinkTitle
{
auto delegate = _delegate.get();
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (206644 => 206645)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h 2016-09-30 18:39:30 UTC (rev 206645)
@@ -231,6 +231,7 @@
@interface WKContentView (WKTesting)
- (void)selectFormAccessoryPickerRow:(NSInteger)rowIndex;
+- (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem;
@end
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (206644 => 206645)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2016-09-30 18:39:30 UTC (rev 206645)
@@ -3849,6 +3849,14 @@
[(WKFormSelectControl *)_inputPeripheral selectRow:rowIndex inComponent:0 extendingSelection:NO];
}
+- (NSDictionary *)_contentsOfUserInterfaceItem:(NSString *)userInterfaceItem
+{
+ if ([userInterfaceItem isEqualToString:@"actionSheet"])
+ return @{ userInterfaceItem: [_actionSheetAssistant currentAvailableActionTitles] };
+
+ return nil;
+}
+
@end
#if HAVE(LINK_PREVIEW)
Modified: trunk/Tools/ChangeLog (206644 => 206645)
--- trunk/Tools/ChangeLog 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Tools/ChangeLog 2016-09-30 18:39:30 UTC (rev 206645)
@@ -1,3 +1,22 @@
+2016-09-30 Megan Gardner <[email protected]>
+
+ Make it possible to test web-related user-interface features
+ https://bugs.webkit.org/show_bug.cgi?id=162657
+
+ Reviewed by Simon Fraser.
+
+ * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptController::contentsOfUserInterfaceItem):
+ (WTR::UIScriptController::selectFormAccessoryPickerRow): Deleted.
+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+ (WTR::UIScriptController::contentsOfUserInterfaceItem):
+ (WTR::UIScriptController::selectFormAccessoryPickerRow): Deleted.
+ * TestRunnerShared/UIScriptContext/UIScriptController.h:
+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptController::contentsOfUserInterfaceItem):
+ (WTR::UIScriptController::selectFormAccessoryPickerRow): Deleted.
+
2016-09-29 Jiewen Tan <[email protected]>
Expose CryptoKey to web workers
Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (206644 => 206645)
--- trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm 2016-09-30 18:39:30 UTC (rev 206645)
@@ -127,6 +127,11 @@
void UIScriptController::selectFormAccessoryPickerRow(long rowIndex)
{
}
+
+JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const
+{
+ return nullptr;
+}
void UIScriptController::scrollToOffset(long, long)
{
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (206644 => 206645)
--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2016-09-30 18:39:30 UTC (rev 206645)
@@ -62,6 +62,9 @@
void keyboardAccessoryBarNext();
void keyboardAccessoryBarPrevious();
+ // Returned object is a dictionary with the passed in string as a key for returned object
+ object contentsOfUserInterfaceItem(DOMString interfaceItem);
+
// These callbacks also work for the form accessory views.
attribute object didShowKeyboardCallback;
attribute object didHideKeyboardCallback;
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (206644 => 206645)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2016-09-30 18:39:30 UTC (rev 206645)
@@ -199,6 +199,11 @@
void UIScriptController::selectFormAccessoryPickerRow(long)
{
}
+
+JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const
+{
+ return nullptr;
+}
void UIScriptController::scrollToOffset(long x, long y)
{
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (206644 => 206645)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2016-09-30 18:39:30 UTC (rev 206645)
@@ -74,6 +74,8 @@
void dismissFormAccessoryView();
void selectFormAccessoryPickerRow(long);
+ JSObjectRef contentsOfUserInterfaceItem(JSStringRef) const;
+
void scrollToOffset(long x, long y);
void setDidStartFormControlInteractionCallback(JSValueRef);
Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (206644 => 206645)
--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2016-09-30 18:29:31 UTC (rev 206644)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2016-09-30 18:39:30 UTC (rev 206645)
@@ -247,6 +247,13 @@
TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
[webView selectFormAccessoryPickerRow:rowIndex];
}
+
+JSObjectRef UIScriptController::contentsOfUserInterfaceItem(JSStringRef interfaceItem) const
+{
+ TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
+ NSDictionary *contentDictionary = [webView _contentsOfUserInterfaceItem:toWTFString(toWK(interfaceItem))];
+ return JSValueToObject(m_context->jsContext(), [JSValue valueWithObject:contentDictionary inContext:[JSContext contextWithJSGlobalContextRef:m_context->jsContext()]].JSValueRef, nullptr);
+}
static CGPoint contentOffsetBoundedInValidRange(UIScrollView *scrollView, CGPoint contentOffset)
{