Merge "[Wi-Fi NetworkRequest] Set theme for the NetworkRequest dialog" into qt-qpr1-dev

This commit is contained in:
Goven Liu
2019-08-21 05:13:49 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 4 deletions

View File

@@ -2707,7 +2707,7 @@
<activity
android:name=".wifi.NetworkRequestDialogActivity"
android:theme="@style/Transparent"
android:theme="@style/Theme.AlertDialog"
android:excludeFromRecents="true"
android:launchMode="singleTop"
android:taskAffinity=".wifi.NetworkRequestDialogActivity"

View File

@@ -26,6 +26,7 @@ import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
import com.android.settingslib.wifi.WifiTracker;
import com.android.settingslib.wifi.WifiTrackerFactory;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
@@ -36,15 +37,18 @@ import org.robolectric.annotation.Config;
@Config(shadows = ShadowAlertDialogCompat.class)
public class NetworkRequestDialogActivityTest {
@Test
public void LaunchActivity_shouldShowNetworkRequestDialog() {
@Before
public void setUp() {
// Mocks fake WifiTracker, in case of exception in NetworkRequestDialogFragment.onResume().
WifiTracker wifiTracker = mock(WifiTracker.class);
WifiTrackerFactory.setTestingWifiTracker(wifiTracker);
}
@Test
public void launchActivity_shouldShowNetworkRequestDialog() {
Robolectric.setupActivity(NetworkRequestDialogActivity.class);
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog.isShowing()).isTrue();
}