summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java51
-rw-r--r--tests/HwAccelerationTest/Android.bp21
-rw-r--r--tests/HwAccelerationTest/Android.mk27
-rw-r--r--tests/JankBench/Android.bp21
-rw-r--r--tests/JankBench/Android.mk38
-rw-r--r--tests/JankBench/app/src/main/jni/Android.bp.converted27
-rw-r--r--tests/JankBench/app/src/main/jni/Android.mk31
-rw-r--r--tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java24
-rw-r--r--tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java23
-rw-r--r--tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java23
-rw-r--r--tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java26
-rw-r--r--tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java27
-rw-r--r--tests/UiBench/Android.bp19
-rw-r--r--tests/UiBench/Android.mk29
-rw-r--r--tests/UsageStatsTest/Android.bp8
-rw-r--r--tests/UsageStatsTest/Android.mk16
-rw-r--r--tests/libs-permissions/Android.bp14
-rw-r--r--tests/libs-permissions/Android.mk15
-rw-r--r--tests/net/java/com/android/server/connectivity/VpnTest.java12
-rw-r--r--tests/privapp-permissions/Android.bp45
-rw-r--r--tests/privapp-permissions/Android.mk48
21 files changed, 251 insertions, 294 deletions
diff --git a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
index bd8c7dd6bd08..26de0b3f6fcd 100644
--- a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
+++ b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
@@ -108,9 +108,8 @@ public class AppLaunch extends InstrumentationTestCase {
private static final String DROP_CACHE_SCRIPT = "/data/local/tmp/dropCache.sh";
private static final String APP_LAUNCH_CMD = "am start -W -n";
private static final String SUCCESS_MESSAGE = "Status: ok";
- private static final String WARNING_MESSAGE = "Warning:";
+ private static final String TOTAL_TIME_MESSAGE = "TotalTime:";
private static final String COMPILE_SUCCESS = "Success";
- private static final String THIS_TIME = "ThisTime:";
private static final String LAUNCH_ITERATION = "LAUNCH_ITERATION - %d";
private static final String TRACE_ITERATION = "TRACE_ITERATION-%d";
private static final String LAUNCH_ITERATION_PREFIX = "LAUNCH_ITERATION";
@@ -831,15 +830,13 @@ public class AppLaunch extends InstrumentationTestCase {
String launchTime = "-1";
String cpuCycles = "-1";
String majorFaults = "-1";
- boolean coldLaunchSuccess = false;
- boolean hotLaunchSuccess = false;
+ boolean launchSuccess = false;
try {
InputStream inputStream = new FileInputStream(parcelDesc.getFileDescriptor());
/* SAMPLE OUTPUT : Cold launch
Starting: Intent { cmp=com.google.android.calculator/com.android.calculator2.Calculator }
Status: ok
Activity: com.google.android.calculator/com.android.calculator2.Calculator
- ThisTime: 357
TotalTime: 357
WaitTime: 377
Complete*/
@@ -848,7 +845,6 @@ public class AppLaunch extends InstrumentationTestCase {
Warning: Activity not started, its current task has been brought to the front
Status: ok
Activity: com.google.android.calculator/com.android.calculator2.CalculatorGoogle
- ThisTime: 60
TotalTime: 60
WaitTime: 67
Complete*/
@@ -859,54 +855,37 @@ public class AppLaunch extends InstrumentationTestCase {
Total test time,1.462129,seconds,*/
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(
inputStream));
- String line = null;
- int lineCount = 1;
+ String line;
mBufferedWriter.newLine();
mBufferedWriter.write(headerInfo);
mBufferedWriter.newLine();
while ((line = bufferedReader.readLine()) != null) {
- if (lineCount == 2 && line.startsWith(SUCCESS_MESSAGE)) {
- coldLaunchSuccess = true;
+ mBufferedWriter.write(line);
+ mBufferedWriter.newLine();
+ if (line.startsWith(SUCCESS_MESSAGE)) {
+ launchSuccess = true;
}
- if (lineCount == 2 && line.startsWith(WARNING_MESSAGE)) {
- hotLaunchSuccess = true;
+ if (!launchSuccess) {
+ continue;
}
// Parse TotalTime which is the launch time
- if (coldLaunchSuccess && lineCount == 5) {
- String launchSplit[] = line.split(":");
- launchTime = launchSplit[1].trim();
- }
- if (hotLaunchSuccess && lineCount == 6) {
+ if (line.startsWith(TOTAL_TIME_MESSAGE)) {
String launchSplit[] = line.split(":");
launchTime = launchSplit[1].trim();
}
if (mSimplePerfAppOnly) {
- // Parse simpleperf output.
- if ((lineCount == 9 && coldLaunchSuccess)
- || (lineCount == 10 && hotLaunchSuccess)) {
- if (!line.contains("cpu-cycles")) {
- Log.e(TAG, "Error in simpleperf output");
- } else {
- cpuCycles = line.split(",")[0].trim();
- }
- } else if ((lineCount == 10 && coldLaunchSuccess)
- || (lineCount == 11 && hotLaunchSuccess)) {
- if (!line.contains("major-faults")) {
- Log.e(TAG, "Error in simpleperf output");
- } else {
- majorFaults = line.split(",")[0].trim();
- }
+ if (line.contains(",cpu-cycles,")) {
+ cpuCycles = line.split(",")[0].trim();
+ } else if (line.contains(",major-faults,")) {
+ majorFaults = line.split(",")[0].trim();
}
}
- mBufferedWriter.write(line);
- mBufferedWriter.newLine();
- lineCount++;
}
mBufferedWriter.flush();
inputStream.close();
} catch (IOException e) {
- Log.w(TAG, "Error writing the launch file", e);
+ Log.w(TAG, "Error parsing launch time and writing to file", e);
}
return new AppLaunchResult(launchTime, cpuCycles, majorFaults);
}
diff --git a/tests/HwAccelerationTest/Android.bp b/tests/HwAccelerationTest/Android.bp
new file mode 100644
index 000000000000..abcd73b115af
--- /dev/null
+++ b/tests/HwAccelerationTest/Android.bp
@@ -0,0 +1,21 @@
+//
+// Copyright (C) 2010 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.
+//
+
+android_test {
+ name: "HwAccelerationTest",
+ srcs: ["**/*.java"],
+ platform_apis: true,
+}
diff --git a/tests/HwAccelerationTest/Android.mk b/tests/HwAccelerationTest/Android.mk
deleted file mode 100644
index 11ea954c62c7..000000000000
--- a/tests/HwAccelerationTest/Android.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2010 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_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := HwAccelerationTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/JankBench/Android.bp b/tests/JankBench/Android.bp
new file mode 100644
index 000000000000..4ca33154e927
--- /dev/null
+++ b/tests/JankBench/Android.bp
@@ -0,0 +1,21 @@
+android_test {
+ name: "JankBench",
+ manifest: "app/src/main/AndroidManifest.xml",
+ sdk_version: "current",
+ // omit gradle 'build' dir
+ srcs: ["app/src/main/java/**/*.java"],
+ // use appcompat/support lib from the tree, so improvements/
+ // regressions are reflected in test data
+ resource_dirs: ["app/src/main/res"],
+ static_libs: [
+ "android-support-design",
+ "android-support-v4",
+ "android-support-v7-appcompat",
+ "android-support-v7-cardview",
+ "android-support-v7-recyclerview",
+ "android-support-v17-leanback",
+ "apache-commons-math",
+ "junit",
+ ],
+ test_suites: ["device-tests"],
+}
diff --git a/tests/JankBench/Android.mk b/tests/JankBench/Android.mk
deleted file mode 100644
index 291ba78758b4..000000000000
--- a/tests/JankBench/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MANIFEST_FILE := app/src/main/AndroidManifest.xml
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_USE_AAPT2 := true
-
-# omit gradle 'build' dir
-LOCAL_SRC_FILES := $(call all-java-files-under,app/src/main/java)
-
-# use appcompat/support lib from the tree, so improvements/
-# regressions are reflected in test data
-LOCAL_RESOURCE_DIR := \
- $(LOCAL_PATH)/app/src/main/res \
-
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
- $(ANDROID_SUPPORT_DESIGN_TARGETS) \
- android-support-v4 \
- android-support-v7-appcompat \
- android-support-v7-cardview \
- android-support-v7-recyclerview \
- android-support-v17-leanback \
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- apache-commons-math \
- junit
-
-
-LOCAL_PACKAGE_NAME := JankBench
-
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/JankBench/app/src/main/jni/Android.bp.converted b/tests/JankBench/app/src/main/jni/Android.bp.converted
new file mode 100644
index 000000000000..9fecf1599fd9
--- /dev/null
+++ b/tests/JankBench/app/src/main/jni/Android.bp.converted
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 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.
+
+cc_library_shared {
+ name: "libnativebench",
+ cflags: [
+ "-Wno-unused-parameter",
+ "-Wno-unused-variable",
+ ],
+ srcs: [
+ "Bench.cpp",
+ "WorkerPool.cpp",
+ "test.cpp",
+ ],
+ host_ldlibs: ["-llog"],
+}
diff --git a/tests/JankBench/app/src/main/jni/Android.mk b/tests/JankBench/app/src/main/jni/Android.mk
deleted file mode 100644
index 8ba874de0e8a..000000000000
--- a/tests/JankBench/app/src/main/jni/Android.mk
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (C) 2015 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)
-LOCAL_SDK_VERSION := 26
-
-include $(CLEAR_VARS)
-
-LOCAL_CFLAGS = -Wno-unused-parameter
-
-LOCAL_MODULE:= libnativebench
-
-LOCAL_SRC_FILES := \
- Bench.cpp \
- WorkerPool.cpp \
- test.cpp
-
-LOCAL_LDLIBS := -llog
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java
index 915a260f5c79..89d32ab5a925 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadIconChangedEventTest.java
@@ -20,9 +20,8 @@ import static com.google.common.truth.Truth.assertThat;
import android.net.Uri;
import android.os.Parcel;
import android.support.test.runner.AndroidJUnit4;
-import android.telephony.ims.RcsGroupThread;
import android.telephony.ims.RcsGroupThreadIconChangedEvent;
-import android.telephony.ims.RcsParticipant;
+import android.telephony.ims.RcsGroupThreadIconChangedEventDescriptor;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -32,20 +31,27 @@ public class RcsGroupThreadIconChangedEventTest {
@Test
public void testCanUnparcel() {
- RcsGroupThread rcsGroupThread = new RcsGroupThread(1);
- RcsParticipant rcsParticipant = new RcsParticipant(2);
+ int rcsGroupThreadId = 1;
+ int rcsParticipantId = 2;
Uri newIconUri = Uri.parse("content://new_icon");
- RcsGroupThreadIconChangedEvent iconChangedEvent =
- new RcsGroupThreadIconChangedEvent(1234567890, rcsGroupThread, rcsParticipant,
- newIconUri);
+ RcsGroupThreadIconChangedEventDescriptor iconChangedEventDescriptor =
+ new RcsGroupThreadIconChangedEventDescriptor(1234567890, rcsGroupThreadId,
+ rcsParticipantId, newIconUri);
Parcel parcel = Parcel.obtain();
- iconChangedEvent.writeToParcel(parcel, iconChangedEvent.describeContents());
+ iconChangedEventDescriptor.writeToParcel(
+ parcel, iconChangedEventDescriptor.describeContents());
parcel.setDataPosition(0);
- iconChangedEvent = RcsGroupThreadIconChangedEvent.CREATOR.createFromParcel(parcel);
+ iconChangedEventDescriptor =
+ RcsGroupThreadIconChangedEventDescriptor.CREATOR.createFromParcel(parcel);
+
+ RcsGroupThreadIconChangedEvent iconChangedEvent =
+ iconChangedEventDescriptor.createRcsEvent();
+
+
assertThat(iconChangedEvent.getNewIcon()).isEqualTo(newIconUri);
assertThat(iconChangedEvent.getRcsGroupThread().getThreadId()).isEqualTo(1);
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java
index 1384c016daa8..726b9cd6641f 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadNameChangedEventTest.java
@@ -19,9 +19,8 @@ import static com.google.common.truth.Truth.assertThat;
import android.os.Parcel;
import android.support.test.runner.AndroidJUnit4;
-import android.telephony.ims.RcsGroupThread;
import android.telephony.ims.RcsGroupThreadNameChangedEvent;
-import android.telephony.ims.RcsParticipant;
+import android.telephony.ims.RcsGroupThreadNameChangedEventDescriptor;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -32,20 +31,24 @@ public class RcsGroupThreadNameChangedEventTest {
public void testCanUnparcel() {
String newName = "new name";
- RcsGroupThread rcsGroupThread = new RcsGroupThread(1);
- RcsParticipant rcsParticipant = new RcsParticipant(2);
+ int rcsGroupThreadId = 1;
+ int rcsParticipantId = 2;
- RcsGroupThreadNameChangedEvent nameChangedEvent =
- new RcsGroupThreadNameChangedEvent(1234567890, rcsGroupThread, rcsParticipant,
- newName);
+ RcsGroupThreadNameChangedEventDescriptor nameChangedEventDescriptor =
+ new RcsGroupThreadNameChangedEventDescriptor(
+ 1234567890, rcsGroupThreadId, rcsParticipantId, newName);
Parcel parcel = Parcel.obtain();
- nameChangedEvent.writeToParcel(parcel, nameChangedEvent.describeContents());
+ nameChangedEventDescriptor.writeToParcel(
+ parcel, nameChangedEventDescriptor.describeContents());
parcel.setDataPosition(0);
- nameChangedEvent = RcsGroupThreadNameChangedEvent.CREATOR.createFromParcel(
- parcel);
+ nameChangedEventDescriptor = RcsGroupThreadNameChangedEventDescriptor.CREATOR
+ .createFromParcel(parcel);
+
+ RcsGroupThreadNameChangedEvent nameChangedEvent =
+ nameChangedEventDescriptor.createRcsEvent();
assertThat(nameChangedEvent.getNewName()).isEqualTo(newName);
assertThat(nameChangedEvent.getRcsGroupThread().getThreadId()).isEqualTo(1);
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java
index d0af7db90627..a109310076d2 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantJoinedEventTest.java
@@ -19,9 +19,8 @@ import static com.google.common.truth.Truth.assertThat;
import android.os.Parcel;
import android.support.test.runner.AndroidJUnit4;
-import android.telephony.ims.RcsGroupThread;
import android.telephony.ims.RcsGroupThreadParticipantJoinedEvent;
-import android.telephony.ims.RcsParticipant;
+import android.telephony.ims.RcsGroupThreadParticipantJoinedEventDescriptor;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -31,20 +30,24 @@ public class RcsGroupThreadParticipantJoinedEventTest {
@Test
public void testCanUnparcel() {
- RcsGroupThread rcsGroupThread = new RcsGroupThread(1);
- RcsParticipant rcsParticipant = new RcsParticipant(2);
+ int rcsGroupThreadId = 1;
+ int rcsParticipantId = 2;
- RcsGroupThreadParticipantJoinedEvent participantJoinedEvent =
- new RcsGroupThreadParticipantJoinedEvent(1234567890, rcsGroupThread, rcsParticipant,
- rcsParticipant);
+ RcsGroupThreadParticipantJoinedEventDescriptor participantJoinedEventDescriptor =
+ new RcsGroupThreadParticipantJoinedEventDescriptor(
+ 1234567890, rcsGroupThreadId, rcsParticipantId, rcsParticipantId);
Parcel parcel = Parcel.obtain();
- participantJoinedEvent.writeToParcel(parcel, participantJoinedEvent.describeContents());
+ participantJoinedEventDescriptor.writeToParcel(
+ parcel, participantJoinedEventDescriptor.describeContents());
parcel.setDataPosition(0);
- participantJoinedEvent = RcsGroupThreadParticipantJoinedEvent.CREATOR.createFromParcel(
- parcel);
+ participantJoinedEventDescriptor = RcsGroupThreadParticipantJoinedEventDescriptor.CREATOR
+ .createFromParcel(parcel);
+
+ RcsGroupThreadParticipantJoinedEvent participantJoinedEvent =
+ participantJoinedEventDescriptor.createRcsEvent();
assertThat(participantJoinedEvent.getJoinedParticipant().getId()).isEqualTo(2);
assertThat(participantJoinedEvent.getRcsGroupThread().getThreadId()).isEqualTo(1);
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java
index 7ba5fa653258..de2688c5b8c8 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsGroupThreadParticipantLeftEventTest.java
@@ -19,9 +19,8 @@ import static com.google.common.truth.Truth.assertThat;
import android.os.Parcel;
import android.support.test.runner.AndroidJUnit4;
-import android.telephony.ims.RcsGroupThread;
import android.telephony.ims.RcsGroupThreadParticipantLeftEvent;
-import android.telephony.ims.RcsParticipant;
+import android.telephony.ims.RcsGroupThreadParticipantLeftEventDescriptor;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -30,24 +29,29 @@ import org.junit.runner.RunWith;
public class RcsGroupThreadParticipantLeftEventTest {
@Test
public void testCanUnparcel() {
- RcsGroupThread rcsGroupThread = new RcsGroupThread(1);
- RcsParticipant rcsParticipant = new RcsParticipant(2);
+ int rcsGroupThreadId = 1;
+ int rcsParticipantId = 2;
- RcsGroupThreadParticipantLeftEvent participantLeftEvent =
- new RcsGroupThreadParticipantLeftEvent(1234567890, rcsGroupThread, rcsParticipant,
- rcsParticipant);
+ RcsGroupThreadParticipantLeftEventDescriptor participantLeftEventDescriptor =
+ new RcsGroupThreadParticipantLeftEventDescriptor(
+ 1234567890, rcsGroupThreadId, rcsParticipantId, rcsParticipantId);
Parcel parcel = Parcel.obtain();
- participantLeftEvent.writeToParcel(parcel, participantLeftEvent.describeContents());
+ participantLeftEventDescriptor.writeToParcel(
+ parcel, participantLeftEventDescriptor.describeContents());
parcel.setDataPosition(0);
// create from parcel
parcel.setDataPosition(0);
- participantLeftEvent = RcsGroupThreadParticipantLeftEvent.CREATOR.createFromParcel(
- parcel);
+ participantLeftEventDescriptor = RcsGroupThreadParticipantLeftEventDescriptor.CREATOR
+ .createFromParcel(parcel);
+
+ RcsGroupThreadParticipantLeftEvent participantLeftEvent =
+ participantLeftEventDescriptor.createRcsEvent();
+
assertThat(participantLeftEvent.getRcsGroupThread().getThreadId()).isEqualTo(1);
- assertThat(participantLeftEvent.getLeavingParticipantId().getId()).isEqualTo(2);
+ assertThat(participantLeftEvent.getLeavingParticipant().getId()).isEqualTo(2);
assertThat(participantLeftEvent.getTimestamp()).isEqualTo(1234567890);
}
}
diff --git a/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java b/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java
index 3e2bbbf8256c..57240545e5d8 100644
--- a/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java
+++ b/tests/RcsTests/src/com/android/tests/ims/RcsParticipantAliasChangedEventTest.java
@@ -19,10 +19,9 @@ import static com.google.common.truth.Truth.assertThat;
import android.os.Parcel;
import android.support.test.runner.AndroidJUnit4;
-import android.telephony.ims.RcsParticipant;
import android.telephony.ims.RcsParticipantAliasChangedEvent;
+import android.telephony.ims.RcsParticipantAliasChangedEventDescriptor;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -30,27 +29,27 @@ import org.junit.runner.RunWith;
public class RcsParticipantAliasChangedEventTest {
private static final String OLD_ALIAS = "old alias";
private static final String NEW_ALIAS = "new alias";
- private RcsParticipant mParticipant;
-
- @Before
- public void setUp() {
- mParticipant = new RcsParticipant(3);
- }
+ private int mParticipantId = 3;
@Test
public void testCanUnparcel() {
- RcsParticipantAliasChangedEvent aliasChangedEvent =
- new RcsParticipantAliasChangedEvent(1234567890, mParticipant, NEW_ALIAS);
+ RcsParticipantAliasChangedEventDescriptor aliasChangedEventDescriptor =
+ new RcsParticipantAliasChangedEventDescriptor(
+ 1234567890, mParticipantId, NEW_ALIAS);
Parcel parcel = Parcel.obtain();
- aliasChangedEvent.writeToParcel(parcel, aliasChangedEvent.describeContents());
+ aliasChangedEventDescriptor.writeToParcel(
+ parcel, aliasChangedEventDescriptor.describeContents());
parcel.setDataPosition(0);
- aliasChangedEvent = RcsParticipantAliasChangedEvent.CREATOR.createFromParcel(
- parcel);
+ aliasChangedEventDescriptor = RcsParticipantAliasChangedEventDescriptor.CREATOR
+ .createFromParcel(parcel);
+
+ RcsParticipantAliasChangedEvent aliasChangedEvent =
+ aliasChangedEventDescriptor.createRcsEvent();
- assertThat(aliasChangedEvent.getParticipantId().getId()).isEqualTo(3);
+ assertThat(aliasChangedEvent.getParticipant().getId()).isEqualTo(mParticipantId);
assertThat(aliasChangedEvent.getNewAlias()).isEqualTo(NEW_ALIAS);
assertThat(aliasChangedEvent.getTimestamp()).isEqualTo(1234567890);
}
diff --git a/tests/UiBench/Android.bp b/tests/UiBench/Android.bp
new file mode 100644
index 000000000000..af17b97f2ea7
--- /dev/null
+++ b/tests/UiBench/Android.bp
@@ -0,0 +1,19 @@
+android_test {
+ name: "UiBench",
+ sdk_version: "current",
+ min_sdk_version: "21",
+ // omit gradle 'build' dir
+ srcs: ["src/**/*.java"],
+ // use appcompat/support lib from the tree, so improvements/
+ // regressions are reflected in test data
+ resource_dirs: ["res"],
+ static_libs: [
+ "android-support-design",
+ "android-support-v4",
+ "android-support-v7-appcompat",
+ "android-support-v7-cardview",
+ "android-support-v7-recyclerview",
+ "android-support-v17-leanback",
+ ],
+ test_suites: ["device-tests"],
+}
diff --git a/tests/UiBench/Android.mk b/tests/UiBench/Android.mk
deleted file mode 100644
index c8e6c2091d8f..000000000000
--- a/tests/UiBench/Android.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 21
-
-# omit gradle 'build' dir
-LOCAL_SRC_FILES := $(call all-java-files-under,src)
-
-# use appcompat/support lib from the tree, so improvements/
-# regressions are reflected in test data
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
- $(ANDROID_SUPPORT_DESIGN_TARGETS) \
- android-support-v4 \
- android-support-v7-appcompat \
- android-support-v7-cardview \
- android-support-v7-recyclerview \
- android-support-v17-leanback
-
-LOCAL_PACKAGE_NAME := UiBench
-
-LOCAL_COMPATIBILITY_SUITE := device-tests
-
-include $(BUILD_PACKAGE)
diff --git a/tests/UsageStatsTest/Android.bp b/tests/UsageStatsTest/Android.bp
new file mode 100644
index 000000000000..4995effa1ce9
--- /dev/null
+++ b/tests/UsageStatsTest/Android.bp
@@ -0,0 +1,8 @@
+android_test {
+ name: "UsageStatsTest",
+ // Only compile source java files in this apk.
+ srcs: ["src/**/*.java"],
+ static_libs: ["android-support-v4"],
+ certificate: "platform",
+ platform_apis: true,
+}
diff --git a/tests/UsageStatsTest/Android.mk b/tests/UsageStatsTest/Android.mk
deleted file mode 100644
index 6735c7c8f787..000000000000
--- a/tests/UsageStatsTest/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4
-
-LOCAL_CERTIFICATE := platform
-
-LOCAL_PACKAGE_NAME := UsageStatsTest
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-include $(BUILD_PACKAGE)
diff --git a/tests/libs-permissions/Android.bp b/tests/libs-permissions/Android.bp
new file mode 100644
index 000000000000..16e927a0cbca
--- /dev/null
+++ b/tests/libs-permissions/Android.bp
@@ -0,0 +1,14 @@
+java_library {
+ name: "com.android.test.libs.product",
+ installable: true,
+ product_specific: true,
+ srcs: ["product/java/**/*.java"],
+ required: ["com.android.test.libs.product.xml"],
+}
+
+prebuilt_etc {
+ name: "com.android.test.libs.product.xml",
+ src: "product/com.android.test.libs.product.xml",
+ sub_dir: "permissions",
+ product_specific: true,
+}
diff --git a/tests/libs-permissions/Android.mk b/tests/libs-permissions/Android.mk
deleted file mode 100644
index eb3862390338..000000000000
--- a/tests/libs-permissions/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := com.android.test.libs.product
-LOCAL_PRODUCT_MODULE := true
-LOCAL_SRC_FILES := $(call all-java-files-under, product/java)
-LOCAL_REQUIRED_MODULES := com.android.test.libs.product.xml
-include $(BUILD_JAVA_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := com.android.test.libs.product.xml
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_ETC)/permissions
-LOCAL_SRC_FILES:= product/com.android.test.libs.product.xml
-include $(BUILD_PREBUILT)
diff --git a/tests/net/java/com/android/server/connectivity/VpnTest.java b/tests/net/java/com/android/server/connectivity/VpnTest.java
index f169d6b5bee3..b5d1ff9a0298 100644
--- a/tests/net/java/com/android/server/connectivity/VpnTest.java
+++ b/tests/net/java/com/android/server/connectivity/VpnTest.java
@@ -28,6 +28,7 @@ import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING;
import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
import static android.net.NetworkCapabilities.TRANSPORT_VPN;
import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
+import static android.net.RouteInfo.RTN_UNREACHABLE;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -89,6 +90,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import java.net.Inet4Address;
+import java.net.Inet6Address;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -775,6 +777,16 @@ public class VpnTest {
// V4 does not, but V6 has sufficient coverage again
lp.addRoute(new RouteInfo(new IpPrefix("::/1")));
assertTrue(Vpn.providesRoutesToMostDestinations(lp));
+
+ lp.clear();
+ // V4-unreachable route should not be treated as sufficient coverage
+ lp.addRoute(new RouteInfo(new IpPrefix(Inet4Address.ANY, 0), RTN_UNREACHABLE));
+ assertFalse(Vpn.providesRoutesToMostDestinations(lp));
+
+ lp.clear();
+ // V6-unreachable route should not be treated as sufficient coverage
+ lp.addRoute(new RouteInfo(new IpPrefix(Inet6Address.ANY, 0), RTN_UNREACHABLE));
+ assertFalse(Vpn.providesRoutesToMostDestinations(lp));
}
@Test
diff --git a/tests/privapp-permissions/Android.bp b/tests/privapp-permissions/Android.bp
new file mode 100644
index 000000000000..066d4f94e896
--- /dev/null
+++ b/tests/privapp-permissions/Android.bp
@@ -0,0 +1,45 @@
+android_app {
+ name: "PrivAppPermissionTest",
+ sdk_version: "current",
+ privileged: true,
+ manifest: "system/AndroidManifest.xml",
+ required: ["privapp-permissions-test.xml"],
+}
+
+prebuilt_etc {
+ name: "privapp-permissions-test.xml",
+ src: "system/privapp-permissions-test.xml",
+ sub_dir: "permissions",
+}
+
+android_app {
+ name: "VendorPrivAppPermissionTest",
+ sdk_version: "current",
+ privileged: true,
+ manifest: "vendor/AndroidManifest.xml",
+ vendor: true,
+ required: ["vendorprivapp-permissions-test.xml"],
+}
+
+prebuilt_etc {
+ name: "vendorprivapp-permissions-test.xml",
+ src: "vendor/privapp-permissions-test.xml",
+ sub_dir: "permissions",
+ proprietary: true,
+}
+
+android_app {
+ name: "ProductPrivAppPermissionTest",
+ sdk_version: "current",
+ privileged: true,
+ manifest: "product/AndroidManifest.xml",
+ product_specific: true,
+ required: ["productprivapp-permissions-test.xml"],
+}
+
+prebuilt_etc {
+ name: "productprivapp-permissions-test.xml",
+ src: "product/privapp-permissions-test.xml",
+ sub_dir: "permissions",
+ product_specific: true,
+}
diff --git a/tests/privapp-permissions/Android.mk b/tests/privapp-permissions/Android.mk
deleted file mode 100644
index 9795188559c4..000000000000
--- a/tests/privapp-permissions/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := PrivAppPermissionTest
-LOCAL_SDK_VERSION := current
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_MANIFEST_FILE := system/AndroidManifest.xml
-LOCAL_REQUIRED_MODULES := privapp-permissions-test.xml
-include $(BUILD_PACKAGE)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := privapp-permissions-test.xml
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
-LOCAL_SRC_FILES:= system/privapp-permissions-test.xml
-include $(BUILD_PREBUILT)
-
-include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := VendorPrivAppPermissionTest
-LOCAL_SDK_VERSION := current
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_MANIFEST_FILE := vendor/AndroidManifest.xml
-LOCAL_VENDOR_MODULE := true
-LOCAL_REQUIRED_MODULES := vendorprivapp-permissions-test.xml
-include $(BUILD_PACKAGE)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := vendorprivapp-permissions-test.xml
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/permissions
-LOCAL_SRC_FILES:= vendor/privapp-permissions-test.xml
-include $(BUILD_PREBUILT)
-
-include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := ProductPrivAppPermissionTest
-LOCAL_SDK_VERSION := current
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_MANIFEST_FILE := product/AndroidManifest.xml
-LOCAL_PRODUCT_MODULE := true
-LOCAL_REQUIRED_MODULES := productprivapp-permissions-test.xml
-include $(BUILD_PACKAGE)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := productprivapp-permissions-test.xml
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_ETC)/permissions
-LOCAL_SRC_FILES:= product/privapp-permissions-test.xml
-include $(BUILD_PREBUILT)