1/* 2 * Copyright (C) 2016 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 17package com.android.internal.telephony; 18 19import android.os.Bundle; 20import android.os.Parcel; 21import android.telephony.VoLteServiceState; 22import android.test.suitebuilder.annotation.SmallTest; 23 24import junit.framework.TestCase; 25 26 27public class VoLteServiceStateTest extends TestCase { 28 29 @SmallTest 30 public void testGetState() { 31 VoLteServiceState state = new VoLteServiceState(VoLteServiceState.HANDOVER_STARTED); 32 assertEquals(VoLteServiceState.HANDOVER_STARTED, state.getSrvccState()); 33 } 34 35 @SmallTest 36 public void testParcel() { 37 VoLteServiceState state = new VoLteServiceState(VoLteServiceState.HANDOVER_FAILED); 38 Parcel p = Parcel.obtain(); 39 state.writeToParcel(p, 0); 40 p.setDataPosition(0); 41 VoLteServiceState newState = VoLteServiceState.CREATOR.createFromParcel(p); 42 assertEquals(state, newState); 43 } 44 45 @SmallTest 46 public void testCreateFromBundle() { 47 Bundle b = new Bundle(); 48 b.putInt("mSrvccState", VoLteServiceState.HANDOVER_COMPLETED); 49 assertEquals(VoLteServiceState.HANDOVER_COMPLETED, 50 VoLteServiceState.newFromBundle(b).getSrvccState()); 51 } 52 53 @SmallTest 54 public void testFillInNotifierBundle() { 55 Bundle b = new Bundle(); 56 VoLteServiceState state = new VoLteServiceState(VoLteServiceState.HANDOVER_CANCELED); 57 state.fillInNotifierBundle(b); 58 assertEquals(VoLteServiceState.HANDOVER_CANCELED, b.getInt("mSrvccState")); 59 } 60 61 @SmallTest 62 public void testCopy() { 63 VoLteServiceState state = new VoLteServiceState(VoLteServiceState.HANDOVER_STARTED); 64 VoLteServiceState newState = new VoLteServiceState(state); 65 assertEquals(state, newState); 66 } 67} 68 69