diff options
author | Tsu Chiang Chuang <tsu@google.com> | 2012-02-13 13:47:45 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-02-13 13:47:45 -0800 |
commit | 298b8004ad1c2cff00676473c702bb4fc98a80a7 (patch) | |
tree | 36d67eaf752fff6c60958d4a5815d181a53d81b4 /core/tests | |
parent | ec5b5156e7a6f46cb90f1b3e980b70a11384f43c (diff) | |
parent | 5f5ea91f60b4b7d2fcf3da3603cd745a53cba48f (diff) | |
download | frameworks_base-298b8004ad1c2cff00676473c702bb4fc98a80a7.zip frameworks_base-298b8004ad1c2cff00676473c702bb4fc98a80a7.tar.gz frameworks_base-298b8004ad1c2cff00676473c702bb4fc98a80a7.tar.bz2 |
am 5f5ea91f: am eb56ad18: am 08eb7dd6: Merge "extending timeout to stabilize tests" into ics-mr1
* commit '5f5ea91f60b4b7d2fcf3da3603cd745a53cba48f':
extending timeout to stabilize tests
Diffstat (limited to 'core/tests')
-rw-r--r-- | core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java | 5 | ||||
-rw-r--r-- | core/tests/bandwidthtests/src/com/android/bandwidthtest/util/ConnectionUtil.java | 12 |
2 files changed, 14 insertions, 3 deletions
diff --git a/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java b/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java index a781472..76b702e 100644 --- a/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java +++ b/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java @@ -90,6 +90,7 @@ public class BandwidthTest extends InstrumentationTestCase { */ @LargeTest public void testWifiDownload() throws Exception { + mConnectionUtil.wifiTestInit(); assertTrue("Could not connect to wifi!", setDeviceWifiAndAirplaneMode(mSsid)); downloadFile(); } @@ -143,6 +144,7 @@ public class BandwidthTest extends InstrumentationTestCase { */ @LargeTest public void testWifiUpload() throws Exception { + mConnectionUtil.wifiTestInit(); assertTrue(setDeviceWifiAndAirplaneMode(mSsid)); uploadFile(); } @@ -197,6 +199,7 @@ public class BandwidthTest extends InstrumentationTestCase { */ @LargeTest public void testWifiDownloadWithDownloadManager() throws Exception { + mConnectionUtil.wifiTestInit(); assertTrue(setDeviceWifiAndAirplaneMode(mSsid)); downloadFileUsingDownloadManager(); } @@ -286,6 +289,8 @@ public class BandwidthTest extends InstrumentationTestCase { * @return true if we successfully connect to mobile data. */ public boolean hasMobileData() { + assertTrue(mConnectionUtil.waitForNetworkState(ConnectivityManager.TYPE_MOBILE, + State.CONNECTED, ConnectionUtil.LONG_TIMEOUT)); assertTrue("Not connected to mobile", mConnectionUtil.isConnectedToMobile()); assertFalse("Still connected to wifi.", mConnectionUtil.isConnectedToWifi()); return mConnectionUtil.hasData(); diff --git a/core/tests/bandwidthtests/src/com/android/bandwidthtest/util/ConnectionUtil.java b/core/tests/bandwidthtests/src/com/android/bandwidthtest/util/ConnectionUtil.java index dfcbba9..7499f68 100644 --- a/core/tests/bandwidthtests/src/com/android/bandwidthtest/util/ConnectionUtil.java +++ b/core/tests/bandwidthtests/src/com/android/bandwidthtest/util/ConnectionUtil.java @@ -57,7 +57,7 @@ public class ConnectionUtil { private static final int WAIT_FOR_SCAN_RESULT = 10 * 1000; // 10 seconds private static final int WIFI_SCAN_TIMEOUT = 50 * 1000; public static final int SHORT_TIMEOUT = 5 * 1000; - public static final int LONG_TIMEOUT = 10 * 1000; + public static final int LONG_TIMEOUT = 120 * 1000; // 2 minutes private ConnectivityReceiver mConnectivityReceiver = null; private WifiReceiver mWifiReceiver = null; private DownloadReceiver mDownloadReceiver = null; @@ -118,8 +118,14 @@ public class ConnectionUtil { initializeNetworkStates(); - mWifiManager.setWifiEnabled(true); + } + + /** + * Additional initialization needed for wifi related tests. + */ + public void wifiTestInit() { + mWifiManager.setWifiEnabled(true); Log.v(LOG_TAG, "Clear Wifi before we start the test."); sleep(SHORT_TIMEOUT); removeConfiguredNetworksAndDisableWifi(); @@ -525,7 +531,7 @@ public class ConnectionUtil { /** * Connect to Wi-Fi with the given configuration. * @param config - * @return true if we ar connected to a given + * @return true if we are connected to a given AP. */ public boolean connectToWifiWithConfiguration(WifiConfiguration config) { // The SSID in the configuration is a pure string, need to convert it to a quoted string. |