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")));
}
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;
}
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;
}
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));
}
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")));
}
Aggregations