diff --git a/build/sdk.atree b/build/sdk.atree index c4a42cdff..4562eb581 100644 --- a/build/sdk.atree +++ b/build/sdk.atree @@ -446,4 +446,3 @@ sdk/files/README_add-ons.txt add-ons/README.txt ############################################################################## # Tests Component ############################################################################## -system/app/EmulatorSmokeTests/EmulatorSmokeTests.apk tests/emulator-test-apps/EmulatorSmokeTests.apk diff --git a/tools/emulator/test-apps/SmokeTests/Android.mk b/tools/emulator/test-apps/SmokeTests/Android.mk deleted file mode 100644 index ccd3eb45d..000000000 --- a/tools/emulator/test-apps/SmokeTests/Android.mk +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2014 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. - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_STATIC_JAVA_LIBRARIES := android-support-test - -LOCAL_MODULE_TAGS := optional - -# Only compile source java files in this apk. -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := EmulatorSmokeTests - -LOCAL_SDK_VERSION := 4 - -LOCAL_PROGUARD_ENABLED := disabled - - -include $(BUILD_PACKAGE) diff --git a/tools/emulator/test-apps/SmokeTests/AndroidManifest.xml b/tools/emulator/test-apps/SmokeTests/AndroidManifest.xml deleted file mode 100644 index 6daafa9c9..000000000 --- a/tools/emulator/test-apps/SmokeTests/AndroidManifest.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - diff --git a/tools/emulator/test-apps/SmokeTests/src/com/android/emulator/smoketests/connectivity/ConnectivityTest.java b/tools/emulator/test-apps/SmokeTests/src/com/android/emulator/smoketests/connectivity/ConnectivityTest.java deleted file mode 100644 index 9fe1ebe77..000000000 --- a/tools/emulator/test-apps/SmokeTests/src/com/android/emulator/smoketests/connectivity/ConnectivityTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2011 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.emulator.smoketests.connectivity; - -import java.io.IOException; -import java.net.URL; -import java.net.URLConnection; - -import android.content.Context; -import android.net.ConnectivityManager; -import android.net.NetworkInfo; -import android.test.AndroidTestCase; -import android.util.Log; - -/** - * Network connectivity testcases. - */ -public class ConnectivityTest extends AndroidTestCase { - - private ConnectivityManager connectivity; - - //Connection attempt will be made to google.com - private static final String URL_NAME = "http://www.google.com"; - - @Override - protected void setUp() throws Exception { - connectivity = (ConnectivityManager) getContext(). - getSystemService(Context.CONNECTIVITY_SERVICE); - assertNotNull(connectivity); - } - - /** - * Test that there is an active network - */ - public void testActiveConnectivity() { - NetworkInfo networkInfo = connectivity.getActiveNetworkInfo(); - Log.d("ConnectivityTest", "validating active networks."); - assertNotNull(networkInfo); - assertEquals( NetworkInfo.State.CONNECTED, networkInfo.getState()); - } - - /** - * Test that a connection can be made over the active network - */ - public void testConnectionCreation() throws IOException { - URL url = new URL(URL_NAME); - Log.d("ConnectivityTest", "creating HTTP connection to google.com."); - URLConnection connection = url.openConnection(); - connection.connect(); - } - -} diff --git a/tools/emulator/test-apps/SmokeTests/src/com/android/emulator/smoketests/gps/GpsLocationTest.java b/tools/emulator/test-apps/SmokeTests/src/com/android/emulator/smoketests/gps/GpsLocationTest.java deleted file mode 100644 index 1e0258c29..000000000 --- a/tools/emulator/test-apps/SmokeTests/src/com/android/emulator/smoketests/gps/GpsLocationTest.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2011 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.emulator.smoketests.gps; - -import android.content.Context; -import android.location.Location; -import android.location.LocationListener; -import android.location.LocationManager; -import android.os.Bundle; -import android.os.HandlerThread; -import android.test.AndroidTestCase; - -import junit.framework.Assert; - -/** - * GPS Location Test - * - * Test the GPS API by verifying the previously set location - */ -public class GpsLocationTest extends AndroidTestCase implements LocationListener { - - private LocationManager locationManager; - private Location mLocation; - /** - * Prior to running this test the GPS location must be set to the following - * longitude and latitude coordinates via the geo fix command - */ - private static final double LONGITUDE = -122.08345770835876; - private static final double LATITUDE = 37.41991859119417; - private static final int TIMEOUT = 5000; - - @Override - protected void setUp() throws Exception { - locationManager = (LocationManager) getContext(). - getSystemService(Context.LOCATION_SERVICE); - assertNotNull(locationManager); - } - - /** - * verify that the last location equals to the location set - * via geo fix command - */ - public void testCurrentLocationGivenLocation(){ - try{ - synchronized ( this ){ - HandlerThread handlerThread = new HandlerThread("testLocationUpdates"); - handlerThread.start(); - locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, this, - handlerThread.getLooper()); - this.wait(TIMEOUT); - } - }catch ( InterruptedException ie){ - ie.printStackTrace(); - Assert.fail(); - } - assertNotNull(mLocation); - assertEquals(new Float(LONGITUDE), new Float(mLocation.getLongitude())); - assertEquals(new Float(LATITUDE), new Float(mLocation.getLatitude())); - locationManager.removeUpdates(this); - } - - public void onLocationChanged(Location location) { - synchronized ( this ){ - mLocation=location; - this.notify(); - } - } - - public void onProviderDisabled(String arg0) { - } - - public void onProviderEnabled(String arg0) { - } - - public void onStatusChanged(String arg0, int arg1, Bundle arg2) { - } -} diff --git a/tools/emulator/test-apps/SmokeTests/src/com/android/emulator/smoketests/sms/SmsTest.java b/tools/emulator/test-apps/SmokeTests/src/com/android/emulator/smoketests/sms/SmsTest.java deleted file mode 100644 index 6b99ea547..000000000 --- a/tools/emulator/test-apps/SmokeTests/src/com/android/emulator/smoketests/sms/SmsTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2014 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.emulator.smoketests.sms; - -import android.content.Context; -import android.content.ContentResolver; -import android.net.Uri; -import android.database.Cursor; -import android.os.Bundle; -import android.os.HandlerThread; -import android.support.test.InstrumentationRegistry; - -import org.junit.Assert; -import static junit.framework.Assert.assertEquals; - -import org.junit.Test; -/** - * Sms Test - * - * Test that an SMS message has been received - */ -public class SmsTest { - - /** - * Prior to running this test an sms must be sent - * via DDMS - */ - public final static String NUMBER = "5551212"; - public final static String BODY = "test sms"; - private final static int SMS_POLL_TIME_MS = 10 * 1000; - private final static int SIXY_SECONDS_OF_LOOPS = 6; - - /** - * Verify that an SMS has been received with the correct number and body - */ - @Test - public void testReceivedSms() throws java.lang.InterruptedException { - Cursor c = getSmsCursor(); - c.moveToFirst(); - - String number = c.getString(c.getColumnIndexOrThrow("address")); - String body = c.getString(c.getColumnIndexOrThrow("body")); - - c.close(); - - assertEquals(NUMBER, number); - assertEquals(BODY, body); - } - - private Cursor getSmsCursor() throws java.lang.InterruptedException { - ContentResolver r = InstrumentationRegistry.getTargetContext().getContentResolver(); - Uri message = Uri.parse("content://sms/"); - Cursor c; - - for(int i = 0; i < SIXY_SECONDS_OF_LOOPS; i++) { - c = r.query(message,null,null,null,null); - - if(c.getCount() != 0) { - return c; - } - - c.close(); - Thread.sleep(SMS_POLL_TIME_MS); - } - Assert.fail("Did not find any SMS messages. Giving up"); - // necessary for compilation - return null; - } - -}