Add an explicit "example" test, which may be used both for reference and
for verification of the CTS framework.

Change-Id: I2b53d9bd7b599fed1ca09a93c67e33deb02bbdd6
diff --git a/tests/tests/example/Android.mk b/tests/tests/example/Android.mk
new file mode 100644
index 0000000..517931b
--- /dev/null
+++ b/tests/tests/example/Android.mk
@@ -0,0 +1,35 @@
+# 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)
+
+include $(CLEAR_VARS)
+
+LOCAL_PACKAGE_NAME := CtsExampleTestCases # Replace "Example" with your name.
+
+
+# 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/example/AndroidManifest.xml b/tests/tests/example/AndroidManifest.xml
new file mode 100644
index 0000000..e37550d
--- /dev/null
+++ b/tests/tests/example/AndroidManifest.xml
@@ -0,0 +1,34 @@
+<?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.
+-->
+
+<!-- Replace all the "example" stuff below with your package name, and
+     remove this comment.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.cts.example">
+
+    <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.example"
+                     android:label="CTS tests of example component"/>
+
+</manifest>
+
diff --git a/tests/tests/example/src/android/example/Example.java b/tests/tests/example/src/android/example/Example.java
new file mode 100644
index 0000000..bc22d9a
--- /dev/null
+++ b/tests/tests/example/src/android/example/Example.java
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+package android.example;
+
+/**
+ * Example class being tested. In a real test, the classes to test would
+ * live somewhere other than in the test package, but for the sake of
+ * brevity, we include this one here instead.
+ */
+public class Example {
+    /**
+     * Return the standard string indication of a successfuly blorting.
+     *
+     * @returns {@code "blort"}, always
+     */
+    public static String blort() {
+        return "blort";
+    }
+
+    /**
+     * Return the standard string indication of a successfuly zorching.
+     *
+     * @returns {@code "zorch"}, always
+     */
+    public static String zorch() {
+        return "zorch";
+    }
+}
diff --git a/tests/tests/example/src/android/example/cts/ExampleSecondaryTest.java b/tests/tests/example/src/android/example/cts/ExampleSecondaryTest.java
new file mode 100644
index 0000000..a311c55
--- /dev/null
+++ b/tests/tests/example/src/android/example/cts/ExampleSecondaryTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+package android.example.cts;
+
+import android.example.Example;
+
+import dalvik.annotation.TestTargetClass;
+
+import junit.framework.TestCase;
+
+/**
+ * Example test to demonstrate how tests work as well as to serve as a
+ * smoke test for the CTS. This secondary test exists to demonstrate
+ * that you may have more than one test class. Typically you will
+ * separate your test classes by what class or major piece of
+ * functionality is being tested.
+ */
+@TestTargetClass(Example.class)
+public class ExampleSecondaryTest extends TestCase {
+    /*
+     * You can define standard JUnit setUp() and tearDown() methods here,
+     * if needed.
+     *
+     * @Override protected void setUp() throws Exception { ... }
+     * @Override protected void tearDown() throws Exception { ... }
+     */
+
+    /**
+     * Test {@link Example#zorch}.
+     */
+    public void testZorch() {
+        assertEquals("zorch", Example.zorch());
+    }
+
+    // Add more tests here.
+}
diff --git a/tests/tests/example/src/android/example/cts/ExampleTest.java b/tests/tests/example/src/android/example/cts/ExampleTest.java
new file mode 100644
index 0000000..168b490
--- /dev/null
+++ b/tests/tests/example/src/android/example/cts/ExampleTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package android.example.cts;
+
+import android.example.Example;
+
+import dalvik.annotation.TestTargetClass;
+
+import junit.framework.TestCase;
+
+/**
+ * Example test to demonstrate how tests work as well as to serve as
+ * a smoke test for the CTS. (If the example test is "broken," then it
+ * probably means that there's something fundamentally wrong with your
+ * setup.)
+ */
+@TestTargetClass(Example.class)
+public class ExampleTest extends TestCase {
+    /*
+     * You can define standard JUnit setUp() and tearDown() methods here,
+     * if needed.
+     *
+     * @Override protected void setUp() throws Exception { ... }
+     * @Override protected void tearDown() throws Exception { ... }
+     */
+
+    /**
+     * Test {@link Example#blort}.
+     */
+    public void testBlort() {
+        assertEquals("blort", Example.blort());
+    }
+
+    // Add more tests here.
+}