Skip to content

Commit

Permalink
Update CustomTabsControllerTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
poovamraj committed Jul 31, 2023
1 parent 4e31d1d commit d89256a
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.content.ServiceConnection;
import android.graphics.Color;
import android.net.Uri;
import android.os.Looper;

import androidx.browser.customtabs.CustomTabsCallback;
import androidx.browser.customtabs.CustomTabsClient;
Expand Down Expand Up @@ -298,6 +299,17 @@ public void shouldLaunchUriWithFallbackIfCustomTabIntentFails() {
assertThat(customTabIntent.getIntExtra(CustomTabsIntent.EXTRA_SHARE_STATE, CustomTabsIntent.SHARE_STATE_OFF), is(CustomTabsIntent.SHARE_STATE_OFF));
}

@Test
public void shouldThrowExceptionIfFailedToLaunchBecauseOfException() {
Exception e = new SecurityException();
doThrow(e)
.when(context).startActivity(any(Intent.class));
controller.launchUri(uri, false, (ex) -> {
assertThat(ex, is(e));
assertThat(Looper.myLooper(), is(Looper.getMainLooper()));
});
}

//Helper Methods

@SuppressWarnings("WrongConstant")
Expand Down

0 comments on commit d89256a

Please sign in to comment.