Loading core/tests/coretests/src/android/app/LoaderLifecycleTest.java +18 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,13 @@ package android.app; import static junit.framework.TestCase.assertNotNull; import static junit.framework.TestCase.assertNotSame; import static junit.framework.TestCase.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import android.content.Context; import android.os.Handler; import android.os.Parcelable; Loading @@ -24,14 +31,11 @@ import android.support.test.filters.MediumTest; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.util.ArrayMap; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import static junit.framework.TestCase.assertNotNull; import static junit.framework.TestCase.assertNotSame; import static junit.framework.TestCase.assertSame; @RunWith(AndroidJUnit4.class) public class LoaderLifecycleTest { @Rule Loading Loading @@ -203,6 +207,16 @@ public class LoaderLifecycleTest { // Test that the fragments are in the configuration we expect final Fragment restoredOne = fm2.findFragmentByTag("one"); try { restoredOne.getLoaderManager(); fail("A restored fragment on the back stack doesn't have a host, so it should " + "throw an exception"); } catch (IllegalStateException e) { // expected } fm2.popBackStackImmediate(); // Now restoredOne should be added and should be in a good state. assertTrue(restoredOne.isAdded()); final LoaderManager lm2 = restoredOne.getLoaderManager(); assertSame("didn't get same LoaderManager instance back", lm2, lm1); Loading Loading
core/tests/coretests/src/android/app/LoaderLifecycleTest.java +18 −4 Original line number Diff line number Diff line Loading @@ -17,6 +17,13 @@ package android.app; import static junit.framework.TestCase.assertNotNull; import static junit.framework.TestCase.assertNotSame; import static junit.framework.TestCase.assertSame; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import android.content.Context; import android.os.Handler; import android.os.Parcelable; Loading @@ -24,14 +31,11 @@ import android.support.test.filters.MediumTest; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import android.util.ArrayMap; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import static junit.framework.TestCase.assertNotNull; import static junit.framework.TestCase.assertNotSame; import static junit.framework.TestCase.assertSame; @RunWith(AndroidJUnit4.class) public class LoaderLifecycleTest { @Rule Loading Loading @@ -203,6 +207,16 @@ public class LoaderLifecycleTest { // Test that the fragments are in the configuration we expect final Fragment restoredOne = fm2.findFragmentByTag("one"); try { restoredOne.getLoaderManager(); fail("A restored fragment on the back stack doesn't have a host, so it should " + "throw an exception"); } catch (IllegalStateException e) { // expected } fm2.popBackStackImmediate(); // Now restoredOne should be added and should be in a good state. assertTrue(restoredOne.isAdded()); final LoaderManager lm2 = restoredOne.getLoaderManager(); assertSame("didn't get same LoaderManager instance back", lm2, lm1); Loading