Search in sources :

Example 1 with ContextHubManager

use of android.hardware.location.ContextHubManager in project robolectric by robolectric.

the class ShadowContextHubManagerTest method getContextHubs_returnsValidList.

@Test
@Config(minSdk = Build.VERSION_CODES.P)
public void getContextHubs_returnsValidList() {
    ContextHubManager contextHubManager = (ContextHubManager) context.getSystemService(Context.CONTEXTHUB_SERVICE);
    List<ContextHubInfo> contextHubInfoList = contextHubManager.getContextHubs();
    assertThat(contextHubInfoList).isNotNull();
    assertThat(contextHubInfoList).isNotEmpty();
}
Also used : ContextHubManager(android.hardware.location.ContextHubManager) ContextHubInfo(android.hardware.location.ContextHubInfo) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 2 with ContextHubManager

use of android.hardware.location.ContextHubManager in project robolectric by robolectric.

the class ShadowContextHubManagerTest method getContextHubInfo_returnsValidInfo.

@Test
public void getContextHubInfo_returnsValidInfo() {
    ContextHubManager contextHubManager = (ContextHubManager) context.getSystemService(Context.CONTEXTHUB_SERVICE);
    int[] handles = contextHubManager.getContextHubHandles();
    assertThat(handles).isNotNull();
    for (int handle : handles) {
        assertThat(contextHubManager.getContextHubInfo(handle)).isNotNull();
    }
}
Also used : ContextHubManager(android.hardware.location.ContextHubManager) Test(org.junit.Test)

Example 3 with ContextHubManager

use of android.hardware.location.ContextHubManager in project robolectric by robolectric.

the class ShadowContextHubManagerTest method getContextHubInfo_returnsInvalidInfo.

@Test
public void getContextHubInfo_returnsInvalidInfo() {
    ContextHubManager contextHubManager = (ContextHubManager) context.getSystemService(Context.CONTEXTHUB_SERVICE);
    int[] handles = contextHubManager.getContextHubHandles();
    assertThat(handles).isNotNull();
    assertThat(contextHubManager.getContextHubInfo(-1)).isNull();
    assertThat(contextHubManager.getContextHubInfo(handles.length)).isNull();
}
Also used : ContextHubManager(android.hardware.location.ContextHubManager) Test(org.junit.Test)

Example 4 with ContextHubManager

use of android.hardware.location.ContextHubManager in project robolectric by robolectric.

the class ShadowContextHubManagerTest method getNanoAppInstanceInfo_noNanoAppsAdded.

@Test
public void getNanoAppInstanceInfo_noNanoAppsAdded() {
    ContextHubManager contextHubManager = context.getSystemService(ContextHubManager.class);
    NanoAppInstanceInfo info = contextHubManager.getNanoAppInstanceInfo(0);
    assertThat(info).isNull();
}
Also used : ContextHubManager(android.hardware.location.ContextHubManager) NanoAppInstanceInfo(android.hardware.location.NanoAppInstanceInfo) Test(org.junit.Test)

Example 5 with ContextHubManager

use of android.hardware.location.ContextHubManager in project robolectric by robolectric.

the class ShadowContextHubManagerTest method getContextHubHandles_returnsValidArray.

@Test
public void getContextHubHandles_returnsValidArray() {
    ContextHubManager contextHubManager = (ContextHubManager) context.getSystemService(Context.CONTEXTHUB_SERVICE);
    int[] handles = contextHubManager.getContextHubHandles();
    assertThat(handles).isNotNull();
    assertThat(handles).isNotEmpty();
}
Also used : ContextHubManager(android.hardware.location.ContextHubManager) Test(org.junit.Test)

Aggregations

ContextHubManager (android.hardware.location.ContextHubManager)9 Test (org.junit.Test)9 ContextHubInfo (android.hardware.location.ContextHubInfo)4 Config (org.robolectric.annotation.Config)4 ContextHubTransaction (android.hardware.location.ContextHubTransaction)2 NanoAppInstanceInfo (android.hardware.location.NanoAppInstanceInfo)2 NanoAppState (android.hardware.location.NanoAppState)2 List (java.util.List)2 ContextHubClient (android.hardware.location.ContextHubClient)1