Changeset 245057 in webkit
- Timestamp:
- May 8, 2019 10:15:21 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r245053 r245057 1 2019-05-08 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 TestRunnerWKWebView's menu callbacks should be cleared upon UI script completion 4 https://bugs.webkit.org/show_bug.cgi?id=197685 5 6 Reviewed by Alex Christensen. 7 8 Adjust a couple of existing layout tests such that they don't rely on didShowMenuCallback and 9 didHideMenuCallback sticking around across UI scripts. Currently, these layout tests do the following: 10 11 1. Run a UI script that registers menu callback handlers. 12 2. Run a subsequent UI script that will cause the callback handlers to be fired (e.g. clicking on an element). 13 14 After making the change in the test runner to clear menu callbacks upon script completion, callbacks registered 15 in step (1) are now unregistered when step (2) completes. Instead, we can rewrite this test logic so that 16 they're driven by a single UI script. 17 18 * editing/pasteboard/ios/dom-paste-consecutive-confirmations.html: 19 * editing/pasteboard/ios/dom-paste-requires-user-gesture.html: 20 21 Instead of using internals.withUserGesture, put the test logic under a click handler (which is inside the scope 22 of a user gesture token), and then use requestAnimationFrame to schedule a second programmatic paste that is 23 outside the scope of user interaction. As opposed to setTimeout, requestAnimationFrame does not propagate the 24 current user gesture token. 25 26 * editing/pasteboard/ios/resources/dom-paste-helper.js: 27 (return.new.Promise.): 28 (async._waitForOrTriggerPasteMenu): 29 1 30 2019-05-08 Rob Buis <rbuis@igalia.com> 2 31 -
trunk/LayoutTests/editing/pasteboard/ios/dom-paste-consecutive-confirmations.html
r242551 r245057 50 50 doneCount = 0; 51 51 function incrementProgress() { 52 if (++doneCount === 4)52 if (++doneCount === 5) 53 53 uiController.uiScriptComplete(); 54 54 } 55 55 56 56 uiController.didHideMenuCallback = incrementProgress; 57 uiController.didShowMenuCallback = () => { 57 uiController.didShowMenuCallback = tapPasteMenuAction; 58 59 function tapPasteMenuAction() { 58 60 const rect = uiController.rectForMenuAction("Paste"); 59 61 uiController.singleTapAtPoint(rect.left + rect.width / 2, rect.top + rect.height / 2, incrementProgress); 60 }; 62 } 63 64 uiController.singleTapAtPoint(160, 50, incrementProgress); 61 65 })()`, resolve); 62 66 }); … … 81 85 return; 82 86 83 waitForAndTapPasteMenuTwice().then(finishJSTest);84 87 await UIHelper.activateAt(160, 125); 85 await UIHelper.activateAt(160, 50); 88 await waitForAndTapPasteMenuTwice(); 89 finishJSTest(); 86 90 }); 87 91 </script> -
trunk/LayoutTests/editing/pasteboard/ios/dom-paste-requires-user-gesture.html
r242551 r245057 44 44 description("Verifies that no callout is shown when the page programmatically triggers paste outside the scope of user interaction. This test requires WebKitTestRunner."); 45 45 46 function checkDone() { 47 if (!window.doneCount) 48 doneCount = 0; 49 50 if (++doneCount == 2) 51 finishJSTest(); 52 } 53 54 editor.addEventListener("click", event => { 55 editor.focus(); 56 shouldBe("document.execCommand('Paste')", "true"); 57 requestAnimationFrame(() => { 58 shouldBe("document.execCommand('Paste')", "false") 59 shouldBeEqualToString("editor.textContent", "Click here to copy"); 60 checkDone(); 61 }); 62 }); 63 46 64 addEventListener("load", async () => { 47 UIHelper.activateAt(160, 125).then(() => { 48 editor.focus(); 49 waitForPasteMenu().then(finishJSTest); 50 51 UIHelper.ensurePresentationUpdate().then(() => { 52 internals.withUserGesture(() => shouldBe("document.execCommand('Paste')", "true")); 53 shouldBe("document.execCommand('Paste')", "false"); 54 shouldBeEqualToString("editor.textContent", "Click here to copy"); 55 }); 56 }); 65 await UIHelper.activateAt(160, 125); 66 await triggerPasteMenuAfterTapAt(160, 50); 67 checkDone(); 57 68 }); 58 69 </script> -
trunk/LayoutTests/editing/pasteboard/ios/resources/dom-paste-helper.js
r241322 r245057 11 11 12 12 uiController.didHideMenuCallback = checkDone; 13 uiController.didShowMenuCallback = () => { 13 14 function tapPasteMenuAction() { 14 15 if (${proceedWithPaste}) { 15 16 const rect = uiController.rectForMenuAction("Paste"); … … 19 20 checkDone(); 20 21 } 21 }; 22 } 23 24 if (uiController.isShowingMenu) 25 tapPasteMenuAction(); 26 else 27 uiController.didShowMenuCallback = tapPasteMenuAction; 22 28 23 29 if (${shouldTap}) -
trunk/Tools/ChangeLog
r245045 r245057 1 2019-05-08 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 TestRunnerWKWebView's menu callbacks should be cleared upon UI script completion 4 https://bugs.webkit.org/show_bug.cgi?id=197685 5 6 Reviewed by Alex Christensen. 7 8 Fixes a bug in the test runner wherein didShowMenuCallback and didHideMenuCallback are not reset upon UI script 9 completion. See LayoutTests/ChangeLog for more details. 10 11 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 12 (WTR::UIScriptController::platformClearAllCallbacks): 13 1 14 2019-05-07 Oriol Brufau <obrufau@igalia.com> 2 15 -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r244955 r245057 994 994 void UIScriptController::platformClearAllCallbacks() 995 995 { 996 TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); 997 998 webView.didStartFormControlInteractionCallback = nil; 999 webView.didEndFormControlInteractionCallback = nil; 1000 webView.didShowForcePressPreviewCallback = nil; 1001 webView.didDismissForcePressPreviewCallback = nil; 1002 webView.didEndZoomingCallback = nil; 1003 webView.willBeginZoomingCallback = nil; 1004 webView.didHideKeyboardCallback = nil; 1005 webView.didShowKeyboardCallback = nil; 1006 webView.willPresentPopoverCallback = nil; 1007 webView.didDismissPopoverCallback = nil; 1008 webView.didEndScrollingCallback = nil; 1009 webView.rotationDidEndCallback = nil; 996 [TestController::singleton().mainWebView()->platformView() resetInteractionCallbacks]; 1010 997 } 1011 998
Note: See TracChangeset
for help on using the changeset viewer.