[CC02] Expect losing explicitly

Before this patch, ConnectivityServiceTest#TestNetworkCallback
relies on TestableNetworkCallback calling this overridden methods
for all expectCallback calls. This is very confusingĀ :
- The code for TestableNetworkCallback might be refactored so it
  no longer calls this, we'd lose the checks and nobody would
  notice.
- Anyone using TestableNetworkCallback instead of
  TestNetworkCallback would get a different behavior but would
  not notice as the interface for these two classes is exactly
  the same

This is also bad for performance because all callback checks will
always look whether it's a check for LOSING, which is rare.
This patch also only generates the error message when the error
actually happens.

Test: ConnectivityServiceTest
Bug: 157405399
Change-Id: Ic9566b815dc4f9b001986ed1376d31a1b97ac8c5
1 file changed