File tree Expand file tree Collapse file tree
ui/kotlinx-coroutines-android
android-unit-tests/test/ordered/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import kotlinx.coroutines.*
55import kotlinx.coroutines.test.*
66import org.junit.Test
77import org.junit.runner.*
8+ import android.os.Looper
89import org.robolectric.*
910import org.robolectric.annotation.*
1011import org.robolectric.shadows.*
@@ -43,7 +44,7 @@ class CustomizedRobolectricTest : TestBase() {
4344
4445
4546 private fun checkComponent (component : TestComponent ) {
46- val mainLooper = ShadowLooper .getShadowMainLooper( )
47+ val mainLooper = Shadows .shadowOf( Looper .getMainLooper() )
4748 mainLooper.pause()
4849 component.launchSomething()
4950 assertFalse(component.launchCompleted)
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import kotlinx.coroutines.*
44import kotlinx.coroutines.test.*
55import org.junit.Test
66import org.junit.runner.*
7+ import android.os.Looper
78import org.robolectric.*
89import org.robolectric.annotation.*
910import org.robolectric.shadows.*
@@ -32,7 +33,7 @@ open class FirstRobolectricTest {
3233 @Test
3334 fun testDelay () {
3435 val component = TestComponent ()
35- val mainLooper = ShadowLooper .getShadowMainLooper( )
36+ val mainLooper = Shadows .shadowOf( Looper .getMainLooper() )
3637 mainLooper.pause()
3738 component.launchDelayed()
3839 mainLooper.runToNextTask()
@@ -42,7 +43,7 @@ open class FirstRobolectricTest {
4243 }
4344
4445 private fun checkComponent (component : TestComponent ) {
45- val mainLooper = ShadowLooper .getShadowMainLooper( )
46+ val mainLooper = Shadows .shadowOf( Looper .getMainLooper() )
4647 mainLooper.pause()
4748 component.launchSomething()
4849 assertFalse(component.launchCompleted)
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ class HandlerDispatcherTest : MainDispatcherTestBase.WithRealTimeDelay() {
8181 }
8282
8383 private fun CoroutineScope.doTestAwaitFrame () {
84- ShadowChoreographer .setPostFrameCallbackDelay(100 )
84+ ShadowLegacyChoreographer .setPostFrameCallbackDelay(100 )
8585 val mainLooper = Shadows .shadowOf(Looper .getMainLooper())
8686 mainLooper.pause()
8787 launch(Dispatchers .Main , start = CoroutineStart .UNDISPATCHED ) {
@@ -96,7 +96,7 @@ class HandlerDispatcherTest : MainDispatcherTestBase.WithRealTimeDelay() {
9696 }
9797
9898 private fun CoroutineScope.doTestAwaitWithDetectedChoreographer () {
99- ShadowChoreographer .setPostFrameCallbackDelay(100 )
99+ ShadowLegacyChoreographer .setPostFrameCallbackDelay(100 )
100100 val mainLooper = Shadows .shadowOf(Looper .getMainLooper())
101101 launch(Dispatchers .Main , start = CoroutineStart .UNDISPATCHED ) {
102102 expect(1 )
You can’t perform that action at this time.
0 commit comments