Update testcases which failed due to the SupportLibrary changed

Fragment.oncreate() causes an IllegalStateException. We use a
ShadowFragment to stop the calling sequence.

Fixes: 135086559
Test: robotest
Change-Id: I601e0f2513f826b0b7749cb2c013b7e4c0a94a33
This commit is contained in:
Sunny Shao
2019-06-13 17:06:31 +08:00
committed by Raff Tsai
parent f1c0f23510
commit 5da24591ea
14 changed files with 87 additions and 27 deletions

View File

@@ -54,6 +54,7 @@ import com.android.settings.R;
import com.android.settings.testutils.shadow.ShadowAccountManager;
import com.android.settings.testutils.shadow.ShadowContentResolver;
import com.android.settings.testutils.shadow.ShadowDevicePolicyManager;
import com.android.settings.testutils.shadow.ShadowFragment;
import com.android.settings.testutils.shadow.ShadowUserManager;
import com.android.settingslib.widget.LayoutPreference;
@@ -169,7 +170,8 @@ public class RemoveAccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class,
ShadowFragment.class})
public void confirmRemove_shouldRemoveAccount()
throws AuthenticatorException, OperationCanceledException, IOException {
when(mFragment.isAdded()).thenReturn(true);
@@ -201,7 +203,8 @@ public class RemoveAccountPreferenceControllerTest {
}
@Test
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class})
@Config(shadows = {ShadowAccountManager.class, ShadowContentResolver.class,
ShadowFragment.class})
public void confirmRemove_activityGone_shouldSilentlyRemoveAccount()
throws AuthenticatorException, OperationCanceledException, IOException {
final Account account = new Account("Account11", "com.acct1");