Merge "Using WifiCommand to toggle the Wi-Fi state"
am: bec5dc830e
Change-Id: I68c100893d634af80a9d14552cdf0255a8ebee16
This commit is contained in:
committed by
android-build-merger
commit
e1ba791c28
@@ -33,14 +33,15 @@ import android.os.ParcelFileDescriptor.AutoCloseInputStream;
|
||||
import android.os.SystemClock;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.support.test.uiautomator.UiDevice;
|
||||
import android.test.InstrumentationTestCase;
|
||||
import android.util.Log;
|
||||
|
||||
import libcore.io.Streams;
|
||||
|
||||
import com.google.mockwebserver.MockResponse;
|
||||
import com.google.mockwebserver.MockWebServer;
|
||||
|
||||
import libcore.io.Streams;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
@@ -63,6 +64,7 @@ public class DownloadManagerBaseTest extends InstrumentationTestCase {
|
||||
private static final String TAG = "DownloadManagerBaseTest";
|
||||
protected DownloadManager mDownloadManager = null;
|
||||
private MockWebServer mServer = null;
|
||||
private UiDevice mUiDevice = null;
|
||||
protected String mFileType = "text/plain";
|
||||
protected Context mContext = null;
|
||||
protected MultipleDownloadsCompletedReceiver mReceiver = null;
|
||||
@@ -234,6 +236,7 @@ public class DownloadManagerBaseTest extends InstrumentationTestCase {
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
mContext = getInstrumentation().getContext();
|
||||
mUiDevice = UiDevice.getInstance(getInstrumentation());
|
||||
mDownloadManager = (DownloadManager)mContext.getSystemService(Context.DOWNLOAD_SERVICE);
|
||||
mServer = new MockWebServer();
|
||||
mServer.play();
|
||||
@@ -512,7 +515,7 @@ public class DownloadManagerBaseTest extends InstrumentationTestCase {
|
||||
Log.i(LOG_TAG, "Setting WiFi State to: " + enable);
|
||||
WifiManager manager = (WifiManager)mContext.getSystemService(Context.WIFI_SERVICE);
|
||||
|
||||
manager.setWifiEnabled(enable);
|
||||
mUiDevice.executeShellCommand("svc wifi " + (enable ? "enable" : "disable"));
|
||||
|
||||
String timeoutMessage = "Timed out waiting for Wifi to be "
|
||||
+ (enable ? "enabled!" : "disabled!");
|
||||
|
||||
Reference in New Issue
Block a user