mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1885410 - Update inputConnection_multiple_commitText_into_batchEdit to fix failure. r=geckoview-reviewers,owlish
This test was added by bug 1837931. But according to bug 1885410, it is rarely failure. So I re-write this to use keyboard event to wait for completion. Differential Revision: https://phabricator.services.mozilla.com/D209989
This commit is contained in:
parent
9a838471e6
commit
3989e41645
@ -1296,14 +1296,40 @@ class TextInputDelegateTest : BaseSessionTest() {
|
||||
setupContent("")
|
||||
val ic = mainSession.textInput.onCreateInputConnection(EditorInfo())!!
|
||||
|
||||
val promise = mainSession.evaluatePromiseJS(
|
||||
when (id) {
|
||||
"#designmode" -> """
|
||||
new Promise(
|
||||
r => document.querySelector('$id').contentDocument.addEventListener('keyup', function handler(e) {
|
||||
if (e.key == "c") {
|
||||
r();
|
||||
document.querySelector('$id').contentDocument.removeEventListener('keyup', handler);
|
||||
}
|
||||
}))
|
||||
""".trimIndent()
|
||||
|
||||
else -> """
|
||||
new Promise(
|
||||
r => document.querySelector('$id').addEventListener('keyup', function handler(e) {
|
||||
if (e.key == "c") {
|
||||
r();
|
||||
document.querySelector('$id').removeEventListener('keyup', handler);
|
||||
}
|
||||
}))
|
||||
""".trimIndent()
|
||||
},
|
||||
)
|
||||
|
||||
// Emulate GBoard's InputConnection API calls
|
||||
ic.beginBatchEdit()
|
||||
ic.commitText("( ", 1)
|
||||
ic.commitText(")", -1)
|
||||
ic.commitText("ab", 1)
|
||||
ic.commitText("c", -1)
|
||||
ic.endBatchEdit()
|
||||
|
||||
promise.value
|
||||
processChildEvents()
|
||||
|
||||
assertText("commit ()", ic, "( )")
|
||||
assertText("committed text is \"abc\"", ic, "abc")
|
||||
}
|
||||
|
||||
// Bug 1593683 - Cursor is jumping when using the arrow keys in input field on GBoard
|
||||
|
Loading…
Reference in New Issue
Block a user