diff --git a/core/tests/coretests/src/android/net/NetworkKeyTest.java b/core/tests/coretests/src/android/net/NetworkKeyTest.java deleted file mode 100644 index 9005188a88fa1..0000000000000 --- a/core/tests/coretests/src/android/net/NetworkKeyTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2014 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; - -import android.os.Parcel; - -import junit.framework.TestCase; - -public class NetworkKeyTest extends TestCase { - public void testValidWifiKey_utf8() { - new WifiKey("\"quotedSsid\"", "AB:CD:01:EF:23:03"); - new WifiKey("\"\"", "AB:CD:01:EF:23:03"); - } - - public void testValidWifiKey_hex() { - new WifiKey("0x1234abcd", "AB:CD:01:EF:23:03"); - } - - public void testInvalidWifiKey_empty() { - try { - new WifiKey("", "AB:CD:01:EF:23:03"); - fail("Should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - empty SSID - } - } - - public void testInvalidWifiKey_unquotedUtf8() { - try { - new WifiKey("unquotedSsid", "AB:CD:01:EF:23:03"); - fail("Should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - empty SSID - } - } - - public void testInvalidWifiKey_invalidHex() { - try { - new WifiKey("0x\"nothex\"", "AB:CD:01:EF:23:03"); - fail("Should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - empty SSID - } - } - - public void testInvalidWifiKey_shortBssid() { - try { - new WifiKey("\"quotedSsid\"", "AB:CD:01:EF:23"); - fail("Should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - BSSID too short - } - } - - public void testInvalidWifiKey_longBssid() { - try { - new WifiKey("\"quotedSsid\"", "AB:CD:01:EF:23:03:11"); - fail("Should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - BSSID too long - } - } - - public void testParceling() { - WifiKey wifiKey = new WifiKey("\"ssid\"", "00:00:00:00:00:00"); - NetworkKey networkKey = new NetworkKey(wifiKey); - Parcel parcel = null; - try { - parcel = Parcel.obtain(); - parcel.writeParcelable(networkKey, 0); - parcel.setDataPosition(0); - networkKey = parcel.readParcelable(getClass().getClassLoader()); - } finally { - if (parcel != null) { - parcel.recycle(); - } - } - - assertEquals(NetworkKey.TYPE_WIFI, networkKey.type); - assertEquals("\"ssid\"", networkKey.wifiKey.ssid); - assertEquals("00:00:00:00:00:00", networkKey.wifiKey.bssid); - } -} diff --git a/core/tests/coretests/src/android/net/RssiCurveTest.java b/core/tests/coretests/src/android/net/RssiCurveTest.java deleted file mode 100644 index d4438df6a3524..0000000000000 --- a/core/tests/coretests/src/android/net/RssiCurveTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2014 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; - -import junit.framework.TestCase; - -public class RssiCurveTest extends TestCase { - public void testLookupScore_constantCurve() { - RssiCurve curve = new RssiCurve(-100, 200, new byte[] { 10 }); - assertEquals(10, curve.lookupScore(-200)); - assertEquals(10, curve.lookupScore(-100)); - assertEquals(10, curve.lookupScore(0)); - assertEquals(10, curve.lookupScore(100)); - assertEquals(10, curve.lookupScore(200)); - } - - public void testLookupScore_changingCurve() { - RssiCurve curve = new RssiCurve(-100, 100, new byte[] { -10, 10 }); - assertEquals(-10, curve.lookupScore(-200)); - assertEquals(-10, curve.lookupScore(-100)); - assertEquals(-10, curve.lookupScore(-50)); - assertEquals(10, curve.lookupScore(0)); - assertEquals(10, curve.lookupScore(50)); - assertEquals(10, curve.lookupScore(100)); - assertEquals(10, curve.lookupScore(200)); - } -} diff --git a/core/tests/coretests/src/android/net/ScoredNetworkTest.java b/core/tests/coretests/src/android/net/ScoredNetworkTest.java deleted file mode 100644 index 7ab69ad2320ec..0000000000000 --- a/core/tests/coretests/src/android/net/ScoredNetworkTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2014 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; - -import android.os.Parcel; - -import junit.framework.TestCase; - -import java.util.Arrays; - -public class ScoredNetworkTest extends TestCase { - private static final RssiCurve CURVE = - new RssiCurve(-110, 10, new byte[] {0, 1, 2, 3, 4, 5, 6, 7}); - - public void testInvalidCurve_nullBuckets() { - try { - new RssiCurve(-110, 10, null); - fail("Should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - } - } - - public void testInvalidCurve_emptyBuckets() { - try { - new RssiCurve(-110, 10, new byte[] {}); - fail("Should have thrown IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // expected - } - } - - public void testParceling() { - NetworkKey key = new NetworkKey(new WifiKey("\"ssid\"", "00:00:00:00:00:00")); - ScoredNetwork network = new ScoredNetwork(key, CURVE); - Parcel parcel = null; - try { - parcel = Parcel.obtain(); - parcel.writeParcelable(network, 0); - parcel.setDataPosition(0); - network = parcel.readParcelable(getClass().getClassLoader()); - } finally { - if (parcel != null) { - parcel.recycle(); - } - } - assertEquals(CURVE.start, network.rssiCurve.start); - assertEquals(CURVE.bucketWidth, network.rssiCurve.bucketWidth); - assertTrue(Arrays.equals(CURVE.rssiBuckets, network.rssiCurve.rssiBuckets)); - } -}