• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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.telephony.ims;
18 
19 import static org.mockito.Mockito.spy;
20 
21 import android.content.Context;
22 import android.telephony.ims.feature.MmTelFeature;
23 import android.telephony.ims.feature.RcsFeature;
24 import android.telephony.ims.stub.ImsFeatureConfiguration;
25 
26 import org.mockito.MockitoAnnotations;
27 
28 /**
29  * Test ImsService compatibility used by mockito to verify functionality.
30  */
31 
32 public class TestImsServiceCompat extends android.telephony.ims.ImsService {
33 
34     public TestMmTelFeature mSpyMmTelFeature;
35     public TestMmTelFeature mTestMmTelFeature;
36 
37     public ImsFeatureConfiguration testFeatureConfig;
38 
39     public long testCaps;
40     public int createMmtelfeatureCount = 0;
41 
TestImsServiceCompat(Context context)42     public TestImsServiceCompat(Context context) {
43         attachBaseContext(context);
44         MockitoAnnotations.initMocks(this);
45         // Must create real MMTelFeature to initialize ImsFeature objects.
46         mTestMmTelFeature = new TestMmTelFeature();
47         mSpyMmTelFeature = spy(mTestMmTelFeature);
48     }
49 
50     @Override
createMmTelFeature(int slotId)51     public MmTelFeature createMmTelFeature(int slotId) {
52         createMmtelfeatureCount++;
53         return mSpyMmTelFeature;
54     }
55 
56     @Override
createRcsFeature(int slotId)57     public RcsFeature createRcsFeature(int slotId) {
58         return null;
59     }
60 
61     @Override
querySupportedImsFeatures()62     public ImsFeatureConfiguration querySupportedImsFeatures() {
63         return testFeatureConfig;
64     }
65 
66     @Override
getImsServiceCapabilities()67     public long getImsServiceCapabilities() {
68         return testCaps;
69     }
70 }
71