Merge "[Wi-Fi] Control Wi-Fi Hotspot Settings using onClick instead of onSwitchToggled" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
29063e3779
@@ -32,10 +32,8 @@ import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkPolicyManager;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.widget.SwitchBar;
|
||||
import com.android.settings.widget.SwitchBarController;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -70,10 +68,9 @@ public class WifiTetherSwitchBarControllerTest {
|
||||
when(mContext.getSystemService(Context.NETWORK_POLICY_SERVICE)).thenReturn(
|
||||
mNetworkPolicyManager);
|
||||
|
||||
mController = new WifiTetherSwitchBarController(mContext,
|
||||
new SwitchBarController(mSwitchBar));
|
||||
mController = new WifiTetherSwitchBarController(mContext, mSwitchBar);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void startTether_fail_resetSwitchBar() {
|
||||
when(mNetworkPolicyManager.getRestrictBackground()).thenReturn(false);
|
||||
@@ -103,12 +100,12 @@ public class WifiTetherSwitchBarControllerTest {
|
||||
@Test
|
||||
public void onSwitchToggled_onlyStartsTetherWhenNeeded() {
|
||||
when(mWifiManager.isWifiApEnabled()).thenReturn(true);
|
||||
mController.onSwitchToggled(true);
|
||||
mController.onClick(mSwitchBar.getSwitch());
|
||||
|
||||
verify(mConnectivityManager, never()).startTethering(anyInt(), anyBoolean(), any(), any());
|
||||
|
||||
doReturn(false).when(mWifiManager).isWifiApEnabled();
|
||||
mController.onSwitchToggled(true);
|
||||
mController.onClick(mSwitchBar.getSwitch());
|
||||
|
||||
verify(mConnectivityManager, times(1))
|
||||
.startTethering(anyInt(), anyBoolean(), any(), any());
|
||||
|
Reference in New Issue
Block a user