Closed Bug 1588717 Opened 6 years ago Closed 6 years ago

assertOnUiThread asserts in the sample app test

Categories

(Data Platform and Tools :: Glean: SDK, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: janerik, Unassigned)

Details

(Whiteboard: [telemetry:glean-rs:m?])

For some reason our assertOnUiThread in Glean.kt and MetricsPingScheduler fails when the sample app is run as part of the instrumentation tests.

I assume the "main thread" is not the same as the UI thread in that test environment for some reason.

So the getMainLooper thread is indeed different than the one Glean gets run on: currentThreadId: 310, expectedThreadId: 2
No idea why though.

We could probably skip the check if in testing mode, hackish though that is. I also wonder if we can getting away with skipping registering lifecycle handlers in test mode...

This applies to the connectedAndroidTests which IMO and at best should not run in test mode (they currently do) and, as I think, the app is launched once without being in test mode.
We can't skip lifecycle handlers to begin with because that's exactly what these tests are testing.

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.