Add NetworkRequestDialogActivity

Framwork will call this activity to start network requesting process.
This activity is simple activity contained NetworkRequestDialogFragment
and any other dialog generated in this process, aka
NetworkRequestTimeoutDialog.

Bug: 117399926
Test: RunSettingsRoboTests
Change-Id: Ib1df28d12427ed3bd7d4b88ec10e52357564c797
This commit is contained in:
cosmohsieh
2018-11-26 11:58:02 +08:00
parent 5948259702
commit da37bb7df7
4 changed files with 345 additions and 226 deletions

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.android.settings.wifi;
import static com.google.common.truth.Truth.assertThat;
import androidx.appcompat.app.AlertDialog;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResourcesImpl;
import com.android.settings.testutils.shadow.ShadowAlertDialogCompat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(shadows = {
ShadowAlertDialogCompat.class,
SettingsShadowResourcesImpl.class
})
public class NetworkRequestDialogActivityTest {
@Test
public void LaunchActivity_shouldShowNetworkRequestDialog() {
NetworkRequestDialogActivity activity = Robolectric
.setupActivity(NetworkRequestDialogActivity.class);
AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(alertDialog.isShowing()).isTrue();
}
}