summaryrefslogtreecommitdiffstats
path: root/core/tests
diff options
context:
space:
mode:
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerStressTestRunner.java27
-rw-r--r--core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestRunner.java22
-rw-r--r--core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/UtilHelper.java46
-rw-r--r--core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java101
-rw-r--r--core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiApStress.java6
-rw-r--r--core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java9
6 files changed, 91 insertions, 120 deletions
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerStressTestRunner.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerStressTestRunner.java
index 7233e7f..3ec9031 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerStressTestRunner.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerStressTestRunner.java
@@ -42,17 +42,13 @@ public class ConnectivityManagerStressTestRunner extends InstrumentationTestRunn
public int mSleepTime = 2 * 60 * 1000;
public String mReconnectSsid = "securenetdhcp";
public String mReconnectPassword = "androidwifi";
+ public boolean mWifiOnlyFlag = false;
@Override
public TestSuite getAllTests() {
TestSuite suite = new InstrumentationTestSuite(this);
- if (!UtilHelper.isWifiOnly(getContext())) {
- suite.addTestSuite(WifiApStress.class);
- suite.addTestSuite(WifiStressTest.class);
- } else {
- // only the wifi stress tests
- suite.addTestSuite(WifiStressTest.class);
- }
+ suite.addTestSuite(WifiApStress.class);
+ suite.addTestSuite(WifiStressTest.class);
return suite;
}
@@ -64,13 +60,11 @@ public class ConnectivityManagerStressTestRunner extends InstrumentationTestRunn
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- if (!UtilHelper.isWifiOnly(getContext())) {
- String valueStr = (String) icicle.get("softap_iterations");
- if (valueStr != null) {
- int iteration = Integer.parseInt(valueStr);
- if (iteration > 0) {
- mSoftapIterations = iteration;
- }
+ String valueStr = (String) icicle.get("softap_iterations");
+ if (valueStr != null) {
+ int iteration = Integer.parseInt(valueStr);
+ if (iteration > 0) {
+ mSoftapIterations = iteration;
}
}
@@ -107,5 +101,10 @@ public class ConnectivityManagerStressTestRunner extends InstrumentationTestRunn
mSleepTime = 1000 * sleepTime;
}
}
+
+ String wifiOnlyFlag = (String) icicle.get("wifi-only");
+ if (wifiOnlyFlag != null) {
+ mWifiOnlyFlag = true;
+ }
}
}
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestRunner.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestRunner.java
index 9c1922f..b94306a 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestRunner.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/ConnectivityManagerTestRunner.java
@@ -35,23 +35,13 @@ import junit.framework.TestSuite;
*/
public class ConnectivityManagerTestRunner extends InstrumentationTestRunner {
- public String TEST_SSID = null;
+ public boolean mWifiOnlyFlag = false;
+ public String mTestSsid = null;
@Override
public TestSuite getAllTests() {
TestSuite suite = new InstrumentationTestSuite(this);
- if (!UtilHelper.isWifiOnly(getContext())) {
- suite.addTestSuite(ConnectivityManagerMobileTest.class);
- } else {
- // create a new test suite
- suite.setName("ConnectivityManagerWifiOnlyFunctionalTests");
- String[] methodNames = {"testConnectToWifi", "testConnectToWifWithKnownAP",
- "testDisconnectWifi", "testWifiStateChange"};
- Class<ConnectivityManagerMobileTest> testClass = ConnectivityManagerMobileTest.class;
- for (String method: methodNames) {
- suite.addTest(TestSuite.createTest(testClass, method));
- }
- }
+ suite.addTestSuite(ConnectivityManagerMobileTest.class);
suite.addTestSuite(WifiConnectionTest.class);
return suite;
}
@@ -66,7 +56,11 @@ public class ConnectivityManagerTestRunner extends InstrumentationTestRunner {
super.onCreate(icicle);
String testSSID = (String) icicle.get("ssid");
if (testSSID != null) {
- TEST_SSID = testSSID;
+ mTestSsid = testSSID;
+ }
+ String wifiOnlyFlag = (String) icicle.get("wifi-only");
+ if (wifiOnlyFlag != null) {
+ mWifiOnlyFlag = true;
}
}
}
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/UtilHelper.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/UtilHelper.java
deleted file mode 100644
index b9fe6ed..0000000
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/UtilHelper.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.connectivitymanagertest;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.util.Log;
-
-public class UtilHelper {
-
- private static Boolean mIsWifiOnly = null;
- private static final Object sLock = new Object();
-
- /**
- * Return true if device is a wifi only device.
- */
- public static boolean isWifiOnly(Context context) {
- synchronized (sLock) {
- // cache the result from pkgMgr statically. It will never change, since its a
- // device configuration setting
- if (mIsWifiOnly == null) {
- PackageManager pkgMgr = context.getPackageManager();
- mIsWifiOnly = Boolean.valueOf(!pkgMgr
- .hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
- && pkgMgr.hasSystemFeature(PackageManager.FEATURE_WIFI));
- String deviceType = mIsWifiOnly ? "wifi-only" : "telephony";
- Log.d("ConnectivityManagerTest", String.format("detected a %s device", deviceType));
- }
- }
- return mIsWifiOnly;
- }
-}
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java
index 52326d5..bf188d3 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/functional/ConnectivityManagerMobileTest.java
@@ -31,16 +31,15 @@ import android.util.Log;
import com.android.connectivitymanagertest.ConnectivityManagerTestActivity;
import com.android.connectivitymanagertest.ConnectivityManagerTestRunner;
import com.android.connectivitymanagertest.NetworkState;
-import com.android.connectivitymanagertest.UtilHelper;
public class ConnectivityManagerMobileTest extends
ActivityInstrumentationTestCase2<ConnectivityManagerTestActivity> {
private static final String LOG_TAG = "ConnectivityManagerMobileTest";
- private String TEST_ACCESS_POINT;
+ private String mTestAccessPoint;
private ConnectivityManagerTestActivity cmActivity;
private WakeLock wl;
- private boolean mIsWifiOnlyDevice;
+ private boolean mWifiOnlyFlag;
public ConnectivityManagerMobileTest() {
super(ConnectivityManagerTestActivity.class);
@@ -52,7 +51,9 @@ public class ConnectivityManagerMobileTest extends
cmActivity = getActivity();
ConnectivityManagerTestRunner mRunner =
(ConnectivityManagerTestRunner)getInstrumentation();
- TEST_ACCESS_POINT = mRunner.TEST_SSID;
+ mTestAccessPoint = mRunner.mTestSsid;
+ mWifiOnlyFlag = mRunner.mWifiOnlyFlag;
+
PowerManager pm = (PowerManager)getInstrumentation().
getContext().getSystemService(Context.POWER_SERVICE);
wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "CMWakeLock");
@@ -63,8 +64,8 @@ public class ConnectivityManagerMobileTest extends
log("airplane is not disabled, disable it.");
cmActivity.setAirplaneMode(getInstrumentation().getContext(), false);
}
- mIsWifiOnlyDevice = UtilHelper.isWifiOnly(mRunner.getTargetContext());
- if (!mIsWifiOnlyDevice) {
+
+ if (!mWifiOnlyFlag) {
if (!cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED,
ConnectivityManagerTestActivity.LONG_TIMEOUT)) {
// Note: When the test fails in setUp(), tearDown is not called. In that case,
@@ -113,6 +114,10 @@ public class ConnectivityManagerMobileTest extends
// event should be expected.
@LargeTest
public void test3GToWifiNotification() {
+ if (mWifiOnlyFlag) {
+ Log.v(LOG_TAG, this.getName() + " is excluded for wifi-only test");
+ return;
+ }
// Enable Wi-Fi to avoid initial UNKNOWN state
cmActivity.enableWifi();
sleep(2 * ConnectivityManagerTestActivity.SHORT_TIMEOUT);
@@ -159,9 +164,9 @@ public class ConnectivityManagerMobileTest extends
// Test case 2: test connection to a given AP
@LargeTest
public void testConnectToWifi() {
- assertNotNull("SSID is null", TEST_ACCESS_POINT);
+ assertNotNull("SSID is null", mTestAccessPoint);
NetworkInfo networkInfo;
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
//Prepare for connectivity verification
networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_MOBILE,
@@ -172,15 +177,15 @@ public class ConnectivityManagerMobileTest extends
NetworkState.TO_CONNECTION, State.CONNECTED);
// Enable Wifi and connect to a test access point
- assertTrue("failed to connect to " + TEST_ACCESS_POINT,
- cmActivity.connectToWifi(TEST_ACCESS_POINT));
+ assertTrue("failed to connect to " + mTestAccessPoint,
+ cmActivity.connectToWifi(mTestAccessPoint));
assertTrue(cmActivity.waitForWifiState(WifiManager.WIFI_STATE_ENABLED,
ConnectivityManagerTestActivity.LONG_TIMEOUT));
log("wifi state is enabled");
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
ConnectivityManagerTestActivity.LONG_TIMEOUT));
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
}
@@ -192,7 +197,7 @@ public class ConnectivityManagerMobileTest extends
cmActivity.getTransitionFailureReason(ConnectivityManager.TYPE_WIFI));
assertTrue(false);
}
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_MOBILE)) {
log("Mobile state transition validation failed.");
log("reason: " +
@@ -205,10 +210,10 @@ public class ConnectivityManagerMobileTest extends
// Test case 3: connect to Wifi with known AP
@LargeTest
public void testConnectToWifWithKnownAP() {
- assertNotNull("SSID is null", TEST_ACCESS_POINT);
- // Connect to TEST_ACCESS_POINT
- assertTrue("failed to connect to " + TEST_ACCESS_POINT,
- cmActivity.connectToWifi(TEST_ACCESS_POINT));
+ assertNotNull("SSID is null", mTestAccessPoint);
+ // Connect to mTestAccessPoint
+ assertTrue("failed to connect to " + mTestAccessPoint,
+ cmActivity.connectToWifi(mTestAccessPoint));
assertTrue(cmActivity.waitForWifiState(WifiManager.WIFI_STATE_ENABLED,
ConnectivityManagerTestActivity.LONG_TIMEOUT));
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
@@ -227,13 +232,13 @@ public class ConnectivityManagerMobileTest extends
ConnectivityManagerTestActivity.LONG_TIMEOUT));
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI,
State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
State.CONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
}
NetworkInfo networkInfo;
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
//Prepare for connectivity state verification
networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_MOBILE,
@@ -253,7 +258,7 @@ public class ConnectivityManagerMobileTest extends
// Wait for Wifi to be connected and mobile to be disconnected
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
ConnectivityManagerTestActivity.LONG_TIMEOUT));
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
}
@@ -270,11 +275,11 @@ public class ConnectivityManagerMobileTest extends
// Test case 4: test disconnect Wifi
@LargeTest
public void testDisconnectWifi() {
- assertNotNull("SSID is null", TEST_ACCESS_POINT);
+ assertNotNull("SSID is null", mTestAccessPoint);
// connect to Wifi
- assertTrue("failed to connect to " + TEST_ACCESS_POINT,
- cmActivity.connectToWifi(TEST_ACCESS_POINT));
+ assertTrue("failed to connect to " + mTestAccessPoint,
+ cmActivity.connectToWifi(mTestAccessPoint));
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
ConnectivityManagerTestActivity.LONG_TIMEOUT));
@@ -283,7 +288,7 @@ public class ConnectivityManagerMobileTest extends
sleep(ConnectivityManagerTestActivity.SHORT_TIMEOUT);
NetworkInfo networkInfo;
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_MOBILE,
networkInfo.getState(),
@@ -299,7 +304,7 @@ public class ConnectivityManagerMobileTest extends
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.DISCONNECTED,
ConnectivityManagerTestActivity.LONG_TIMEOUT));
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
State.CONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
}
@@ -311,7 +316,7 @@ public class ConnectivityManagerMobileTest extends
cmActivity.getTransitionFailureReason(ConnectivityManager.TYPE_WIFI));
assertTrue(false);
}
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_MOBILE)) {
log("Mobile state transition validation failed.");
log("reason: " +
@@ -324,6 +329,10 @@ public class ConnectivityManagerMobileTest extends
// Test case 5: test connectivity from 3G to airplane mode, then to 3G again
@LargeTest
public void testDataConnectionWith3GToAmTo3G() {
+ if (mWifiOnlyFlag) {
+ Log.v(LOG_TAG, this.getName() + " is excluded for wifi-only test");
+ return;
+ }
//Prepare for state verification
NetworkInfo networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
cmActivity.setStateTransitionCriteria(ConnectivityManager.TYPE_MOBILE,
@@ -340,7 +349,9 @@ public class ConnectivityManagerMobileTest extends
networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
assertEquals(State.DISCONNECTED, networkInfo.getState());
-
+ // wait until mobile is turn off
+ assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
+ State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_MOBILE)) {
log("Mobile state transition validation failed.");
log("reason: " +
@@ -382,13 +393,17 @@ public class ConnectivityManagerMobileTest extends
// Test case 6: test connectivity with airplane mode Wifi connected
@LargeTest
public void testDataConnectionOverAMWithWifi() {
- assertNotNull("SSID is null", TEST_ACCESS_POINT);
+ if (mWifiOnlyFlag) {
+ Log.v(LOG_TAG, this.getName() + " is excluded for wifi-only test");
+ return;
+ }
+ assertNotNull("SSID is null", mTestAccessPoint);
// Eanble airplane mode
log("Enable airplane mode");
cmActivity.setAirplaneMode(getInstrumentation().getContext(), true);
NetworkInfo networkInfo;
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
networkInfo = cmActivity.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
@@ -402,8 +417,8 @@ public class ConnectivityManagerMobileTest extends
NetworkState.TO_CONNECTION, State.CONNECTED);
// Connect to Wifi
- assertTrue("failed to connect to " + TEST_ACCESS_POINT,
- cmActivity.connectToWifi(TEST_ACCESS_POINT));
+ assertTrue("failed to connect to " + mTestAccessPoint,
+ cmActivity.connectToWifi(mTestAccessPoint));
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
ConnectivityManagerTestActivity.LONG_TIMEOUT));
@@ -414,7 +429,7 @@ public class ConnectivityManagerMobileTest extends
cmActivity.getTransitionFailureReason(ConnectivityManager.TYPE_WIFI));
assertTrue("State validation failed", false);
}
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
if (!cmActivity.validateNetworkStates(ConnectivityManager.TYPE_MOBILE)) {
log("state validation for Mobile failed");
log("reason: " +
@@ -428,11 +443,15 @@ public class ConnectivityManagerMobileTest extends
// Test case 7: test connectivity while transit from Wifi->AM->Wifi
@LargeTest
public void testDataConnectionWithWifiToAMToWifi () {
- // Connect to TEST_ACCESS_POINT
- assertNotNull("SSID is null", TEST_ACCESS_POINT);
+ if (mWifiOnlyFlag) {
+ Log.v(LOG_TAG, this.getName() + " is excluded for wifi-only test");
+ return;
+ }
+ // Connect to mTestAccessPoint
+ assertNotNull("SSID is null", mTestAccessPoint);
// Connect to Wifi
- assertTrue("failed to connect to " + TEST_ACCESS_POINT,
- cmActivity.connectToWifi(TEST_ACCESS_POINT));
+ assertTrue("failed to connect to " + mTestAccessPoint,
+ cmActivity.connectToWifi(mTestAccessPoint));
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
ConnectivityManagerTestActivity.LONG_TIMEOUT));
@@ -466,7 +485,7 @@ public class ConnectivityManagerMobileTest extends
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
ConnectivityManagerTestActivity.LONG_TIMEOUT));
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_MOBILE,
State.DISCONNECTED, ConnectivityManagerTestActivity.LONG_TIMEOUT));
}
@@ -483,10 +502,10 @@ public class ConnectivityManagerMobileTest extends
// Test case 8: test wifi state change while connecting/disconnecting to/from an AP
@LargeTest
public void testWifiStateChange () {
- assertNotNull("SSID is null", TEST_ACCESS_POINT);
- //Connect to TEST_ACCESS_POINT
- assertTrue("failed to connect to " + TEST_ACCESS_POINT,
- cmActivity.connectToWifi(TEST_ACCESS_POINT));
+ assertNotNull("SSID is null", mTestAccessPoint);
+ //Connect to mTestAccessPoint
+ assertTrue("failed to connect to " + mTestAccessPoint,
+ cmActivity.connectToWifi(mTestAccessPoint));
assertTrue(cmActivity.waitForWifiState(WifiManager.WIFI_STATE_ENABLED,
ConnectivityManagerTestActivity.LONG_TIMEOUT));
assertTrue(cmActivity.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.CONNECTED,
@@ -503,7 +522,7 @@ public class ConnectivityManagerMobileTest extends
// Disconnect from the current AP
log("disconnect from the AP");
if (!cmActivity.disconnectAP()) {
- log("failed to disconnect from " + TEST_ACCESS_POINT);
+ log("failed to disconnect from " + mTestAccessPoint);
}
// Verify the connectivity state for Wifi is DISCONNECTED
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiApStress.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiApStress.java
index 41104fe..7e136be 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiApStress.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiApStress.java
@@ -51,6 +51,7 @@ public class WifiApStress
private int iterations;
private BufferedWriter mOutputWriter = null;
private int mLastIteration = 0;
+ private boolean mWifiOnlyFlag;
public WifiApStress() {
super(ConnectivityManagerTestActivity.class);
@@ -63,6 +64,7 @@ public class WifiApStress
ConnectivityManagerStressTestRunner mRunner =
(ConnectivityManagerStressTestRunner)getInstrumentation();
iterations = mRunner.mSoftapIterations;
+ mWifiOnlyFlag = mRunner.mWifiOnlyFlag;
mAct.turnScreenOn();
}
@@ -79,6 +81,10 @@ public class WifiApStress
@LargeTest
public void testWifiHotSpot() {
+ if (mWifiOnlyFlag) {
+ Log.v(TAG, this.getName() + " is excluded for wi-fi only test");
+ return;
+ }
WifiConfiguration config = new WifiConfiguration();
config.SSID = NETWORK_ID;
config.allowedKeyManagement.set(KeyMgmt.WPA_PSK);
diff --git a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
index feb63cd..f46546f 100644
--- a/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
+++ b/core/tests/ConnectivityManagerTest/src/com/android/connectivitymanagertest/stress/WifiStressTest.java
@@ -34,7 +34,6 @@ import android.util.Log;
import com.android.connectivitymanagertest.ConnectivityManagerStressTestRunner;
import com.android.connectivitymanagertest.ConnectivityManagerTestActivity;
-import com.android.connectivitymanagertest.UtilHelper;
import java.io.BufferedWriter;
import java.io.File;
@@ -75,7 +74,7 @@ public class WifiStressTest
private String mPassword;
private ConnectivityManagerStressTestRunner mRunner;
private BufferedWriter mOutputWriter = null;
- private boolean mIsWifiOnlyDevice;
+ private boolean mWifiOnlyFlag;
public WifiStressTest() {
super(ConnectivityManagerTestActivity.class);
@@ -91,13 +90,13 @@ public class WifiStressTest
mPassword = mRunner.mReconnectPassword;
mScanIterations = mRunner.mScanIterations;
mWifiSleepTime = mRunner.mSleepTime;
+ mWifiOnlyFlag = mRunner.mWifiOnlyFlag;
log(String.format("mReconnectIterations(%d), mSsid(%s), mPassword(%s),"
+ "mScanIterations(%d), mWifiSleepTime(%d)", mReconnectIterations, mSsid,
mPassword, mScanIterations, mWifiSleepTime));
mOutputWriter = new BufferedWriter(new FileWriter(new File(
Environment.getExternalStorageDirectory(), OUTPUT_FILE), true));
mAct.turnScreenOn();
- mIsWifiOnlyDevice = UtilHelper.isWifiOnly(mRunner.getTargetContext());
if (!mAct.mWifiManager.isWifiEnabled()) {
log("Enable wi-fi before stress tests.");
if (!mAct.enableWifi()) {
@@ -269,7 +268,7 @@ public class WifiStressTest
assertTrue("Wait for Wi-Fi to idle timeout",
mAct.waitForNetworkState(ConnectivityManager.TYPE_WIFI, State.DISCONNECTED,
6 * ConnectivityManagerTestActivity.SHORT_TIMEOUT));
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
// use long timeout as the pppd startup may take several retries.
assertTrue("Wait for cellular connection timeout",
mAct.waitForNetworkState(ConnectivityManager.TYPE_MOBILE, State.CONNECTED,
@@ -280,7 +279,7 @@ public class WifiStressTest
assertEquals("Wi-Fi is reconnected", State.DISCONNECTED,
mAct.mCM.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState());
- if (!mIsWifiOnlyDevice) {
+ if (!mWifiOnlyFlag) {
assertEquals("Cellular connection is down", State.CONNECTED,
mAct.mCM.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState());
assertTrue("Mobile is connected, but no data connection.", mAct.pingTest(null));