diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2021-01-13 21:02:56 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2021-01-13 21:02:56 +0000 |
commit | a471cb613a74dcf9ac256291f1838f81de1a42a4 (patch) | |
tree | 2dbfe193a7dae8cb1269cb0a1c07928f88cde0b4 /tests/wifitests/src/com/android/server/wifi/hotspot2/anqp/IPAddressTypeAvailabilityElementTest.java | |
parent | e5b3cdd01585c1f82618aeb7fa0c68e200c51eab (diff) | |
parent | d7a9757d49f900eeb9a82e296a59b3790e0ce256 (diff) | |
download | wifi-android11-mainline-release.tar.gz |
Snap for 7080270 from d7a9757d49f900eeb9a82e296a59b3790e0ce256 to mainline-releaseandroid-mainline-12.0.0_r55android-mainline-11.0.0_r8android-mainline-11.0.0_r7android-mainline-11.0.0_r45android-mainline-11.0.0_r33android-mainline-11.0.0_r10android11-mainline-release
Change-Id: I87dc515cb196aef06379279836663cdabfedca9c
Diffstat (limited to 'tests/wifitests/src/com/android/server/wifi/hotspot2/anqp/IPAddressTypeAvailabilityElementTest.java')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/hotspot2/anqp/IPAddressTypeAvailabilityElementTest.java | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/anqp/IPAddressTypeAvailabilityElementTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/anqp/IPAddressTypeAvailabilityElementTest.java deleted file mode 100644 index 2250871be..000000000 --- a/tests/wifitests/src/com/android/server/wifi/hotspot2/anqp/IPAddressTypeAvailabilityElementTest.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ - -package com.android.server.wifi.hotspot2.anqp; - -import static org.junit.Assert.assertEquals; - -import androidx.test.filters.SmallTest; - -import com.android.server.wifi.WifiBaseTest; - -import org.junit.Test; - -import java.net.ProtocolException; -import java.nio.ByteBuffer; - -/** - * Unit tests for {@link com.android.server.wifi.hotspot2.anqp.IPAddressTypeAvailabilityElement}. - */ -@SmallTest -public class IPAddressTypeAvailabilityElementTest extends WifiBaseTest { - private static final int TEST_IPV4_AVAILABILITY = - IPAddressTypeAvailabilityElement.IPV4_PUBLIC; - private static final int TEST_IPV6_AVAILABILITY = - IPAddressTypeAvailabilityElement.IPV6_AVAILABLE; - - private static int getIPAvailability() { - return (TEST_IPV4_AVAILABILITY << 2) | TEST_IPV6_AVAILABILITY; - } - - /** - * Verify that ProtocolException will be thrown when parsing an empty buffer. - * - * @throws Exception - */ - @Test(expected = ProtocolException.class) - public void parseBufferEmptyBuffer() throws Exception { - IPAddressTypeAvailabilityElement.parse(ByteBuffer.allocate(0)); - } - - /** - * Verify that ProtocolException will be thrown when parsing an buffer containing excess - * data. - * - * @throws Exception - */ - @Test(expected = ProtocolException.class) - public void parseBufferWithExcessData() throws Exception { - ByteBuffer buffer = ByteBuffer.allocate( - IPAddressTypeAvailabilityElement.EXPECTED_BUFFER_LENGTH + 1); - buffer.put((byte) getIPAvailability()); - buffer.put((byte) 0); // Excess data. - buffer.position(0); - IPAddressTypeAvailabilityElement.parse(ByteBuffer.allocate(0)); - } - - /** - * Verify that the expected IPAddressTypeAvailabilityElement is returned when parsing - * a buffer containing the test data. - * - * @throws Exception - */ - @Test - public void parseBufferWithTestData() throws Exception { - ByteBuffer buffer = ByteBuffer.allocate( - IPAddressTypeAvailabilityElement.EXPECTED_BUFFER_LENGTH); - buffer.put((byte) getIPAvailability()); - buffer.position(0); - - IPAddressTypeAvailabilityElement expectedElement = new IPAddressTypeAvailabilityElement( - TEST_IPV4_AVAILABILITY, TEST_IPV6_AVAILABILITY); - assertEquals(expectedElement, IPAddressTypeAvailabilityElement.parse(buffer)); - } -} |