p2p: do P2P factory reset for Network Reset
Bug: 109866998
Test: * manual trigger network reset in below conditions:
* trigger network reset with P2P on
* trigger network reset with WiFi on, P2P off
* trigger network reset with WiFi off
* trigger network reset with WiFi off then do reboot
* check groups shown in WiFi Direct page
* use wpa_cli -i p2p0 list_network
Test: RobotTest - make ROBOTEST_FILTER=ResetNetworkConfirmTest
Change-Id: If5292e34cb9702d4319a4c9bbd867e0e5ed716a2
This commit is contained in:
@@ -24,6 +24,7 @@ import android.app.Activity;
|
||||
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.testutils.shadow.ShadowRecoverySystem;
|
||||
import com.android.settings.testutils.shadow.ShadowWifiP2pManager;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
@@ -35,7 +36,7 @@ import org.robolectric.Robolectric;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(shadows = {ShadowRecoverySystem.class})
|
||||
@Config(shadows = {ShadowRecoverySystem.class, ShadowWifiP2pManager.class})
|
||||
public class ResetNetworkConfirmTest {
|
||||
|
||||
private Activity mActivity;
|
||||
@@ -52,6 +53,7 @@ public class ResetNetworkConfirmTest {
|
||||
@After
|
||||
public void tearDown() {
|
||||
ShadowRecoverySystem.reset();
|
||||
ShadowWifiP2pManager.reset();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -76,4 +78,16 @@ public class ResetNetworkConfirmTest {
|
||||
assertThat(ShadowRecoverySystem.getWipeEuiccCalledCount())
|
||||
.isEqualTo(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for WifiP2pManager factoryReset method.
|
||||
*/
|
||||
@Test
|
||||
public void testResetNetworkData_resetP2p() {
|
||||
|
||||
mResetNetworkConfirm.p2pFactoryReset(mActivity);
|
||||
|
||||
assertThat(ShadowWifiP2pManager.getFactoryResetCount())
|
||||
.isEqualTo(1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user