Refine NetworkCallbackTest
In R, to avoid data overages due to apps not detecting a
meteredness change, when a wifi network changes from unmetered
to metered the network will go down and will be replaced with a
new network. It will make NetworkCallbackTest fail because the
original design is getting the active network in setUp(). So once
the wifi reconnects, the network which is got in setUp() will be
meaningless and make the test fail due to network mismatches.
The new changes are:
1. Moving some initial pre-configurations into setUp().
2. Override the onCapabilitiesChanged() to check if network has
changed to metered or not.
3. Add unregisterNetworkCallback() into iMyService.aidl so that
NetworkCallbackTest can call it to unregister the network
callback.
4. Enlarge the timeout of connecting network and receiving
callback to prevent network cannot reconnect in time or
callback cannot be received in a short time.
Bug: 153485744
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Change-Id: I1aa0e107cf6797b06dee4a15896c63321d822156
Merged-In: I1aa0e107cf6797b06dee4a15896c63321d822156
6 files changed
tree: f47e3310991711bf9edea17d39a9106d42c2cb77
- tests/