From 317ade534d1e97ddfa2870a5e93b9e24c92c36e4 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Wed, 17 Oct 2018 09:05:00 -0700 Subject: WifiLastResortWatchdog: Use injector to get SelfRecovery To solve cyclic dependencies between WifiLastResortWatchdog & SelfRecovery via ClientModeImpl. Bug: 117867598 Test: Unit tests Test: Device boots up and connects to networks. Test: Manual test using an assert to ensure SelfRecovery is not null. Change-Id: I81b973157b0804a5b8002dba71c57a2977ce4421 --- .../src/com/android/server/wifi/WifiLastResortWatchdogTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java b/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java index eb6af0f86..e9351258f 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiLastResortWatchdogTest.java @@ -41,6 +41,7 @@ import java.util.List; @SmallTest public class WifiLastResortWatchdogTest { WifiLastResortWatchdog mLastResortWatchdog; + @Mock WifiInjector mWifiInjector; @Mock WifiMetrics mWifiMetrics; @Mock SelfRecovery mSelfRecovery; @Mock ClientModeImpl mClientModeImpl; @@ -61,7 +62,8 @@ public class WifiLastResortWatchdogTest { public void setUp() throws Exception { initMocks(this); mLooper = new TestLooper(); - mLastResortWatchdog = new WifiLastResortWatchdog(mSelfRecovery, mClock, mWifiMetrics, + when(mWifiInjector.getSelfRecovery()).thenReturn(mSelfRecovery); + mLastResortWatchdog = new WifiLastResortWatchdog(mWifiInjector, mClock, mWifiMetrics, mClientModeImpl, mLooper.getLooper()); mLastResortWatchdog.setBugReportProbability(1); } -- cgit v1.2.3