Merge "Move more network unit tests to common tests"
This commit is contained in:
@@ -6,6 +6,7 @@ java_defaults {
|
||||
static_libs: [
|
||||
"FrameworksNetCommonTests",
|
||||
"frameworks-base-testutils",
|
||||
"frameworks-net-testutils",
|
||||
"framework-protos",
|
||||
"androidx.test.rules",
|
||||
"mockito-target-minus-junit4",
|
||||
|
||||
@@ -21,6 +21,7 @@ java_library {
|
||||
srcs: ["java/**/*.java"],
|
||||
static_libs: [
|
||||
"androidx.test.rules",
|
||||
"frameworks-net-testutils",
|
||||
"junit",
|
||||
],
|
||||
libs: [
|
||||
|
||||
@@ -19,11 +19,10 @@ package android.net.apf;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
import android.net.shared.ParcelableTestUtil;
|
||||
|
||||
import androidx.test.filters.SmallTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.internal.util.ParcelableTestUtil;
|
||||
import com.android.internal.util.TestUtils;
|
||||
|
||||
import org.junit.Test;
|
||||
@@ -17,7 +17,8 @@
|
||||
package android.net.shared;
|
||||
|
||||
import static android.net.InetAddresses.parseNumericAddress;
|
||||
import static android.net.shared.ParcelableTestUtil.assertFieldCountEquals;
|
||||
|
||||
import static com.android.internal.util.ParcelableTestUtil.assertFieldCountEquals;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
@@ -19,7 +19,8 @@ package android.net.shared;
|
||||
import static android.net.InetAddresses.parseNumericAddress;
|
||||
import static android.net.shared.IpConfigurationParcelableUtil.fromStableParcelable;
|
||||
import static android.net.shared.IpConfigurationParcelableUtil.toStableParcelable;
|
||||
import static android.net.shared.ParcelableTestUtil.assertFieldCountEquals;
|
||||
|
||||
import static com.android.internal.util.ParcelableTestUtil.assertFieldCountEquals;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
package android.net.shared;
|
||||
|
||||
import static android.net.InetAddresses.parseNumericAddress;
|
||||
import static android.net.shared.ParcelableTestUtil.assertFieldCountEquals;
|
||||
import static android.net.shared.ProvisioningConfiguration.fromStableParcelable;
|
||||
|
||||
import static com.android.internal.util.ParcelableTestUtil.assertFieldCountEquals;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
|
||||
30
tests/net/util/Android.bp
Normal file
30
tests/net/util/Android.bp
Normal file
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// Copyright (C) 2019 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.
|
||||
//
|
||||
|
||||
// Common utilities for network tests.
|
||||
java_library {
|
||||
name: "frameworks-net-testutils",
|
||||
srcs: ["java/**/*.java"],
|
||||
// test_current to be also appropriate for CTS tests
|
||||
sdk_version: "test_current",
|
||||
static_libs: [
|
||||
"androidx.annotation_annotation",
|
||||
"junit",
|
||||
],
|
||||
libs: [
|
||||
"android.test.base.stubs",
|
||||
],
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.net.shared;
|
||||
package com.android.internal.util;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.android.internal.util;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.os.ConditionVariable;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerThread;
|
||||
@@ -27,6 +26,8 @@ import android.os.Looper;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public final class TestUtils {
|
||||
@@ -36,7 +37,7 @@ public final class TestUtils {
|
||||
* Block until the given Handler thread becomes idle, or until timeoutMs has passed.
|
||||
*/
|
||||
public static void waitForIdleHandler(HandlerThread handlerThread, long timeoutMs) {
|
||||
waitForIdleHandler(handlerThread.getThreadHandler(), timeoutMs);
|
||||
waitForIdleLooper(handlerThread.getLooper(), timeoutMs);
|
||||
}
|
||||
|
||||
/**
|
||||
Reference in New Issue
Block a user