@Test public void createIntentToLaunchUriInBrowser_optionallyConfiguresIntentForChromeCustomTabs() { when(context.getApplicationContext()).thenReturn(applicationContext); when(ChromeCustomTabs.isAvailable(applicationContext)).thenReturn(true); Uri uri = Uri.parse("https: Intent result = sut.createIntentToLaunchUriInBrowser(context, uri); assertEquals(result.getData().toString(), "https: assertEquals(result.getAction(), Intent.ACTION_VIEW); assertEquals(result.getFlags(), Intent.FLAG_ACTIVITY_NEW_TASK); verifyStatic(ChromeCustomTabs.class); ChromeCustomTabs.addChromeCustomTabsExtras(applicationContext, result); }
Intent createIntentToLaunchUriInBrowser(Context context, Uri uri) { Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Context applicationContext = context.getApplicationContext(); if (ChromeCustomTabs.isAvailable(applicationContext)) { ChromeCustomTabs.addChromeCustomTabsExtras(applicationContext, intent); } return intent; }
BrowserSwitchConfig { Intent createIntentToLaunchUriInBrowser(Context context, Uri uri) { Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Context applicationContext = context.getApplicationContext(); if (ChromeCustomTabs.isAvailable(applicationContext)) { ChromeCustomTabs.addChromeCustomTabsExtras(applicationContext, intent); } return intent; } }
BrowserSwitchConfig { Intent createIntentToLaunchUriInBrowser(Context context, Uri uri) { Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Context applicationContext = context.getApplicationContext(); if (ChromeCustomTabs.isAvailable(applicationContext)) { ChromeCustomTabs.addChromeCustomTabsExtras(applicationContext, intent); } return intent; }  }
BrowserSwitchConfig { Intent createIntentToLaunchUriInBrowser(Context context, Uri uri) { Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Context applicationContext = context.getApplicationContext(); if (ChromeCustomTabs.isAvailable(applicationContext)) { ChromeCustomTabs.addChromeCustomTabsExtras(applicationContext, intent); } return intent; }   }
BrowserSwitchConfig { Intent createIntentToLaunchUriInBrowser(Context context, Uri uri) { Intent intent = new Intent(Intent.ACTION_VIEW, uri); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Context applicationContext = context.getApplicationContext(); if (ChromeCustomTabs.isAvailable(applicationContext)) { ChromeCustomTabs.addChromeCustomTabsExtras(applicationContext, intent); } return intent; }    }