am 48cae1a0: am 03bf8716: Merge "CtsVerifier Test List Infrastructure" into froyo
Merge commit '48cae1a07e6e0f6bb437fba8f2cf3fce050f3421' into gingerbread
* commit '48cae1a07e6e0f6bb437fba8f2cf3fce050f3421':
CtsVerifier Test List Infrastructure
diff --git a/tests/ProcessTest/Android.mk b/tests/ProcessTest/Android.mk
index be1e7de..ba58e87 100644
--- a/tests/ProcessTest/Android.mk
+++ b/tests/ProcessTest/Android.mk
@@ -20,7 +20,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_JAVA_LIBRARIES := framework-tests android.test.runner
+LOCAL_JAVA_LIBRARIES := android.test.runner
LOCAL_AAPT_FLAGS = -c xx_YY -c cs
diff --git a/tests/appsecurity-tests/src/com/android/cts/appsecurity/AppSecurityTests.java b/tests/appsecurity-tests/src/com/android/cts/appsecurity/AppSecurityTests.java
index f528ee1..2833fa4 100644
--- a/tests/appsecurity-tests/src/com/android/cts/appsecurity/AppSecurityTests.java
+++ b/tests/appsecurity-tests/src/com/android/cts/appsecurity/AppSecurityTests.java
@@ -225,8 +225,9 @@
*
* @param pkgName Android application package for tests
* @return <code>true</code> if all tests passed.
+ * @throws IOException if connection to device was lost
*/
- private boolean runDeviceTests(String pkgName) {
+ private boolean runDeviceTests(String pkgName) throws IOException {
CollectingTestRunListener listener = doRunTests(pkgName);
return listener.didAllTestsPass();
}
@@ -235,8 +236,9 @@
* Helper method to run tests and return the listener that collected the results.
* @param pkgName Android application package for tests
* @return the {@link CollectingTestRunListener}
+ * @throws IOException if connection to device was lost
*/
- private CollectingTestRunListener doRunTests(String pkgName) {
+ private CollectingTestRunListener doRunTests(String pkgName) throws IOException {
RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner(pkgName, getDevice());
CollectingTestRunListener listener = new CollectingTestRunListener();
testRunner.run(listener);
diff --git a/tests/core/annotation/Android.mk b/tests/core/annotation/Android.mk
deleted file mode 100644
index 4778710..0000000
--- a/tests/core/annotation/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Annotation Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/annotation/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.annotation
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/annotation/AndroidManifest.xml b/tests/core/annotation/AndroidManifest.xml
deleted file mode 100644
index 7e34d2a..0000000
--- a/tests/core/annotation/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.annotation">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/archive/Android.mk b/tests/core/archive/Android.mk
deleted file mode 100644
index 78edd09..0000000
--- a/tests/core/archive/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Archive Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/archive/src/test/java/org) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.archive
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/archive/AndroidManifest.xml b/tests/core/archive/AndroidManifest.xml
deleted file mode 100644
index 22ba6f7..0000000
--- a/tests/core/archive/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.archive">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/concurrent/Android.mk b/tests/core/concurrent/Android.mk
deleted file mode 100644
index d42c6da..0000000
--- a/tests/core/concurrent/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Concurrent Tests
-##########################################################
-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)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/concurrent/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.concurrent
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/concurrent/AndroidManifest.xml b/tests/core/concurrent/AndroidManifest.xml
deleted file mode 100644
index b3ee187..0000000
--- a/tests/core/concurrent/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.concurrent">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/crypto/Android.mk b/tests/core/crypto/Android.mk
deleted file mode 100644
index 2450ad1..0000000
--- a/tests/core/crypto/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# crypto Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/crypto/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.crypto
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/crypto/AndroidManifest.xml b/tests/core/crypto/AndroidManifest.xml
deleted file mode 100644
index 25052ee..0000000
--- a/tests/core/crypto/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.crypto">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/ctscore.mk b/tests/core/ctscore.mk
index 085730c..337b3f5 100644
--- a/tests/core/ctscore.mk
+++ b/tests/core/ctscore.mk
@@ -17,7 +17,7 @@
# and when built explicitly put them in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_JAVA_LIBRARIES := android.test.runner
+LOCAL_JAVA_LIBRARIES := android.test.runner bouncycastle
LOCAL_PROGUARD_ENABLED := disabled
diff --git a/tests/core/dom/Android.mk b/tests/core/dom/Android.mk
index 47b3dbb..69d4af3 100644
--- a/tests/core/dom/Android.mk
+++ b/tests/core/dom/Android.mk
@@ -23,10 +23,13 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/dom/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/dom/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/junit/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java/)
LOCAL_PACKAGE_NAME := android.core.tests.dom
+# for java.* javax.* support classes in libcore/support/src/test/java
+LOCAL_DX_FLAGS := --core-library
+
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/logging/Android.mk b/tests/core/logging/Android.mk
deleted file mode 100644
index 89d1ca9..0000000
--- a/tests/core/logging/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Logging Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/logging/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.logging
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/logging/AndroidManifest.xml b/tests/core/logging/AndroidManifest.xml
deleted file mode 100644
index c6e5bee..0000000
--- a/tests/core/logging/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.logging">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/luni-io/Android.mk b/tests/core/luni-io/Android.mk
index f2aae36..ed39e03 100644
--- a/tests/core/luni-io/Android.mk
+++ b/tests/core/luni-io/Android.mk
@@ -23,14 +23,16 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/io) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/io) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg1) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg2) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsIo.java \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/java/io) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/io) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg1) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/pkg2) \
+ ../../../../libcore/luni/src/test/java/tests/luni/AllTestsIo.java
LOCAL_PACKAGE_NAME := android.core.tests.luni.io
+# for java.* javax.* support classes in libcore/support/src/test/java
+LOCAL_DX_FLAGS := --core-library
+
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/luni-lang/Android.mk b/tests/core/luni-lang/Android.mk
index 225bdf9..a31b881 100644
--- a/tests/core/luni-lang/Android.mk
+++ b/tests/core/luni-lang/Android.mk
@@ -23,12 +23,14 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/lang) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/lang) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsLang.java \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/lang) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/java/lang) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
+ ../../../../libcore/luni/src/test/java/tests/luni/AllTestsLang.java
LOCAL_PACKAGE_NAME := android.core.tests.luni.lang
+# for java.* javax.* support classes in libcore/support/src/test/java
+LOCAL_DX_FLAGS := --core-library
+
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/luni-net/Android.mk b/tests/core/luni-net/Android.mk
index 1092ff1..ebef9e3 100644
--- a/tests/core/luni-net/Android.mk
+++ b/tests/core/luni-net/Android.mk
@@ -23,14 +23,18 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/net) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/net) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/http) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsNet.java \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/java/net) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/http) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/net) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/java/net) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
+ ../../../../libcore/luni/src/test/java/tests/luni/AllTestsNet.java
LOCAL_PACKAGE_NAME := android.core.tests.luni.net
+# for java.* javax.* support classes in libcore/support/src/test/java
+LOCAL_DX_FLAGS := --core-library
+
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/luni-util/Android.mk b/tests/core/luni-util/Android.mk
index 101cde8..5468c17 100644
--- a/tests/core/luni-util/Android.mk
+++ b/tests/core/luni-util/Android.mk
@@ -23,12 +23,14 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/util) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/tests/api/java/util) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java/) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/luni/AllTestsUtil.java \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/util) \
+ $(call all-java-files-under,../../../../libcore/luni/src/test/java/tests/api/java/util) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java/) \
+ ../../../../libcore/luni/src/test/java/tests/luni/AllTestsUtil.java
LOCAL_PACKAGE_NAME := android.core.tests.luni.util
+# for java.* javax.* support classes in libcore/support/src/test/java
+LOCAL_DX_FLAGS := --core-library
+
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/math/Android.mk b/tests/core/math/Android.mk
deleted file mode 100644
index 4c559cd..0000000
--- a/tests/core/math/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Math Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/math/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.math
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/math/AndroidManifest.xml b/tests/core/math/AndroidManifest.xml
deleted file mode 100644
index f87fa13..0000000
--- a/tests/core/math/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.math">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/nio/Android.mk b/tests/core/nio/Android.mk
deleted file mode 100644
index 6ebd1bc..0000000
--- a/tests/core/nio/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Nio Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/nio/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.nio
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/nio/AndroidManifest.xml b/tests/core/nio/AndroidManifest.xml
deleted file mode 100644
index 4c79bfa..0000000
--- a/tests/core/nio/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.nio">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/nio_char/Android.mk b/tests/core/nio_char/Android.mk
deleted file mode 100644
index e3b463a..0000000
--- a/tests/core/nio_char/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# NioChar Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/nio_char/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.nio_char
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/nio_char/AndroidManifest.xml b/tests/core/nio_char/AndroidManifest.xml
deleted file mode 100644
index b8de2c9..0000000
--- a/tests/core/nio_char/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.nio_char">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/prefs/Android.mk b/tests/core/prefs/Android.mk
deleted file mode 100644
index f8f225c..0000000
--- a/tests/core/prefs/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Prefs Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/prefs/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.prefs
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/prefs/AndroidManifest.xml b/tests/core/prefs/AndroidManifest.xml
deleted file mode 100644
index d994c72..0000000
--- a/tests/core/prefs/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.prefs">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/regex/Android.mk b/tests/core/regex/Android.mk
deleted file mode 100644
index 70927a0..0000000
--- a/tests/core/regex/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Regex Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/regex/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.regex
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/regex/AndroidManifest.xml b/tests/core/regex/AndroidManifest.xml
deleted file mode 100644
index ddd2165..0000000
--- a/tests/core/regex/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.regex">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/security/Android.mk b/tests/core/security/Android.mk
deleted file mode 100644
index 76c0ca5..0000000
--- a/tests/core/security/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Security Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/security/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.security
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/security/AndroidManifest.xml b/tests/core/security/AndroidManifest.xml
deleted file mode 100644
index 3960a82..0000000
--- a/tests/core/security/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.security">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/sql/Android.mk b/tests/core/sql/Android.mk
deleted file mode 100644
index fe9b4cc..0000000
--- a/tests/core/sql/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Sql Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/sql/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.sql
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/sql/AndroidManifest.xml b/tests/core/sql/AndroidManifest.xml
deleted file mode 100644
index 0ebcab6..0000000
--- a/tests/core/sql/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.sql">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/text/Android.mk b/tests/core/text/Android.mk
deleted file mode 100644
index 8b9fd1f..0000000
--- a/tests/core/text/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Text Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/text/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.text
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/text/AndroidManifest.xml b/tests/core/text/AndroidManifest.xml
deleted file mode 100644
index baf0031..0000000
--- a/tests/core/text/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.text">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/core/xml/Android.mk b/tests/core/xml/Android.mk
index ba784b9..825d14e 100644
--- a/tests/core/xml/Android.mk
+++ b/tests/core/xml/Android.mk
@@ -23,12 +23,14 @@
##########################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/xml/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/dom/src/test) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
+LOCAL_SRC_FILES := $(call all-java-files-under,../../../../libcore/xml/src/test/java) \
+ $(call all-java-files-under,../../../../libcore/dom/src/test) \
+ $(call all-java-files-under,../../../../libcore/junit/src/test/java/junit) \
+ $(call all-java-files-under,../../../../libcore/support/src/test/java)
LOCAL_PACKAGE_NAME := android.core.tests.xml
+# for java.* javax.* support classes in libcore/support/src/test/java
+LOCAL_DX_FLAGS := --core-library
+
include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/xnet/Android.mk b/tests/core/xnet/Android.mk
deleted file mode 100644
index 2415f38..0000000
--- a/tests/core/xnet/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-ifeq ($(BUILD_CTSCORE_PACKAGE),)
- $(error BUILD_CTSCORE_PACKAGE must be defined)
-endif
-
-#
-# Xnet Tests
-##########################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under,../../../../dalvik/libcore/x-net/src/test/java) \
- $(call all-java-files-under,../../../../dalvik/libcore/luni/src/test/java/junit) \
- $(call all-java-files-under,../../../../dalvik/libcore/support/src/test/java) \
- ../../../../dalvik/libcore/luni/src/test/java/tests/TestSuiteFactory.java
-
-LOCAL_PACKAGE_NAME := android.core.tests.xnet
-
-include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/xnet/AndroidManifest.xml b/tests/core/xnet/AndroidManifest.xml
deleted file mode 100644
index 82e5dd7..0000000
--- a/tests/core/xnet/AndroidManifest.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2007 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.core.tests.xnet">
- <uses-permission android:name="android.permission.INTERNET" />
- <application>
- <uses-library android:name="android.test.runner" />
- </application>
-
- <instrumentation android:name="android.test.InstrumentationCtsTestRunner"
- android:targetPackage="android.core.tests.runner"
- android:label="cts framework tests"/>
-
-</manifest>
diff --git a/tests/res/values-large/configVarying.xml b/tests/res/values-large/configVarying.xml
new file mode 100755
index 0000000..7b2df7c
--- /dev/null
+++ b/tests/res/values-large/configVarying.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<resources>
+ <item type="configVarying" name="simple">simple large</item>
+ <bag type="configVarying" name="bag">
+ <item name="testString">bag large</item>
+ </bag>
+ <item type="configVarying" name="large">large</item>
+</resources>
diff --git a/tests/res/values-normal/configVarying.xml b/tests/res/values-normal/configVarying.xml
new file mode 100755
index 0000000..b45ee49
--- /dev/null
+++ b/tests/res/values-normal/configVarying.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<resources>
+ <item type="configVarying" name="simple">simple normal</item>
+ <bag type="configVarying" name="bag">
+ <item name="testString">bag normal</item>
+ </bag>
+ <item type="configVarying" name="normal">normal</item>
+</resources>
diff --git a/tests/res/values-small/configVarying.xml b/tests/res/values-small/configVarying.xml
new file mode 100755
index 0000000..15a9f8f
--- /dev/null
+++ b/tests/res/values-small/configVarying.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<resources>
+ <item type="configVarying" name="simple">simple small</item>
+ <bag type="configVarying" name="bag">
+ <item name="testString">bag small</item>
+ </bag>
+ <item type="configVarying" name="small">small</item>
+</resources>
diff --git a/tests/res/values-xlarge/configVarying.xml b/tests/res/values-xlarge/configVarying.xml
new file mode 100755
index 0000000..fb9cad7
--- /dev/null
+++ b/tests/res/values-xlarge/configVarying.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+
+<resources>
+ <item type="configVarying" name="simple">simple xlarge</item>
+ <bag type="configVarying" name="bag">
+ <item name="testString">bag xlarge</item>
+ </bag>
+ <item type="configVarying" name="xlarge">xlarge</item>
+</resources>
diff --git a/tests/res/values/configVarying.xml b/tests/res/values/configVarying.xml
index a2d5b97..de1b09e 100755
--- a/tests/res/values/configVarying.xml
+++ b/tests/res/values/configVarying.xml
@@ -19,4 +19,8 @@
<bag type="configVarying" name="bag">
<item name="testString">bag default</item>
</bag>
+ <item type="configVarying" name="small">default</item>
+ <item type="configVarying" name="normal">default</item>
+ <item type="configVarying" name="large">default</item>
+ <item type="configVarying" name="xlarge">default</item>
</resources>
diff --git a/tests/src/android/hardware/cts/CameraStubActivity.java b/tests/src/android/hardware/cts/CameraStubActivity.java
index 50bd13b..8ab7fbd 100644
--- a/tests/src/android/hardware/cts/CameraStubActivity.java
+++ b/tests/src/android/hardware/cts/CameraStubActivity.java
@@ -24,9 +24,7 @@
import com.android.cts.stub.R;
public class CameraStubActivity extends Activity {
-
- public static SurfaceView mSurfaceView;
-
+ private SurfaceView mSurfaceView;
private final int LAYOUT_WIDTH = 480;
private final int LAYOUT_HEIGHT = 320;
@@ -43,4 +41,8 @@
mSurfaceView.getHolder().setFixedSize(LAYOUT_WIDTH, LAYOUT_HEIGHT);
mSurfaceView.getHolder().setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
+
+ public SurfaceView getSurfaceView() {
+ return mSurfaceView;
+ }
}
diff --git a/tests/tests/app/src/android/app/cts/InstrumentationTest.java b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
index 5ce33a0..1861ae2 100644
--- a/tests/tests/app/src/android/app/cts/InstrumentationTest.java
+++ b/tests/tests/app/src/android/app/cts/InstrumentationTest.java
@@ -36,10 +36,12 @@
import android.os.IBinder;
import android.os.SystemClock;
import android.test.InstrumentationTestCase;
+import android.view.InputQueue;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
+import android.view.SurfaceHolder;
import android.view.View;
import android.view.Window;
import android.view.ViewGroup.LayoutParams;
@@ -956,6 +958,14 @@
@Override
public void togglePanel(int featureId, KeyEvent event) {
}
+
+ @Override
+ public void takeSurface(SurfaceHolder.Callback2 callback) {
+ }
+
+ @Override
+ public void takeInputQueue(InputQueue.Callback queue) {
+ }
}
}
diff --git a/tests/tests/content/src/android/content/res/cts/ConfigTest.java b/tests/tests/content/src/android/content/res/cts/ConfigTest.java
index 276cb35..d68fd19 100755
--- a/tests/tests/content/src/android/content/res/cts/ConfigTest.java
+++ b/tests/tests/content/src/android/content/res/cts/ConfigTest.java
@@ -43,7 +43,8 @@
ORIENTATION,
WIDTH,
HEIGHT,
- DENSITY
+ DENSITY,
+ SCREENLAYOUT
}
private static void checkValue(final Resources res, final int resId,
@@ -129,9 +130,11 @@
break;
case DENSITY:
// this is the ratio from the standard
-
mMetrics.density = (((float)value)/((float)DisplayMetrics.DENSITY_DEFAULT));
break;
+ case SCREENLAYOUT:
+ mConfig.screenLayout = value;
+ break;
default:
assert(false);
break;
@@ -303,6 +306,34 @@
checkValue(res, R.configVarying.simple, "simple square");
checkValue(res, R.configVarying.bag,
R.styleable.TestConfig, new String[]{"bag square"});
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_SMALL);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple small");
+ checkValue(res, R.configVarying.bag,
+ R.styleable.TestConfig, new String[]{"bag small"});
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_NORMAL);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple normal");
+ checkValue(res, R.configVarying.bag,
+ R.styleable.TestConfig, new String[]{"bag normal"});
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple large");
+ checkValue(res, R.configVarying.bag,
+ R.styleable.TestConfig, new String[]{"bag large"});
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_XLARGE);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple xlarge");
+ checkValue(res, R.configVarying.bag,
+ R.styleable.TestConfig, new String[]{"bag xlarge"});
}
@MediumTest
@@ -378,6 +409,47 @@
R.styleable.TestConfig, new String[]{"bag 240dpi"});
}
+ @MediumTest
+ public void testScreenSize() throws Exception {
+ // ensure that we fall back to the best available screen size
+ // for a given configuration.
+ TotalConfig config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_SMALL);
+ Resources res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple small");
+ checkValue(res, R.configVarying.small, "small");
+ checkValue(res, R.configVarying.normal, "default");
+ checkValue(res, R.configVarying.large, "default");
+ checkValue(res, R.configVarying.xlarge, "default");
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_NORMAL);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple normal");
+ checkValue(res, R.configVarying.small, "default");
+ checkValue(res, R.configVarying.normal, "normal");
+ checkValue(res, R.configVarying.large, "default");
+ checkValue(res, R.configVarying.xlarge, "default");
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_LARGE);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple large");
+ checkValue(res, R.configVarying.small, "default");
+ checkValue(res, R.configVarying.normal, "normal");
+ checkValue(res, R.configVarying.large, "large");
+ checkValue(res, R.configVarying.xlarge, "default");
+
+ config = new TotalConfig();
+ config.setProperty(Properties.SCREENLAYOUT, Configuration.SCREENLAYOUT_SIZE_XLARGE);
+ res = config.getResources();
+ checkValue(res, R.configVarying.simple, "simple xlarge");
+ checkValue(res, R.configVarying.small, "default");
+ checkValue(res, R.configVarying.normal, "normal");
+ checkValue(res, R.configVarying.large, "large");
+ checkValue(res, R.configVarying.xlarge, "xlarge");
+ }
+
// TODO - add tests for special cases - ie, other key params seem ignored if
// nokeys is set
@@ -421,7 +493,8 @@
*/
/**
- * Precidence order: mcc, mnc, locale, orientation, density,
+ * Precidence order: mcc, mnc, locale, screenlayout-size,
+ * screenlayout-long, orientation, density,
* touchscreen, hidden, keyboard, navigation, width-height
*/
diff --git a/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java b/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
index d69dd4f..041de94 100644
--- a/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
@@ -34,7 +34,6 @@
import android.graphics.RectF;
import android.graphics.Region;
import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.Suppress;
@TestTargetClass(NinePatch.class)
public class NinePatchTest extends AndroidTestCase {
@@ -174,7 +173,6 @@
method = "hasAlpha",
args = {}
)
- @Suppress // Suppressed for current release
public void testHasAlpha() {
assertFalse(mNinePatch.hasAlpha());
assertEquals(mNinePatch.hasAlpha(), mBitmap.hasAlpha());
diff --git a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
index ba298c2..dd86466 100644
--- a/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/CameraTest.java
@@ -16,7 +16,6 @@
package android.hardware.cts;
-import dalvik.annotation.BrokenTest;
import dalvik.annotation.TestLevel;
import dalvik.annotation.TestTargetClass;
import dalvik.annotation.TestTargetNew;
@@ -26,10 +25,10 @@
import android.graphics.BitmapFactory;
import android.graphics.ImageFormat;
import android.hardware.Camera;
+import android.hardware.Camera.CameraInfo;
import android.hardware.Camera.ErrorCallback;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.PictureCallback;
-import android.hardware.Camera.PreviewCallback;
import android.hardware.Camera.ShutterCallback;
import android.hardware.Camera.Size;
import android.media.ExifInterface;
@@ -62,7 +61,7 @@
"/test.jpg";
private byte[] mJpegData;
- private boolean mRawPreviewCallbackResult = false;
+ private boolean mPreviewCallbackResult = false;
private boolean mShutterCallbackResult = false;
private boolean mRawPictureCallbackResult = false;
private boolean mJpegPictureCallbackResult = false;
@@ -73,7 +72,7 @@
private static final int WAIT_FOR_FOCUS_TO_COMPLETE = 3000;
private static final int WAIT_FOR_SNAPSHOT_TO_COMPLETE = 5000;
- private RawPreviewCallback mRawPreviewCallback = new RawPreviewCallback();
+ private PreviewCallback mPreviewCallback = new PreviewCallback();
private TestShutterCallback mShutterCallback = new TestShutterCallback();
private RawPictureCallback mRawPictureCallback = new RawPictureCallback();
private JpegPictureCallback mJpegPictureCallback = new JpegPictureCallback();
@@ -154,18 +153,13 @@
}
//Implement the previewCallback
- private final class RawPreviewCallback implements PreviewCallback {
- public void onPreviewFrame(byte [] rawData, Camera camera) {
- if (LOGV) Log.v(TAG, "Preview callback start");
- int rawDataLength = 0;
- if (rawData != null) {
- rawDataLength = rawData.length;
- }
- if (rawDataLength > 0) {
- mRawPreviewCallbackResult = true;
- } else {
- mRawPreviewCallbackResult = false;
- }
+ private final class PreviewCallback
+ implements android.hardware.Camera.PreviewCallback {
+ public void onPreviewFrame(byte [] data, Camera camera) {
+ assertNotNull(data);
+ Size size = camera.getParameters().getPreviewSize();
+ assertEquals(size.width * size.height * 3 / 2, data.length);
+ mPreviewCallbackResult = true;
mCamera.stopPreview();
if (LOGV) Log.v(TAG, "notify the preview callback");
mPreviewDone.open();
@@ -266,10 +260,7 @@
}
private void checkPreviewCallback() throws Exception {
- SurfaceHolder mSurfaceHolder;
-
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
if (LOGV) Log.v(TAG, "check preview callback");
mCamera.startPreview();
waitForPreviewDone();
@@ -318,9 +309,7 @@
public void testTakePicture() throws Exception {
initializeMessageLooper();
Size pictureSize = mCamera.getParameters().getPictureSize();
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.startPreview();
mCamera.autoFocus(mAutoFocusCallback);
assertTrue(waitForFocusDone());
@@ -330,16 +319,12 @@
terminateMessageLooper();
assertTrue(mShutterCallbackResult);
assertTrue(mJpegPictureCallbackResult);
- assertTrue(mJpegData != null);
+ assertNotNull(mJpegData);
Bitmap b = BitmapFactory.decodeByteArray(mJpegData, 0, mJpegData.length);
- assertEquals(b.getWidth(), pictureSize.width);
- assertEquals(b.getHeight(), pictureSize.height);
+ assertEquals(pictureSize.width, b.getWidth());
+ assertEquals(pictureSize.height, b.getHeight());
}
- /*
- * Test case 2: Set the preview and
- * verify the RawPreviewCallback is called
- */
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
@@ -378,13 +363,34 @@
)
})
@UiThreadTest
- public void testCheckPreview() throws Exception {
+ public void testPreviewCallback() throws Exception {
initializeMessageLooper();
- mCamera.setPreviewCallback(mRawPreviewCallback);
+ mCamera.setPreviewCallback(mPreviewCallback);
mCamera.setErrorCallback(mErrorCallback);
checkPreviewCallback();
terminateMessageLooper();
- assertTrue(mRawPreviewCallbackResult);
+ assertTrue(mPreviewCallbackResult);
+
+ mPreviewCallbackResult = false;
+ initializeMessageLooper();
+ checkPreviewCallback();
+ terminateMessageLooper();
+ assertFalse(mPreviewCallbackResult);
+
+ // Test all preview sizes.
+ initializeMessageLooper();
+ Parameters parameters = mCamera.getParameters();
+ for (Size size: parameters.getSupportedPreviewSizes()) {
+ mPreviewCallbackResult = false;
+ mCamera.setPreviewCallback(mPreviewCallback);
+ parameters.setPreviewSize(size.width, size.height);
+ mCamera.setParameters(parameters);
+ mCamera.startPreview();
+ waitForPreviewDone();
+ assertTrue(mPreviewCallbackResult);
+ mCamera.stopPreview();
+ }
+ terminateMessageLooper();
}
@TestTargetNew(
@@ -395,16 +401,16 @@
@UiThreadTest
public void testSetOneShotPreviewCallback() throws Exception {
initializeMessageLooper();
- mCamera.setOneShotPreviewCallback(mRawPreviewCallback);
+ mCamera.setOneShotPreviewCallback(mPreviewCallback);
checkPreviewCallback();
terminateMessageLooper();
- assertTrue(mRawPreviewCallbackResult);
+ assertTrue(mPreviewCallbackResult);
- mRawPreviewCallbackResult = false;
+ mPreviewCallbackResult = false;
initializeMessageLooper();
checkPreviewCallback();
terminateMessageLooper();
- assertFalse(mRawPreviewCallbackResult);
+ assertFalse(mPreviewCallbackResult);
}
@TestTargetNew(
@@ -414,38 +420,37 @@
)
@UiThreadTest
public void testSetPreviewDisplay() throws Exception {
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
+ SurfaceHolder holder = getActivity().getSurfaceView().getHolder();
initializeMessageLooper();
// Check the order: startPreview->setPreviewDisplay.
- mCamera.setOneShotPreviewCallback(mRawPreviewCallback);
+ mCamera.setOneShotPreviewCallback(mPreviewCallback);
mCamera.startPreview();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(holder);
waitForPreviewDone();
terminateMessageLooper();
- assertTrue(mRawPreviewCallbackResult);
+ assertTrue(mPreviewCallbackResult);
// Check the order: setPreviewDisplay->startPreview.
initializeMessageLooper();
- mRawPreviewCallbackResult = false;
- mCamera.setOneShotPreviewCallback(mRawPreviewCallback);
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mPreviewCallbackResult = false;
+ mCamera.setOneShotPreviewCallback(mPreviewCallback);
+ mCamera.setPreviewDisplay(holder);
mCamera.startPreview();
waitForPreviewDone();
mCamera.stopPreview();
- assertTrue(mRawPreviewCallbackResult);
+ assertTrue(mPreviewCallbackResult);
// Check the order: setting preview display to null->startPreview->
// setPreviewDisplay.
- mRawPreviewCallbackResult = false;
- mCamera.setOneShotPreviewCallback(mRawPreviewCallback);
+ mPreviewCallbackResult = false;
+ mCamera.setOneShotPreviewCallback(mPreviewCallback);
mCamera.setPreviewDisplay(null);
mCamera.startPreview();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(holder);
waitForPreviewDone();
terminateMessageLooper();
- assertTrue(mRawPreviewCallbackResult);
+ assertTrue(mPreviewCallbackResult);
}
@TestTargetNew(
@@ -472,9 +477,7 @@
}
// Start preview.
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.startPreview();
// Check setting orientation during preview is not allowed.
@@ -532,10 +535,10 @@
assertTrue(origPreviewFrameRate > 0);
// The default preview format must be yuv420 (NV21).
- assertTrue(origPreviewFormat == ImageFormat.NV21);
+ assertEquals(ImageFormat.NV21, origPreviewFormat);
// The default picture format must be Jpeg.
- assertTrue(origPictureFormat == ImageFormat.JPEG);
+ assertEquals(ImageFormat.JPEG, origPictureFormat);
// If camera supports flash, the default flash mode must be off.
String flashMode = parameters.getFlashMode();
@@ -558,7 +561,7 @@
assertTrue(pictureFormats != null && pictureFormats.size() != 0);
assertTrue(frameRates != null && frameRates.size() != 0);
assertTrue(focusModes != null && focusModes.size() != 0);
- assertTrue(focusMode != null);
+ assertNotNull(focusMode);
assertTrue(focalLength > 0);
assertTrue(horizontalViewAngle > 0 && horizontalViewAngle <= 360);
assertTrue(verticalViewAngle > 0 && verticalViewAngle <= 360);
@@ -568,34 +571,34 @@
// If a parameter is supported, both getXXX and getSupportedXXX have to
// be non null.
if (parameters.getWhiteBalance() != null) {
- assertTrue(parameters.getSupportedWhiteBalance() != null);
+ assertNotNull(parameters.getSupportedWhiteBalance());
}
if (parameters.getSupportedWhiteBalance() != null) {
- assertTrue(parameters.getWhiteBalance() != null);
+ assertNotNull(parameters.getWhiteBalance());
}
if (parameters.getColorEffect() != null) {
- assertTrue(parameters.getSupportedColorEffects() != null);
+ assertNotNull(parameters.getSupportedColorEffects());
}
if (parameters.getSupportedColorEffects() != null) {
- assertTrue(parameters.getColorEffect() != null);
+ assertNotNull(parameters.getColorEffect());
}
if (parameters.getAntibanding() != null) {
- assertTrue(parameters.getSupportedAntibanding() != null);
+ assertNotNull(parameters.getSupportedAntibanding());
}
if (parameters.getSupportedAntibanding() != null) {
- assertTrue(parameters.getAntibanding() != null);
+ assertNotNull(parameters.getAntibanding());
}
if (parameters.getSceneMode() != null) {
- assertTrue(parameters.getSupportedSceneModes() != null);
+ assertNotNull(parameters.getSupportedSceneModes());
}
if (parameters.getSupportedSceneModes() != null) {
- assertTrue(parameters.getSceneMode() != null);
+ assertNotNull(parameters.getSceneMode());
}
if (parameters.getFlashMode() != null) {
- assertTrue(parameters.getSupportedFlashModes() != null);
+ assertNotNull(parameters.getSupportedFlashModes());
}
if (parameters.getSupportedFlashModes() != null) {
- assertTrue(parameters.getFlashMode() != null);
+ assertNotNull(parameters.getFlashMode());
}
// Set the parameters.
@@ -617,11 +620,11 @@
// camera may not accept exact parameters, but values must be in valid range
assertTrue(isValidPixelFormat(paramActual.getPictureFormat()));
- assertEquals(paramActual.getPictureSize().width, pictureSize.width);
- assertEquals(paramActual.getPictureSize().height, pictureSize.height);
+ assertEquals(pictureSize.width, paramActual.getPictureSize().width);
+ assertEquals(pictureSize.height, paramActual.getPictureSize().height);
assertTrue(isValidPixelFormat(paramActual.getPreviewFormat()));
- assertEquals(paramActual.getPreviewSize().width, previewSize.width);
- assertEquals(paramActual.getPreviewSize().height, previewSize.height);
+ assertEquals(previewSize.width, paramActual.getPreviewSize().width);
+ assertEquals(previewSize.height, paramActual.getPreviewSize().height);
assertTrue(paramActual.getPreviewFrameRate() > 0);
checkExposureCompensation(parameters);
@@ -676,9 +679,7 @@
assertTrue(sizes.contains(mCamera.new Size(0, 0)));
// Test if the thumbnail size matches the setting.
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.startPreview();
mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
waitForSnapshotDone();
@@ -687,8 +688,8 @@
assertTrue(exif.hasThumbnail());
byte[] thumb = exif.getThumbnail();
Bitmap b = BitmapFactory.decodeByteArray(thumb, 0, thumb.length);
- assertEquals(b.getWidth(), size.width);
- assertEquals(b.getHeight(), size.height);
+ assertEquals(size.width, b.getWidth());
+ assertEquals(size.height, b.getHeight());
// Test no thumbnail case.
p.setJpegThumbnailSize(0, 0);
@@ -696,9 +697,9 @@
mCamera.startPreview();
mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
waitForSnapshotDone();
- assertEquals(mJpegPictureCallbackResult, true);
+ assertTrue(mJpegPictureCallbackResult);
exif = new ExifInterface(JPEG_PATH);
- assertTrue(!exif.hasThumbnail());
+ assertFalse(exif.hasThumbnail());
terminateMessageLooper();
}
@@ -707,26 +708,18 @@
public void testJpegExif() throws Exception {
initializeMessageLooper();
Camera.Parameters parameters = mCamera.getParameters();
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.startPreview();
double focalLength = (double)parameters.getFocalLength();
mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
waitForSnapshotDone();
ExifInterface exif = new ExifInterface(JPEG_PATH);
- assertTrue(exif.getAttribute(ExifInterface.TAG_MAKE) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_MODEL) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_DATETIME) != null);
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_MAKE));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_MODEL));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_DATETIME));
assertTrue(exif.getAttributeInt(ExifInterface.TAG_IMAGE_WIDTH, 0) != 0);
assertTrue(exif.getAttributeInt(ExifInterface.TAG_IMAGE_LENGTH, 0) != 0);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_TIMESTAMP), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_DATESTAMP), null);
- assertEquals(exif.getAttribute(ExifInterface.TAG_GPS_PROCESSING_METHOD), null);
+ checkGpsDataNull(exif);
double exifFocalLength = (double)exif.getAttributeDouble(
ExifInterface.TAG_FOCAL_LENGTH, -1);
assertEquals(focalLength, exifFocalLength, 0.001);
@@ -743,17 +736,36 @@
mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
waitForSnapshotDone();
exif = new ExifInterface(JPEG_PATH);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_TIMESTAMP) != null);
- assertTrue(exif.getAttribute(ExifInterface.TAG_GPS_DATESTAMP) != null);
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_TIMESTAMP));
+ assertNotNull(exif.getAttribute(ExifInterface.TAG_GPS_DATESTAMP));
assertEquals(thirtyTwoCharacters,
exif.getAttribute(ExifInterface.TAG_GPS_PROCESSING_METHOD));
+
+ // Test gps tags do not exist after calling removeGpsData.
+ mCamera.startPreview();
+ parameters.removeGpsData();
+ mCamera.setParameters(parameters);
+ mCamera.takePicture(mShutterCallback, mRawPictureCallback, mJpegPictureCallback);
+ waitForSnapshotDone();
+ exif = new ExifInterface(JPEG_PATH);
+ checkGpsDataNull(exif);
terminateMessageLooper();
}
+ private void checkGpsDataNull(ExifInterface exif) {
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_TIMESTAMP));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_DATESTAMP));
+ assertNull(exif.getAttribute(ExifInterface.TAG_GPS_PROCESSING_METHOD));
+ }
+
@TestTargets({
@TestTargetNew(
level = TestLevel.COMPLETE,
@@ -771,7 +783,7 @@
initializeMessageLooper();
Camera.Parameters parameters = mCamera.getParameters();
SurfaceHolder surfaceHolder;
- surfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
+ surfaceHolder = getActivity().getSurfaceView().getHolder();
Size size = parameters.getPreviewSize();
mCamera.setParameters(parameters);
mCamera.setPreviewDisplay(surfaceHolder);
@@ -837,39 +849,49 @@
public void testPreviewCallbackWithBuffer() throws Exception {
initializeMessageLooper();
SurfaceHolder surfaceHolder;
- surfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
+ surfaceHolder = getActivity().getSurfaceView().getHolder();
mCamera.setPreviewDisplay(surfaceHolder);
- Size size = mCamera.getParameters().getPreviewSize();
+ Parameters parameters = mCamera.getParameters();
PreviewCallbackWithBuffer callback = new PreviewCallbackWithBuffer();
- callback.mBuffer1 = new byte[size.width * size.height * 3 / 2 + 1];
- callback.mBuffer2 = new byte[size.width * size.height * 3 / 2 + 1];
- callback.mBuffer3 = new byte[size.width * size.height * 3 / 2 + 1];
+ // Test all preview sizes.
+ for (Size size: parameters.getSupportedPreviewSizes()) {
+ parameters.setPreviewSize(size.width, size.height);
+ mCamera.setParameters(parameters);
+ callback.mNumCbWithBuffer1 = 0;
+ callback.mNumCbWithBuffer2 = 0;
+ callback.mNumCbWithBuffer3 = 0;
+ callback.mBuffer1 = new byte[size.width * size.height * 3 / 2];
+ callback.mBuffer2 = new byte[size.width * size.height * 3 / 2];
+ callback.mBuffer3 = new byte[size.width * size.height * 3 / 2];
- // Test if we can get the preview callbacks with specified buffers.
- mCamera.addCallbackBuffer(callback.mBuffer1);
- mCamera.addCallbackBuffer(callback.mBuffer2);
- mCamera.setPreviewCallbackWithBuffer(callback);
- mCamera.startPreview();
- waitForPreviewDone();
- assertEquals(1, callback.mNumCbWithBuffer1);
- assertEquals(1, callback.mNumCbWithBuffer2);
- assertEquals(0, callback.mNumCbWithBuffer3);
+ // Test if we can get the preview callbacks with specified buffers.
+ mCamera.addCallbackBuffer(callback.mBuffer1);
+ mCamera.addCallbackBuffer(callback.mBuffer2);
+ mCamera.setPreviewCallbackWithBuffer(callback);
+ mCamera.startPreview();
+ waitForPreviewDone();
+ assertEquals(1, callback.mNumCbWithBuffer1);
+ assertEquals(1, callback.mNumCbWithBuffer2);
+ assertEquals(0, callback.mNumCbWithBuffer3);
- // Test if preview callback with buffer still works during preview.
- callback.mNumCbWithBuffer1 = callback.mNumCbWithBuffer2 = 0;
- mCamera.addCallbackBuffer(callback.mBuffer3);
- waitForPreviewDone();
- assertEquals(0, callback.mNumCbWithBuffer1);
- assertEquals(0, callback.mNumCbWithBuffer2);
- assertEquals(1, callback.mNumCbWithBuffer3);
+ // Test if preview callback with buffer still works during preview.
+ mCamera.addCallbackBuffer(callback.mBuffer3);
+ waitForPreviewDone();
+ assertEquals(1, callback.mNumCbWithBuffer1);
+ assertEquals(1, callback.mNumCbWithBuffer2);
+ assertEquals(1, callback.mNumCbWithBuffer3);
+ mCamera.setPreviewCallbackWithBuffer(null);
+ mCamera.stopPreview();
+ }
terminateMessageLooper();
}
- private final class PreviewCallbackWithBuffer implements PreviewCallback {
+ private final class PreviewCallbackWithBuffer
+ implements android.hardware.Camera.PreviewCallback {
public int mNumCbWithBuffer1, mNumCbWithBuffer2, mNumCbWithBuffer3;
public byte[] mBuffer1, mBuffer2, mBuffer3;
public void onPreviewFrame(byte[] data, Camera camera) {
- assert(data != null);
+ assertNotNull(data);
if (data == mBuffer1) {
mNumCbWithBuffer1++;
} else if (data == mBuffer2) {
@@ -917,21 +939,19 @@
if (!parameters.isZoomSupported()) return;
// Test the zoom parameters.
- assertEquals(parameters.getZoom(), 0); // default zoom should be 0.
+ assertEquals(0, parameters.getZoom()); // default zoom should be 0.
int maxZoom = parameters.getMaxZoom();
assertTrue(maxZoom >= 0);
if (maxZoom > 0) {
// Zoom ratios should be sorted from small to large.
List<Integer> ratios = parameters.getZoomRatios();
- assertEquals(ratios.size(), maxZoom + 1);
- assertEquals(ratios.get(0).intValue(), 100);
+ assertEquals(maxZoom + 1, ratios.size());
+ assertEquals(100, ratios.get(0).intValue());
for (int i = 0; i < ratios.size() - 1; i++) {
assertTrue(ratios.get(i) < ratios.get(i + 1));
}
}
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.startPreview();
waitForPreviewDone();
@@ -962,10 +982,8 @@
if (!parameters.isSmoothZoomSupported()) return;
assertTrue(parameters.isZoomSupported());
- SurfaceHolder mSurfaceHolder;
- mSurfaceHolder = CameraStubActivity.mSurfaceView.getHolder();
ZoomListener zoomListener = new ZoomListener();
- mCamera.setPreviewDisplay(mSurfaceHolder);
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
mCamera.setZoomChangeListener(zoomListener);
mCamera.startPreview();
waitForPreviewDone();
@@ -1001,7 +1019,7 @@
Log.e(TAG, "zoomListener.mStopped = " + zoomListener.mStopped);
zoomListener.mZoomDone.close();
mCamera.startSmoothZoom(maxZoom / 2);
- assertEquals(true, zoomListener.mZoomDone.block(5000));
+ assertTrue(zoomListener.mZoomDone.block(5000));
assertEquals(maxZoom - (maxZoom / 2), zoomListener.mValues.size());
int i = maxZoom - 1;
for(Integer value: zoomListener.mValues) {
@@ -1042,11 +1060,203 @@
public void onZoomChange(int value, boolean stopped, Camera camera) {
mValues.add(value);
assertEquals(value, camera.getParameters().getZoom());
- assertEquals(false, mStopped);
+ assertFalse(mStopped);
mStopped = stopped;
if (stopped) {
mZoomDone.open();
}
}
}
+
+ @UiThreadTest
+ public void testFocusDistances() throws Exception {
+ initializeMessageLooper();
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
+ mCamera.startPreview();
+ waitForPreviewDone();
+ Parameters parameters = mCamera.getParameters();
+
+ // Test every supported focus mode.
+ for (String focusMode: parameters.getSupportedFocusModes()) {
+ parameters.setFocusMode(focusMode);
+ mCamera.setParameters(parameters);
+ parameters = mCamera.getParameters();
+ checkFocusDistances(parameters);
+ if (Parameters.FOCUS_MODE_AUTO.equals(focusMode)
+ || Parameters.FOCUS_MODE_MACRO.equals(focusMode)) {
+ mCamera.autoFocus(mAutoFocusCallback);
+ assertTrue(waitForFocusDone());
+ parameters = mCamera.getParameters();
+ checkFocusDistances(parameters);
+ }
+ }
+
+ // Test if the method throws exception if the argument is invalid.
+ try {
+ parameters.getFocusDistances(null);
+ fail("getFocusDistances should not accept null.");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ parameters.getFocusDistances(new float[2]);
+ fail("getFocusDistances should not accept a float array with two elements.");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+
+ try {
+ parameters.getFocusDistances(new float[4]);
+ fail("getFocusDistances should not accept a float array with four elements.");
+ } catch (IllegalArgumentException e) {
+ // expected
+ }
+ terminateMessageLooper();
+ }
+
+ private void checkFocusDistances(Parameters parameters) {
+ float[] distances = new float[3];
+ parameters.getFocusDistances(distances);
+
+ // Focus distances should be greater than 0.
+ assertTrue(distances[Parameters.FOCUS_DISTANCE_NEAR_INDEX] > 0);
+ assertTrue(distances[Parameters.FOCUS_DISTANCE_OPTIMAL_INDEX] > 0);
+ assertTrue(distances[Parameters.FOCUS_DISTANCE_FAR_INDEX] > 0);
+
+ // Make sure far focus distance >= optimal focus distance >= near focus distance.
+ assertTrue(distances[Parameters.FOCUS_DISTANCE_FAR_INDEX] >=
+ distances[Parameters.FOCUS_DISTANCE_OPTIMAL_INDEX]);
+ assertTrue(distances[Parameters.FOCUS_DISTANCE_OPTIMAL_INDEX] >=
+ distances[Parameters.FOCUS_DISTANCE_NEAR_INDEX]);
+
+ // Far focus distance should be infinity in infinity focus mode.
+ if (Parameters.FOCUS_MODE_INFINITY.equals(parameters.getFocusMode())) {
+ assertEquals(Float.POSITIVE_INFINITY,
+ distances[Parameters.FOCUS_DISTANCE_FAR_INDEX]);
+ }
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "cancelAutofocus",
+ args = {}
+ )
+ })
+ @UiThreadTest
+ public void testCancelAutofocus() throws Exception {
+ initializeMessageLooper();
+ mCamera.setPreviewDisplay(getActivity().getSurfaceView().getHolder());
+ mCamera.startPreview();
+
+ // No op if autofocus is not in progress.
+ mCamera.cancelAutoFocus();
+
+ // Try to cancel autofocus immediately.
+ mCamera.autoFocus(mAutoFocusCallback);
+ mCamera.cancelAutoFocus();
+ checkFocusDistanceNotChanging();
+
+ // Try to cancel autofocus after it starts for some time.
+ mCamera.autoFocus(mAutoFocusCallback);
+ Thread.sleep(500);
+ mCamera.cancelAutoFocus();
+ checkFocusDistanceNotChanging();
+
+ // Try to cancel autofocus after it completes. It should be no op.
+ mCamera.autoFocus(mAutoFocusCallback);
+ assertTrue(waitForFocusDone());
+ mCamera.cancelAutoFocus();
+
+ // Test the case calling cancelAutoFocus and release in a row.
+ mCamera.autoFocus(mAutoFocusCallback);
+ mCamera.cancelAutoFocus();
+ mCamera.release();
+
+ // Ensure the camera can be opened if release is called right after AF.
+ mCamera = Camera.open();
+ mCamera.startPreview();
+ mCamera.autoFocus(mAutoFocusCallback);
+ mCamera.release();
+
+ terminateMessageLooper();
+ }
+
+ private void checkFocusDistanceNotChanging() throws Exception {
+ float[] distances1 = new float[3];
+ float[] distances2 = new float[3];
+ Parameters parameters = mCamera.getParameters();
+ parameters.getFocusDistances(distances1);
+ Thread.sleep(100);
+ parameters = mCamera.getParameters();
+ parameters.getFocusDistances(distances2);
+ assertEquals(distances1[Parameters.FOCUS_DISTANCE_NEAR_INDEX],
+ distances2[Parameters.FOCUS_DISTANCE_NEAR_INDEX]);
+ assertEquals(distances1[Parameters.FOCUS_DISTANCE_OPTIMAL_INDEX],
+ distances2[Parameters.FOCUS_DISTANCE_OPTIMAL_INDEX]);
+ assertEquals(distances1[Parameters.FOCUS_DISTANCE_FAR_INDEX],
+ distances2[Parameters.FOCUS_DISTANCE_FAR_INDEX]);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getNumberOfCameras",
+ args = {int.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getCameraInfo",
+ args = {int.class, CameraInfo.class}
+ ),
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "open",
+ args = {int.class}
+ )
+ })
+ @UiThreadTest
+ public void testMultipleCameras() throws Exception {
+ int nCameras = Camera.getNumberOfCameras();
+ Log.v(TAG, "total " + nCameras + " cameras");
+ assertTrue(nCameras > 0);
+
+ for (int id = -1; id <= nCameras; id++) {
+ Log.v(TAG, "testing camera #" + id);
+
+ boolean isBadId = (id < 0 || id >= nCameras);
+
+ CameraInfo info = new CameraInfo();
+ try {
+ Camera.getCameraInfo(id, info);
+ if (isBadId) {
+ fail("getCameraInfo should not accept bad cameraId (" + id + ")");
+ }
+ } catch (RuntimeException e) {
+ if (!isBadId) throw e;
+ }
+
+ int facing = info.mFacing;
+ int orientation = info.mOrientation;
+ assertTrue(facing == CameraInfo.CAMERA_FACING_BACK ||
+ facing == CameraInfo.CAMERA_FACING_FRONT);
+ assertTrue(orientation == 0 || orientation == 90 ||
+ orientation == 180 || orientation == 270);
+
+ Camera camera = null;
+ try {
+ camera = Camera.open(id);
+ if (isBadId) {
+ fail("open() should not accept bad cameraId (" + id + ")");
+ }
+ } catch (RuntimeException e) {
+ if (!isBadId) throw e;
+ } finally {
+ if (camera != null) {
+ camera.release();
+ }
+ }
+ }
+ }
}
diff --git a/tests/tests/jni/libjnitest/helper.h b/tests/tests/jni/libjnitest/helper.h
index 6771d2f..58a3407 100644
--- a/tests/tests/jni/libjnitest/helper.h
+++ b/tests/tests/jni/libjnitest/helper.h
@@ -47,7 +47,7 @@
* @param ... printf-style arguments
* @return an allocated (char *) containing the formatted result
*/
-char *failure(const char *format, ...);
+char *failure(const char *format, ...) __attribute__((format(printf, 1, 2)));
/**
* Runs a list of tests. It will run all the tests, collecting as output
diff --git a/tests/tests/media/src/android/media/cts/CamcorderProfileTest.java b/tests/tests/media/src/android/media/cts/CamcorderProfileTest.java
new file mode 100644
index 0000000..b94da11
--- /dev/null
+++ b/tests/tests/media/src/android/media/cts/CamcorderProfileTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+
+package android.media.cts;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.hardware.Camera;
+import android.media.CamcorderProfile;
+import android.test.AndroidTestCase;
+import android.util.Log;
+
+import java.util.List;
+
+@TestTargetClass(CamcorderProfile.class)
+public class CamcorderProfileTest extends AndroidTestCase {
+
+ private static final String TAG = "CamcorderProfileTest";
+
+ private void checkProfile(CamcorderProfile profile) {
+ Log.v(TAG, String.format("profile: duration=%d, quality=%d, " +
+ "fileFormat=%d, videoCodec=%d, videoBitRate=%d, videoFrameRate=%d, " +
+ "videoFrameWidth=%d, videoFrameHeight=%d, audioCodec=%d, " +
+ "audioBitRate=%d, audioSampleRate=%d, audioChannels=%d",
+ profile.duration,
+ profile.quality,
+ profile.fileFormat,
+ profile.videoCodec,
+ profile.videoBitRate,
+ profile.videoFrameRate,
+ profile.videoFrameWidth,
+ profile.videoFrameHeight,
+ profile.audioCodec,
+ profile.audioBitRate,
+ profile.audioSampleRate,
+ profile.audioChannels));
+ assertTrue(profile.duration > 0);
+ assertTrue(profile.quality == CamcorderProfile.QUALITY_LOW ||
+ profile.quality == CamcorderProfile.QUALITY_HIGH);
+ assertTrue(profile.videoBitRate > 0);
+ assertTrue(profile.videoFrameRate > 0);
+ assertTrue(profile.videoFrameWidth > 0);
+ assertTrue(profile.videoFrameHeight > 0);
+ assertTrue(profile.audioBitRate > 0);
+ assertTrue(profile.audioSampleRate > 0);
+ assertTrue(profile.audioChannels > 0);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "get",
+ args = {int.class}
+ )
+ })
+ public void testGet() {
+ CamcorderProfile lowProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
+ CamcorderProfile highProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
+ checkProfile(lowProfile);
+ checkProfile(highProfile);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "get",
+ args = {int.class, int.class}
+ )
+ })
+ public void testGetWithId() {
+ int nCamera = Camera.getNumberOfCameras();
+ for (int id = 0; id < nCamera; id++) {
+ CamcorderProfile lowProfile = CamcorderProfile.get(id,
+ CamcorderProfile.QUALITY_LOW);
+ CamcorderProfile highProfile = CamcorderProfile.get(id,
+ CamcorderProfile.QUALITY_HIGH);
+ checkProfile(lowProfile);
+ checkProfile(highProfile);
+ }
+ }
+}
diff --git a/tests/tests/media/src/android/media/cts/CameraProfileTest.java b/tests/tests/media/src/android/media/cts/CameraProfileTest.java
new file mode 100644
index 0000000..72cd296
--- /dev/null
+++ b/tests/tests/media/src/android/media/cts/CameraProfileTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+package android.media.cts;
+
+import dalvik.annotation.TestLevel;
+import dalvik.annotation.TestTargetClass;
+import dalvik.annotation.TestTargetNew;
+import dalvik.annotation.TestTargets;
+
+import android.hardware.Camera;
+import android.media.CameraProfile;
+import android.test.AndroidTestCase;
+import android.util.Log;
+
+import java.util.List;
+
+@TestTargetClass(CameraProfile.class)
+public class CameraProfileTest extends AndroidTestCase {
+
+ private static final String TAG = "CameraProfileTest";
+
+ private void checkQuality(int low, int mid, int high) {
+ Log.v(TAG, "low = " + low + ", mid = " + mid + ", high = " + high);
+ assertTrue(low >= 0 && low <= 100);
+ assertTrue(mid >= 0 && mid <= 100);
+ assertTrue(high >= 0 && high <= 100);
+ assertTrue(low <= mid && mid <= high);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getJpegEncodingQualityParameter",
+ args = {int.class}
+ )
+ })
+ public void testGetImageEncodingQualityParameter() {
+ int low = CameraProfile.getJpegEncodingQualityParameter(CameraProfile.QUALITY_LOW);
+ int mid = CameraProfile.getJpegEncodingQualityParameter(CameraProfile.QUALITY_MEDIUM);
+ int high = CameraProfile.getJpegEncodingQualityParameter(CameraProfile.QUALITY_HIGH);
+ checkQuality(low, mid, high);
+ }
+
+ @TestTargets({
+ @TestTargetNew(
+ level = TestLevel.COMPLETE,
+ method = "getJpegEncodingQualityParameter",
+ args = {int.class, int.class}
+ )
+ })
+ public void testGetWithId() {
+ int nCamera = Camera.getNumberOfCameras();
+ for (int id = 0; id < nCamera; id++) {
+ int low = CameraProfile.getJpegEncodingQualityParameter(id, CameraProfile.QUALITY_LOW);
+ int mid = CameraProfile.getJpegEncodingQualityParameter(id, CameraProfile.QUALITY_MEDIUM);
+ int high = CameraProfile.getJpegEncodingQualityParameter(id, CameraProfile.QUALITY_HIGH);
+ checkQuality(low, mid, high);
+ }
+ }
+}
diff --git a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
index e5dc1ff..db9c5be 100644
--- a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
@@ -38,8 +38,8 @@
private final String OUTPUT_PATH;
private static final int RECORD_TIME = 3000;
- private static final int VIDEO_WIDTH = 320;
- private static final int VIDEO_HEIGHT = 240;
+ private static final int VIDEO_WIDTH = 176;
+ private static final int VIDEO_HEIGHT = 144;
private static final int FRAME_RATE = 15;
private static final long MAX_FILE_SIZE = 5000;
private static final int MAX_DURATION_MSEC = 200;
diff --git a/tests/tests/media/src/android/media/cts/VideoEditorTest.java b/tests/tests/media/src/android/media/cts/VideoEditorTest.java
new file mode 100644
index 0000000..481f4d6
--- /dev/null
+++ b/tests/tests/media/src/android/media/cts/VideoEditorTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package android.media.cts;
+
+import com.android.cts.stub.R;
+
+import android.test.ActivityInstrumentationTestCase2;
+
+public class VideoEditorTest extends ActivityInstrumentationTestCase2<MediaStubActivity> {
+
+ public VideoEditorTest() {
+ super(MediaStubActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ //setup for each test case.
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ //Test case clean up.
+ super.tearDown();
+ }
+}
diff --git a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
index 3f75f94..a97aa96 100644
--- a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
@@ -17,12 +17,15 @@
package android.telephony.cts;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.os.SystemClock;
import android.telephony.TelephonyManager;
import android.telephony.SmsManager;
import android.test.AndroidTestCase;
@@ -50,6 +53,12 @@
private static final String SMS_SEND_ACTION = "CTS_SMS_SEND_ACTION";
private static final String SMS_DELIVERY_ACTION = "CTS_SMS_DELIVERY_ACTION";
+ // List of network operators that don't support SMS delivery report
+ private static final List<String> NO_DELIVERY_REPORTS =
+ Arrays.asList(
+ "310410" // AT&T Mobility
+ );
+
private TelephonyManager mTelephonyManager;
private String mDestAddr;
private String mText;
@@ -59,6 +68,7 @@
private PendingIntent mDeliveredIntent;
private Intent mSendIntent;
private Intent mDeliveryIntent;
+ private boolean mDeliveryReportSupported;
private static final int TIME_OUT = 1000 * 60 * 4;
@@ -69,6 +79,18 @@
(TelephonyManager) getContext().getSystemService(Context.TELEPHONY_SERVICE);
mDestAddr = mTelephonyManager.getLine1Number();
mText = "This is a test message";
+
+ if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
+ // CDMA supports SMS delivery report
+ mDeliveryReportSupported = true;
+ } else if (mTelephonyManager.getDeviceId().equals("000000000000000")) {
+ // emulator doesn't support SMS delivery report
+ mDeliveryReportSupported = false;
+ } else {
+ // is this a GSM network that doesn't support SMS delivery report?
+ String mccmnc = mTelephonyManager.getSimOperator();
+ mDeliveryReportSupported = !(NO_DELIVERY_REPORTS.contains(mccmnc));
+ }
}
@TestTargetNew(
@@ -120,8 +142,10 @@
// send single text sms
init();
sendTextMessage(mDestAddr, mDestAddr, mSentIntent, mDeliveredIntent);
- mSendReceiver.waitForCalls(1, TIME_OUT);
- mDeliveryReceiver.waitForCalls(1, TIME_OUT);
+ assertTrue(mSendReceiver.waitForCalls(1, TIME_OUT));
+ if (mDeliveryReportSupported) {
+ assertTrue(mDeliveryReceiver.waitForCalls(1, TIME_OUT));
+ }
if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
// TODO: temp workaround, OCTET encoding for EMS not properly supported
@@ -134,8 +158,10 @@
init();
sendDataMessage(mDestAddr, port, data, mSentIntent, mDeliveredIntent);
- mSendReceiver.waitForCalls(1, TIME_OUT);
- mDeliveryReceiver.waitForCalls(1, TIME_OUT);
+ assertTrue(mSendReceiver.waitForCalls(1, TIME_OUT));
+ if (mDeliveryReportSupported) {
+ assertTrue(mDeliveryReceiver.waitForCalls(1, TIME_OUT));
+ }
// send multi parts text sms
init();
@@ -148,8 +174,10 @@
deliveryIntents.add(PendingIntent.getBroadcast(getContext(), 0, mDeliveryIntent, 0));
}
sendMultiPartTextMessage(mDestAddr, parts, sentIntents, deliveryIntents);
- mSendReceiver.waitForCalls(numParts, TIME_OUT);
- mDeliveryReceiver.waitForCalls(numParts, TIME_OUT);
+ assertTrue(mSendReceiver.waitForCalls(numParts, TIME_OUT));
+ if (mDeliveryReportSupported) {
+ assertTrue(mDeliveryReceiver.waitForCalls(numParts, TIME_OUT));
+ }
}
private void init() {
@@ -220,12 +248,20 @@
}
}
- public void waitForCalls(int expectedCalls, long timeout) throws InterruptedException {
+ public boolean waitForCalls(int expectedCalls, long timeout) throws InterruptedException {
synchronized(mLock) {
mExpectedCalls = expectedCalls;
- if (mCalls < mExpectedCalls) {
- mLock.wait(timeout);
+ long startTime = SystemClock.elapsedRealtime();
+
+ while (mCalls < mExpectedCalls) {
+ long waitTime = timeout - (SystemClock.elapsedRealtime() - startTime);
+ if (waitTime > 0) {
+ mLock.wait(waitTime);
+ } else {
+ return false; // timed out
+ }
}
+ return true; // success
}
}
}
diff --git a/tests/tests/telephony/src/android/telephony/cts/SmsMessageTest.java b/tests/tests/telephony/src/android/telephony/cts/SmsMessageTest.java
index 44b0871..515f8b5 100644
--- a/tests/tests/telephony/src/android/telephony/cts/SmsMessageTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SmsMessageTest.java
@@ -212,7 +212,7 @@
assertEquals(SCA2, sms.getServiceCenterAddress());
assertEquals(OA2, sms.getOriginatingAddress());
assertEquals(MESSAGE_BODY2, sms.getMessageBody());
- CharSequence msgBody = (CharSequence) sms.getMessageBody();
+ CharSequence msgBody = sms.getMessageBody();
result = SmsMessage.calculateLength(msgBody, false);
assertEquals(SMS_NUMBER2, result[0]);
assertEquals(sms.getMessageBody().length(), result[1]);
diff --git a/tests/tests/telephony/src/android/telephony/gsm/cts/SmsManagerTest.java b/tests/tests/telephony/src/android/telephony/gsm/cts/SmsManagerTest.java
index 8dc6936..512e89d 100644
--- a/tests/tests/telephony/src/android/telephony/gsm/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/gsm/cts/SmsManagerTest.java
@@ -28,6 +28,7 @@
@TestTargetClass(SmsManager.class)
public class SmsManagerTest extends android.telephony.cts.SmsManagerTest {
+ @Override
@TestTargetNew(
level = TestLevel.COMPLETE,
method = "getDefault",
diff --git a/tests/tests/util/src/android/util/cts/TimeUtilsTest.java b/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
index 8a720ef..47e37a0 100644
--- a/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
+++ b/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
@@ -21,8 +21,6 @@
import dalvik.annotation.TestTargetNew;
import dalvik.annotation.TestTargets;
-import org.apache.harmony.luni.internal.util.ZoneInfoDB;
-
import android.util.TimeUtils;
import java.util.Calendar;
@@ -473,20 +471,6 @@
}
}
- @TestTargets({
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- notes = "Test method: getTimeZoneDatabaseVersion",
- method = "getTimeZoneDatabaseVersion",
- args = {}
- )
- })
- public void testGetTimeZoneDatabaseVersion(){
- String version = TimeUtils.getTimeZoneDatabaseVersion();
- assertTrue(5 == version.length());
- assertEquals(ZoneInfoDB.getVersion(), version);
- }
-
private static TimeZone guessTimeZone(Calendar c, String country) {
return TimeUtils.getTimeZone(c.get(Calendar.ZONE_OFFSET) + c.get(Calendar.DST_OFFSET),
c.get(Calendar.DST_OFFSET) != 0,
diff --git a/tests/tests/view/src/android/view/cts/MotionEventTest.java b/tests/tests/view/src/android/view/cts/MotionEventTest.java
index beece1e..e4df594 100644
--- a/tests/tests/view/src/android/view/cts/MotionEventTest.java
+++ b/tests/tests/view/src/android/view/cts/MotionEventTest.java
@@ -488,5 +488,13 @@
assertEquals(1, mMotionEvent2.getHistorySize());
mMotionEvent2.recycle();
+
+ try {
+ mMotionEvent2.recycle();
+ fail("recycle() should throw an exception when the event has already been recycled.");
+ } catch (RuntimeException ex) {
+ }
+
+ mMotionEvent2 = null; // since it was recycled, don't try to recycle again in tear down
}
}
diff --git a/tests/tests/view/src/android/view/cts/WindowTest.java b/tests/tests/view/src/android/view/cts/WindowTest.java
index 527f444..0e31888 100644
--- a/tests/tests/view/src/android/view/cts/WindowTest.java
+++ b/tests/tests/view/src/android/view/cts/WindowTest.java
@@ -39,11 +39,13 @@
import android.util.DisplayMetrics;
import android.view.accessibility.AccessibilityEvent;
import android.view.Gravity;
+import android.view.InputQueue;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
+import android.view.SurfaceHolder;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
@@ -1243,6 +1245,14 @@
public void setDefaultWindowFormat(int format) {
super.setDefaultWindowFormat(format);
}
+
+ @Override
+ public void takeSurface(SurfaceHolder.Callback2 callback) {
+ }
+
+ @Override
+ public void takeInputQueue(InputQueue.Callback callback) {
+ }
}
private class MockWindowCallback implements Window.Callback {