diff --git a/tests/cts/net/src/android/net/cts/NetworkRequestTest.java b/tests/cts/net/src/android/net/cts/NetworkRequestTest.java new file mode 100644 index 0000000000..c862c77bc7 --- /dev/null +++ b/tests/cts/net/src/android/net/cts/NetworkRequestTest.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2018 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.net.cts; + +import static android.net.NetworkCapabilities.NET_CAPABILITY_MMS; +import static android.net.NetworkCapabilities.TRANSPORT_BLUETOOTH; + +import android.net.NetworkRequest; +import android.test.AndroidTestCase; + +public class NetworkRequestTest extends AndroidTestCase { + public void testCapabilities() { + assertTrue(new NetworkRequest.Builder().addCapability(NET_CAPABILITY_MMS).build() + .hasCapability(NET_CAPABILITY_MMS)); + assertFalse(new NetworkRequest.Builder().removeCapability(NET_CAPABILITY_MMS).build() + .hasCapability(NET_CAPABILITY_MMS)); + } + + public void testTransports() { + assertTrue(new NetworkRequest.Builder().addTransportType(TRANSPORT_BLUETOOTH).build() + .hasTransport(TRANSPORT_BLUETOOTH)); + assertFalse(new NetworkRequest.Builder().removeTransportType(TRANSPORT_BLUETOOTH).build() + .hasTransport(TRANSPORT_BLUETOOTH)); + } +}