am 451b9477: Merge "Farewell Magnetometer Test" into gingerbread
* commit '451b94772a56112d04cf67a7ed03fe2f500a8436':
Farewell Magnetometer Test
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index 9e3f0a5..60e6858 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -44,6 +44,7 @@
CtsJniTestCases \
CtsLocationTestCases \
CtsMediaTestCases \
+ CtsNdefTestCases \
CtsOsTestCases \
CtsPermissionTestCases \
CtsPermission2TestCases \
diff --git a/tests/tests/ndef/Android.mk b/tests/tests/ndef/Android.mk
new file mode 100644
index 0000000..4cb0b78
--- /dev/null
+++ b/tests/tests/ndef/Android.mk
@@ -0,0 +1,34 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_PACKAGE_NAME := CtsNdefTestCases
+
+# Don't include this package in any target.
+LOCAL_MODULE_TAGS := optional
+
+# When built, explicitly put it in the data partition.
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+# All tests should include android.test.runner.
+LOCAL_JAVA_LIBRARIES := android.test.runner
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tests/tests/ndef/AndroidManifest.xml b/tests/tests/ndef/AndroidManifest.xml
new file mode 100644
index 0000000..4a65818
--- /dev/null
+++ b/tests/tests/ndef/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.ndef">
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <!-- This is a self-instrumenting test package. -->
+ <instrumentation android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.android.cts.ndef"
+ android:label="CTS tests of NDEF data classes"/>
+
+</manifest>
+
diff --git a/tests/tests/ndef/src/android/ndef/cts/BasicNdefTest.java b/tests/tests/ndef/src/android/ndef/cts/BasicNdefTest.java
new file mode 100644
index 0000000..6e2ac3c
--- /dev/null
+++ b/tests/tests/ndef/src/android/ndef/cts/BasicNdefTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.ndef.cts;
+
+import android.nfc.NdefMessage;
+import android.nfc.NdefRecord;
+import android.nfc.FormatException;
+
+import junit.framework.TestCase;
+
+public class BasicNdefTest extends TestCase {
+ /**
+ * A Smart Poster containing a URL and no text.
+ */
+ public static final byte[] SMART_POSTER_URL_NO_TEXT = new byte[] {
+ (byte) 0xd1, (byte) 0x02, (byte) 0x0f, (byte) 0x53, (byte) 0x70, (byte) 0xd1,
+ (byte) 0x01, (byte) 0x0b, (byte) 0x55, (byte) 0x01, (byte) 0x67, (byte) 0x6f,
+ (byte) 0x6f, (byte) 0x67, (byte) 0x6c, (byte) 0x65, (byte) 0x2e, (byte) 0x63,
+ (byte) 0x6f, (byte) 0x6d
+ };
+
+ public void test_parseSmartPoster() throws FormatException {
+ NdefMessage msg = new NdefMessage(SMART_POSTER_URL_NO_TEXT);
+ NdefRecord[] records = msg.getRecords();
+
+ assertEquals(1, records.length);
+
+ assertEquals(0, records[0].getId().length);
+
+ assertEquals(NdefRecord.TNF_WELL_KNOWN, records[0].getTnf());
+
+ assertByteArrayEquals(NdefRecord.RTD_SMART_POSTER, records[0].getType());
+
+ assertByteArrayEquals(new byte[] {
+ (byte) 0xd1, (byte) 0x01, (byte) 0x0b, (byte) 0x55, (byte) 0x01,
+ (byte) 0x67, (byte) 0x6f, (byte) 0x6f, (byte) 0x67, (byte) 0x6c,
+ (byte) 0x65, (byte) 0x2e, (byte) 0x63, (byte) 0x6f, (byte) 0x6d},
+ records[0].getPayload());
+ }
+
+ private static void assertByteArrayEquals(byte[] b1, byte[] b2) {
+ assertEquals(b1.length, b2.length);
+ for (int i = 0; i < b1.length; i++) {
+ assertEquals(b1[i], b2[i]);
+ }
+ }
+}
diff --git a/tests/tests/os/src/android/os/cts/BuildVersionTest.java b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
index 1c3ec8f..cc15f6f 100644
--- a/tests/tests/os/src/android/os/cts/BuildVersionTest.java
+++ b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
@@ -32,7 +32,7 @@
private static final String LOG_TAG = "BuildVersionTest";
private static final Set<String> EXPECTED_RELEASES =
- new HashSet<String>(Arrays.asList("2.3.3"));
+ new HashSet<String>(Arrays.asList("2.3.3", "2.3.4"));
private static final int EXPECTED_SDK = 10;
public void testReleaseVersion() {
diff --git a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
index 381c97f..2a0bcbe 100755
--- a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
@@ -64,7 +64,8 @@
"45002", // SKT Mobility
"45008", // KT Mobility
"45006", // LGT
- "311660" // MetroPCS
+ "311660", // MetroPCS
+ "310120" // Sprint
);
// List of network operators that doesn't support Data(binary) SMS message