Merge "Synchronously call callback when load is cancelled" into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7ac6850464
@@ -312,6 +312,7 @@ open class ControlsBindingControllerImpl @Inject constructor(
|
||||
Log.d(TAG, "Canceling loadSubscribtion")
|
||||
it.invoke()
|
||||
}
|
||||
callback.error("Load cancelled")
|
||||
}
|
||||
|
||||
override fun onSubscribe(token: IBinder, subs: IControlsSubscription) {
|
||||
|
||||
@@ -116,11 +116,7 @@ class ControlsBindingControllerImplTest : SysuiTestCase() {
|
||||
|
||||
@Test
|
||||
fun testBindAndLoad_cancel() {
|
||||
val callback = object : ControlsBindingController.LoadCallback {
|
||||
override fun error(message: String) {}
|
||||
|
||||
override fun accept(t: List<Control>) {}
|
||||
}
|
||||
val callback = mock(ControlsBindingController.LoadCallback::class.java)
|
||||
val subscription = mock(IControlsSubscription::class.java)
|
||||
|
||||
val canceller = controller.bindAndLoad(TEST_COMPONENT_NAME_1, callback)
|
||||
@@ -130,6 +126,7 @@ class ControlsBindingControllerImplTest : SysuiTestCase() {
|
||||
|
||||
canceller.run()
|
||||
verify(providers[0]).cancelSubscription(subscription)
|
||||
verify(callback).error(any())
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user