• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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 package com.android.phone;
17 
18 import static com.google.common.truth.Truth.assertThat;
19 
20 import android.os.PersistableBundle;
21 import android.telephony.CarrierConfigManager;
22 
23 import androidx.test.runner.AndroidJUnit4;
24 
25 import com.android.internal.telephony.PhoneConstants;
26 
27 import org.junit.Test;
28 import org.junit.runner.RunWith;
29 
30 @RunWith(AndroidJUnit4.class)
31 public class CdmaOptionsTest {
32     @Test
shouldAddApnExpandPreference_doesNotExpandOnGsm()33     public void shouldAddApnExpandPreference_doesNotExpandOnGsm() {
34         PersistableBundle bundle = new PersistableBundle();
35         bundle.putBoolean(CarrierConfigManager.KEY_SHOW_APN_SETTING_CDMA_BOOL, true);
36         assertThat(CdmaOptions.shouldAddApnExpandPreference(PhoneConstants.PHONE_TYPE_GSM, bundle))
37                 .isFalse();
38     }
39 
40     @Test
shouldAddApnExpandPreference_showExpandOnCdma()41     public void shouldAddApnExpandPreference_showExpandOnCdma() {
42         PersistableBundle bundle = new PersistableBundle();
43         bundle.putBoolean(CarrierConfigManager.KEY_SHOW_APN_SETTING_CDMA_BOOL, true);
44         assertThat(CdmaOptions.shouldAddApnExpandPreference(PhoneConstants.PHONE_TYPE_CDMA, bundle))
45                 .isTrue();
46     }
47 
48     @Test
shouldAddApnExpandPreference_doesNotExpandOnCdmaIfCarrierConfigDisabled()49     public void shouldAddApnExpandPreference_doesNotExpandOnCdmaIfCarrierConfigDisabled() {
50         PersistableBundle bundle = new PersistableBundle();
51         bundle.putBoolean(CarrierConfigManager.KEY_SHOW_APN_SETTING_CDMA_BOOL, false);
52         assertThat(CdmaOptions.shouldAddApnExpandPreference(PhoneConstants.PHONE_TYPE_CDMA, bundle))
53                 .isFalse();
54     }
55 }
56