Home | History | Annotate | Download | only in cts
      1 /*
      2  * Copyright (C) 2009 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package android.net.cts;
     18 
     19 
     20 import android.net.NetworkInfo.DetailedState;
     21 import android.test.AndroidTestCase;
     22 
     23 public class NetworkInfo_DetailedStateTest extends AndroidTestCase {
     24 
     25     public void testValueOf() {
     26         assertEquals(DetailedState.AUTHENTICATING, DetailedState.valueOf("AUTHENTICATING"));
     27         assertEquals(DetailedState.CONNECTED, DetailedState.valueOf("CONNECTED"));
     28         assertEquals(DetailedState.CONNECTING, DetailedState.valueOf("CONNECTING"));
     29         assertEquals(DetailedState.DISCONNECTED, DetailedState.valueOf("DISCONNECTED"));
     30         assertEquals(DetailedState.DISCONNECTING, DetailedState.valueOf("DISCONNECTING"));
     31         assertEquals(DetailedState.FAILED, DetailedState.valueOf("FAILED"));
     32         assertEquals(DetailedState.IDLE, DetailedState.valueOf("IDLE"));
     33         assertEquals(DetailedState.OBTAINING_IPADDR, DetailedState.valueOf("OBTAINING_IPADDR"));
     34         assertEquals(DetailedState.SCANNING, DetailedState.valueOf("SCANNING"));
     35         assertEquals(DetailedState.SUSPENDED, DetailedState.valueOf("SUSPENDED"));
     36     }
     37 
     38     public void testValues() {
     39         DetailedState[] expected = DetailedState.values();
     40         assertEquals(13, expected.length);
     41         assertEquals(DetailedState.IDLE, expected[0]);
     42         assertEquals(DetailedState.SCANNING, expected[1]);
     43         assertEquals(DetailedState.CONNECTING, expected[2]);
     44         assertEquals(DetailedState.AUTHENTICATING, expected[3]);
     45         assertEquals(DetailedState.OBTAINING_IPADDR, expected[4]);
     46         assertEquals(DetailedState.CONNECTED, expected[5]);
     47         assertEquals(DetailedState.SUSPENDED, expected[6]);
     48         assertEquals(DetailedState.DISCONNECTING, expected[7]);
     49         assertEquals(DetailedState.DISCONNECTED, expected[8]);
     50         assertEquals(DetailedState.FAILED, expected[9]);
     51         assertEquals(DetailedState.BLOCKED, expected[10]);
     52         assertEquals(DetailedState.VERIFYING_POOR_LINK, expected[11]);
     53         assertEquals(DetailedState.CAPTIVE_PORTAL_CHECK, expected[12]);
     54     }
     55 
     56 }
     57