mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1748981 - Use delegateDuringNextWait when returning GeckoResult. r=calu
When looking test failure, I found that `onOrientationLock` always returned null in geckoview-junit since default method is called. We should use use `delegateDuringNextWait` instead of `waitUntilCalled`. Differential Revision: https://phabricator.services.mozilla.com/D135574
This commit is contained in:
parent
bf31f73133
commit
df7f7503f4
@ -47,7 +47,7 @@ class OrientationDelegateTest : BaseSessionTest() {
|
||||
|
||||
private fun lockPortrait() {
|
||||
val promise = mainSession.evaluatePromiseJS("screen.orientation.lock('portrait-primary')")
|
||||
sessionRule.waitUntilCalled(object : OrientationController.OrientationDelegate {
|
||||
sessionRule.delegateDuringNextWait(object : OrientationController.OrientationDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onOrientationLock(aOrientation: Int): GeckoResult<AllowOrDeny> {
|
||||
assertThat(
|
||||
@ -63,11 +63,13 @@ class OrientationDelegateTest : BaseSessionTest() {
|
||||
})
|
||||
sessionRule.runtime.orientationChanged(Configuration.ORIENTATION_PORTRAIT)
|
||||
promise.value
|
||||
// Remove previous delegate
|
||||
mainSession.waitForRoundTrip()
|
||||
}
|
||||
|
||||
private fun lockLandscape() {
|
||||
val promise = mainSession.evaluatePromiseJS("screen.orientation.lock('landscape-primary')")
|
||||
sessionRule.waitUntilCalled(object : OrientationController.OrientationDelegate {
|
||||
sessionRule.delegateDuringNextWait(object : OrientationController.OrientationDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onOrientationLock(aOrientation: Int): GeckoResult<AllowOrDeny> {
|
||||
assertThat(
|
||||
@ -83,6 +85,8 @@ class OrientationDelegateTest : BaseSessionTest() {
|
||||
})
|
||||
sessionRule.runtime.orientationChanged(Configuration.ORIENTATION_LANDSCAPE)
|
||||
promise.value
|
||||
// Remove previous delegate
|
||||
mainSession.waitForRoundTrip()
|
||||
}
|
||||
|
||||
@Test fun orientationLock() {
|
||||
@ -144,7 +148,7 @@ class OrientationDelegateTest : BaseSessionTest() {
|
||||
goFullscreen()
|
||||
|
||||
val promise = mainSession.evaluatePromiseJS("screen.orientation.lock('landscape-primary')")
|
||||
sessionRule.waitUntilCalled(object : OrientationController.OrientationDelegate {
|
||||
sessionRule.delegateDuringNextWait(object : OrientationController.OrientationDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onOrientationLock(aOrientation: Int): GeckoResult<AllowOrDeny> {
|
||||
assertThat(
|
||||
@ -160,6 +164,8 @@ class OrientationDelegateTest : BaseSessionTest() {
|
||||
})
|
||||
sessionRule.runtime.orientationChanged(Configuration.ORIENTATION_LANDSCAPE)
|
||||
promise.value
|
||||
// Remove previous delegate
|
||||
mainSession.waitForRoundTrip()
|
||||
|
||||
// after locking to orientation landscape, unlock to default
|
||||
mainSession.evaluateJS("screen.orientation.unlock()")
|
||||
|
Loading…
Reference in New Issue
Block a user