@Test public void testConstructorRegistersAppropriateReceiversAndListeners() { verify(mockWifiSettings).addListener(mWifiMediator); verify(mockPowerTracker).addListener(mWifiMediator); verify(mockUserAbsentRadiosOffObserver).addListener(mWifiMediator); IntentFilter intentFilter = mWifiMediator.getBroadcastReceiverIntentFilter(); for (Iterator<String> it = intentFilter.actionsIterator(); it.hasNext(); ) { String action = it.next(); Assert.assertTrue("BroadcastReceiver not registered for action: " + action, shadowApplication.hasReceiverForIntent(new Intent(action))); } }
@VisibleForTesting IntentFilter getBroadcastReceiverIntentFilter() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION); intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); return intentFilter; }
WearWifiMediator implements
        UserAbsentRadiosOffObserver.Listener,
        PowerTracker.Listener,
        WearWifiMediatorSettings.Listener,
        WifiBackoff.Listener { @VisibleForTesting IntentFilter getBroadcastReceiverIntentFilter() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION); intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); return intentFilter; } }
WearWifiMediator implements
        UserAbsentRadiosOffObserver.Listener,
        PowerTracker.Listener,
        WearWifiMediatorSettings.Listener,
        WifiBackoff.Listener { @VisibleForTesting IntentFilter getBroadcastReceiverIntentFilter() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION); intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); return intentFilter; } WearWifiMediator(Context context,
                            AlarmManager alarmManager,
                            WearWifiMediatorSettings wifiMediatorSettings,
                            CompanionTracker companionTracker,
                            PowerTracker powerTracker,
                            UserAbsentRadiosOffObserver userAbsentRadiosOffObserver,
                            WifiBackoff wifiBackoff,
                            WifiManager wifiManager,
                            WifiLogger wifiLogger); }
WearWifiMediator implements
        UserAbsentRadiosOffObserver.Listener,
        PowerTracker.Listener,
        WearWifiMediatorSettings.Listener,
        WifiBackoff.Listener { @VisibleForTesting IntentFilter getBroadcastReceiverIntentFilter() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION); intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); return intentFilter; } WearWifiMediator(Context context,
                            AlarmManager alarmManager,
                            WearWifiMediatorSettings wifiMediatorSettings,
                            CompanionTracker companionTracker,
                            PowerTracker powerTracker,
                            UserAbsentRadiosOffObserver userAbsentRadiosOffObserver,
                            WifiBackoff wifiBackoff,
                            WifiManager wifiManager,
                            WifiLogger wifiLogger); void onBootCompleted(boolean proxyConnected); void updateProxyConnected(boolean proxyConnected); void updateNumUnmeteredRequests(int numUnmeteredRequests); void updateNumHighBandwidthRequests(int numHighBandwidthRequests); void updateNumWifiRequests(int numWifiRequests); void updateActivityMode(boolean activityMode); @Override void onUserAbsentRadiosOffChanged(boolean isEnabled); @Override void onPowerSaveModeChanged(); @Override void onChargingStateChanged(); @Override void onDeviceIdleModeChanged(); @Override void onWifiSettingChanged(String newWifiSetting); @Override void onInWifiSettingsMenuChanged(boolean inWifiSettingsMenu); @Override void onEnableWifiWhileChargingChanged(boolean enableWifiWhileCharging); @Override void onDisableWifiMediatorChanged(boolean disableWifiMediator); @Override void onHardwareLowPowerModeChanged(boolean inHardwareLowPowerMode); @Override void onWifiOnWhenProxyDisconnectedChanged(boolean wifiOnWhenProxyDisconnected); @Override void onWifiBackoffChanged(); void dump(IndentingPrintWriter ipw); }
WearWifiMediator implements
        UserAbsentRadiosOffObserver.Listener,
        PowerTracker.Listener,
        WearWifiMediatorSettings.Listener,
        WifiBackoff.Listener { @VisibleForTesting IntentFilter getBroadcastReceiverIntentFilter() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(WifiManager.CONFIGURED_NETWORKS_CHANGED_ACTION); intentFilter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION); intentFilter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION); return intentFilter; } WearWifiMediator(Context context,
                            AlarmManager alarmManager,
                            WearWifiMediatorSettings wifiMediatorSettings,
                            CompanionTracker companionTracker,
                            PowerTracker powerTracker,
                            UserAbsentRadiosOffObserver userAbsentRadiosOffObserver,
                            WifiBackoff wifiBackoff,
                            WifiManager wifiManager,
                            WifiLogger wifiLogger); void onBootCompleted(boolean proxyConnected); void updateProxyConnected(boolean proxyConnected); void updateNumUnmeteredRequests(int numUnmeteredRequests); void updateNumHighBandwidthRequests(int numHighBandwidthRequests); void updateNumWifiRequests(int numWifiRequests); void updateActivityMode(boolean activityMode); @Override void onUserAbsentRadiosOffChanged(boolean isEnabled); @Override void onPowerSaveModeChanged(); @Override void onChargingStateChanged(); @Override void onDeviceIdleModeChanged(); @Override void onWifiSettingChanged(String newWifiSetting); @Override void onInWifiSettingsMenuChanged(boolean inWifiSettingsMenu); @Override void onEnableWifiWhileChargingChanged(boolean enableWifiWhileCharging); @Override void onDisableWifiMediatorChanged(boolean disableWifiMediator); @Override void onHardwareLowPowerModeChanged(boolean inHardwareLowPowerMode); @Override void onWifiOnWhenProxyDisconnectedChanged(boolean wifiOnWhenProxyDisconnected); @Override void onWifiBackoffChanged(); void dump(IndentingPrintWriter ipw);  }