CTS: Test WifiNl80211Manager.OemSecurityType
Bug: 150979317 Test: atest android.net.wifi.nl80211.cts Change-Id: I1ad45223641e4e4b88be1fc8f5396b6b4f6abd61
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.wifi.nl80211.cts;
|
||||
|
||||
import static android.net.wifi.nl80211.WifiNl80211Manager.OemSecurityType;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.wifi.ScanResult;
|
||||
import android.net.wifi.cts.WifiFeature;
|
||||
import android.net.wifi.nl80211.WifiNl80211Manager;
|
||||
|
||||
import androidx.test.filters.SmallTest;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/** CTS tests for {@link WifiNl80211Manager}. */
|
||||
@SmallTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class WifiNl80211ManagerTest {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
Context context = InstrumentationRegistry.getInstrumentation().getContext();
|
||||
// skip tests if Wifi is not supported
|
||||
assumeTrue(WifiFeature.isWifiSupported(context));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOemSecurityTypeConstructor() {
|
||||
OemSecurityType securityType = new OemSecurityType(
|
||||
ScanResult.PROTOCOL_WPA,
|
||||
Arrays.asList(ScanResult.KEY_MGMT_PSK, ScanResult.KEY_MGMT_SAE),
|
||||
Arrays.asList(ScanResult.CIPHER_NONE, ScanResult.CIPHER_TKIP),
|
||||
ScanResult.CIPHER_CCMP);
|
||||
|
||||
assertThat(securityType.protocol).isEqualTo(ScanResult.PROTOCOL_WPA);
|
||||
assertThat(securityType.keyManagement)
|
||||
.isEqualTo(Arrays.asList(ScanResult.KEY_MGMT_PSK, ScanResult.KEY_MGMT_SAE));
|
||||
assertThat(securityType.pairwiseCipher)
|
||||
.isEqualTo(Arrays.asList(ScanResult.CIPHER_NONE, ScanResult.CIPHER_TKIP));
|
||||
assertThat(securityType.groupCipher).isEqualTo(ScanResult.CIPHER_CCMP);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user