Merge "Enable host side holo test for L and beyond"
diff --git a/tests/core/libcore/okhttp/Android.mk b/tests/core/libcore/okhttp/Android.mk
new file mode 100644
index 0000000..4fe50ff
--- /dev/null
+++ b/tests/core/libcore/okhttp/Android.mk
@@ -0,0 +1,24 @@
+# Copyright (C) 2014 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
+
+include $(CLEAR_VARS)
+LOCAL_PACKAGE_NAME := android.core.tests.libcore.package.okhttp
+LOCAL_STATIC_JAVA_LIBRARIES := okhttp-nojarjar junit4-target bouncycastle-nojarjar okhttp-tests-nojarjar
+include $(BUILD_CTSCORE_PACKAGE)
diff --git a/tests/core/libcore/okhttp/AndroidManifest.xml b/tests/core/libcore/okhttp/AndroidManifest.xml
new file mode 100644
index 0000000..f69bc83
--- /dev/null
+++ b/tests/core/libcore/okhttp/AndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2014 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.libcore.package.okhttp">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests">
+ <meta-data android:name="listener"
+ android:value="com.android.cts.runner.CtsTestRunListener" />
+ </instrumentation>
+
+</manifest>
diff --git a/tests/core/runner/src/com/android/cts/runner/CtsTestRunListener.java b/tests/core/runner/src/com/android/cts/runner/CtsTestRunListener.java
index 21ef195..5196df1 100644
--- a/tests/core/runner/src/com/android/cts/runner/CtsTestRunListener.java
+++ b/tests/core/runner/src/com/android/cts/runner/CtsTestRunListener.java
@@ -61,15 +61,7 @@
// We might want to move this to /sdcard, if is is mounted/writable.
File cacheDir = getInstrumentation().getTargetContext().getCacheDir();
-
- // Set some properties that the core tests absolutely need.
- System.setProperty("user.language", "en");
- System.setProperty("user.region", "US");
-
- System.setProperty("java.home", cacheDir.getAbsolutePath());
- System.setProperty("user.home", cacheDir.getAbsolutePath());
System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath());
- System.setProperty("user.dir", cacheDir.getAbsolutePath());
// attempt to disable keyguard, if current test has permission to do so
// TODO: move this to a better place, such as InstrumentationTestRunner
@@ -157,7 +149,6 @@
static class TestEnvironment {
private final Locale mDefaultLocale;
private final TimeZone mDefaultTimeZone;
- private final String mUserHome;
private final String mJavaIoTmpDir;
private final HostnameVerifier mHostnameVerifier;
private final SSLSocketFactory mSslSocketFactory;
@@ -165,17 +156,16 @@
TestEnvironment() {
mDefaultLocale = Locale.getDefault();
mDefaultTimeZone = TimeZone.getDefault();
- mUserHome = System.getProperty("user.home");
mJavaIoTmpDir = System.getProperty("java.io.tmpdir");
mHostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
mSslSocketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
}
void reset() {
+ System.setProperties(null);
+ System.setProperty("java.io.tmpdir", mJavaIoTmpDir);
Locale.setDefault(mDefaultLocale);
TimeZone.setDefault(mDefaultTimeZone);
- System.setProperty("user.home", mUserHome);
- System.setProperty("java.io.tmpdir", mJavaIoTmpDir);
Authenticator.setDefault(null);
CookieHandler.setDefault(null);
ResponseCache.setDefault(null);