Merge "CoreTests: Tidy up legacy tests."
diff --git a/tests/CoreTests/android/Android.mk b/tests/CoreTests/android/Android.mk
index 56d7918..04f6739 100644
--- a/tests/CoreTests/android/Android.mk
+++ b/tests/CoreTests/android/Android.mk
@@ -7,14 +7,14 @@
$(call all-subdir-java-files)
LOCAL_JAVA_LIBRARIES := \
- android.test.runner \
- bouncycastle \
- conscrypt \
+ android.test.runner.stubs \
org.apache.http.legacy \
- android.test.base \
+ android.test.base.stubs \
+
+LOCAL_SDK_VERSION := current
LOCAL_STATIC_JAVA_LIBRARIES := junit
-LOCAL_PACKAGE_NAME := CoreTests
+LOCAL_PACKAGE_NAME := LegacyCoreTests
include $(BUILD_PACKAGE)
diff --git a/tests/CoreTests/android/core/JniLibTest.java b/tests/CoreTests/android/core/JniLibTest.java
deleted file mode 100644
index d476072..0000000
--- a/tests/CoreTests/android/core/JniLibTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2006 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.core;
-
-import android.test.suitebuilder.annotation.Suppress;
-import android.util.Log;
-import junit.framework.TestCase;
-
-
-@Suppress
-public class JniLibTest extends TestCase {
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- /*
- * This causes the native shared library to be loaded when the
- * class is first used. The library is only loaded once, even if
- * multiple classes include this line.
- *
- * The library must be in java.library.path, which is derived from
- * LD_LIBRARY_PATH. The actual library name searched for will be
- * "libjni_lib_test.so" under Linux, but may be different on other
- * platforms.
- */
- try {
- System.loadLibrary("jni_lib_test");
- } catch (UnsatisfiedLinkError ule) {
- Log.e("JniLibTest", "WARNING: Could not load jni_lib_test natives");
- }
- }
-
- private static native int nativeStaticThing(float f);
- private native void nativeThing(int val);
-
- public void testNativeCall() {
- Log.i("JniLibTest", "JNI search path is "
- + System.getProperty("java.library.path"));
- Log.i("JniLibTest", "'jni_lib_test' becomes '"
- + System.mapLibraryName("jni_lib_test") + "'");
-
- int result = nativeStaticThing(1234.5f);
- nativeThing(result);
- }
-}
diff --git a/tests/CoreTests/android/core/MiscRegressionTest.java b/tests/CoreTests/android/core/MiscRegressionTest.java
deleted file mode 100644
index 32995b5..0000000
--- a/tests/CoreTests/android/core/MiscRegressionTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 android.core;
-
-import android.test.suitebuilder.annotation.MediumTest;
-import java.util.logging.Logger;
-import junit.framework.TestCase;
-
-public class MiscRegressionTest extends TestCase {
-
- // Regression test for #951285: Suitable LogHandler should be chosen
- // depending on the environment.
- @MediumTest
- public void testAndroidLogHandler() throws Exception {
- Logger.global.severe("This has logging Level.SEVERE, should become ERROR");
- Logger.global.warning("This has logging Level.WARNING, should become WARN");
- Logger.global.info("This has logging Level.INFO, should become INFO");
- Logger.global.config("This has logging Level.CONFIG, should become DEBUG");
- Logger.global.fine("This has logging Level.FINE, should become VERBOSE");
- Logger.global.finer("This has logging Level.FINER, should become VERBOSE");
- Logger.global.finest("This has logging Level.FINEST, should become VERBOSE");
- }
-}
diff --git a/tests/CoreTests/android/core/RequestAPITest.java b/tests/CoreTests/android/core/RequestAPITest.java
index 94eb23e..206f228 100644
--- a/tests/CoreTests/android/core/RequestAPITest.java
+++ b/tests/CoreTests/android/core/RequestAPITest.java
@@ -22,7 +22,6 @@
import android.test.suitebuilder.annotation.Suppress;
import android.util.Log;
import android.webkit.CookieSyncManager;
-import com.google.android.collect.Maps;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -87,7 +86,7 @@
* header is attempted to be set
*/
Log.d(LOGTAG, "testRequestAddNullHeader start ");
- Map<String, String> headers = Maps.newHashMap();
+ Map<String, String> headers = new HashMap<>();
headers.put(null, null);
verifyFailure(headers);
Log.d(LOGTAG, "testRequestAddNullHeader - returning");
@@ -99,7 +98,7 @@
* value is attempted to be set
*/
Log.d(LOGTAG, "testRequestAddNullValue start ");
- Map<String, String> headers = Maps.newHashMap();
+ Map<String, String> headers = new HashMap<>();
headers.put("TestHeader", null);
verifyFailure(headers);
Log.d(LOGTAG, "testRequestAddNullValue - returning");
@@ -111,7 +110,7 @@
* header is attempted to be set
*/
Log.d(LOGTAG, "testRequestAddEmptyValue start ");
- Map<String, String> headers = Maps.newHashMap();
+ Map<String, String> headers = new HashMap<>();
headers.put("TestHeader", "");
verifyFailure(headers);
Log.d(LOGTAG, "testRequestAddEmptyValue - returning");
@@ -131,7 +130,7 @@
* generating and exception
*/
Log.d(LOGTAG, "testRequestAddHeader start ");
- Map<String, String> headers = Maps.newHashMap();
+ Map<String, String> headers = new HashMap<>();
headers.put("TestHeader", "RequestAddHeader");
verifySuccess(headers);
Log.d(LOGTAG, "testRequestAddHeader - returning");
@@ -143,7 +142,7 @@
* can be set without generating and exception
*/
Log.d(LOGTAG, "testRequestAddMultiHeader start ");
- Map<String, String> headers = Maps.newHashMap();
+ Map<String, String> headers = new HashMap<>();
headers.put("TestHeader", "RequestAddMultiHeader");
headers.put("TestHeader2", "RequestAddMultiHeader");
headers.put("TestHeader3", "RequestAddMultiHeader");
@@ -157,7 +156,7 @@
* and values can be set without generating and exception
*/
Log.d(LOGTAG, "testRequestAddSameHeader start ");
- Map<String, String> headers = Maps.newHashMap();
+ Map<String, String> headers = new HashMap<>();
headers.put("TestHeader", "RequestAddSameHeader");
headers.put("TestHeader", "RequestAddSameHeader");
headers.put("TestHeader", "RequestAddSameHeader");
diff --git a/tests/CoreTests/android/core/Sha1Test.java b/tests/CoreTests/android/core/Sha1Test.java
deleted file mode 100644
index 8ed1205..0000000
--- a/tests/CoreTests/android/core/Sha1Test.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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 android.core;
-
-import android.test.suitebuilder.annotation.SmallTest;
-import java.security.MessageDigest;
-import junit.framework.TestCase;
-
-/**
- * Tests SHA1 message digest algorithm.
- */
-public class Sha1Test extends TestCase {
- class TestData {
- private String input;
- private String result;
-
- public TestData(String i, String r) {
- input = i;
- result = r;
- }
- }
-
- TestData[] mTestData = new TestData[]{
- new TestData("abc", "a9993e364706816aba3e25717850c26c9cd0d89d"),
- new TestData("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
- "84983e441c3bd26ebaae4aa1f95129e5e54670f1")
- };
-
- @SmallTest
- public void testSha1() throws Exception {
- MessageDigest digest = MessageDigest.getInstance("SHA-1");
-
- int numTests = mTestData.length;
- for (int i = 0; i < numTests; i++) {
- digest.update(mTestData[i].input.getBytes());
- byte[] hash = digest.digest();
- String encodedHash = encodeHex(hash);
- assertEquals(encodedHash, mTestData[i].result);
- }
- }
-
- private static String encodeHex(byte[] bytes) {
- StringBuffer hex = new StringBuffer(bytes.length * 2);
-
- for (int i = 0; i < bytes.length; i++) {
- if (((int) bytes[i] & 0xff) < 0x10) {
- hex.append("0");
- }
- hex.append(Integer.toString((int) bytes[i] & 0xff, 16));
- }
-
- return hex.toString();
- }
-}
-