Make Bluetooth settings page can be discoverable

Bug: 118760361
Test: make -j42 RunSettingsRoboTests
Change-Id: I2f663197f3c0f6c58529609845bab4dd7e714348
This commit is contained in:
hughchen
2019-08-13 10:41:34 +08:00
parent 2862e79478
commit a0b167e3da
2 changed files with 24 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ package com.android.settings.bluetooth;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import android.content.Context;
import android.provider.Settings;
@@ -47,6 +48,8 @@ public class BluetoothSwitchPreferenceControllerTest {
private RestrictionUtils mRestrictionUtils;
@Mock
private SwitchWidgetController mSwitchController;
@Mock
private AlwaysDiscoverable mAlwaysDiscoverable;
private FooterPreference mFooterPreference;
private Context mContext;
@@ -62,6 +65,7 @@ public class BluetoothSwitchPreferenceControllerTest {
mController =
new BluetoothSwitchPreferenceController(mContext, mRestrictionUtils,
mSwitchController, mFooterPreference);
mController.mAlwaysDiscoverable = mAlwaysDiscoverable;
}
@Test
@@ -103,4 +107,18 @@ public class BluetoothSwitchPreferenceControllerTest {
assertThat(mFooterPreference.getTitle()).isEqualTo(BLUETOOTH_INFO_STRING);
}
@Test
public void onStart_shouldStartAlwaysDiscoverable() {
mController.onStart();
verify(mAlwaysDiscoverable).start();
}
@Test
public void onStop_shouldStopAlwaysDiscoverable() {
mController.onStop();
verify(mAlwaysDiscoverable).stop();
}
}