- Revision
- 237328
- Author
- [email protected]
- Date
- 2018-10-22 13:12:07 -0700 (Mon, 22 Oct 2018)
Log Message
[iOS] [Datalist] fast/forms/datalist/datalist-show-hide.html fails
https://bugs.webkit.org/show_bug.cgi?id=190777
Reviewed by Tim Horton.
Tools:
Implement isShowingDataListSuggestions on iOS. See below for more details.
* DumpRenderTree/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::isShowingDataListSuggestions const):
Add a stub implementation for DumpRenderTree.
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::isShowingDataListSuggestions const):
Move this stub implementation to !PLATFORM(COCOA).
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::forEachViewInHierarchy):
Add a helper function to apply a given function to a UIView and each of its subviews, recursively.
(WTR::UIScriptController::isShowingDataListSuggestions const):
For iOS, return whether the UIRemoteKeyboardWindow contains a subview of type WKDataListSuggestionsPickerView.
LayoutTests:
Refactor this test such that it passes on both iOS and macOS. This test verifies that datalist suggestions menu
UI can be shown and hidden. On macOS, we focus and then blur the input field; on iOS, we tap in the datalist
button to show the suggestions UI, and then tap in the text field to bring back the regular keyboard.
* fast/forms/datalist/datalist-show-hide-expected.txt:
* fast/forms/datalist/datalist-show-hide.html:
* platform/ios/TestExpectations:
Unskip the layout test on iOS.
* resources/ui-helper.js:
(window.UIHelper.isShowingDataListSuggestions):
Tweak this helper function to resolve with either true or false (Boolean types), instead of the strings "true"
and "false".
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (237327 => 237328)
--- trunk/LayoutTests/ChangeLog 2018-10-22 19:24:04 UTC (rev 237327)
+++ trunk/LayoutTests/ChangeLog 2018-10-22 20:12:07 UTC (rev 237328)
@@ -1,3 +1,26 @@
+2018-10-22 Wenson Hsieh <[email protected]>
+
+ [iOS] [Datalist] fast/forms/datalist/datalist-show-hide.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=190777
+
+ Reviewed by Tim Horton.
+
+ Refactor this test such that it passes on both iOS and macOS. This test verifies that datalist suggestions menu
+ UI can be shown and hidden. On macOS, we focus and then blur the input field; on iOS, we tap in the datalist
+ button to show the suggestions UI, and then tap in the text field to bring back the regular keyboard.
+
+ * fast/forms/datalist/datalist-show-hide-expected.txt:
+ * fast/forms/datalist/datalist-show-hide.html:
+ * platform/ios/TestExpectations:
+
+ Unskip the layout test on iOS.
+
+ * resources/ui-helper.js:
+ (window.UIHelper.isShowingDataListSuggestions):
+
+ Tweak this helper function to resolve with either true or false (Boolean types), instead of the strings "true"
+ and "false".
+
2018-10-22 Truitt Savell <[email protected]>
[ MacOS WK1 ] Layout Test platform/mac/media/audio-session-category-video-paused.html is flaky Timeout
Modified: trunk/LayoutTests/fast/forms/datalist/datalist-show-hide-expected.txt (237327 => 237328)
--- trunk/LayoutTests/fast/forms/datalist/datalist-show-hide-expected.txt 2018-10-22 19:24:04 UTC (rev 237327)
+++ trunk/LayoutTests/fast/forms/datalist/datalist-show-hide-expected.txt 2018-10-22 20:12:07 UTC (rev 237328)
@@ -1,8 +1,9 @@
-CLICK
-PASS showingList is "true"
-BLUR
-PASS showingList is "false"
-PASS successfullyParsed is true
-TEST COMPLETE
+1. Is showing suggestions? true
+2. Is showing suggestions? false
+This test verifies that datalist suggestions UI can be shown and hidden. To test manually:
+Focus the text field; on iOS, additionally tap the suggestions dropdown button.
+Verify that a menu containing suggestions is shown.
+On iOS, tap the input field; on macOS, blur the input.
+Verify that the suggestions menu is no longer shown.
Modified: trunk/LayoutTests/fast/forms/datalist/datalist-show-hide.html (237327 => 237328)
--- trunk/LayoutTests/fast/forms/datalist/datalist-show-hide.html 2018-10-22 19:24:04 UTC (rev 237327)
+++ trunk/LayoutTests/fast/forms/datalist/datalist-show-hide.html 2018-10-22 20:12:07 UTC (rev 237328)
@@ -1,38 +1,71 @@
<!DOCTYPE html>
<html>
<head>
-<script src=""
+<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src=""
+<style>
+input {
+ width: 300px;
+ height: 50px;
+}
+
+body {
+ margin: 0;
+}
+</style>
<head>
<body _onload_="runTest()">
-<input id="fruit" list="fruits" type="text"/>
+<input id="input" list="fruits" type="text"/>
<datalist id="fruits">
<option>Apple</option>
<option>Orange</option>
<option>Pear</option>
</datalist>
+<pre>1. Is showing suggestions? <span id="before"></span></pre>
+<pre>2. Is showing suggestions? <span id="after"></span></pre>
+<br>
+<div>This test verifies that datalist suggestions UI can be shown and hidden. To test manually:</div>
+<ol>
+ <li>Focus the text field; on iOS, additionally tap the suggestions dropdown button.</li>
+ <li>Verify that a menu containing suggestions is shown.</li>
+ <li>On iOS, tap the input field; on macOS, blur the input.</li>
+ <li>Verify that the suggestions menu is no longer shown.</li>
+</ol>
</body>
<script>
-jsTestIsAsync = true;
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+function waitForDataListSuggestionsToChangeVisibility(visible)
+{
+ return new Promise(async resolve => {
+ while (visible != await UIHelper.isShowingDataListSuggestions())
+ continue;
+ resolve();
+ });
+}
+
async function runTest() {
- let input = document.getElementById("fruit");
+ await UIHelper.activateAndWaitForInputSessionAt(150, 25);
- await UIHelper.activateElement(input);
- UIHelper.isShowingDataListSuggestions().then(async (value) => {
- showingList = value;
- debug("CLICK");
- shouldBe("showingList", '"true"');
+ if (UIHelper.isIOS()) {
+ await UIHelper.tapAt(290, 30);
+ await waitForDataListSuggestionsToChangeVisibility(true);
+ }
- await UIHelper.activateAt(0, 0);
- UIHelper.isShowingDataListSuggestions().then((value) => {
- showingList = value;
- debug("BLUR");
- shouldBe("showingList", '"false"');
- finishJSTest();
- });
- });
+ before.textContent = await UIHelper.isShowingDataListSuggestions();
+
+ if (UIHelper.isIOS()) {
+ await UIHelper.tapAt(150, 25);
+ await waitForDataListSuggestionsToChangeVisibility(false);
+ } else
+ input.blur();
+
+ after.textContent = await UIHelper.isShowingDataListSuggestions();
+
+ testRunner.notifyDone();
}
-
</script>
</html>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (237327 => 237328)
--- trunk/LayoutTests/platform/ios/TestExpectations 2018-10-22 19:24:04 UTC (rev 237327)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2018-10-22 20:12:07 UTC (rev 237328)
@@ -3109,7 +3109,6 @@
fast/block/block-only/absolute-position-min-max-height.html [ Failure ]
# Datalist
-webkit.org/b/186714 fast/forms/datalist/datalist-show-hide.html [ Skip ]
webkit.org/b/186714 fast/forms/datalist/datalist-textinput-keydown.html [ Skip ]
webkit.org/b/190613 fast/forms/datalist/update-range-with-datalist.html [ Skip ]
Modified: trunk/LayoutTests/resources/ui-helper.js (237327 => 237328)
--- trunk/LayoutTests/resources/ui-helper.js 2018-10-22 19:24:04 UTC (rev 237327)
+++ trunk/LayoutTests/resources/ui-helper.js 2018-10-22 20:12:07 UTC (rev 237328)
@@ -297,7 +297,7 @@
return new Promise(resolve => {
testRunner.runUIScript(`(() => {
uiController.uiScriptComplete(uiController.isShowingDataListSuggestions);
- })()`, resolve);
+ })()`, result => resolve(result === "true" ? true : false));
});
}
Modified: trunk/Tools/ChangeLog (237327 => 237328)
--- trunk/Tools/ChangeLog 2018-10-22 19:24:04 UTC (rev 237327)
+++ trunk/Tools/ChangeLog 2018-10-22 20:12:07 UTC (rev 237328)
@@ -1,3 +1,31 @@
+2018-10-22 Wenson Hsieh <[email protected]>
+
+ [iOS] [Datalist] fast/forms/datalist/datalist-show-hide.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=190777
+
+ Reviewed by Tim Horton.
+
+ Implement isShowingDataListSuggestions on iOS. See below for more details.
+
+ * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptController::isShowingDataListSuggestions const):
+
+ Add a stub implementation for DumpRenderTree.
+
+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+ (WTR::UIScriptController::isShowingDataListSuggestions const):
+
+ Move this stub implementation to !PLATFORM(COCOA).
+
+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+ (WTR::forEachViewInHierarchy):
+
+ Add a helper function to apply a given function to a UIView and each of its subviews, recursively.
+
+ (WTR::UIScriptController::isShowingDataListSuggestions const):
+
+ For iOS, return whether the UIRemoteKeyboardWindow contains a subview of type WKDataListSuggestionsPickerView.
+
2018-10-19 Dan Bernstein <[email protected]>
[macOS] MiniBrowser has an unused injected bundle
Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (237327 => 237328)
--- trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm 2018-10-22 19:24:04 UTC (rev 237327)
+++ trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm 2018-10-22 20:12:07 UTC (rev 237328)
@@ -389,6 +389,11 @@
return nullptr;
}
+bool UIScriptController::isShowingDataListSuggestions() const
+{
+ return false;
}
+}
+
#endif // PLATFORM(IOS_FAMILY)
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (237327 => 237328)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2018-10-22 19:24:04 UTC (rev 237327)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2018-10-22 20:12:07 UTC (rev 237328)
@@ -507,6 +507,11 @@
{
}
+bool UIScriptController::isShowingDataListSuggestions() const
+{
+ return false;
+}
+
#endif // !PLATFORM(COCOA)
#if !PLATFORM(MAC)
@@ -536,11 +541,6 @@
return false;
}
-bool UIScriptController::isShowingDataListSuggestions() const
-{
- return false;
-}
-
#endif
void UIScriptController::uiScriptComplete(JSStringRef result)
Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (237327 => 237328)
--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2018-10-22 19:24:04 UTC (rev 237327)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2018-10-22 20:12:07 UTC (rev 237328)
@@ -784,6 +784,45 @@
m_context->asyncTaskComplete(callbackID);
}
+static BOOL forEachViewInHierarchy(UIView *view, void(^mapFunction)(UIView *subview, BOOL *stop))
+{
+ BOOL stop = NO;
+ mapFunction(view, &stop);
+ if (stop)
+ return YES;
+
+ for (UIView *subview in view.subviews) {
+ stop = forEachViewInHierarchy(subview, mapFunction);
+ if (stop)
+ break;
+ }
+ return stop;
}
+bool UIScriptController::isShowingDataListSuggestions() const
+{
+ Class remoteKeyboardWindowClass = NSClassFromString(@"UIRemoteKeyboardWindow");
+ Class suggestionsPickerViewClass = NSClassFromString(@"WKDataListSuggestionsPickerView");
+ UIWindow *remoteInputHostingWindow = nil;
+ for (UIWindow *window in UIApplication.sharedApplication.windows) {
+ if ([window isKindOfClass:remoteKeyboardWindowClass])
+ remoteInputHostingWindow = window;
+ }
+
+ if (!remoteInputHostingWindow)
+ return false;
+
+ __block bool foundDataListSuggestionsPickerView = false;
+ forEachViewInHierarchy(remoteInputHostingWindow, ^(UIView *subview, BOOL *stop) {
+ if (![subview isKindOfClass:suggestionsPickerViewClass])
+ return;
+
+ foundDataListSuggestionsPickerView = true;
+ *stop = YES;
+ });
+ return foundDataListSuggestionsPickerView;
+}
+
+}
+
#endif // PLATFORM(IOS_FAMILY)