зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1630119 - Set initial text and selection correctly on sendDummyKeyboardEvent. r=geckoview-reviewers,owlish
This test is rarely failure when initial text and selection correctly. Because we don't wait for setting initial data, or it is text is too short to update text. So I re-write this tests. And also, this has typo fix for test name. Differential Revision: https://phabricator.services.mozilla.com/D131048
This commit is contained in:
Родитель
3c8a797094
Коммит
44f94fa3e3
|
@ -738,21 +738,17 @@ class TextInputDelegateTest : BaseSessionTest() {
|
|||
}
|
||||
|
||||
@WithDisplay(width = 512, height = 512) // Child process updates require having a display.
|
||||
@Test fun sendDummpyKeyboardEvent() {
|
||||
@Test fun sendDummyKeyboardEvent() {
|
||||
// unnecessary for designmode
|
||||
assumeThat("Not in designmode", id, not(equalTo("#designmode")))
|
||||
|
||||
mainSession.textInput.view = View(InstrumentationRegistry.getInstrumentation().targetContext)
|
||||
|
||||
mainSession.loadTestPath(INPUTS_PATH)
|
||||
mainSession.waitForPageStop()
|
||||
|
||||
textContent = ""
|
||||
mainSession.evaluateJS("document.querySelector('$id').focus()")
|
||||
mainSession.waitUntilCalled(GeckoSession.TextInputDelegate::class, "restartInput")
|
||||
setupContent("")
|
||||
|
||||
val ic = mainSession.textInput.onCreateInputConnection(EditorInfo())!!
|
||||
ic.commitText("a", 1)
|
||||
assertText("Set initial text", ic, "")
|
||||
|
||||
commitText(ic, "foo", 1)
|
||||
assertTextAndSelectionAt("commit text and selection", ic, "foo", 3)
|
||||
|
||||
// Dispatching keydown, input and keyup
|
||||
val promise =
|
||||
|
@ -763,7 +759,7 @@ class TextInputDelegateTest : BaseSessionTest() {
|
|||
{ once: true }) },
|
||||
{ once: true}))""")
|
||||
ic.beginBatchEdit();
|
||||
ic.setSelection(0, 1)
|
||||
ic.setSelection(0, 3)
|
||||
ic.setComposingText("", 1)
|
||||
ic.endBatchEdit()
|
||||
promise.value
|
||||
|
|
Загрузка…
Ссылка в новой задаче