Merge "CTS tests for cross-profile content uris." into lmp-dev
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index 4a7725a..4bbd783 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -45,7 +45,6 @@
CtsMonkeyApp2 \
CtsSomeAccessibilityServices \
CtsThemeDeviceApp \
- SignatureTest \
TestDeviceSetup \
CtsUiAutomatorApp \
CtsUsbSerialTestApp \
@@ -115,6 +114,7 @@
CtsRsCppTestCases \
CtsSaxTestCases \
CtsSecurityTestCases \
+ CtsSignatureTestCases \
CtsSpeechTestCases \
CtsTelephonyTestCases \
CtsTextTestCases \
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 3bb9a01..0183fa2 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -728,18 +728,6 @@
</intent-filter>
</receiver>
- <activity android:name=".sensors.AccelerometerTestActivity"
- android:label="@string/snsr_accel_test"
- android:screenOrientation="nosensor">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/test_category_sensors" />
- <meta-data android:name="test_required_features"
- android:value="android.hardware.sensor.accelerometer" />
- </activity>
-
<activity android:name=".sensors.AccelerometerMeasurementTestActivity"
android:label="@string/snsr_accel_m_test"
android:screenOrientation="locked">
@@ -752,17 +740,6 @@
android:value="android.hardware.sensor.accelerometer"/>
</activity>
- <activity android:name=".sensors.GyroscopeTestActivity" android:label="@string/snsr_gyro_test"
- android:screenOrientation="nosensor">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.cts.intent.category.MANUAL_TEST" />
- </intent-filter>
- <meta-data android:name="test_category" android:value="@string/test_category_sensors" />
- <meta-data android:name="test_required_features"
- android:value="android.hardware.sensor.gyroscope" />
- </activity>
-
<activity android:name=".sensors.GyroscopeMeasurementTestActivity"
android:label="@string/snsr_gyro_m_test"
android:screenOrientation="locked">
@@ -811,7 +788,8 @@
android:value="android.hardware.sensor.accelerometer" />
</activity>
- <activity android:name=".sensors.RotationVectorTestActivity"
+ <!-- TODO: enable when a full set of verifications can be implemented -->
+ <!--activity android:name=".sensors.RotationVectorTestActivity"
android:label="@string/snsr_rot_vec_test"
android:screenOrientation="locked">
<intent-filter>
@@ -821,7 +799,7 @@
<meta-data android:name="test_category" android:value="@string/test_category_sensors" />
<meta-data android:name="test_required_features"
android:value="android.hardware.sensor.gyroscope" />
- </activity>
+ </activity-->
<activity android:name=".sensors.BatchingTestActivity"
android:label="@string/snsr_batch_test"
@@ -835,7 +813,7 @@
android:value="android.hardware.sensor.accelerometer" />
</activity>
- <!-- TODO: enable test when a more reliable way to identify time synchronization is available -->
+ <!-- TODO: enable when a more reliable way to identify time synchronization is available -->
<!--activity android:name=".sensors.SensorSynchronizationTestActivity"
android:label="@string/snsr_synch_test"
android:screenOrientation="locked">
@@ -1131,6 +1109,7 @@
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
+ <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity-alias>
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 8f28706..38e0ced 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -504,14 +504,14 @@
facing the ceiling.</string>
<string name="snsr_accel_test_face_down">Place the device on a flat surface with the screen
facing it.</string>
- <string name="snsr_accel_test_right_side">Place the device resting vertically on its right
- side.</string>
- <string name="snsr_accel_test_left_side">Place the device resting vertically on its left
- side.</string>
- <string name="snsr_accel_test_top_side">Place the device resting vertically on its top
- side.</string>
- <string name="snsr_accel_test_bottom_side">Place the device resting vertically on its bottom
- side.</string>
+ <string name="snsr_accel_test_right_side">Place the device in a flat surface resting vertically
+ on its right side.</string>
+ <string name="snsr_accel_test_left_side">Place the device in a flat surface resting vertically
+ on its left side.</string>
+ <string name="snsr_accel_test_top_side">Place the device in a flat surface resting vertically
+ on its top side.</string>
+ <string name="snsr_accel_test_bottom_side">Place the device in a flat surface resting vertically
+ on its bottom side.</string>
<!-- Gyroscope -->
<string name="snsr_gyro_test">Gyroscope Test</string>
@@ -558,7 +558,8 @@
<!-- Sensor Batching -->
<string name="snsr_batch_test">Sensor Batching Tests</string>
- <string name="snsr_batching_walking_needed">Once the test begins, you will have to walk.</string>
+ <string name="snsr_batching_walking_needed">Once the test begins, you will have to take the
+ device in your hand and walk.</string>
<string name="snsr_batching_fifo_count">FifoReservedEventCount=%1$d. Expected to be at most FifoMaxEventCount=%2$d.</string>
<!-- Sensor Synchronization -->
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java
index 6319133..20ccd81 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java
@@ -194,6 +194,9 @@
public static final Feature[] ALL_LMP_FEATURES = {
new Feature(PackageManager.FEATURE_SENSOR_HEART_RATE_ECG, false),
+ new Feature("android.hardware.ethernet", false),
+ new Feature("android.software.backup", false),
+ new Feature("android.software.print", false),
};
@Override
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerMeasurementTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerMeasurementTestActivity.java
index 945e9ab..dfcf120 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerMeasurementTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerMeasurementTestActivity.java
@@ -107,10 +107,11 @@
private String delayedVerifyMeasurements(int descriptionResId, float ... expectations)
throws Throwable {
- appendText(descriptionResId);
- appendText(R.string.snsr_test_play_sound);
- waitForUser();
- Thread.sleep(TimeUnit.MILLISECONDS.convert(10, TimeUnit.SECONDS));
+ SensorTestLogger logger = getTestLogger();
+ logger.logInstructions(descriptionResId);
+ logger.logWaitForSound();
+ waitForUserToBegin();
+ Thread.sleep(TimeUnit.MILLISECONDS.convert(7, TimeUnit.SECONDS));
try {
return verifyMeasurements(expectations);
@@ -121,9 +122,10 @@
private String verifyMeasurements(int descriptionResId, float ... expectations)
throws Throwable {
- appendText(descriptionResId);
- appendText(R.string.snsr_device_steady);
- waitForUser();
+ SensorTestLogger logger = getTestLogger();
+ logger.logInstructions(descriptionResId);
+ logger.logInstructions(R.string.snsr_device_steady);
+ waitForUserToBegin();
return verifyMeasurements(expectations);
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerTestActivity.java
index 597f5fb..0d4f755 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerTestActivity.java
@@ -31,7 +31,10 @@
* CTS Verifier case for verifying correct integration of accelerometer.
* Displays a wedge using OpenGL that, on a correctly-integrated device, always
* points down.
+ *
+ * @deprecated It has been replaced by {@link AccelerometerMeasurementTestActivity}
*/
+@Deprecated
public class AccelerometerTestActivity extends PassFailButtons.Activity {
private GLSurfaceView mGLSurfaceView;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/GyroscopeTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/GyroscopeTestActivity.java
index 7a7a7f5..f886e75 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/GyroscopeTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/GyroscopeTestActivity.java
@@ -36,7 +36,10 @@
* Manual test for testing the gyroscope sensor. This test consists of 6 steps for all the
* different ways to rotate the device along the x, y, and z axis. It also raises a warning
* if the values seem to high and may be degrees.
+ *
+ * @deprecated It has been replaced by {@link GyroscopeMeasurementTestActivity}
*/
+@Deprecated
public class GyroscopeTestActivity extends PassFailButtons.Activity {
private static final int NUM_STAGES = 6;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SensorSynchronizationTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SensorSynchronizationTestActivity.java
index eeb4bf0..b5ffc2a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SensorSynchronizationTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SensorSynchronizationTestActivity.java
@@ -1,7 +1,7 @@
package com.android.cts.verifier.sensors;
-import com.android.cts.verifier.sensors.base.BaseSensorSemiAutomatedTestActivity;
+import com.android.cts.verifier.sensors.base.SensorCtsVerifierTestActivity;
import junit.framework.Assert;
@@ -25,8 +25,11 @@
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public class SensorSynchronizationTestActivity
- extends BaseSensorSemiAutomatedTestActivity
+ extends SensorCtsVerifierTestActivity
implements SensorEventListener {
+ public SensorSynchronizationTestActivity() {
+ super(SensorSynchronizationTestActivity.class);
+ }
private final double NANOS_PER_MILLI = 1e6;
private final int DATA_COLLECTION_TIME_IN_MS = 5000;
@@ -132,7 +135,7 @@
Assert.assertTrue("Gyroscope did not detect any movement", gyrMovementDetected);
}
- private void executeCrossSensorTest() throws Throwable {
+ public String testCrossSensorSynchronization() throws Throwable {
appendText("This test provides a rough indication of cross-sensor timestamp synchronization.");
appendText("Hold device still in hand and click 'Next'");
waitForUser();
@@ -144,6 +147,7 @@
stopDataCollection();
analyzeData();
+ return null;
}
protected double angleBetweenVecsDegrees(float[] vec1, float[] vec2) {
@@ -156,11 +160,6 @@
}
@Override
- protected void onRun() throws Throwable {
- executeCrossSensorTest();
- }
-
- @Override
public void onSensorChanged(SensorEvent sensorEvent) {
mSensorEvents.add(new TestSensorEvent(sensorEvent, SystemClock.elapsedRealtimeNanos()));
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SensorValueAccuracyActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SensorValueAccuracyActivity.java
index b720ffb..b6d7cd6 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SensorValueAccuracyActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SensorValueAccuracyActivity.java
@@ -96,7 +96,7 @@
}
public String testGyroscopeCalibratedUncalibrated() throws Throwable {
- appendText(R.string.snsr_keep_device_rotating_clockwise);
+ getTestLogger().logInstructions(R.string.snsr_keep_device_rotating_clockwise);
return verifyCalibratedUncalibrated(
Sensor.TYPE_GYROSCOPE,
Sensor.TYPE_GYROSCOPE_UNCALIBRATED,
@@ -113,8 +113,8 @@
int instructionsResId,
float expectedNorm,
float threshold) {
- appendText(instructionsResId);
- waitForUser();
+ getTestLogger().logInstructions(instructionsResId);
+ waitForUserToBegin();
TestSensorEnvironment environment =
new TestSensorEnvironment(getApplicationContext(), sensorType, SENSOR_RATE);
@@ -151,8 +151,9 @@
int calibratedSensorType,
int uncalibratedSensorType,
float threshold) throws Throwable {
- appendText(R.string.snsr_no_interaction);
- waitForUser();
+ SensorTestLogger logger = getTestLogger();
+ logger.logInstructions(R.string.snsr_no_interaction);
+ waitForUserToBegin();
Sensor calibratedSensor = mSensorManager.getDefaultSensor(calibratedSensorType);
if (calibratedSensor == null) {
@@ -167,7 +168,7 @@
final long timeout = TimeUnit.SECONDS.toMillis(10);
startDataCollection(calibratedSensor);
startDataCollection(uncalibratedSensor);
- appendText(R.string.snsr_test_play_sound);
+ logger.logWaitForSound();
Thread.sleep(timeout);
stopDataCollection();
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SignificantMotionTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SignificantMotionTestActivity.java
index fbc56c2..a84a045 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SignificantMotionTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/SignificantMotionTestActivity.java
@@ -67,7 +67,7 @@
false /* vibrate */);
}
- public String testNotTriggerAfterCancell() throws Throwable {
+ public String testNotTriggerAfterCancel() throws Throwable {
return runTest(
R.string.snsr_significant_motion_test_cancel,
false /* isMotionExpected */,
@@ -107,12 +107,13 @@
}
public String testTriggerDeactivation() throws Throwable {
- appendText(R.string.snsr_significant_motion_test_deactivation);
- waitForUser();
+ SensorTestLogger logger = getTestLogger();
+ logger.logInstructions(R.string.snsr_significant_motion_test_deactivation);
+ waitForUserToBegin();
TriggerVerifier verifier = new TriggerVerifier();
mSensorManager.requestTriggerSensor(verifier, mSensorSignificantMotion);
- appendText(R.string.snsr_test_play_sound);
+ logger.logWaitForSound();
// wait for the first event to trigger
verifier.verifyEventTriggered();
@@ -137,8 +138,9 @@
boolean isMotionExpected,
boolean cancelEventNotification,
boolean vibrate) throws Throwable {
- appendText(instructionsResId);
- waitForUser();
+ SensorTestLogger logger = getTestLogger();
+ logger.logInstructions(instructionsResId);
+ waitForUserToBegin();
if (vibrate) {
vibrate(VIBRATE_DURATION_MILLIS);
@@ -154,7 +156,7 @@
getString(R.string.snsr_significant_motion_cancelation),
mSensorManager.cancelTriggerSensor(verifier, mSensorSignificantMotion));
}
- appendText(R.string.snsr_test_play_sound);
+ logger.logWaitForSound();
String result;
try {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/StepCounterTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/StepCounterTestActivity.java
index e3e934c..76d12d9 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/StepCounterTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/StepCounterTestActivity.java
@@ -139,7 +139,7 @@
vibrate(VIBRATE_PATTERN);
}
startMeasurements();
- appendText(R.string.snsr_test_play_sound);
+ getTestLogger().logWaitForSound();
Thread.sleep(TimeUnit.SECONDS.toMillis(TEST_DURATION_SECONDS));
mCheckForMotion = false;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/BaseSensorSemiAutomatedTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/BaseSensorSemiAutomatedTestActivity.java
deleted file mode 100644
index 9f2f5c4..0000000
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/BaseSensorSemiAutomatedTestActivity.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2013 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.cts.verifier.sensors.base;
-
-import com.android.cts.verifier.sensors.reporting.SensorTestDetails;
-
-import android.hardware.cts.helpers.SensorTestStateNotSupportedException;
-
-/**
- * Base class to author a single Sensor semi-automated test case.
- *
- * @deprecated use {@link BaseSensorTestActivity} instead.
- */
-@Deprecated
-public abstract class BaseSensorSemiAutomatedTestActivity extends BaseSensorTestActivity {
- public BaseSensorSemiAutomatedTestActivity() {
- super(BaseSensorSemiAutomatedTestActivity.class);
- }
-
- @Override
- public SensorTestDetails executeTests() {
- String summary = "";
- SensorTestDetails.ResultCode resultCode = SensorTestDetails.ResultCode.PASS;
- try {
- onRun();
- } catch(SensorTestStateNotSupportedException e) {
- // the sensor state is not supported in the device, log a warning and skip the test
- resultCode = SensorTestDetails.ResultCode.SKIPPED;
- summary = e.getMessage();
- } catch(Throwable e) {
- resultCode = SensorTestDetails.ResultCode.FAIL;
- summary = e.getMessage();
- }
- return new SensorTestDetails(getTestClassName(), resultCode, summary);
- }
-
- /**
- * This is the method that subclasses will implement to define the operations that need to be
- * verified.
- * Any exception thrown will cause the test to fail, additionally mAssert can be used to verify
- * the tests state.
- *
- * throws Throwable
- */
- @Deprecated
- protected abstract void onRun() throws Throwable;
-}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/BaseSensorTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/BaseSensorTestActivity.java
index 236c180..068869f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/BaseSensorTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/BaseSensorTestActivity.java
@@ -237,11 +237,6 @@
}
@Deprecated
- protected void appendText(int resId, int textColor) {
- mTestLogger.logInstructions(resId);
- }
-
- @Deprecated
protected void appendText(String text, int textColor) {
appendText(text);
}
diff --git a/development/ide/eclipse/.classpath b/development/ide/eclipse/.classpath
index fafcc32..98939ba 100644
--- a/development/ide/eclipse/.classpath
+++ b/development/ide/eclipse/.classpath
@@ -1,101 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="lib" path="prebuilts/misc/common/ddmlib/ddmlib-prebuilt.jar"/>
- <classpathentry kind="lib" path="prebuilts/misc/common/tradefed/tradefed-prebuilt.jar"/>
- <classpathentry kind="src" path="cts/apps/CtsVerifier/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/appsecurity/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/appsecurity/test-apps/AppWithData/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/monkey/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/monkey/test-apps/CtsMonkeyApp/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/monkey/test-apps/CtsMonkeyApp2/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/sample/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/sample/app/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/theme/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/theme/app/src"/>
- <classpathentry kind="src" path="cts/hostsidetests/usb/src"/>
- <classpathentry kind="src" path="cts/libs/vogar-expect/src"/>
- <classpathentry kind="src" path="cts/libs/commonutil/src"/>
- <classpathentry kind="src" path="cts/libs/deviceutil/src"/>
- <classpathentry kind="src" path="cts/libs/json/src"/>
- <classpathentry kind="src" path="cts/libs/testserver/src"/>
- <classpathentry kind="src" path="cts/libs/wrappedgtest/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/browserbench/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/dram/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/filesystemperf/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/opengl/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/simplecpu/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/ui/src"/>
- <classpathentry kind="src" path="cts/suite/cts/deviceTests/videoperf/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/jank/app/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/jank/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/appA/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/appB/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/control/src"/>
- <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/src"/>
- <classpathentry kind="src" path="cts/tests/ProcessTest/src"/>
- <classpathentry kind="src" path="cts/tests/ProcessTest/NoShareUidApp/src"/>
- <classpathentry kind="src" path="cts/tests/ProcessTest/ShareUidApp/src"/>
- <classpathentry kind="src" path="cts/tests/SignatureTest/src"/>
- <classpathentry kind="src" path="cts/tests/SignatureTest/tests/src"/>
- <classpathentry kind="src" path="cts/tests/acceleration/src"/>
- <classpathentry kind="src" path="cts/tests/core/runner/src"/>
- <classpathentry kind="src" path="cts/tests/deviceadmin/src"/>
- <classpathentry kind="src" path="cts/tests/sample/src"/>
- <classpathentry kind="src" path="cts/tests/src"/>
- <classpathentry kind="src" path="cts/tests/tests/acceleration/src"/>
- <classpathentry kind="src" path="cts/tests/tests/accessibility/src"/>
- <classpathentry kind="src" path="cts/tests/tests/accessibilityservice/src"/>
- <classpathentry kind="src" path="cts/tests/tests/accounts/src"/>
- <classpathentry kind="src" path="cts/tests/tests/admin/src"/>
- <classpathentry kind="src" path="cts/tests/tests/animation/src"/>
- <classpathentry kind="src" path="cts/tests/tests/app/src"/>
- <classpathentry kind="src" path="cts/tests/tests/bluetooth/src"/>
- <classpathentry kind="src" path="cts/tests/tests/content/src"/>
- <classpathentry kind="src" path="cts/tests/tests/database/src"/>
- <classpathentry kind="src" path="cts/tests/tests/dpi/src"/>
- <classpathentry kind="src" path="cts/tests/tests/dpi2/src"/>
- <classpathentry kind="src" path="cts/tests/tests/drm/src"/>
- <classpathentry kind="src" path="cts/tests/tests/gesture/src"/>
- <classpathentry kind="src" path="cts/tests/tests/graphics/src"/>
- <classpathentry kind="src" path="cts/tests/tests/graphics2/src"/>
- <classpathentry kind="src" path="cts/tests/tests/hardware/src"/>
- <classpathentry kind="src" path="cts/tests/tests/jni/src"/>
- <classpathentry kind="src" path="cts/tests/tests/location/src"/>
- <classpathentry kind="src" path="cts/tests/tests/media/src"/>
- <classpathentry kind="src" path="cts/tests/tests/mediastress/src"/>
- <classpathentry kind="src" path="cts/tests/tests/net/src"/>
- <classpathentry kind="src" path="cts/tests/tests/opengl/src"/>
- <classpathentry kind="src" path="cts/tests/tests/openglperf/src"/>
- <classpathentry kind="src" path="cts/tests/tests/os/src"/>
- <classpathentry kind="src" path="cts/tests/tests/permission/src"/>
- <classpathentry kind="src" path="cts/tests/tests/permission2/src"/>
- <classpathentry kind="src" path="cts/tests/tests/preference/src"/>
- <classpathentry kind="src" path="cts/tests/tests/preference2/src"/>
- <classpathentry kind="src" path="cts/tests/tests/provider/src"/>
- <classpathentry kind="src" path="cts/tests/tests/renderscript/src"/>
- <classpathentry kind="src" path="cts/tests/tests/security/src"/>
- <classpathentry kind="src" path="cts/tests/tests/speech/src"/>
- <classpathentry kind="src" path="cts/tests/tests/telephony/src"/>
- <classpathentry kind="src" path="cts/tests/tests/text/src"/>
- <classpathentry kind="src" path="cts/tests/tests/textureview/src"/>
- <classpathentry kind="src" path="cts/tests/tests/util/src"/>
- <classpathentry kind="src" path="cts/tests/tests/view/src"/>
- <classpathentry kind="src" path="cts/tests/tests/webkit/src"/>
- <classpathentry kind="src" path="cts/tests/tests/widget/src"/>
- <classpathentry kind="src" path="cts/tools/cts-api-coverage/src"/>
- <classpathentry kind="src" path="cts/tools/cts-java-scanner/src"/>
- <classpathentry kind="src" path="cts/tools/cts-java-scanner-doclet/src"/>
- <classpathentry kind="src" path="cts/tools/cts-native-scanner/src"/>
- <classpathentry kind="src" path="cts/tools/cts-reference-app-lib/src"/>
- <classpathentry kind="src" path="cts/tools/cts-xml-generator/src"/>
- <classpathentry kind="src" path="cts/tools/dasm/src"/>
- <classpathentry kind="src" path="cts/tools/device-setup/TestDeviceSetup/src"/>
- <classpathentry kind="src" path="cts/tools/dex-tools/src"/>
- <classpathentry kind="src" path="cts/tools/signature-tools/src"/>
- <classpathentry kind="src" path="cts/tools/signature-tools/test"/>
- <classpathentry kind="src" path="cts/tools/tradefed-host/src"/>
- <classpathentry kind="src" path="cts/tools/tradefed-host/tests/src"/>
- <classpathentry kind="src" path="cts/tools/utils"/>
- <classpathentry kind="src" path="cts/tools/vm-tests-tf/src"/>
- <classpathentry kind="src" path="external/easymock/src"/>
+ <classpathentry kind="lib" path="prebuilts/misc/common/ddmlib/ddmlib-prebuilt.jar"/>
+ <classpathentry kind="lib" path="prebuilts/misc/common/tradefed/tradefed-prebuilt.jar"/>
+ <classpathentry kind="src" path="cts/apps/CtsVerifier/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/appsecurity/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/appsecurity/test-apps/AppWithData/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/monkey/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/monkey/test-apps/CtsMonkeyApp/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/monkey/test-apps/CtsMonkeyApp2/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/sample/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/sample/app/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/theme/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/theme/app/src"/>
+ <classpathentry kind="src" path="cts/hostsidetests/usb/src"/>
+ <classpathentry kind="src" path="cts/libs/vogar-expect/src"/>
+ <classpathentry kind="src" path="cts/libs/commonutil/src"/>
+ <classpathentry kind="src" path="cts/libs/deviceutil/src"/>
+ <classpathentry kind="src" path="cts/libs/json/src"/>
+ <classpathentry kind="src" path="cts/libs/testserver/src"/>
+ <classpathentry kind="src" path="cts/libs/wrappedgtest/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/browserbench/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/dram/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/filesystemperf/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/opengl/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/simplecpu/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/ui/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/deviceTests/videoperf/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/jank/app/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/jank/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/appA/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/appB/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/control/src"/>
+ <classpathentry kind="src" path="cts/suite/cts/hostTests/uihost/src"/>
+ <classpathentry kind="src" path="cts/tests/ProcessTest/src"/>
+ <classpathentry kind="src" path="cts/tests/ProcessTest/NoShareUidApp/src"/>
+ <classpathentry kind="src" path="cts/tests/ProcessTest/ShareUidApp/src"/>
+ <classpathentry kind="src" path="cts/tests/signature/src"/>
+ <classpathentry kind="src" path="cts/tests/signature-tests/src"/>
+ <classpathentry kind="src" path="cts/tests/acceleration/src"/>
+ <classpathentry kind="src" path="cts/tests/core/runner/src"/>
+ <classpathentry kind="src" path="cts/tests/deviceadmin/src"/>
+ <classpathentry kind="src" path="cts/tests/sample/src"/>
+ <classpathentry kind="src" path="cts/tests/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/acceleration/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/accessibility/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/accessibilityservice/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/accounts/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/admin/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/animation/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/app/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/bluetooth/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/content/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/database/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/dpi/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/dpi2/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/drm/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/gesture/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/graphics/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/graphics2/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/hardware/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/jni/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/location/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/media/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/mediastress/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/net/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/opengl/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/openglperf/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/os/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/permission/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/permission2/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/preference/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/preference2/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/provider/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/renderscript/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/security/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/speech/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/telephony/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/text/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/textureview/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/util/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/view/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/webkit/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/widget/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-api-coverage/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-java-scanner/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-java-scanner-doclet/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-native-scanner/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-reference-app-lib/src"/>
+ <classpathentry kind="src" path="cts/tools/cts-xml-generator/src"/>
+ <classpathentry kind="src" path="cts/tools/dasm/src"/>
+ <classpathentry kind="src" path="cts/tools/device-setup/TestDeviceSetup/src"/>
+ <classpathentry kind="src" path="cts/tools/dex-tools/src"/>
+ <classpathentry kind="src" path="cts/tools/signature-tools/src"/>
+ <classpathentry kind="src" path="cts/tools/signature-tools/test"/>
+ <classpathentry kind="src" path="cts/tools/tradefed-host/src"/>
+ <classpathentry kind="src" path="cts/tools/tradefed-host/tests/src"/>
+ <classpathentry kind="src" path="cts/tools/utils"/>
+ <classpathentry kind="src" path="cts/tools/vm-tests-tf/src"/>
+ <classpathentry kind="src" path="external/easymock/src"/>
</classpath>
diff --git a/development/ide/eclipse/genclasspath.sh b/development/ide/eclipse/genclasspath.sh
index 00ee9b3..9b90d82 100755
--- a/development/ide/eclipse/genclasspath.sh
+++ b/development/ide/eclipse/genclasspath.sh
@@ -13,6 +13,5 @@
echo '<?xml version="1.0" encoding="UTF-8"?>'
echo '<classpath>'
-cat $ANDROID_BUILD_TOP/cts/development/ide/eclipse/.classpath | grep classpathentry
-cat $ANDROID_BUILD_TOP/development/ide/eclipse/.classpath | grep classpathentry
+cat $ANDROID_BUILD_TOP/cts/development/ide/eclipse/.classpath $ANDROID_BUILD_TOP/development/ide/eclipse/.classpath | grep classpathentry | sort
echo '</classpath>'
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml b/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
index 4246b70..e156a4f 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
@@ -33,7 +33,13 @@
<activity android:name=".PrimaryUserFilterSetterActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
- <action android:name="com.android.cts.managedprofile.ACTION_TEST_SET_FILTERS" />
+ <category android:name="android.intent.category.DEFAULT"/>
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ <activity android:name=".ComponentDisablingActivity" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/crossprofileintentfilters/ComponentDisablingActivity.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/crossprofileintentfilters/ComponentDisablingActivity.java
new file mode 100644
index 0000000..03922da
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/crossprofileintentfilters/ComponentDisablingActivity.java
@@ -0,0 +1,47 @@
+/*
+ * 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.cts.managedprofile;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.os.Process;
+import android.util.Log;
+
+/**
+ * Class that disables a given component for the user it's running in.
+ */
+public class ComponentDisablingActivity extends Activity {
+
+ private static final String TAG = ComponentDisablingActivity.class.getName();
+ public static final String EXTRA_PACKAGE = "extra-package";
+ public static final String EXTRA_CLASS_NAME = "extra-class-name";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ String extraClassName = getIntent().getStringExtra(EXTRA_CLASS_NAME);
+ String extraPackage = getIntent().getStringExtra(EXTRA_PACKAGE);
+
+ Log.i(TAG, "Disabling: " + extraPackage + "/" + extraClassName + " for user "
+ + Process.myUserHandle());
+ PackageManager packageManager = getPackageManager();
+ packageManager.setComponentEnabledSetting(new ComponentName(extraPackage, extraClassName),
+ PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+ PackageManager.DONT_KILL_APP);
+ }
+}
\ No newline at end of file
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
index b2c4ea5..7fc33f0 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
@@ -84,29 +84,27 @@
assertFalse(listUsers().contains(mUserId));
}
-// TODO: Reinstate once we find another way of disabling an activity for a user (adb pm disable does
-// not work at the moment on non-eng builds.
-// public void testCrossProfileIntentFilters() throws Exception {
-// if (!mHasFeature) {
-// return;
-// }
-// // Set up activities: ManagedProfileActivity will only be enabled in the managed profile and
-// // PrimaryUserActivity only in the primary one
-// disableActivityForUser("ManagedProfileActivity", 0);
-// disableActivityForUser("PrimaryUserActivity", mUserId);
-//
-// assertTrue(runDeviceTestsAsUser(MANAGED_PROFILE_PKG,
-// MANAGED_PROFILE_PKG + ".ManagedProfileTest", mUserId));
-//
-// // Set up filters from primary to managed profile
-// String command = "am start -W --user " + mUserId + " " + MANAGED_PROFILE_PKG
-// + "/.PrimaryUserFilterSetterActivity";
-// CLog.logAndDisplay(LogLevel.INFO, "Output for command " + command + ": "
-// + getDevice().executeShellCommand(command));
-// assertTrue(runDeviceTests(MANAGED_PROFILE_PKG, MANAGED_PROFILE_PKG + ".PrimaryUserTest"));
-// // TODO: Test with startActivity
-// // TODO: Test with CtsVerifier for disambiguation cases
-// }
+ public void testCrossProfileIntentFilters() throws Exception {
+ if (!mHasFeature) {
+ return;
+ }
+ // Set up activities: ManagedProfileActivity will only be enabled in the managed profile and
+ // PrimaryUserActivity only in the primary one
+ disableActivityForUser("ManagedProfileActivity", 0);
+ disableActivityForUser("PrimaryUserActivity", mUserId);
+
+ assertTrue(runDeviceTestsAsUser(MANAGED_PROFILE_PKG,
+ MANAGED_PROFILE_PKG + ".ManagedProfileTest", mUserId));
+
+ // Set up filters from primary to managed profile
+ String command = "am start -W --user " + mUserId + " " + MANAGED_PROFILE_PKG
+ + "/.PrimaryUserFilterSetterActivity";
+ CLog.logAndDisplay(LogLevel.INFO, "Output for command " + command + ": "
+ + getDevice().executeShellCommand(command));
+ assertTrue(runDeviceTests(MANAGED_PROFILE_PKG, MANAGED_PROFILE_PKG + ".PrimaryUserTest"));
+ // TODO: Test with startActivity
+ // TODO: Test with CtsVerifier for disambiguation cases
+ }
public void testCrossProfileContent() throws Exception {
if (!mHasFeature) {
@@ -128,8 +126,10 @@
private void disableActivityForUser(String activityName, int userId)
throws DeviceNotAvailableException {
- String command = "pm disable --user " + userId + " " + MANAGED_PROFILE_PKG + "/."
- + activityName;
+ String command = "am start -W --user " + userId
+ + " --es extra-package " + MANAGED_PROFILE_PKG
+ + " --es extra-class-name " + MANAGED_PROFILE_PKG + "." + activityName + " "
+ + MANAGED_PROFILE_PKG + "/.ComponentDisablingActivity ";
CLog.logAndDisplay(LogLevel.INFO, "Output for command " + command + ": "
+ getDevice().executeShellCommand(command));
}
diff --git a/tests/SignatureTest/src/android/tests/sigtest/SignatureTestLog.java b/tests/SignatureTest/src/android/tests/sigtest/SignatureTestLog.java
deleted file mode 100644
index 7cd9663..0000000
--- a/tests/SignatureTest/src/android/tests/sigtest/SignatureTestLog.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2008 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 android.tests.sigtest;
-
-import android.util.Log;
-
-public class SignatureTestLog {
- private static final String TAG = "CTSSignatureTest";
-
- public static void e(String msg, Exception e) {
- Log.e(TAG, msg, e);
- }
-
- public static void d(String msg) {
- Log.d(TAG, msg);
- }
-}
diff --git a/tests/SignatureTest/tests/Android.mk b/tests/SignatureTest/tests/Android.mk
deleted file mode 100644
index 0796670..0000000
--- a/tests/SignatureTest/tests/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := SignatureTestTests
-
-LOCAL_INSTRUMENTATION_FOR := SignatureTest
-
-LOCAL_PROGUARD_FLAGS := -ignorewarnings
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
-
-include $(BUILD_PACKAGE)
diff --git a/tests/SignatureTest/tests/AndroidManifest.xml b/tests/SignatureTest/tests/AndroidManifest.xml
deleted file mode 100644
index 49b3827..0000000
--- a/tests/SignatureTest/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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="android.tests.sigtest.tests">
-
- <application>
- <uses-library android:name="android.test.runner"/>
- </application>
-
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
- android:targetPackage="android.tests.sigtest"
- android:label="SignatureTest Functional Testset"/>
-
-</manifest>
diff --git a/tests/core/ctscore.mk b/tests/core/ctscore.mk
index 95f4634..fea0b07 100644
--- a/tests/core/ctscore.mk
+++ b/tests/core/ctscore.mk
@@ -25,4 +25,8 @@
LOCAL_JNI_SHARED_LIBRARIES := libjavacoretests
+# Include both the 32 and 64 bit versions of libjavacoretests,
+# where applicable.
+LOCAL_MULTILIB := both
+
include $(BUILD_PACKAGE)
diff --git a/tests/signature-tests/Android.mk b/tests/signature-tests/Android.mk
new file mode 100644
index 0000000..f17ee47
--- /dev/null
+++ b/tests/signature-tests/Android.mk
@@ -0,0 +1,26 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# Include all test java files.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_MODULE := signature-tests
+LOCAL_MODULE_TAGS := optional
+LOCAL_JAVA_LIBRARIES := tradefed-prebuilt cts-tradefed signature-hostside
+
+include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/tests/signature-tests/run_unit_tests.sh b/tests/signature-tests/run_unit_tests.sh
new file mode 100755
index 0000000..19ce8d2
--- /dev/null
+++ b/tests/signature-tests/run_unit_tests.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# 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.
+
+# helper script for running the signature unit tests
+
+checkFile() {
+ if [ ! -f "$1" ]; then
+ echo "Unable to locate $1"
+ exit
+ fi;
+}
+
+# check if in Android build env
+if [ ! -z ${ANDROID_BUILD_TOP} ]; then
+ HOST=`uname`
+ if [ "$HOST" == "Linux" ]; then
+ OS="linux-x86"
+ elif [ "$HOST" == "Darwin" ]; then
+ OS="darwin-x86"
+ else
+ echo "Unrecognized OS"
+ exit
+ fi;
+fi;
+
+JAR_DIR=${ANDROID_BUILD_TOP}/out/host/$OS/framework
+JARS="tradefed-prebuilt.jar hosttestlib.jar signature-hostside.jar signature-tests.jar"
+
+for JAR in $JARS; do
+ checkFile ${JAR_DIR}/${JAR}
+ JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}
+done
+
+java $RDBG_FLAG \
+ -cp ${JAR_PATH} com.android.tradefed.command.Console run singleCommand host -n --class android.signature.cts.tests.AllTests "$@"
+
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/AllTests.java b/tests/signature-tests/src/android/signature/cts/tests/AllTests.java
similarity index 70%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/AllTests.java
rename to tests/signature-tests/src/android/signature/cts/tests/AllTests.java
index 096cb02..56916f4 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/AllTests.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/AllTests.java
@@ -14,18 +14,23 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests;
+package android.signature.cts.tests;
-import android.test.TestSuiteProvider;
-import android.test.suitebuilder.TestSuiteBuilder;
-
+import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Finds all instrumentation and unit tests for this application.
*/
-public class AllTests implements TestSuiteProvider {
- public TestSuite getTestSuite() {
- return new TestSuiteBuilder(getClass()).includeAllPackagesUnderHere().build();
+public class AllTests extends TestSuite {
+
+ public AllTests() {
+ super();
+
+ addTestSuite(JDiffClassDescriptionTest.class);
+ }
+
+ public static Test suite() {
+ return new AllTests();
}
}
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/JDiffClassDescriptionTest.java b/tests/signature-tests/src/android/signature/cts/tests/JDiffClassDescriptionTest.java
similarity index 61%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/JDiffClassDescriptionTest.java
rename to tests/signature-tests/src/android/signature/cts/tests/JDiffClassDescriptionTest.java
index b5bf49e..ffb81ce 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/JDiffClassDescriptionTest.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/JDiffClassDescriptionTest.java
@@ -14,48 +14,53 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests;
+package android.signature.cts.tests;
-import android.test.InstrumentationTestCase;
-import android.tests.sigtest.JDiffClassDescription;
-import android.tests.sigtest.ResultObserver;
-import android.tests.sigtest.SignatureTest.FAILURE_TYPE;
+import android.signature.cts.FailureType;
+import android.signature.cts.JDiffClassDescription;
+import android.signature.cts.ResultObserver;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
import java.lang.reflect.Modifier;
/**
* Test class for JDiffClassDescription.
*/
-public class JDiffClassDescriptionTest extends InstrumentationTestCase {
+public class JDiffClassDescriptionTest extends TestCase {
+
private class NoFailures implements ResultObserver {
- public void notifyFailure(FAILURE_TYPE type, String name, String errmsg) {
- JDiffClassDescriptionTest.this.fail("Saw unexpected test failure: " + name + " failure type: " + type);
+ @Override
+ public void notifyFailure(FailureType type, String name, String errmsg) {
+ Assert.fail("Saw unexpected test failure: " + name + " failure type: " + type);
}
}
private class ExpectFailure implements ResultObserver {
- private FAILURE_TYPE expectedType;
+ private FailureType expectedType;
private boolean failureSeen;
- public ExpectFailure(FAILURE_TYPE expectedType) {
+ public ExpectFailure(FailureType expectedType) {
this.expectedType = expectedType;
}
- public void notifyFailure(FAILURE_TYPE type, String name, String errMsg) {
+ @Override
+ public void notifyFailure(FailureType type, String name, String errMsg) {
if (type == expectedType) {
if (failureSeen) {
- JDiffClassDescriptionTest.this.fail("Saw second test failure: " + name + " failure type: " + type);
+ Assert.fail("Saw second test failure: " + name + " failure type: " + type);
} else {
// We've seen the error, mark it and keep going
failureSeen = true;
}
} else {
- JDiffClassDescriptionTest.this.fail("Saw unexpected test failure: " + name + " failure type: " + type);
+ Assert.fail("Saw unexpected test failure: " + name + " failure type: " + type);
}
}
-
+
public void validate() {
- JDiffClassDescriptionTest.this.assertTrue(failureSeen);
+ Assert.assertTrue(failureSeen);
}
}
@@ -74,24 +79,23 @@
* @return the new JDiffClassDescription
*/
private JDiffClassDescription createNormalClass(ResultObserver observer) {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalClass", observer);
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass", observer);
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
return clz;
- }
+ }
public void testNormalClassCompliance() {
JDiffClassDescription clz = createNormalClass();
clz.checkSignatureCompliance();
- assertEquals(clz.toSignatureString(),
- "public class NormalClass");
+ assertEquals(clz.toSignatureString(), "public class NormalClass");
}
public void testMissingClass() {
- ExpectFailure observer = new ExpectFailure(FAILURE_TYPE.MISSING_CLASS);
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data",
- "NoSuchClass",
- observer);
+ ExpectFailure observer = new ExpectFailure(FailureType.MISSING_CLASS);
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NoSuchClass", observer);
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.checkSignatureCompliance();
observer.validate();
@@ -99,88 +103,110 @@
public void testSimpleConstructor() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffConstructor constructor = new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PUBLIC);
+ JDiffClassDescription.JDiffConstructor constructor =
+ new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PUBLIC);
clz.addConstructor(constructor);
clz.checkSignatureCompliance();
assertEquals(constructor.toSignatureString(), "public NormalClass()");
}
+
public void testOneArgConstructor() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffConstructor constructor = new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PRIVATE);
+ JDiffClassDescription.JDiffConstructor constructor =
+ new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PRIVATE);
constructor.addParam("java.lang.String");
clz.addConstructor(constructor);
clz.checkSignatureCompliance();
assertEquals(constructor.toSignatureString(), "private NormalClass(java.lang.String)");
}
+
public void testConstructorThrowsException() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffConstructor constructor = new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PROTECTED);
+ JDiffClassDescription.JDiffConstructor constructor =
+ new JDiffClassDescription.JDiffConstructor("NormalClass", Modifier.PROTECTED);
constructor.addParam("java.lang.String");
constructor.addParam("java.lang.String");
- constructor.addException("android.tests.sigtest.tests.data.NormalException");
+ constructor.addException("android.signature.cts.tests.data.NormalException");
clz.addConstructor(constructor);
clz.checkSignatureCompliance();
- assertEquals(constructor.toSignatureString(), "protected NormalClass(java.lang.String, " +
- "java.lang.String) throws android.tests.sigtest.tests.data.NormalException");
+ assertEquals(constructor.toSignatureString(),
+ "protected NormalClass(java.lang.String, java.lang.String) " +
+ "throws android.signature.cts.tests.data.NormalException");
}
+
public void testPackageProtectedConstructor() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffConstructor constructor = new JDiffClassDescription.JDiffConstructor("NormalClass", 0);
+ JDiffClassDescription.JDiffConstructor constructor =
+ new JDiffClassDescription.JDiffConstructor("NormalClass", 0);
constructor.addParam("java.lang.String");
constructor.addParam("java.lang.String");
constructor.addParam("java.lang.String");
clz.addConstructor(constructor);
clz.checkSignatureCompliance();
- assertEquals(constructor.toSignatureString(), "NormalClass(java.lang.String, java.lang.String, java.lang.String)");
+ assertEquals(constructor.toSignatureString(),
+ "NormalClass(java.lang.String, java.lang.String, java.lang.String)");
}
public void testStaticMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("staticMethod", Modifier.STATIC | Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "staticMethod", Modifier.STATIC | Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "public static void staticMethod()");
}
+
public void testSyncMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("syncMethod", Modifier.SYNCHRONIZED | Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "syncMethod", Modifier.SYNCHRONIZED | Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "public synchronized void syncMethod()");
}
+
public void testPackageProtectMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("packageProtectedMethod", 0, "boolean");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "packageProtectedMethod", 0, "boolean");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "boolean packageProtectedMethod()");
}
+
public void testPrivateMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("privateMethod", Modifier.PRIVATE, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "privateMethod", Modifier.PRIVATE, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "private void privateMethod()");
}
+
public void testProtectedMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("protectedMethod", Modifier.PROTECTED, "java.lang.String");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "protectedMethod", Modifier.PROTECTED, "java.lang.String");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "protected java.lang.String protectedMethod()");
}
+
public void testThrowsMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("throwsMethod", Modifier.PUBLIC, "void");
- method.addException("android.tests.sigtest.tests.data.NormalException");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "throwsMethod", Modifier.PUBLIC, "void");
+ method.addException("android.signature.cts.tests.data.NormalException");
clz.addMethod(method);
clz.checkSignatureCompliance();
- assertEquals(method.toSignatureString(), "public void throwsMethod() throws" +
- " android.tests.sigtest.tests.data.NormalException");
+ assertEquals(method.toSignatureString(), "public void throwsMethod() " +
+ "throws android.signature.cts.tests.data.NormalException");
}
+
public void testNativeMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("nativeMethod", Modifier.PUBLIC | Modifier.NATIVE, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "nativeMethod", Modifier.PUBLIC | Modifier.NATIVE, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "public native void nativeMethod()");
@@ -188,207 +214,259 @@
public void testFinalField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("FINAL_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.FINAL);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "FINAL_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.FINAL);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "public final java.lang.String FINAL_FIELD");
}
+
public void testStaticField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("STATIC_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.STATIC);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "STATIC_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.STATIC);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "public static java.lang.String STATIC_FIELD");
}
+
public void testVolatileFiled() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("VOLATILE_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.VOLATILE);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "VOLATILE_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.VOLATILE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "public volatile java.lang.String VOLATILE_FIELD");
}
+
public void testTransientField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("TRANSIENT_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.TRANSIENT);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "TRANSIENT_FIELD", "java.lang.String", Modifier.PUBLIC | Modifier.TRANSIENT);
clz.addField(field);
clz.checkSignatureCompliance();
- assertEquals(field.toSignatureString(), "public transient java.lang.String TRANSIENT_FIELD");
+ assertEquals(field.toSignatureString(),
+ "public transient java.lang.String TRANSIENT_FIELD");
}
+
public void testPacakgeField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("PACAKGE_FIELD", "java.lang.String", 0);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "PACAKGE_FIELD", "java.lang.String", 0);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "java.lang.String PACAKGE_FIELD");
}
+
public void testPrivateField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("PRIVATE_FIELD", "java.lang.String", Modifier.PRIVATE);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "PRIVATE_FIELD", "java.lang.String", Modifier.PRIVATE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "private java.lang.String PRIVATE_FIELD");
}
+
public void testProtectedField() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("PROTECTED_FIELD", "java.lang.String", Modifier.PROTECTED);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "PROTECTED_FIELD", "java.lang.String", Modifier.PROTECTED);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(field.toSignatureString(), "protected java.lang.String PROTECTED_FIELD");
}
public void testInnerClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalClass.InnerClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass.InnerClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("innerClassData", "java.lang.String", Modifier.PRIVATE);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "innerClassData", "java.lang.String", Modifier.PRIVATE);
clz.addField(field);
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(), "public class NormalClass.InnerClass");
}
+
public void testInnerInnerClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalClass.InnerClass.InnerInnerClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass.InnerClass.InnerInnerClass",
+ new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
- JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField("innerInnerClassData", "java.lang.String", Modifier.PRIVATE);
+ JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+ "innerInnerClassData", "java.lang.String", Modifier.PRIVATE);
clz.addField(field);
clz.checkSignatureCompliance();
- assertEquals(clz.toSignatureString(), "public class NormalClass.InnerClass.InnerInnerClass");
+ assertEquals(clz.toSignatureString(),
+ "public class NormalClass.InnerClass.InnerInnerClass");
}
+
public void testInnerInterface() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalClass.InnerInterface", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass.InnerInterface", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.INTERFACE);
clz.setModifier(Modifier.PUBLIC | Modifier.STATIC | Modifier.ABSTRACT);
- clz.addMethod(new JDiffClassDescription.JDiffMethod("doSomething", Modifier.PUBLIC, "void"));
+ clz.addMethod(
+ new JDiffClassDescription.JDiffMethod("doSomething", Modifier.PUBLIC, "void"));
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(), "public interface NormalClass.InnerInterface");
}
+
public void testInterface() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalInterface", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalInterface", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.INTERFACE);
clz.setModifier(Modifier.PUBLIC | Modifier.ABSTRACT);
- clz.addMethod(new JDiffClassDescription.JDiffMethod("doSomething", Modifier.PUBLIC, "void"));
+ clz.addMethod(
+ new JDiffClassDescription.JDiffMethod("doSomething", Modifier.PUBLIC, "void"));
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(), "public interface NormalInterface");
}
+
public void testFinalClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "FinalClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "FinalClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC | Modifier.FINAL);
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(), "public final class FinalClass");
}
- /** Test the case where the API declares the method not
- * synchronized, but it actually is. */
+
+ /**
+ * Test the case where the API declares the method not synchronized, but it
+ * actually is.
+ */
public void testAddingSync() {
- ExpectFailure observer = new ExpectFailure(FAILURE_TYPE.MISMATCH_METHOD);
+ ExpectFailure observer = new ExpectFailure(FailureType.MISMATCH_METHOD);
JDiffClassDescription clz = createNormalClass(observer);
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("syncMethod", Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "syncMethod", Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
observer.validate();
}
- /** Test the case where the API declares the method is
- * synchronized, but it actually is not. */
+
+ /**
+ * Test the case where the API declares the method is synchronized, but it
+ * actually is not.
+ */
public void testRemovingSync() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("notSyncMethod", Modifier.SYNCHRONIZED | Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "notSyncMethod", Modifier.SYNCHRONIZED | Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
}
- /** API says method is not native, but it actually is.
- * http://b/1839558
+
+ /**
+ * API says method is not native, but it actually is. http://b/1839558
*/
public void testAddingNative() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("nativeMethod", Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "nativeMethod", Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
}
- /** API says method is native, but actually isn't.
- * http://b/1839558
+
+ /**
+ * API says method is native, but actually isn't. http://b/1839558
*/
public void testRemovingNative() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("notNativeMethod", Modifier.NATIVE | Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "notNativeMethod", Modifier.NATIVE | Modifier.PUBLIC, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
}
+
public void testAbstractClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "AbstractClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "AbstractClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC | Modifier.ABSTRACT);
clz.checkSignatureCompliance();
assertEquals(clz.toSignatureString(), "public abstract class AbstractClass");
}
- /** API lists class as abstract, reflection does not.
- * http://b/1839622
+
+ /**
+ * API lists class as abstract, reflection does not. http://b/1839622
*/
public void testRemovingAbstractFromAClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "NormalClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC | Modifier.ABSTRACT);
clz.checkSignatureCompliance();
}
- /** reflection lists class as abstract, api does not.
- * http://b/1839622
+
+ /**
+ * reflection lists class as abstract, api does not. http://b/1839622
*/
public void testAddingAbstractToAClass() {
- ExpectFailure observer = new ExpectFailure(FAILURE_TYPE.MISMATCH_CLASS);
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data",
- "AbstractClass",
- observer);
+ ExpectFailure observer = new ExpectFailure(FailureType.MISMATCH_CLASS);
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "AbstractClass", observer);
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
clz.checkSignatureCompliance();
observer.validate();
}
+
public void testFinalMethod() {
JDiffClassDescription clz = createNormalClass();
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("finalMethod", Modifier.PUBLIC | Modifier.FINAL, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "finalMethod", Modifier.PUBLIC | Modifier.FINAL, "void");
clz.addMethod(method);
clz.checkSignatureCompliance();
assertEquals(method.toSignatureString(), "public final void finalMethod()");
}
+
/**
* Final Class, API lists methods as non-final, reflection has it as final.
* http://b/1839589
*/
public void testAddingFinalToAMethodInAFinalClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "FinalClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "FinalClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC | Modifier.FINAL);
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("finalMethod", Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "finalMethod", Modifier.PUBLIC, "void");
clz.addMethod(method);
- clz.checkSignatureCompliance();
+ clz.checkSignatureCompliance();
}
+
/**
* Final Class, API lists methods as final, reflection has it as non-final.
* http://b/1839589
*/
public void testRemovingFinalToAMethodInAFinalClass() {
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data", "FinalClass", new NoFailures());
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "FinalClass", new NoFailures());
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC | Modifier.FINAL);
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("nonFinalMethod",
- Modifier.PUBLIC | Modifier.FINAL,
- "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "nonFinalMethod", Modifier.PUBLIC | Modifier.FINAL, "void");
clz.addMethod(method);
- clz.checkSignatureCompliance();
+ clz.checkSignatureCompliance();
}
+
/**
- * non-final Class, API lists methods as non-final, reflection has it as final.
- * http://b/1839589
- */
+ * non-final Class, API lists methods as non-final, reflection has it as
+ * final. http://b/1839589
+ */
public void testAddingFinalToAMethodInANonFinalClass() {
- ExpectFailure observer = new ExpectFailure(FAILURE_TYPE.MISMATCH_METHOD);
- JDiffClassDescription clz = new JDiffClassDescription("android.tests.sigtest.tests.data",
- "NormalClass",
- observer);
+ ExpectFailure observer = new ExpectFailure(FailureType.MISMATCH_METHOD);
+ JDiffClassDescription clz = new JDiffClassDescription(
+ "android.signature.cts.tests.data", "NormalClass", observer);
clz.setType(JDiffClassDescription.JDiffType.CLASS);
clz.setModifier(Modifier.PUBLIC);
- JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod("finalMethod", Modifier.PUBLIC, "void");
+ JDiffClassDescription.JDiffMethod method = new JDiffClassDescription.JDiffMethod(
+ "finalMethod", Modifier.PUBLIC, "void");
clz.addMethod(method);
- clz.checkSignatureCompliance();
+ clz.checkSignatureCompliance();
observer.validate();
}
}
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/AbstractClass.java b/tests/signature-tests/src/android/signature/cts/tests/data/AbstractClass.java
similarity index 94%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/AbstractClass.java
rename to tests/signature-tests/src/android/signature/cts/tests/data/AbstractClass.java
index d24d691..527e7eb 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/AbstractClass.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/data/AbstractClass.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests.data;
+package android.signature.cts.tests.data;
/**
* This class is used as reference data for the JDiffClassDescriptionTest tests.
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/FinalClass.java b/tests/signature-tests/src/android/signature/cts/tests/data/FinalClass.java
similarity index 95%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/FinalClass.java
rename to tests/signature-tests/src/android/signature/cts/tests/data/FinalClass.java
index 4c871f0..395e166 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/FinalClass.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/data/FinalClass.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests.data;
+package android.signature.cts.tests.data;
/**
* This class is used as reference data for the
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalClass.java b/tests/signature-tests/src/android/signature/cts/tests/data/NormalClass.java
similarity index 97%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalClass.java
rename to tests/signature-tests/src/android/signature/cts/tests/data/NormalClass.java
index 9cd54ab..5acd696 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalClass.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/data/NormalClass.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests.data;
+package android.signature.cts.tests.data;
/**
* This class is used as reference data for the
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalException.java b/tests/signature-tests/src/android/signature/cts/tests/data/NormalException.java
similarity index 94%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalException.java
rename to tests/signature-tests/src/android/signature/cts/tests/data/NormalException.java
index cc3d725..b2dd52d 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalException.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/data/NormalException.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests.data;
+package android.signature.cts.tests.data;
import java.lang.Exception;
diff --git a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalInterface.java b/tests/signature-tests/src/android/signature/cts/tests/data/NormalInterface.java
similarity index 95%
rename from tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalInterface.java
rename to tests/signature-tests/src/android/signature/cts/tests/data/NormalInterface.java
index 3200b76..899f4cc 100644
--- a/tests/SignatureTest/tests/src/android/tests/sigtest/tests/data/NormalInterface.java
+++ b/tests/signature-tests/src/android/signature/cts/tests/data/NormalInterface.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest.tests.data;
+package android.signature.cts.tests.data;
/**
* This class is used as reference data for the
diff --git a/tests/SignatureTest/Android.mk b/tests/signature/Android.mk
similarity index 84%
rename from tests/SignatureTest/Android.mk
rename to tests/signature/Android.mk
index fc794e8..53ba50d 100644
--- a/tests/SignatureTest/Android.mk
+++ b/tests/signature/Android.mk
@@ -20,11 +20,11 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_PACKAGE_NAME := SignatureTest
+LOCAL_PACKAGE_NAME := CtsSignatureTestCases
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
# To be passed in on command line
CTS_API_VERSION ?= current
@@ -84,5 +84,18 @@
android_api_description :=
CTS_API_VERSION :=
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
+# signature-hostside java library (for testing)
+# ============================================================
+
+include $(CLEAR_VARS)
+
+# These files are for device-side only, so filter-out for host library
+LOCAL_DEVICE_ONLY_SOURCES := %/SignatureTest.java
+
+LOCAL_SRC_FILES := $(filter-out $(LOCAL_DEVICE_ONLY_SOURCES), $(call all-java-files-under, src))
+
+LOCAL_MODULE := signature-hostside
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_HOST_JAVA_LIBRARY)
\ No newline at end of file
diff --git a/tests/SignatureTest/AndroidManifest.xml b/tests/signature/AndroidManifest.xml
similarity index 90%
rename from tests/SignatureTest/AndroidManifest.xml
rename to tests/signature/AndroidManifest.xml
index 89d8590..e42302e 100644
--- a/tests/SignatureTest/AndroidManifest.xml
+++ b/tests/signature/AndroidManifest.xml
@@ -16,7 +16,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="android.tests.sigtest">
+ package="android.signature">
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<application>
@@ -24,7 +24,7 @@
</application>
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
- android:targetPackage="android.tests.sigtest"
+ android:targetPackage="android.signature"
android:label="API Signature Test"/>
</manifest>
\ No newline at end of file
diff --git a/tests/SignatureTest/res/raw/excludepackages.txt b/tests/signature/res/raw/excludepackages.txt
similarity index 100%
rename from tests/SignatureTest/res/raw/excludepackages.txt
rename to tests/signature/res/raw/excludepackages.txt
diff --git a/tests/signature/src/android/signature/cts/FailureType.java b/tests/signature/src/android/signature/cts/FailureType.java
new file mode 100644
index 0000000..5aaebc4
--- /dev/null
+++ b/tests/signature/src/android/signature/cts/FailureType.java
@@ -0,0 +1,16 @@
+package android.signature.cts;
+
+/**
+ * Define the type of the signature check failures.
+ */
+public enum FailureType {
+ MISSING_CLASS,
+ MISSING_INTERFACE,
+ MISSING_METHOD,
+ MISSING_FIELD,
+ MISMATCH_CLASS,
+ MISMATCH_INTERFACE,
+ MISMATCH_METHOD,
+ MISMATCH_FIELD,
+ CAUGHT_EXCEPTION,
+}
diff --git a/tests/SignatureTest/src/android/tests/sigtest/JDiffClassDescription.java b/tests/signature/src/android/signature/cts/JDiffClassDescription.java
similarity index 94%
rename from tests/SignatureTest/src/android/tests/sigtest/JDiffClassDescription.java
rename to tests/signature/src/android/signature/cts/JDiffClassDescription.java
index 36360d6..7ea9911 100644
--- a/tests/SignatureTest/src/android/tests/sigtest/JDiffClassDescription.java
+++ b/tests/signature/src/android/signature/cts/JDiffClassDescription.java
@@ -14,9 +14,7 @@
* limitations under the License.
*/
-package android.tests.sigtest;
-
-import android.tests.sigtest.SignatureTest.FAILURE_TYPE;
+package android.signature.cts;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@@ -83,9 +81,8 @@
*/
public JDiffClassDescription(String pkg, String className) {
this(pkg, className, new ResultObserver() {
- public void notifyFailure(FAILURE_TYPE type,
- String name,
- String errorMessage) {
+ @Override
+ public void notifyFailure(FailureType type, String name, String errorMessage) {
// This is a null result observer that doesn't do anything.
}
});
@@ -99,9 +96,7 @@
* @param className the name of the class.
* @param resultObserver the resultObserver to get results with.
*/
- public JDiffClassDescription(String pkg,
- String className,
- ResultObserver resultObserver) {
+ public JDiffClassDescription(String pkg, String className, ResultObserver resultObserver) {
mPackageName = pkg;
mShortClassName = className;
mResultObserver = resultObserver;
@@ -144,7 +139,6 @@
}
static String convertModifiersToAccessLevel(int modifiers) {
- String accessLevel = "";
if ((modifiers & Modifier.PUBLIC) != 0) {
return "public";
} else if ((modifiers & Modifier.PRIVATE) != 0) {
@@ -500,7 +494,7 @@
Method m = findMatchingMethod(method);
if (m == null) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISSING_METHOD,
+ mResultObserver.notifyFailure(FailureType.MISSING_METHOD,
method.toReadableString(mAbsoluteClassName),
"No method with correct signature found:" +
method.toSignatureString());
@@ -521,15 +515,15 @@
}
if (!areMethodModifiedCompatibile(method, m)) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISMATCH_METHOD,
+ mResultObserver.notifyFailure(FailureType.MISMATCH_METHOD,
method.toReadableString(mAbsoluteClassName),
"Non-compatible method found when looking for " +
method.toSignatureString());
}
}
} catch (Exception e) {
- SignatureTestLog.e("Got exception when checking method compliance", e);
- mResultObserver.notifyFailure(FAILURE_TYPE.CAUGHT_EXCEPTION,
+ loge("Got exception when checking method compliance", e);
+ mResultObserver.notifyFailure(FailureType.CAUGHT_EXCEPTION,
method.toReadableString(mAbsoluteClassName),
"Exception!");
}
@@ -583,7 +577,6 @@
@SuppressWarnings("unchecked")
private Method findMatchingMethod(JDiffMethod method) {
Method[] methods = mClass.getDeclaredMethods();
- boolean found = false;
for (Method m : methods) {
if (matches(method, m)) {
@@ -637,7 +630,7 @@
try {
Constructor<?> c = findMatchingConstructor(con);
if (c == null) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISSING_METHOD,
+ mResultObserver.notifyFailure(FailureType.MISSING_METHOD,
con.toReadableString(mAbsoluteClassName),
"No method with correct signature found:" +
con.toSignatureString());
@@ -647,15 +640,15 @@
}
if (c.getModifiers() != con.mModifier) {
mResultObserver.notifyFailure(
- FAILURE_TYPE.MISMATCH_METHOD,
+ FailureType.MISMATCH_METHOD,
con.toReadableString(mAbsoluteClassName),
"Non-compatible method found when looking for " +
con.toSignatureString());
}
}
} catch (Exception e) {
- SignatureTestLog.e("Got exception when checking constructor compliance", e);
- mResultObserver.notifyFailure(FAILURE_TYPE.CAUGHT_EXCEPTION,
+ loge("Got exception when checking constructor compliance", e);
+ mResultObserver.notifyFailure(FailureType.CAUGHT_EXCEPTION,
con.toReadableString(mAbsoluteClassName),
"Exception!");
}
@@ -716,12 +709,12 @@
try {
Field f = findMatchingField(field);
if (f == null) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISSING_FIELD,
+ mResultObserver.notifyFailure(FailureType.MISSING_FIELD,
field.toReadableString(mAbsoluteClassName),
"No field with correct signature found:" +
field.toSignatureString());
} else if (f.getModifiers() != field.mModifier) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISMATCH_FIELD,
+ mResultObserver.notifyFailure(FailureType.MISMATCH_FIELD,
field.toReadableString(mAbsoluteClassName),
"Non-compatible field modifiers found when looking for " +
field.toSignatureString());
@@ -735,7 +728,7 @@
}
if (genericTypeName == null || !genericTypeName.equals(field.mFieldType)) {
mResultObserver.notifyFailure(
- FAILURE_TYPE.MISMATCH_FIELD,
+ FailureType.MISMATCH_FIELD,
field.toReadableString(mAbsoluteClassName),
"Non-compatible field type found when looking for " +
field.toSignatureString());
@@ -743,10 +736,11 @@
}
} catch (Exception e) {
- SignatureTestLog.e("Got exception when checking field compliance", e);
- mResultObserver.notifyFailure(FAILURE_TYPE.CAUGHT_EXCEPTION,
+ loge("Got exception when checking field compliance", e);
+ mResultObserver.notifyFailure(
+ FailureType.CAUGHT_EXCEPTION,
field.toReadableString(mAbsoluteClassName),
- "Exception!");
+ "Exception!");
}
}
}
@@ -880,11 +874,11 @@
if (mClass == null) {
// No class found, notify the observer according to the class type
if (JDiffType.INTERFACE.equals(mClassType)) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISSING_INTERFACE,
+ mResultObserver.notifyFailure(FailureType.MISSING_INTERFACE,
mAbsoluteClassName,
"Classloader is unable to find " + mAbsoluteClassName);
} else {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISSING_CLASS,
+ mResultObserver.notifyFailure(FailureType.MISSING_CLASS,
mAbsoluteClassName,
"Classloader is unable to find " + mAbsoluteClassName);
}
@@ -920,10 +914,11 @@
}
}
} catch (Exception e) {
- SignatureTestLog.e("Got exception when checking field compliance", e);
- mResultObserver.notifyFailure(FAILURE_TYPE.CAUGHT_EXCEPTION,
+ loge("Got exception when checking field compliance", e);
+ mResultObserver.notifyFailure(
+ FailureType.CAUGHT_EXCEPTION,
mAbsoluteClassName,
- "Exception!");
+ "Exception!");
}
}
@@ -974,11 +969,11 @@
private void logMismatchInterfaceSignature(String classFullName, String errorMessage) {
if (JDiffType.INTERFACE.equals(mClassType)) {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISMATCH_INTERFACE,
+ mResultObserver.notifyFailure(FailureType.MISMATCH_INTERFACE,
classFullName,
errorMessage);
} else {
- mResultObserver.notifyFailure(FAILURE_TYPE.MISMATCH_CLASS,
+ mResultObserver.notifyFailure(FailureType.MISMATCH_CLASS,
classFullName,
errorMessage);
}
@@ -1026,7 +1021,7 @@
}
}
} catch (ClassNotFoundException e) {
- SignatureTestLog.e("ClassNotFoundException for " + mPackageName + "." + mShortClassName, e);
+ loge("ClassNotFoundException for " + mPackageName + "." + mShortClassName, e);
return null;
}
return null;
@@ -1195,4 +1190,8 @@
// canonicalize them to one form.
return paramType.replace("<? extends java.lang.Object>", "<?>");
}
+
+ private static void loge(String message, Exception exception) {
+ System.err.println(String.format("%s: %s", message, exception));
+ }
}
diff --git a/tests/SignatureTest/src/android/tests/sigtest/ResultObserver.java b/tests/signature/src/android/signature/cts/ResultObserver.java
similarity index 81%
rename from tests/SignatureTest/src/android/tests/sigtest/ResultObserver.java
rename to tests/signature/src/android/signature/cts/ResultObserver.java
index e9d2260..33234e9 100644
--- a/tests/SignatureTest/src/android/tests/sigtest/ResultObserver.java
+++ b/tests/signature/src/android/signature/cts/ResultObserver.java
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-package android.tests.sigtest;
+package android.signature.cts;
-import android.tests.sigtest.SignatureTest.FAILURE_TYPE;
/**
* Interface for saving signature test result.
*/
@@ -27,8 +26,6 @@
* @param name Name of the failed element (interface/class/method/field)
* @param errorMessage a descriptive message indicating why it failed.
*/
- void notifyFailure(FAILURE_TYPE type,
- String name,
- String errorMessage);
+ void notifyFailure(FailureType type, String name, String errorMessage);
}
diff --git a/tests/SignatureTest/src/android/tests/sigtest/SignatureTest.java b/tests/signature/src/android/signature/cts/SignatureTest.java
similarity index 91%
rename from tests/SignatureTest/src/android/tests/sigtest/SignatureTest.java
rename to tests/signature/src/android/signature/cts/SignatureTest.java
index 8ae02ac..e3099a9 100644
--- a/tests/SignatureTest/src/android/tests/sigtest/SignatureTest.java
+++ b/tests/signature/src/android/signature/cts/SignatureTest.java
@@ -14,13 +14,15 @@
* limitations under the License.
*/
-package android.tests.sigtest;
+package android.signature.cts;
import android.content.res.Resources;
+import android.signature.R;
+import android.signature.cts.JDiffClassDescription.JDiffConstructor;
+import android.signature.cts.JDiffClassDescription.JDiffField;
+import android.signature.cts.JDiffClassDescription.JDiffMethod;
import android.test.AndroidTestCase;
-import android.tests.sigtest.JDiffClassDescription.JDiffConstructor;
-import android.tests.sigtest.JDiffClassDescription.JDiffField;
-import android.tests.sigtest.JDiffClassDescription.JDiffMethod;
+import android.util.Log;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -37,6 +39,8 @@
*/
public class SignatureTest extends AndroidTestCase {
+ private static final String TAG = SignatureTest.class.getSimpleName();
+
private static final String TAG_ROOT = "api";
private static final String TAG_PACKAGE = "package";
private static final String TAG_CLASS = "class";
@@ -70,26 +74,12 @@
private HashSet<String> mKeyTagSet;
private TestResultObserver mResultObserver;
- /**
- * Define the type of the signature check failures.
- */
- public static enum FAILURE_TYPE {
- MISSING_CLASS,
- MISSING_INTERFACE,
- MISSING_METHOD,
- MISSING_FIELD,
- MISMATCH_CLASS,
- MISMATCH_INTERFACE,
- MISMATCH_METHOD,
- MISMATCH_FIELD,
- CAUGHT_EXCEPTION,
- }
-
private class TestResultObserver implements ResultObserver {
boolean mDidFail = false;
StringBuilder mErrorString = new StringBuilder();
- public void notifyFailure(FAILURE_TYPE type, String name, String errorMessage) {
+ @Override
+ public void notifyFailure(FailureType type, String name, String errorMessage) {
mDidFail = true;
mErrorString.append("\n");
mErrorString.append(type.toString().toLowerCase());
@@ -116,12 +106,14 @@
public void testSignature() {
Resources r = getContext().getResources();
Class rClass = R.xml.class;
+ logd(String.format("Class: %s", rClass.toString()));
Field[] fs = rClass.getFields();
for (Field f : fs) {
+ logd(String.format("Field: %s", fs.toString()));
try {
start(r.getXml(f.getInt(rClass)));
} catch (Exception e) {
- mResultObserver.notifyFailure(FAILURE_TYPE.CAUGHT_EXCEPTION, e.getMessage(),
+ mResultObserver.notifyFailure(FailureType.CAUGHT_EXCEPTION, e.getMessage(),
e.getMessage());
}
}
@@ -150,6 +142,11 @@
* Signature test entry point.
*/
private void start(XmlPullParser parser) throws XmlPullParserException, IOException {
+ logd(String.format("Parser: %s", parser.getName()));
+ logd(String.format("Parser: %s", parser.getNamespace()));
+ logd(String.format("Parser: %s", parser.getLineNumber()));
+ logd(String.format("Parser: %s", parser.getColumnNumber()));
+ logd(String.format("Parser: %s", parser.getPositionDescription()));
JDiffClassDescription currentClass = null;
String currentPackage = "";
JDiffMethod currentMethod = null;
@@ -332,4 +329,12 @@
}
return modifier;
}
+
+ public static void loge(String msg, Exception e) {
+ Log.e(TAG, msg, e);
+ }
+
+ public static void logd(String msg) {
+ Log.d(TAG, msg);
+ }
}
diff --git a/tests/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java b/tests/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
index 408efe7..7d3fc5e 100644
--- a/tests/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
+++ b/tests/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
@@ -98,6 +98,10 @@
expectedMinimumMemory = isXLarge ? 256 : 128;
break;
+ case DisplayMetrics.DENSITY_560:
+ expectedMinimumMemory = isXLarge ? 512 : 256;
+ break;
+
case DisplayMetrics.DENSITY_XXXHIGH:
expectedMinimumMemory = isXLarge ? 512 : 256;
break;
diff --git a/tests/tests/content/AndroidManifest.xml b/tests/tests/content/AndroidManifest.xml
index a5caba8..f7080ae 100644
--- a/tests/tests/content/AndroidManifest.xml
+++ b/tests/tests/content/AndroidManifest.xml
@@ -187,6 +187,15 @@
</intent-filter>
</activity>
+ <activity android:name="com.android.cts.content.ReadableFileReceiverActivity"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.intent.action.SEND" />
+ <action android:name="android.intent.action.SEND_MULTIPLE" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
+
</application>
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
diff --git a/tests/tests/content/src/android/content/cts/ContextWrapperTest.java b/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
index e7b6ed7..62fc83a 100644
--- a/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
+++ b/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
@@ -641,7 +641,8 @@
}
public void testCheckCallingOrSelfPermission() {
- int retValue = mContextWrapper.checkCallingOrSelfPermission("android.permission.GET_TASKS");
+ int retValue = mContextWrapper.checkCallingOrSelfPermission(
+ "android.permission.SET_WALLPAPER");
assertEquals(PackageManager.PERMISSION_GRANTED, retValue);
}
@@ -705,7 +706,7 @@
}
// Test with invalid uid and included granted permission.
- returnValue = mContextWrapper.checkPermission("android.permission.GET_TASKS", 1, -11);
+ returnValue = mContextWrapper.checkPermission("android.permission.SET_WALLPAPER", 1, -11);
assertEquals(PackageManager.PERMISSION_DENIED, returnValue);
}
diff --git a/tests/tests/content/src/android/content/cts/ReadableFileReceiverActivity.java b/tests/tests/content/src/android/content/cts/ReadableFileReceiverActivity.java
new file mode 100644
index 0000000..bab516e
--- /dev/null
+++ b/tests/tests/content/src/android/content/cts/ReadableFileReceiverActivity.java
@@ -0,0 +1,120 @@
+/*
+ * 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.cts.content;
+
+import android.app.Activity;
+import android.content.ClipData;
+import android.content.ClipData.Item;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.util.Log;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ReadableFileReceiverActivity extends Activity {
+ public static final String ACTION_CONFIRM_READ_SUCCESS
+ = "com.android.cts.content.action.CONFIRM_READ_SUCCESS";
+ private static final String TAG = ReadableUriExtraToClipDataTest.TAG;
+
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Intent intent = getIntent();
+
+ // Check action.
+ String action = intent.getAction();
+ if (Intent.ACTION_SEND.equals(action)
+ || Intent.ACTION_SEND_MULTIPLE.equals(action)) {
+ readFilesFromClipDataUri(intent);
+ }
+
+ finish();
+ }
+
+ // Sends ACTION_FILE_READY intent when read from clipdata uri is succesful
+ // and read data matches the data written by the test.
+ private void readFilesFromClipDataUri(Intent intent) {
+ if ((intent.getFlags() & Intent.FLAG_GRANT_READ_URI_PERMISSION) == 0) {
+
+ // Note: since this activity is in the same package as the test we can read from the
+ // file regardless of this permission, but in general this permission is required.
+ Log.e(TAG, "Intent.FLAG_GRANT_READ_URI_PERMISSION was not granted.");
+ return;
+ }
+
+ List<File> files = getFilesFromIntent(intent);
+ if (files == null) {
+ Log.e(TAG, "Could not get files from clipdata.");
+ return;
+ }
+ for (File file : files) {
+ if (!testFileContents(file)) {
+ Log.e(TAG, "File contents of " + file.getPath()
+ + " is incorrect or could not be verified.");
+ return;
+ }
+ }
+ Intent confirmIntent = new Intent(ACTION_CONFIRM_READ_SUCCESS);
+ sendBroadcast(confirmIntent);
+ }
+
+ private ArrayList<File> getFilesFromIntent(Intent intent) {
+ ClipData clipData = intent.getClipData();
+ if (clipData == null) {
+ Log.e(TAG, "ClipData missing.");
+ return null;
+ }
+ if (clipData.getItemCount() == 0) {
+ Log.e(TAG, "Uri missing in ClipData.");
+ return null;
+ }
+
+ ArrayList<File> result = new ArrayList<File>();
+ for (int i = 0; i < clipData.getItemCount(); i++) {
+ Uri filePath = clipData.getItemAt(i).getUri();
+ if (filePath == null) {
+ Log.e(TAG, "Uri missing in ClipData.");
+ return null;
+ }
+ try {
+ result.add(new File(filePath.getPath()));
+ } catch (IllegalArgumentException e) {
+ Log.e(TAG, "Cannot get file at Uri.");
+ return null;
+ }
+ }
+ return result;
+ }
+
+ private boolean testFileContents(File file) {
+ char[] buffer = new char[ReadableUriExtraToClipDataTest.TEST_INPUT.length()];
+ try {
+ FileReader reader = new FileReader(file);
+ reader.read(buffer);
+ reader.close();
+ } catch (IOException e) {
+ Log.e(TAG, "Error while reading file " + file.getPath() + ".");
+ return false;
+ }
+ String fileContents = new String(buffer);
+ return ReadableUriExtraToClipDataTest.TEST_INPUT.equals(fileContents);
+ }
+}
\ No newline at end of file
diff --git a/tests/tests/content/src/android/content/cts/ReadableUriExtraToClipDataTest.java b/tests/tests/content/src/android/content/cts/ReadableUriExtraToClipDataTest.java
new file mode 100644
index 0000000..129d964
--- /dev/null
+++ b/tests/tests/content/src/android/content/cts/ReadableUriExtraToClipDataTest.java
@@ -0,0 +1,125 @@
+/*
+ * 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.cts.content;
+
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.Uri;
+import android.provider.MediaStore;
+import android.test.AndroidTestCase;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.List;
+
+public class ReadableUriExtraToClipDataTest extends AndroidTestCase {
+ private static final List<String> FILE_NAMES = Arrays.asList("testFile1.txt", "testFile2.txt");
+ private static final List<File> mTestFiles = new ArrayList<File>();
+ private static final ArrayList<Uri> mTestFileUris = new ArrayList<Uri>();
+ private final Semaphore mReadSuccessSemaphore = new Semaphore(0);
+
+ public static final String TEST_INPUT = "testString";
+ public static final String TAG = "ReadableUriExtraToClipDataTest";
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ assertEquals(0, mReadSuccessSemaphore.availablePermits());
+
+ BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ mReadSuccessSemaphore.release();
+ }
+ };
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(ReadableFileReceiverActivity.ACTION_CONFIRM_READ_SUCCESS);
+ getContext().registerReceiver(mReceiver, filter);
+
+ for (String fileName : FILE_NAMES) {
+ File testFile = new File(getContext().getFilesDir() + File.separator + fileName);
+ writeTestInputToFile(testFile);
+ mTestFiles.add(testFile);
+ mTestFileUris.add(Uri.fromFile(testFile));
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ for (File testFile : mTestFiles) {
+ if (testFile.exists()) {
+ assertTrue(testFile.delete());
+ }
+ }
+ mTestFiles.clear();
+ mTestFileUris.clear();
+ super.tearDown();
+ }
+
+ public void testUriExtraStreamMigratedToClipData_sendIntent() {
+ Intent intent = new Intent(Intent.ACTION_SEND);
+ intent.setComponent(new ComponentName(getContext(), ReadableFileReceiverActivity.class));
+ intent.putExtra(Intent.EXTRA_STREAM, mTestFileUris.get(0));
+ intent.setType("*/*");
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
+ getContext().startActivity(intent);
+
+ waitForConfirmationReadSuccess();
+ }
+
+ public void testUriExtraStreamMigratedToClipData_sendMultipleIntent() {
+ Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
+ intent.setComponent(new ComponentName(getContext(), ReadableFileReceiverActivity.class));
+ intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, mTestFileUris);
+ intent.setType("*/*");
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
+ getContext().startActivity(intent);
+
+ waitForConfirmationReadSuccess();
+ }
+
+ private void writeTestInputToFile(File file) {
+ try {
+ FileWriter writer = new FileWriter(file);
+ writer.write(TEST_INPUT);
+ writer.flush();
+ writer.close();
+ } catch (IOException e) {
+ fail(e.toString());
+ return;
+ }
+ }
+
+ private void waitForConfirmationReadSuccess() {
+ try {
+ assertTrue(mReadSuccessSemaphore.tryAcquire(5, TimeUnit.SECONDS));
+ } catch (InterruptedException e) {
+ fail(e.toString());
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/tests/hardware/src/android/hardware/camera2/cts/StillCaptureTest.java b/tests/tests/hardware/src/android/hardware/camera2/cts/StillCaptureTest.java
index 2f5409d..9766a45 100644
--- a/tests/tests/hardware/src/android/hardware/camera2/cts/StillCaptureTest.java
+++ b/tests/tests/hardware/src/android/hardware/camera2/cts/StillCaptureTest.java
@@ -65,8 +65,8 @@
// 60 second to accommodate the possible long exposure time.
private static final int EXIF_DATETIME_ERROR_MARGIN_SEC = 60;
private static final float EXIF_FOCAL_LENGTH_ERROR_MARGIN = 0.001f;
- // TODO: exposure time error margin need to be scaled with exposure time.
- private static final float EXIF_EXPOSURE_TIME_ERROR_MARGIN_SEC = 0.002f;
+ private static final float EXIF_EXPOSURE_TIME_ERROR_MARGIN_RATIO = 0.05f;
+ private static final float EXIF_EXPOSURE_TIME_MIN_ERROR_MARGIN_SEC = 0.002f;
private static final float EXIF_APERTURE_ERROR_MARGIN = 0.001f;
private static final Location sTestLocation0 = new Location(LocationManager.GPS_PROVIDER);
private static final Location sTestLocation1 = new Location(LocationManager.GPS_PROVIDER);
@@ -1121,8 +1121,10 @@
double exposureTimeValue = Double.parseDouble(exposureTime);
long expTimeResult = result.get(CaptureResult.SENSOR_EXPOSURE_TIME);
double expected = expTimeResult / 1e9;
+ double tolerance = expected * EXIF_EXPOSURE_TIME_ERROR_MARGIN_RATIO;
+ tolerance = Math.max(tolerance, EXIF_EXPOSURE_TIME_MIN_ERROR_MARGIN_SEC);
mCollector.expectEquals("Exif exposure time doesn't match", expected,
- exposureTimeValue, EXIF_EXPOSURE_TIME_ERROR_MARGIN_SEC);
+ exposureTimeValue, tolerance);
}
}
diff --git a/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorManager.java b/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorManager.java
index a62107b..d72a2ce 100644
--- a/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorManager.java
+++ b/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorManager.java
@@ -58,7 +58,7 @@
private TestSensorEventListener mTestSensorEventListener;
/**
- * @Deprecated Use {@link #TestSensorManager(TestSensorEnvironment)} instead.
+ * @deprecated Use {@link #TestSensorManager(TestSensorEnvironment)} instead.
*/
@Deprecated
public TestSensorManager(
diff --git a/tools/tradefed-host/res/report/cts_result.xsl b/tools/tradefed-host/res/report/cts_result.xsl
index 3c914dc..7bc216b 100644
--- a/tools/tradefed-host/res/report/cts_result.xsl
+++ b/tools/tradefed-host/res/report/cts_result.xsl
@@ -339,8 +339,7 @@
<TD class="rowtitle">Host Info</TD>
<TD>
<xsl:value-of select="TestResult/HostInfo/@name"/>
- (<xsl:value-of select="TestResult/HostInfo/Os/@name"/> -
- <xsl:value-of select="TestResult/HostInfo/Os/@version"/>)
+ (<xsl:value-of select="TestResult/HostInfo/Os/@name"/> - <xsl:value-of select="TestResult/HostInfo/Os/@version"/>)
</TD>
</TR>
<TR>
@@ -467,7 +466,9 @@
<TD class="package" colspan="3">
<xsl:variable name="href"><xsl:value-of select="@appPackageName"/></xsl:variable>
<a name="{$href}">Compatibility Test Package: <xsl:value-of select="@appPackageName"/>
- abi: <xsl:value-of select="@abi"/>
+ <xsl:if test="@abi">
+ ABI: <xsl:value-of select="@abi"/>
+ </xsl:if>
</a>
</TD>
</TR>
@@ -512,7 +513,7 @@
<xsl:if test="@result='pass'">
<TD class="pass">
<div style="text-align: center; margin-left:auto; margin-right:auto;">
- known problem
+ Known problem
</div>
</TD>
<TD class="failuredetails"></TD>
@@ -585,7 +586,7 @@
</DIV>
</xsl:template>
- <!-- Take a delimited string and insert line breaks after a some number of elements. -->
+ <!-- Take a delimited string and insert line breaks after a some number of elements. -->
<xsl:template name="formatDelimitedString">
<xsl:param name="string" />
<xsl:param name="numTokensPerRow" select="10" />
@@ -595,7 +596,7 @@
<xsl:variable name="token" select="substring-before($string, ';')" />
<xsl:value-of select="$token" />
<xsl:text> </xsl:text>
-
+
<xsl:if test="$tokenIndex mod $numTokensPerRow = 0">
<br />
</xsl:if>
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/DeqpTestRunner.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/DeqpTestRunner.java
index db1b2dd..c185cec 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/DeqpTestRunner.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/DeqpTestRunner.java
@@ -1,8 +1,10 @@
package com.android.cts.tradefed.testtype;
+import com.android.cts.tradefed.build.CtsBuildHelper;
import com.android.cts.util.AbiUtils;
import com.android.ddmlib.MultiLineReceiver;
import com.android.ddmlib.testrunner.TestIdentifier;
+import com.android.tradefed.build.IBuildInfo;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.log.LogUtil.CLog;
@@ -10,9 +12,12 @@
import com.android.tradefed.result.ITestInvocationListener;
import com.android.tradefed.result.LogDataType;
import com.android.tradefed.testtype.IAbi;
+import com.android.tradefed.testtype.IBuildReceiver;
import com.android.tradefed.testtype.IDeviceTest;
import com.android.tradefed.testtype.IRemoteTest;
+import java.io.File;
+import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -25,8 +30,12 @@
*
* Supports running drawElements Quality Program tests found under external/deqp.
*/
-public class DeqpTestRunner implements IDeviceTest, IRemoteTest {
- final private int TESTCASE_BATCH_LIMIT = 1000;
+public class DeqpTestRunner implements IBuildReceiver, IDeviceTest, IRemoteTest {
+
+ private static final String DEQP_ONDEVICE_APK = "com.drawelements.deqp.apk";
+ private static final String DEQP_ONDEVICE_PKG = "com.drawelements.deqp";
+
+ private final int TESTCASE_BATCH_LIMIT = 1000;
private boolean mLogData;
@@ -36,6 +45,7 @@
private final String mName;
private Collection<TestIdentifier> mTests;
private IAbi mAbi;
+ private CtsBuildHelper mCtsBuild;
private TestIdentifier mCurrentTestId;
private boolean mGotTestResult;
@@ -58,6 +68,14 @@
}
/**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setBuild(IBuildInfo buildInfo) {
+ mCtsBuild = CtsBuildHelper.createBuildHelper(buildInfo);
+ }
+
+ /**
* Enable or disable raw dEQP test log collection.
*/
public void setCollectLogs(boolean logData) {
@@ -420,6 +438,29 @@
}
/**
+ * Install dEQP OnDevice Package
+ */
+ private void installTestApk() throws DeviceNotAvailableException {
+ try {
+ File apkFile = mCtsBuild.getTestApp(DEQP_ONDEVICE_APK);
+ String[] options = {AbiUtils.createAbiFlag(mAbi.getName())};
+ String errorCode = getDevice().installPackage(apkFile, true, options);
+ if (errorCode != null) {
+ CLog.e("Failed to install %s. Reason: %s", DEQP_ONDEVICE_APK, errorCode);
+ }
+ } catch (FileNotFoundException e) {
+ CLog.e("Could not find test apk %s", DEQP_ONDEVICE_APK);
+ }
+ }
+
+ /**
+ * Uninstall dEQP OnDevice Package
+ */
+ private void uninstallTestApk() throws DeviceNotAvailableException {
+ getDevice().uninstallPackage(DEQP_ONDEVICE_PKG);
+ }
+
+ /**
* {@inheritDoc}
*/
@Override
@@ -429,6 +470,10 @@
if ((mName.equals( "dEQP-GLES3") && isSupportedGles(mDevice, 3, 0))
|| (mName.equals("dEQP-GLES31") && isSupportedGles(mDevice, 3, 1))) {
+ // Make sure there is no pre-existing package form earlier interrupted test run.
+ uninstallTestApk();
+ installTestApk();
+
while (!mTests.isEmpty()) {
executeTests(listener);
@@ -445,16 +490,18 @@
source.cancel();
}
- if (!mGotTestResult) {
- mListener.testFailed(mCurrentTestId,
- "Log doesn't contain test result");
- }
+ if (!mGotTestResult) {
+ mListener.testFailed(mCurrentTestId,
+ "Log doesn't contain test result");
+ }
mListener.testEnded(mCurrentTestId, emptyMap);
mCurrentTestId = null;
mListener.testRunEnded(0, emptyMap);
}
}
+
+ uninstallTestApk();
} else {
/* Pass all tests if OpenGL ES version is not supported */
Map <String, String> emptyMap = Collections.emptyMap();
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
index 45c176a..2eccb50 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageDef.java
@@ -60,9 +60,6 @@
public static final String UIAUTOMATOR_TEST = "uiAutomator";
public static final String JUNIT_DEVICE_TEST = "jUnitDeviceTest";
- private static final String SIGNATURE_TEST_METHOD = "testSignature";
- private static final String SIGNATURE_TEST_CLASS = "android.tests.sigtest.SignatureTest";
-
private String mAppPackageName = null;
private String mAppNameSpace = null;
private String mName = null;
@@ -70,7 +67,6 @@
private String mTestType = null;
private String mJarPath = null;
private String mRunTimeArgs = null;
- private boolean mIsSignatureTest = false;
private String mTestPackageName = null;
private String mDigest = null;
private IAbi mAbi = null;
@@ -176,14 +172,6 @@
return mJarPath;
}
- void setIsSignatureCheck(boolean isSignatureCheckTest) {
- mIsSignatureTest = isSignatureCheckTest;
- }
-
- boolean isSignatureCheck() {
- return mIsSignatureTest;
- }
-
void setTestPackageName(String testPackageName) {
mTestPackageName = testPackageName;
}
@@ -288,26 +276,6 @@
} else if (UIAUTOMATOR_TEST.equals(mTestType)) {
UiAutomatorJarTest uiautomatorTest = new UiAutomatorJarTest();
return setUiAutomatorTest(uiautomatorTest);
- } else if (mIsSignatureTest) {
- // TODO: hardcode the runner/class/method for now, since current package xml points to
- // specialized instrumentation. Eventually this special case for signatureTest can be
- // removed, and it can be treated just like a normal InstrumentationTest
- CLog.d("Creating signature test %s", mName);
- CtsInstrumentationApkTest instrTest = new CtsInstrumentationApkTest();
- instrTest.setPackageName(mAppNameSpace);
- instrTest.setRunnerName("android.test.InstrumentationTestRunner");
- instrTest.setClassName(SIGNATURE_TEST_CLASS);
- instrTest.setMethodName(SIGNATURE_TEST_METHOD);
- instrTest.setAbi(mAbi);
- mTests.clear();
- // set expected tests to the single signature test
- TestIdentifier t = new TestIdentifier(
- SIGNATURE_TEST_CLASS, SIGNATURE_TEST_METHOD);
- mTests.add(t);
- // mName means 'apk file name' for instrumentation tests
- instrTest.addInstallApk(String.format("%s.apk", mName), mAppNameSpace);
- mDigest = generateDigest(testCaseDir, String.format("%s.apk", mName));
- return instrTest;
} else if (JUNIT_DEVICE_TEST.equals(mTestType)){
CLog.d("Creating JUnit device test %s", mName);
JUnitDeviceTest jUnitDeviceTest = new JUnitDeviceTest();
@@ -438,7 +406,7 @@
}
/**
- * Get the collection of tests in this test package.
+ * {@inheritDoc}
*/
@Override
public Collection<TestIdentifier> getTests() {
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageRepo.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageRepo.java
index 4c549e2..ce91a8a 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageRepo.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageRepo.java
@@ -84,7 +84,14 @@
Set<TestPackageDef> defs = parser.getTestPackageDefs();
if (!defs.isEmpty()) {
for (TestPackageDef def : defs) {
- mTestMap.get(def.getAbi().getName()).put(def.getAppPackageName(), def);
+ String name = def.getAppPackageName();
+ String abi = def.getAbi().getName();
+ if (def.getTests().size() > 0) {
+ mTestMap.get(abi).put(name, def);
+ } else {
+ Log.i(LOG_TAG, String.format("No tests in %s for %s, skipping",
+ name, abi));
+ }
}
} else {
Log.w(LOG_TAG, String.format("Could not find test package info in xml file %s",
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java
index 71279c7..8f4f1b0 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/TestPackageXmlParser.java
@@ -82,7 +82,6 @@
final String packageName = attributes.getValue("name");
final String runnerName = attributes.getValue("runner");
final String jarPath = attributes.getValue("jarPath");
- final boolean signatureCheck = parseBoolean(attributes.getValue("signatureCheck"));
final String javaPackageFilter = attributes.getValue("javaPackageFilter");
final String targetBinaryName = attributes.getValue("targetBinaryName");
final String targetNameSpace = attributes.getValue("targetNameSpace");
@@ -98,7 +97,6 @@
packageDef.setRunner(runnerName);
packageDef.setTestType(testType);
packageDef.setJarPath(jarPath);
- packageDef.setIsSignatureCheck(signatureCheck);
packageDef.setRunTimeArgs(runTimeArgs);
if (!"".equals(javaPackageFilter)) {
packageDef.setTestPackageName(javaPackageFilter);
diff --git a/tools/tradefed-host/tests/Android.mk b/tools/tradefed-host/tests/Android.mk
index 7d4ab4a..2734a5b 100644
--- a/tools/tradefed-host/tests/Android.mk
+++ b/tools/tradefed-host/tests/Android.mk
@@ -24,6 +24,4 @@
LOCAL_JAVA_LIBRARIES := tradefed-prebuilt cts-tradefed
LOCAL_STATIC_JAVA_LIBRARIES := easymock
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-
+include $(BUILD_HOST_JAVA_LIBRARY)
\ No newline at end of file
diff --git a/tools/utils/buildCts.py b/tools/utils/buildCts.py
index cdd6e10..85adb0c 100755
--- a/tools/utils/buildCts.py
+++ b/tools/utils/buildCts.py
@@ -78,9 +78,6 @@
"""Generate test descriptions for all packages."""
pool = Pool(processes=2)
- # individually generate descriptions not following conventions
- pool.apply_async(GenerateSignatureCheckDescription, [self.test_repository])
-
# generate test descriptions for android tests
results = []
pool.close()
@@ -118,7 +115,7 @@
plan.Exclude('android\.performance.*')
self.__WritePlan(plan, 'SDK')
- plan.Exclude(r'android\.tests\.sigtest')
+ plan.Exclude(r'android\.signature')
plan.Exclude(r'android\.core.*')
self.__WritePlan(plan, 'Android')
@@ -137,10 +134,6 @@
self.__WritePlan(plan, 'VM-TF')
plan = tools.TestPlan(packages)
- plan.Include(r'android\.tests\.sigtest')
- self.__WritePlan(plan, 'Signature')
-
- plan = tools.TestPlan(packages)
plan.Include(r'android\.tests\.appsecurity')
self.__WritePlan(plan, 'AppSecurity')
@@ -328,6 +321,7 @@
'android.rscpp' : [],
'android.rsg' : [],
'android.sax' : [],
+ 'android.signature' : [],
'android.speech' : [],
'android.tests.appsecurity' : [],
'android.text' : [],
@@ -370,7 +364,7 @@
'android.location2' : [],
'android.print' : [],
'android.renderscriptlegacy' : [],
- 'android.tests.sigtest' : [],
+ 'android.signature' : [],
'android.tv' : [],
'android.uiautomation' : [],
'android.uirendering' : [],
@@ -434,18 +428,6 @@
def LogGenerateDescription(name):
print 'Generating test description for package %s' % name
-def GenerateSignatureCheckDescription(test_repository):
- """Generate the test description for the signature check."""
- LogGenerateDescription('android.tests.sigtest')
- package = tools.TestPackage('SignatureTest', 'android.tests.sigtest')
- package.AddAttribute('appNameSpace', 'android.tests.sigtest')
- package.AddAttribute('signatureCheck', 'true')
- package.AddAttribute('runner', '.InstrumentationRunner')
- package.AddTest('android.tests.sigtest.SignatureTest.testSignature')
- description = open(os.path.join(test_repository, 'SignatureTest.xml'), 'w')
- package.WriteDescription(description)
- description.close()
-
if __name__ == '__main__':
builder = CtsBuilder(sys.argv)
result = builder.GenerateTestDescriptions()