summaryrefslogtreecommitdiff
path: root/instrumentation
diff options
context:
space:
mode:
authorMaurice Chu <mochu@google.com>2013-10-16 13:12:22 -0700
committerMaurice Chu <mochu@google.com>2013-10-16 13:12:22 -0700
commit667f9a8a8155c41970a83be1414b57b5e37de336 (patch)
tree59f038d4fa70e54b07f1132eb33ba028ee9bf65d /instrumentation
parent494c055d577c6750ffc2d61165284d602b84c536 (diff)
downloadmultidex-667f9a8a8155c41970a83be1414b57b5e37de336.tar.gz
Initial move of code from frameworks/support/multidex to here
Also, - Removed extraneous Eclipse-specific configuration files that are unnecessary in the Android build tree - Includes the patch to support API level 19 from https://googleplex-android-review.git.corp.google.com/#/c/348129 - Checks for null and returns without patching the classloader when getting the package manager or package name from the passed in Context to MultiDex.install(...) since the Context object is probably a mock context for testing. - Moved the test runners to package com.android.test.runner, which seems to be the standard place for all test runners. Bug: 10674263 Change-Id: Idc894b360bd17db4acb50dd7daa2839ea8ea37e0
Diffstat (limited to 'instrumentation')
-rw-r--r--instrumentation/Android.mk22
-rw-r--r--instrumentation/README.txt6
-rw-r--r--instrumentation/src/com/android/test/runner/MultiDexAndroidJUnitRunner.java33
-rw-r--r--instrumentation/src/com/android/test/runner/MultiDexTestRunner.java31
4 files changed, 92 insertions, 0 deletions
diff --git a/instrumentation/Android.mk b/instrumentation/Android.mk
new file mode 100644
index 0000000..22ee642
--- /dev/null
+++ b/instrumentation/Android.mk
@@ -0,0 +1,22 @@
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android-support-multidex-instrumentation
+LOCAL_JAVA_LIBRARIES := android-support-multidex android-test-lib
+LOCAL_SDK_VERSION := 4
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/instrumentation/README.txt b/instrumentation/README.txt
new file mode 100644
index 0000000..322676b
--- /dev/null
+++ b/instrumentation/README.txt
@@ -0,0 +1,6 @@
+Library Project including compatibility IntrumentationTestRunner
+for multiple dex applications.
+
+This can be used by an Android test project to set up the classloader
+of applications with multiple dexes.
+
diff --git a/instrumentation/src/com/android/test/runner/MultiDexAndroidJUnitRunner.java b/instrumentation/src/com/android/test/runner/MultiDexAndroidJUnitRunner.java
new file mode 100644
index 0000000..afb6e08
--- /dev/null
+++ b/instrumentation/src/com/android/test/runner/MultiDexAndroidJUnitRunner.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.test.runner;
+
+import com.android.test.runner.AndroidJUnitRunner;
+
+import android.os.Bundle;
+import android.support.multidex.MultiDex;
+
+/**
+ * Extends AndroidJUnitRunner to patch up things for GMS Core multi-dex support.
+ */
+public class MultiDexAndroidJUnitRunner extends AndroidJUnitRunner {
+ @Override
+ public void onCreate(Bundle arguments) {
+ MultiDex.install(getTargetContext());
+ super.onCreate(arguments);
+ }
+}
diff --git a/instrumentation/src/com/android/test/runner/MultiDexTestRunner.java b/instrumentation/src/com/android/test/runner/MultiDexTestRunner.java
new file mode 100644
index 0000000..a93a740
--- /dev/null
+++ b/instrumentation/src/com/android/test/runner/MultiDexTestRunner.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.test.runner;
+
+import android.os.Bundle;
+import android.support.multidex.MultiDex;
+import android.test.InstrumentationTestRunner;
+
+public class MultiDexTestRunner extends InstrumentationTestRunner {
+
+ @Override
+ public void onCreate(Bundle arguments) {
+ MultiDex.install(getTargetContext());
+ super.onCreate(arguments);
+ }
+
+}