Merge "Bind service in onCreate"

This commit is contained in:
TreeHugger Robot
2017-07-11 20:15:08 +00:00
committed by Android (Google) Code Review
2 changed files with 27 additions and 11 deletions

View File

@@ -16,7 +16,6 @@
package com.android.settings.network;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothPan;
import android.bluetooth.BluetoothProfile;
@@ -77,6 +76,14 @@ public class TetherPreferenceControllerTest {
ReflectionHelpers.setField(mController, "mPreference", mPreference);
}
@Test
public void lifeCycle_onCreate_shouldInitBluetoothPan() {
mController.onCreate(null);
verify(mBluetoothAdapter).getProfileProxy(mContext, mController.mBtProfileServiceListener,
BluetoothProfile.PAN);
}
@Test
public void goThroughLifecycle_shouldDestoryBluetoothProfile() {
final BluetoothPan pan = mock(BluetoothPan.class);
@@ -161,7 +168,8 @@ public class TetherPreferenceControllerTest {
mController.onResume();
verify(mContext).registerReceiver(
any(TetherPreferenceController.TetherBroadcastReceiver.class), any(IntentFilter.class));
any(TetherPreferenceController.TetherBroadcastReceiver.class),
any(IntentFilter.class));
}
@Test
@@ -172,7 +180,7 @@ public class TetherPreferenceControllerTest {
mController.onPause();
verify(mContext).unregisterReceiver(
any(TetherPreferenceController.TetherBroadcastReceiver.class));
any(TetherPreferenceController.TetherBroadcastReceiver.class));
}
@Test