Search in sources :

Example 1 with RangingSession

use of android.uwb.RangingSession in project robolectric by robolectric.

the class ShadowRangingSessionTest method start_notifyAdaptor.

@Test
public void start_notifyAdaptor() {
    RangingSession session = (RangingSession) rangingSessionObject;
    RangingSession.Callback callback = (RangingSession.Callback) callbackObject;
    session.start(genParams("start"));
    verify(adapter).onStart(eq(session), eq(callback), argThat(checkParams("start")));
}
Also used : RangingSession(android.uwb.RangingSession) Test(org.junit.Test)

Example 2 with RangingSession

use of android.uwb.RangingSession in project robolectric by robolectric.

the class ShadowRangingSession method newInstance.

static RangingSession newInstance(Executor executor, RangingSession.Callback callback, Adapter adapter) {
    RangingSession rangingSession = new RangingSession(executor, callback, null, null);
    ShadowRangingSession shadow = Shadow.extract(rangingSession);
    shadow.setCallback(callback, executor);
    shadow.setAdapter(adapter);
    return rangingSession;
}
Also used : RangingSession(android.uwb.RangingSession)

Example 3 with RangingSession

use of android.uwb.RangingSession in project robolectric by robolectric.

the class ShadowUwbManager method openRangingSession.

/**
 * Instantiates a {@link ShadowRangingSession} with the adapter provided by {@link
 * ShadowUwbManager#setUwbAdapter()}, allowing the tester dictate the results of ranging attempts.
 */
@Implementation
protected CancellationSignal openRangingSession(PersistableBundle params, Executor executor, RangingSession.Callback callback) {
    RangingSession session = ShadowRangingSession.newInstance(executor, callback, adapter);
    CancellationSignal cancellationSignal = new CancellationSignal();
    cancellationSignal.setOnCancelListener(session::close);
    Shadow.<ShadowRangingSession>extract(session).open(params);
    return cancellationSignal;
}
Also used : CancellationSignal(android.os.CancellationSignal) RangingSession(android.uwb.RangingSession) Implementation(org.robolectric.annotation.Implementation)

Example 4 with RangingSession

use of android.uwb.RangingSession in project robolectric by robolectric.

the class ShadowRangingSessionTest method close_notifyAdaptor.

@Test
public void close_notifyAdaptor() {
    RangingSession session = (RangingSession) rangingSessionObject;
    RangingSession.Callback callback = (RangingSession.Callback) callbackObject;
    session.close();
    verify(adapter).onClose(eq(session), eq(callback));
}
Also used : RangingSession(android.uwb.RangingSession) Test(org.junit.Test)

Example 5 with RangingSession

use of android.uwb.RangingSession in project robolectric by robolectric.

the class ShadowRangingSessionTest method open_notifyAdaptor.

@Test
public void open_notifyAdaptor() {
    RangingSession session = (RangingSession) rangingSessionObject;
    RangingSession.Callback callback = (RangingSession.Callback) callbackObject;
    Shadow.<ShadowRangingSession>extract(session).open(genParams("open"));
    verify(adapter).onOpen(eq(session), eq(callback), argThat(checkParams("open")));
}
Also used : RangingSession(android.uwb.RangingSession) Test(org.junit.Test)

Aggregations

RangingSession (android.uwb.RangingSession)7 Test (org.junit.Test)5 CancellationSignal (android.os.CancellationSignal)1 Implementation (org.robolectric.annotation.Implementation)1