use of com.google.firebase.perf.util.Timer in project firebase-android-sdk by firebase.
the class TraceMetricBuilderTest method setUp.
@Before
public void setUp() {
currentTime = 0;
initMocks(this);
doAnswer(new Answer<Timer>() {
@Override
public Timer answer(InvocationOnMock invocationOnMock) throws Throwable {
return new Timer(currentTime);
}
}).when(clock).getTime();
}
use of com.google.firebase.perf.util.Timer in project firebase-android-sdk by firebase.
the class AppStartTraceTest method setUp.
@Before
public void setUp() {
initMocks(this);
doAnswer(new Answer<Timer>() {
@Override
public Timer answer(InvocationOnMock invocationOnMock) throws Throwable {
return new Timer(currentTime);
}
}).when(clock).getTime();
transportManager = mock(TransportManager.class);
traceArgumentCaptor = ArgumentCaptor.forClass(TraceMetric.class);
appStartTime = FirebasePerfProvider.getAppStartTime().getMicros();
appStartHRT = FirebasePerfProvider.getAppStartTime().getHighResTime();
}
use of com.google.firebase.perf.util.Timer in project firebase-android-sdk by firebase.
the class FirebasePerfTraceValidatorTest method setUp.
@Before
public void setUp() {
initMocks(this);
doAnswer(new Answer<Timer>() {
@Override
public Timer answer(InvocationOnMock invocationOnMock) throws Throwable {
return new Timer(currentTime);
}
}).when(clock).getTime();
}
use of com.google.firebase.perf.util.Timer in project firebase-android-sdk by firebase.
the class TraceTest method setUp.
@Before
public void setUp() {
currentTime = 1;
initMocks(this);
doAnswer((Answer<Timer>) invocationOnMock -> new Timer(currentTime)).when(mockClock).getTime();
arguments = ArgumentCaptor.forClass(TraceMetric.class);
DeviceCacheManager.clearInstance();
ConfigResolver.clearInstance();
appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE).edit().clear().commit();
ConfigResolver configResolver = ConfigResolver.getInstance();
configResolver.setDeviceCacheManager(new DeviceCacheManager(new FakeDirectExecutorService()));
configResolver.setApplicationContext(appContext);
}
use of com.google.firebase.perf.util.Timer in project firebase-android-sdk by firebase.
the class InstrumentOkHttpEnqueueCallbackTest method mockTimer.
private static Timer mockTimer() {
Timer timer = mock(Timer.class);
when(timer.getDurationMicros()).thenReturn((long) 2000);
return timer;
}
Aggregations