From d8fd0f83956710595d336b65ccdbfc339d452ff6 Mon Sep 17 00:00:00 2001 From: Jae Choon Jeon Date: Wed, 22 Jan 2020 15:04:45 -0800 Subject: [PATCH] Change the location of WiFi Initialize() API within the same function The testcase is failing for the model as there are no clients which have already invoked the initialize API. So we changed the location of initialize() API little forward to be invoked before CTS test. Bug: 148126151 Test: run cts --m CtsNetTestCases --t android.net.wifi.cts.ConcurrencyTest#testConcurrency Change-Id: I1081d343795e07440ebf380c25f47c320c064556 Signed-off-by: Jae Choon Jeon (cherry picked from commit 1a46560a2b55df0b3159884a7eed4b2598c2e827) --- .../android/net/wifi/cts/ConcurrencyTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/cts/net/src/android/net/wifi/cts/ConcurrencyTest.java b/tests/cts/net/src/android/net/wifi/cts/ConcurrencyTest.java index 628571c89e..c5573386e4 100644 --- a/tests/cts/net/src/android/net/wifi/cts/ConcurrencyTest.java +++ b/tests/cts/net/src/android/net/wifi/cts/ConcurrencyTest.java @@ -272,6 +272,14 @@ public class ConcurrencyTest extends AndroidTestCase { + " needs Location enabled."); } + mWifiP2pManager = + (WifiP2pManager) getContext().getSystemService(Context.WIFI_P2P_SERVICE); + mWifiP2pChannel = mWifiP2pManager.initialize( + getContext(), getContext().getMainLooper(), null); + + assertNotNull(mWifiP2pManager); + assertNotNull(mWifiP2pChannel); + long timeout = System.currentTimeMillis() + TIMEOUT_MSEC; while (!mWifiManager.isWifiEnabled() && System.currentTimeMillis() < timeout) { try { @@ -288,14 +296,6 @@ public class ConcurrencyTest extends AndroidTestCase { assertEquals(WifiManager.WIFI_STATE_ENABLED, mMySync.expectedWifiState); assertEquals(WifiP2pManager.WIFI_P2P_STATE_ENABLED, mMySync.expectedP2pState); - mWifiP2pManager = - (WifiP2pManager) getContext().getSystemService(Context.WIFI_P2P_SERVICE); - mWifiP2pChannel = mWifiP2pManager.initialize( - getContext(), getContext().getMainLooper(), null); - - assertNotNull(mWifiP2pManager); - assertNotNull(mWifiP2pChannel); - assertTrue(waitForBroadcasts(MySync.NETWORK_INFO)); // wait for changing to EnabledState assertNotNull(mMySync.expectedNetworkInfo);