delete tests baked into emulator system image
- tests are out of maintainence - the checks were general functional tests on comms related areas and should be covered by the same tests across physical and virtual devices Bug: 77496099 Test: build `make -j droid tests dist` Change-Id: I899764846b4829add5ade8085a43bf88c958914f
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 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.
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.android.emulator.smoketests">
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_SMS" />
|
||||
<uses-sdk android:minSdkVersion="4"
|
||||
android:targetSdkVersion="24"/>
|
||||
<instrumentation android:targetPackage="com.android.emulator.smoketests"
|
||||
android:name="android.support.test.runner.AndroidJUnitRunner" />
|
||||
<application android:label="Emulator Smoke Tests">
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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) {
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user