Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove CountDownLatch from MockPlayer
The MockPlayer has a single CountDownLatch field and multiple boolean flags that track if a player method was called. Upon calling the methods the latch count. Tests set the latch count to match exactly with the number of expected player interactions then block the test thread until the latch reaches zero and assert the respective method flags are true. This is subject to false positives. If the underneath implementation changes and call more player method, then the test thread will unblock as soon as a certain number of interactions is performed, which may be less than what the test expected originally. However, the test may stil pass if the player thread had enough time to update the expected method flag. This change removes the single CountDownLatch and the boolean flags and instead it adds APIs to query the MockPlayer if a method has been called and await until a method is called. Internally, the MockPlayer has a ConditionVariable per method. PiperOrigin-RevId: 432399077
- Loading branch information