Add a method to help mocking registerNetworkAgent
This is a trick to help mocking registerNetworkAgent without having to import its return type. In the near future the return type will be changed to a non-public class, which can't be seen in CTS. Really this shouldn't be necessary because only Connectivity tests should mock ConnectivityManager, but the practice is different and other mockers need this support. See also aosp/3538922 Test: NetworkAgentTest Change-Id: I3ac63d95d3830a3b413f9ad12b84ac426b63dd08
This commit is contained in:
parent
ca91ebdcab
commit
8fd6347d35
1 changed files with 30 additions and 0 deletions
|
|
@ -1242,6 +1242,22 @@ public class ConnectivityManager {
|
|||
@ConnectivityManagerFeature
|
||||
private Long mEnabledConnectivityManagerFeatures = null;
|
||||
|
||||
/**
|
||||
* A class to help with mocking ConnectivityManager.
|
||||
* @hide
|
||||
*/
|
||||
public static class MockHelpers {
|
||||
/**
|
||||
* Produce an instance of the class returned by
|
||||
* {@link ConnectivityManager#registerNetworkAgent}
|
||||
* @hide
|
||||
*/
|
||||
public static Network registerNetworkAgentResult(
|
||||
@Nullable final Network network, @Nullable final INetworkAgentRegistry registry) {
|
||||
return network;
|
||||
}
|
||||
}
|
||||
|
||||
private TetheringManager getTetheringManager() {
|
||||
synchronized (mTetheringEventCallbacks) {
|
||||
if (mTetheringManager == null) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue