Search in sources :

Example 31 with IDelegate

use of com.android.speech.tts.MockableTextToSpeechService.IDelegate in project platform_frameworks_base by android.

the class TextToSpeechTests method testSetLanguage_delegation.

public void testSetLanguage_delegation() {
    IDelegate delegate = Mockito.mock(IDelegate.class);
    MockableTextToSpeechService.setMocker(delegate);
    Mockito.doReturn(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE).when(delegate).onIsLanguageAvailable("eng", "USA", "variant");
    Mockito.doReturn(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE).when(delegate).onLoadLanguage("eng", "USA", "variant");
    // Test 1 :Tests that calls to onLoadLanguage( ) are delegated through to the
    // service without any caching or intermediate steps.
    assertEquals(TextToSpeech.LANG_COUNTRY_VAR_AVAILABLE, mTts.setLanguage(new Locale("eng", "USA", "variant")));
    Mockito.verify(delegate, Mockito.atLeast(0)).onIsLanguageAvailable("eng", "USA", "variant");
    Mockito.verify(delegate, Mockito.atLeast(0)).onLoadLanguage("eng", "USA", "variant");
}
Also used : Locale(java.util.Locale) IDelegate(com.android.speech.tts.MockableTextToSpeechService.IDelegate)

Aggregations

IDelegate (com.android.speech.tts.MockableTextToSpeechService.IDelegate)31 Locale (java.util.Locale)16 SynthesisRequest (android.speech.tts.SynthesisRequest)14