Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 482f199c authored by Evan Severson's avatar Evan Severson
Browse files

Make AppOpsUidStateTracker callbacks more testable

The unit tests will become easier to write when validating callbacks
and when having delayed behaviors. This is done by 1: using an executor
instead of a handler so that we only need to check if the execute mock
is invoked and 2: a custom executor interface that supports delayed
execution. Executors are preferred so that this interface will be more
consistent with public api guidelines and also because post/send methods
in Handler are final so it's impossible to decouple a subclass/mocked
Handler's behavior from the current Looper. Finally the test clock
implementation takes the custom executor in the constructor so it can
tell the executor when time changes so it can execute delayed runnables.

Test: AppOpsUidStateTrackerTest
Bug: 247111208

Change-Id: I930e7e56630408440f6ca03b4c2ab84b19b20eb9
parent ddcc7f5c
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