1cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell/*
2cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell * Copyright (C) 2016 The Android Open Source Project
3cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell *
4cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell * Licensed under the Apache License, Version 2.0 (the "License");
5cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell * you may not use this file except in compliance with the License.
6cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell * You may obtain a copy of the License at
7cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell *
8cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell *      http://www.apache.org/licenses/LICENSE-2.0
9cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell *
10cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell * Unless required by applicable law or agreed to in writing, software
11cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell * distributed under the License is distributed on an "AS IS" BASIS,
12cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell * See the License for the specific language governing permissions and
14cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell * limitations under the License
15cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell */
16054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
17cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwellpackage com.android.incallui.ringtone;
18cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell
19cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwellimport android.media.RingtoneManager;
20054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwellimport android.net.Uri;
21cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwellimport android.test.AndroidTestCase;
22054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwellimport android.test.suitebuilder.annotation.SmallTest;
23cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell
24cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwellimport com.android.contacts.common.compat.CompatUtils;
25054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwellimport com.android.incallui.Call;
26cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwellimport com.android.incallui.Call.State;
27054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwellimport com.android.incallui.CallList;
28054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
29054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwellimport org.mockito.Mock;
30054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwellimport org.mockito.Mockito;
31054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwellimport org.mockito.MockitoAnnotations;
32cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell
33054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell@SmallTest
3495bd6e323cf5f1e00411df3760fab1dc5dabdcd6Brandon Maxwellpublic class DialerRingtoneManagerTest extends AndroidTestCase {
35cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell
36054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    private static final Uri RINGTONE_URI = RingtoneManager
37054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            .getDefaultUri(RingtoneManager.TYPE_RINGTONE);
38054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
39054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    @Mock private InCallTonePlayer mInCallTonePlayer;
40054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    @Mock private CallList mCallList;
41054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    @Mock private Call mCall;
42054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    private DialerRingtoneManager mRingtoneManagerEnabled;
43054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    private DialerRingtoneManager mRingtoneManagerDisabled;
44cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell
45cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    @Override
46054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void setUp() throws Exception {
47054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        super.setUp();
48054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        MockitoAnnotations.initMocks(this);
49054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        mRingtoneManagerEnabled = new DialerRingtoneManager(mInCallTonePlayer, mCallList);
50054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        mRingtoneManagerEnabled.setDialerRingingEnabledForTesting(true);
51054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        mRingtoneManagerDisabled = new DialerRingtoneManager(mInCallTonePlayer, mCallList);
52054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        mRingtoneManagerDisabled.setDialerRingingEnabledForTesting(false);
53cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    }
54cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell
55054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testNullInCallTonePlayer() {
56054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        try {
57054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            new DialerRingtoneManager(null, mCallList);
58054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            fail();
59054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        } catch (NullPointerException e) {}
60054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
61054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
62054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testNullCallList() {
63054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        try {
64054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            new DialerRingtoneManager(mInCallTonePlayer, null);
65054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            fail();
66054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        } catch (NullPointerException e) {}
67cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    }
68cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell
69cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    public void testShouldPlayRingtone_M() {
70cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell        if (CompatUtils.isNCompatible()) {
71cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell            return;
72cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell        }
73054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertFalse(mRingtoneManagerEnabled.shouldPlayRingtone(0, RINGTONE_URI));
74cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    }
75cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell
76cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    public void testShouldPlayRingtone_N_NullUri() {
77cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
78cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell            return;
79cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell        }
80054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertFalse(mRingtoneManagerEnabled.shouldPlayRingtone(State.INCOMING, null));
81054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
82054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
83054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testShouldPlayRingtone_N_Disabled() {
84054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
85054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            return;
86054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        }
87054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertFalse(mRingtoneManagerDisabled.shouldPlayRingtone(State.INCOMING, RINGTONE_URI));
88cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    }
89cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell
90cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    public void testShouldPlayRingtone_N_NotIncoming() {
91cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
92cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell            return;
93cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell        }
94054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertFalse(mRingtoneManagerEnabled.shouldPlayRingtone(State.ACTIVE, RINGTONE_URI));
95cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    }
96cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell
97cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    // Specific case for call waiting since that needs its own sound
98054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testShouldPlayRingtone_N_CallWaitingByState() {
99054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
100054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            return;
101054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        }
102054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertFalse(mRingtoneManagerEnabled.shouldPlayRingtone(State.CALL_WAITING, RINGTONE_URI));
103054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
104054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
105054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testShouldPlayRingtone_N_CallWaitingByActiveCall() {
106cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
107cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell            return;
108cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell        }
109054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        Mockito.when(mCallList.getActiveCall()).thenReturn(mCall);
110054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertFalse(mRingtoneManagerEnabled.shouldPlayRingtone(State.INCOMING, RINGTONE_URI));
111cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    }
112cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell
113cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    public void testShouldPlayRingtone_N() {
114cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
115cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell            return;
116cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell        }
117054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertTrue(mRingtoneManagerEnabled.shouldPlayRingtone(State.INCOMING, RINGTONE_URI));
118cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell    }
119249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell
120249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell    public void testShouldPlayCallWaitingTone_M() {
121249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell        if (CompatUtils.isNCompatible()) {
122249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell            return;
123249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell        }
124054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertFalse(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(0));
125054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
126054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
127054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testShouldPlayCallWaitingTone_N_Disabled() {
128054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
129054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            return;
130054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        }
131054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertFalse(mRingtoneManagerDisabled.shouldPlayCallWaitingTone(State.CALL_WAITING));
132249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell    }
133249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell
134249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell    public void testShouldPlayCallWaitingTone_N_NotCallWaiting() {
135249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
136249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell            return;
137249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell        }
138054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertFalse(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(State.ACTIVE));
139249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell    }
140249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell
141249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell    // Specific case for incoming since it plays its own sound
142249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell    public void testShouldPlayCallWaitingTone_N_Incoming() {
143249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
144249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell            return;
145249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell        }
146054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertFalse(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(State.INCOMING));
147054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
148054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
149054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testShouldPlayCallWaitingTone_N_AlreadyPlaying() {
150054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
151054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            return;
152054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        }
153054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        Mockito.when(mInCallTonePlayer.isPlayingTone()).thenReturn(true);
154054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertFalse(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(State.CALL_WAITING));
155054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
156054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
157054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testShouldPlayCallWaitingTone_N_ByState() {
158054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
159054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            return;
160054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        }
161054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertTrue(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(State.CALL_WAITING));
162054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
163054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
164054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testShouldPlayCallWaitingTone_N_ByActiveCall() {
165054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
166054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            return;
167054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        }
168054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        Mockito.when(mCallList.getActiveCall()).thenReturn(mCall);
169054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        assertTrue(mRingtoneManagerEnabled.shouldPlayCallWaitingTone(State.INCOMING));
170054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
171054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
172054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testPlayCallWaitingTone_M() {
173054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        if (CompatUtils.isNCompatible()) {
174054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            return;
175054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        }
176054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        mRingtoneManagerEnabled.playCallWaitingTone();
177054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        Mockito.verify(mInCallTonePlayer, Mockito.never()).play(Mockito.anyInt());
178054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
179054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
180054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testPlayCallWaitingTone_N_NotEnabled() {
181054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
182054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            return;
183054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        }
184054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        mRingtoneManagerDisabled.playCallWaitingTone();
185054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        Mockito.verify(mInCallTonePlayer, Mockito.never()).play(Mockito.anyInt());
186054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
187054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
188054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testPlayCallWaitingTone_N() {
189054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
190054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            return;
191054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        }
192054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        mRingtoneManagerEnabled.playCallWaitingTone();
193054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        Mockito.verify(mInCallTonePlayer).play(Mockito.anyInt());
194054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
195054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
196054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testStopCallWaitingTone_M() {
197054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        if (CompatUtils.isNCompatible()) {
198054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            return;
199054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        }
200054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        mRingtoneManagerEnabled.stopCallWaitingTone();
201054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        Mockito.verify(mInCallTonePlayer, Mockito.never()).stop();
202054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    }
203054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell
204054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testStopCallWaitingTone_N_NotEnabled() {
205054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
206054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell            return;
207054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        }
208054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        mRingtoneManagerDisabled.stopCallWaitingTone();
209054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        Mockito.verify(mInCallTonePlayer, Mockito.never()).stop();
210249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell    }
211249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell
212054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell    public void testStopCallWaitingTone_N() {
213249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell        if (!CompatUtils.isNCompatible()) {
214249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell            return;
215249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell        }
216054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        mRingtoneManagerEnabled.stopCallWaitingTone();
217054559b6c279a0149ac6473d1897f6db817c5a57Brandon Maxwell        Mockito.verify(mInCallTonePlayer).stop();
218249c755441938ead47c01d27c168c4096e0d9769Brandon Maxwell    }
219cc7e5a7a71ecd3037802668be19935270f9c0216Brandon Maxwell}
220