Skip to content
Commit 225b7123 authored by Kevin Han's avatar Kevin Han
Browse files

Move inflation-related NEM tests to their own file

In a gambit to improve organization and make other improvements to
NotificationEntryManagerTest, this CL moves the inflation-related tests
to a separate file, leaving more focused unit tests in
NotificationEntryManagerTest.

In the process of doing this, I've also tried to make net positive
changes to how the inflation test works. The summary of changes below.

The Good
* We no longer modify NotificationContentInflater behavior for tests by
telling it to enter "synchronous" mode which probably means we no
longer have to maintain a test-specific path of logic in that class
* We no longer depend on a countdown latch attached as a listener to
know when inflation is done, so listeners breaking shouldn't break all
the inflation-related tests.
* We no longer have the possibility of the test blocking forever from a
TestableLooper#processMessages waiting for a message forever (we just
throw a runtime exception now if it times out)
* Hopefully less flaky since we have tighter control/knowledge on what
messages we produce/wait on.

The Bad
* We now have to use the main thread looper. This is because using
NotificationContentInflater "for real" uses a lot of AsyncTasks which
HAVE to post back to main thread. Since we split the tests though, this
is only needed for inflation-related tests which arguably should be on
main thread.

The Ugly
* The test is more fragile for async/main-thread-related changes as we
depend on knowing the exact number of main thread callbacks to know when
inflation is done. I've tried to mitigate this as much as possible by
having very explicit documentation, but this is clearly less than ideal.

Test: atest SystemUITests
Change-Id: Iff5413cc48167e182f9fdfa0606790c0d4071154
parent 5263c11a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment