aboutsummaryrefslogtreecommitdiff
path: root/tests/libTestDep
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libTestDep')
-rw-r--r--tests/libTestDep/build.gradle23
-rw-r--r--tests/libTestDep/src/instrumentTest/java/com/android/tests/libdeps/MainActivityTest.java61
-rw-r--r--tests/libTestDep/src/main/AndroidManifest.xml21
-rw-r--r--tests/libTestDep/src/main/java/com/android/tests/libdeps/MainActivity.java15
-rw-r--r--tests/libTestDep/src/main/res/drawable-hdpi/ic_launcher.pngbin0 -> 4147 bytes
-rw-r--r--tests/libTestDep/src/main/res/drawable-ldpi/ic_launcher.pngbin0 -> 1723 bytes
-rw-r--r--tests/libTestDep/src/main/res/drawable-mdpi/ic_launcher.pngbin0 -> 2574 bytes
-rw-r--r--tests/libTestDep/src/main/res/layout/lib1_main.xml13
-rw-r--r--tests/libTestDep/src/main/res/values/strings.xml7
9 files changed, 140 insertions, 0 deletions
diff --git a/tests/libTestDep/build.gradle b/tests/libTestDep/build.gradle
new file mode 100644
index 0000000..001edb0
--- /dev/null
+++ b/tests/libTestDep/build.gradle
@@ -0,0 +1,23 @@
+buildscript {
+ repositories {
+ maven { url '../../../../out/host/gradle/repo' }
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.5.0-SNAPSHOT'
+ }
+}
+
+apply plugin: 'android-library'
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ compile 'com.google.guava:guava:11.0.2'
+}
+
+android {
+ compileSdkVersion 15
+ buildToolsVersion "17.0"
+} \ No newline at end of file
diff --git a/tests/libTestDep/src/instrumentTest/java/com/android/tests/libdeps/MainActivityTest.java b/tests/libTestDep/src/instrumentTest/java/com/android/tests/libdeps/MainActivityTest.java
new file mode 100644
index 0000000..23c8303
--- /dev/null
+++ b/tests/libTestDep/src/instrumentTest/java/com/android/tests/libdeps/MainActivityTest.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tests.libdeps;
+
+import android.test.ActivityInstrumentationTestCase2;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.widget.TextView;
+import com.android.tests.libdeps.MainActivity;
+import com.google.common.base.Splitter;
+
+/**
+ *
+ */
+public class MainActivityTest extends ActivityInstrumentationTestCase2<MainActivity> {
+
+ private TextView mLib1TextView1;
+
+ public MainActivityTest() {
+ super(MainActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ final MainActivity a = getActivity();
+ // ensure a valid handle to the activity has been returned
+ assertNotNull(a);
+
+ mLib1TextView1 = (TextView) a.findViewById(R.id.lib1_text1);
+ }
+
+ /**
+ * The name 'test preconditions' is a convention to signal that if this
+ * test doesn't pass, the test case was not set up properly and it might
+ * explain any and all failures in other tests. This is not guaranteed
+ * to run before other tests, as junit uses reflection to find the tests.
+ */
+ @MediumTest
+ public void testPreconditions() {
+ assertNotNull(mLib1TextView1);
+
+ // use some of Guava's class as they should be accessible through the
+ // classpath from the library
+ Iterable<String> segments = Splitter.on("-").split(mLib1TextView1.getText());
+ assertEquals("SUCCESS", segments.iterator().next());
+ }
+}
diff --git a/tests/libTestDep/src/main/AndroidManifest.xml b/tests/libTestDep/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..00deb5c
--- /dev/null
+++ b/tests/libTestDep/src/main/AndroidManifest.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.tests.libdeps"
+ android:versionCode="1"
+ android:versionName="1.0" >
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/lib1_name" >
+ <activity
+ android:name="MainActivity"
+ android:label="@string/lib1_name" >
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest> \ No newline at end of file
diff --git a/tests/libTestDep/src/main/java/com/android/tests/libdeps/MainActivity.java b/tests/libTestDep/src/main/java/com/android/tests/libdeps/MainActivity.java
new file mode 100644
index 0000000..ab764d9
--- /dev/null
+++ b/tests/libTestDep/src/main/java/com/android/tests/libdeps/MainActivity.java
@@ -0,0 +1,15 @@
+package com.android.tests.libdeps;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+import com.android.tests.libdeps.R;
+
+public class MainActivity extends Activity {
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.lib1_main);
+ }
+}
diff --git a/tests/libTestDep/src/main/res/drawable-hdpi/ic_launcher.png b/tests/libTestDep/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..8074c4c
--- /dev/null
+++ b/tests/libTestDep/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/tests/libTestDep/src/main/res/drawable-ldpi/ic_launcher.png b/tests/libTestDep/src/main/res/drawable-ldpi/ic_launcher.png
new file mode 100644
index 0000000..1095584
--- /dev/null
+++ b/tests/libTestDep/src/main/res/drawable-ldpi/ic_launcher.png
Binary files differ
diff --git a/tests/libTestDep/src/main/res/drawable-mdpi/ic_launcher.png b/tests/libTestDep/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..a07c69f
--- /dev/null
+++ b/tests/libTestDep/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/tests/libTestDep/src/main/res/layout/lib1_main.xml b/tests/libTestDep/src/main/res/layout/lib1_main.xml
new file mode 100644
index 0000000..06ec124
--- /dev/null
+++ b/tests/libTestDep/src/main/res/layout/lib1_main.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical" >
+
+ <TextView
+ android:id="@+id/lib1_text1"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/lib1_string" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/tests/libTestDep/src/main/res/values/strings.xml b/tests/libTestDep/src/main/res/values/strings.xml
new file mode 100644
index 0000000..8d20610
--- /dev/null
+++ b/tests/libTestDep/src/main/res/values/strings.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="lib1_name">LibsTest-lib1</string>
+ <string name="lib1_string">SUCCESS-LIB1</string>
+
+</resources> \ No newline at end of file