1 package com.android.bluetooth.hfpclient; 2 3 import android.bluetooth.BluetoothAdapter; 4 import android.bluetooth.BluetoothDevice; 5 import android.bluetooth.BluetoothProfile; 6 import android.content.Context; 7 import android.content.Intent; 8 import android.media.AudioManager; 9 import android.os.Bundle; 10 import android.os.HandlerThread; 11 import android.test.AndroidTestCase; 12 import android.util.Log; 13 14 import java.nio.ByteBuffer; 15 import java.util.Arrays; 16 import java.util.ArrayList; 17 import java.util.List; 18 import java.util.Map; 19 20 import com.android.bluetooth.btservice.AdapterService; 21 22 import static org.mockito.Mockito.*; 23 import org.mockito.ArgumentCaptor; 24 25 public class HeadsetClientServiceTest extends AndroidTestCase { 26 // Time to wait for the service to be initialized 27 private static int SERVICE_START_TIMEOUT_MS = 5000; // 5 sec 28 private static int STATE_MACHINE_TRANSITION_TIMEOUT_MS = 5000; // 5 sec 29 private HeadsetClientService mService = null; 30 private BluetoothAdapter mAdapter = null; 31 32 void startServices() { 33 Intent startIntent = new Intent(getContext(), HeadsetClientService.class); 34 getContext().startService(startIntent); 35 36 try { 37 Thread.sleep(SERVICE_START_TIMEOUT_MS); 38 } catch (Exception ex) {} 39 40 // At this point the service should have started so check NOT null 41 mService = HeadsetClientService.getHeadsetClientService(); 42 assertTrue(mService != null); 43 44 // At this point Adapter Service should have started 45 AdapterService inst = AdapterService.getAdapterService(); 46 assertTrue(inst != null); 47 48 // Try getting the Bluetooth adapter 49 mAdapter = BluetoothAdapter.getDefaultAdapter(); 50 assertTrue(mAdapter != null); 51 } 52 53 @Override 54 protected void setUp() throws Exception { 55 startServices(); 56 } 57 58 @Override 59 protected void tearDown() throws Exception { 60 mService = null; 61 mAdapter = null; 62 } 63 64 // Test that we can initialize the service 65 public void testInitialize() { 66 } 67 } 68