use of com.android.settings.widget.ValidatedEditTextPreference in project android_packages_apps_Settings by omnirom.
the class WifiTetherPasswordPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mPreference = new ValidatedEditTextPreference(RuntimeEnvironment.application);
mConfig = new SoftApConfiguration.Builder().setSsid("test_1234").setPassphrase(INITIAL_PASSWORD, SoftApConfiguration.SECURITY_TYPE_WPA2_PSK).build();
doReturn(mWifiManager).when(mContext).getSystemService(WifiManager.class);
when(mWifiManager.getSoftApConfiguration()).thenReturn(mConfig);
doReturn(mTetheringManager).when(mContext).getSystemService(TetheringManager.class);
when(mTetheringManager.getTetherableWifiRegexs()).thenReturn(new String[] { "1", "2" });
when(mContext.getResources()).thenReturn(RuntimeEnvironment.application.getResources());
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
mController = new WifiTetherPasswordPreferenceController(mContext, mListener, mMetricsFeatureProvider);
}
use of com.android.settings.widget.ValidatedEditTextPreference in project android_packages_apps_Settings by omnirom.
the class DeviceNamePreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(ApplicationProvider.getApplicationContext());
when(mContext.getSystemService(WifiManager.class)).thenReturn(mWifiManager);
mResources = spy(mContext.getResources());
when(mContext.getResources()).thenReturn(mResources);
if (Looper.myLooper() == null) {
Looper.prepare();
}
PreferenceManager preferenceManager = new PreferenceManager(mContext);
mScreen = preferenceManager.createPreferenceScreen(mContext);
mPreference = new ValidatedEditTextPreference(mContext);
mPreference.setKey(TEST_PREFERENCE_KEY);
mScreen.addPreference(mPreference);
final SoftApConfiguration configuration = new SoftApConfiguration.Builder().setSsid("test-ap").build();
when(mWifiManager.getSoftApConfiguration()).thenReturn(configuration);
mController = new DeviceNamePreferenceController(mContext, TEST_PREFERENCE_KEY);
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
}
Aggregations