@@ -130,6 +130,7 @@ public void setUp() {
130
130
@ After
131
131
public void tearDown () {
132
132
shadowOf (Looper .getMainLooper ()).idle ();
133
+ GaugeCounter .INSTANCE .resetCounter ();
133
134
}
134
135
135
136
@ Test
@@ -331,11 +332,11 @@ public void stopCollectingGauges_invalidGaugeCollectionFrequency_appInForeground
331
332
}
332
333
333
334
@ Test
334
- public void testGaugeCounterStartsAJobToConsumeTheGeneratedMetrics () throws InterruptedException {
335
+ public void testGaugeCounterStartsAJobToConsumeTheGeneratedMetrics () {
335
336
PerfSession fakeSession = createTestSession (1 );
336
337
testGaugeManager .setApplicationProcessState (ApplicationProcessState .FOREGROUND );
337
338
testGaugeManager .startCollectingGauges (fakeSession );
338
- GaugeCounter .INSTANCE . setGaugeManager (testGaugeManager );
339
+ GaugeCounter .setGaugeManager (testGaugeManager );
339
340
340
341
// There's no job to log the gauges.
341
342
assertThat (fakeScheduledExecutorService .isEmpty ()).isTrue ();
@@ -377,7 +378,7 @@ public void testUpdateAppStateHandlesMultipleAppStates() {
377
378
fakeSession .setGaugeAndEventCollectionEnabled (true );
378
379
testGaugeManager .setApplicationProcessState (ApplicationProcessState .FOREGROUND );
379
380
testGaugeManager .startCollectingGauges (fakeSession );
380
- GaugeCounter .INSTANCE . setGaugeManager (testGaugeManager );
381
+ GaugeCounter .setGaugeManager (testGaugeManager );
381
382
382
383
// Generate metrics that don't exceed the GaugeCounter.MAX_COUNT.
383
384
generateMetricsAndIncrementCounter (10 );
@@ -429,7 +430,7 @@ public void testGaugeManagerHandlesMultipleSessionIds() {
429
430
fakeSession .setGaugeAndEventCollectionEnabled (true );
430
431
testGaugeManager .setApplicationProcessState (ApplicationProcessState .BACKGROUND );
431
432
testGaugeManager .startCollectingGauges (fakeSession );
432
- GaugeCounter .INSTANCE . setGaugeManager (testGaugeManager );
433
+ GaugeCounter .setGaugeManager (testGaugeManager );
433
434
434
435
// Generate metrics that don't exceed the GaugeCounter.MAX_COUNT.
435
436
generateMetricsAndIncrementCounter (10 );
@@ -519,7 +520,7 @@ public void testStopCollectingGaugesCreatesOneLastJobToConsumeAnyPendingMetrics(
519
520
+ recordedGaugeMetric .getCpuMetricReadingsCount ();
520
521
assertThat (recordedGaugeMetricsCount ).isEqualTo (2 );
521
522
522
- // TODO(b/394127311): Investigate why this isn't 0 on local runs .
523
+ // TODO(b/394127311): Investigate why this isn't 0.
523
524
// assertThat(GaugeCounter.INSTANCE.count()).isEqualTo(0);
524
525
}
525
526
0 commit comments