DO NOT MERGE: Move the connectivity tests to frameworks/base/tests/net.
This will give us a good place to put all the networking tests.
Fix: 31479480
Test: adb shell am instrument -w -e notClass com.android.server.connectivity.tethering.TetherInterfaceStateMachineTest 'com.android.frameworks.tests.net/android.support.test.runner.AndroidJUnitRunner' # PASS
(cherry picked from commit ecc986d430)
Change-Id: I4c417c2ba0747d2085169e47ae4a99e93c4d8814
This commit is contained in:
80
tests/net/Android.mk
Normal file
80
tests/net/Android.mk
Normal file
@@ -0,0 +1,80 @@
|
||||
#########################################################################
|
||||
# Build FrameworksNetTests package
|
||||
#########################################################################
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# We only want this apk build for tests.
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
|
||||
# Include all test java files.
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, java)
|
||||
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := \
|
||||
frameworks-base-testutils \
|
||||
framework-protos \
|
||||
android-support-test \
|
||||
mockito-target-minus-junit4 \
|
||||
platform-test-annotations \
|
||||
services.core \
|
||||
services.net
|
||||
|
||||
LOCAL_JAVA_LIBRARIES := \
|
||||
android.test.runner
|
||||
|
||||
LOCAL_PACKAGE_NAME := FrameworksNetTests
|
||||
|
||||
LOCAL_CERTIFICATE := platform
|
||||
|
||||
# These are not normally accessible from apps so they must be explicitly included.
|
||||
LOCAL_JNI_SHARED_LIBRARIES := libframeworksnettestsjni \
|
||||
libbacktrace \
|
||||
libbase \
|
||||
libbinder \
|
||||
libc++ \
|
||||
libcutils \
|
||||
liblog \
|
||||
liblzma \
|
||||
libnativehelper \
|
||||
libnetdaidl \
|
||||
libui \
|
||||
libunwind \
|
||||
libutils
|
||||
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
|
||||
|
||||
include $(BUILD_PACKAGE)
|
||||
|
||||
#########################################################################
|
||||
# Build JNI Shared Library
|
||||
#########################################################################
|
||||
|
||||
LOCAL_PATH:= $(LOCAL_PATH)/jni
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE_TAGS := tests
|
||||
|
||||
LOCAL_CFLAGS := -Wall -Wextra -Werror
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
libpcap \
|
||||
hardware/google/apf
|
||||
|
||||
LOCAL_SRC_FILES := $(call all-cpp-files-under)
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := \
|
||||
libbinder \
|
||||
liblog \
|
||||
libcutils \
|
||||
libnativehelper \
|
||||
libnetdaidl
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := \
|
||||
libpcap \
|
||||
libapf
|
||||
|
||||
LOCAL_MODULE := libframeworksnettestsjni
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
57
tests/net/AndroidManifest.xml
Normal file
57
tests/net/AndroidManifest.xml
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 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="com.android.frameworks.tests.net">
|
||||
|
||||
<uses-permission android:name="android.permission.READ_LOGS" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
|
||||
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
|
||||
<uses-permission android:name="android.permission.MANAGE_APP_TOKENS" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
|
||||
<uses-permission android:name="android.permission.REAL_GET_TASKS" />
|
||||
<uses-permission android:name="android.permission.GET_DETAILED_TASKS" />
|
||||
<uses-permission android:name="android.permission.MANAGE_NETWORK_POLICY" />
|
||||
<uses-permission android:name="android.permission.READ_NETWORK_USAGE_HISTORY" />
|
||||
<uses-permission android:name="android.permission.MODIFY_NETWORK_ACCOUNTING" />
|
||||
<uses-permission android:name="android.permission.CONNECTIVITY_INTERNAL" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.MANAGE_USERS" />
|
||||
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
|
||||
<uses-permission android:name="android.permission.MANAGE_DEVICE_ADMINS" />
|
||||
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.PACKET_KEEPALIVE_OFFLOAD" />
|
||||
<uses-permission android:name="android.permission.GET_INTENT_SENDER_INTENT" />
|
||||
<uses-permission android:name="android.permission.MANAGE_ACTIVITY_STACKS" />
|
||||
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||
|
||||
<application>
|
||||
<uses-library android:name="android.test.runner" />
|
||||
</application>
|
||||
|
||||
<instrumentation
|
||||
android:name="android.support.test.runner.AndroidJUnitRunner"
|
||||
android:targetPackage="com.android.frameworks.tests.net"
|
||||
android:label="Frameworks Networking Tests" />
|
||||
</manifest>
|
||||
@@ -26,7 +26,7 @@ import static org.junit.Assert.assertArrayEquals;
|
||||
public class UidRangeTest extends TestCase {
|
||||
|
||||
static {
|
||||
System.loadLibrary("servicestestsjni");
|
||||
System.loadLibrary("frameworksnettestsjni");
|
||||
}
|
||||
|
||||
private static native byte[] readAndWriteNative(byte[] inParcel);
|
||||
@@ -35,7 +35,7 @@ import android.test.AndroidTestCase;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
import static android.system.OsConstants.*;
|
||||
|
||||
import com.android.frameworks.servicestests.R;
|
||||
import com.android.frameworks.tests.net.R;
|
||||
import com.android.internal.util.HexDump;
|
||||
|
||||
import org.mockito.ArgumentCaptor;
|
||||
@@ -75,7 +75,7 @@ public class ApfTest extends AndroidTestCase {
|
||||
super.setUp();
|
||||
MockitoAnnotations.initMocks(this);
|
||||
// Load up native shared library containing APF interpreter exposed via JNI.
|
||||
System.loadLibrary("servicestestsjni");
|
||||
System.loadLibrary("frameworksnettestsjni");
|
||||
}
|
||||
|
||||
// Expected return codes from APF interpreter.
|
||||
Reference in New Issue
Block a user