Commit 53755470 authored by Sophey Dong's avatar Sophey Dong Committed by Commit Bot

Revert "[ShareCCT] Implement sharing in the toolbar and by default in CCT."

This reverts commit 6769a912.

Reason for revert: Causing crashes (https://crbug.com/1142672)

Original change's description:
> [ShareCCT] Implement sharing in the toolbar and by default in CCT.
>
> Bug: 1135311
> Change-Id: I967300591d383a21b9f3f40233422b763180ddb0
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459403
> Reviewed-by: Tanya Gupta <tgupta@chromium.org>
> Reviewed-by: Andrew Grieve <agrieve@chromium.org>
> Reviewed-by: Peter Conn <peconn@chromium.org>
> Commit-Queue: Sophey Dong <sophey@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#820029}

TBR=agrieve@chromium.org,peconn@chromium.org,tgupta@chromium.org,sophey@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1135311, 1142672
Change-Id: Id0a3d68fc60893c39eef76c6fa79379dfe8faf2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2500591Reviewed-by: default avatarKrishna Govind <govind@chromium.org>
Commit-Queue: Krishna Govind <govind@chromium.org>
Auto-Submit: Sophey Dong <sophey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821101}
parent 1aedd084
...@@ -959,7 +959,6 @@ android_library("chrome_test_util_java") { ...@@ -959,7 +959,6 @@ android_library("chrome_test_util_java") {
"//base:base_java", "//base:base_java",
"//base:base_java_test_support", "//base:base_java_test_support",
"//chrome/android:chrome_java", "//chrome/android:chrome_java",
"//chrome/browser/flags:java",
"//chrome/browser/tab:java", "//chrome/browser/tab:java",
"//chrome/browser/ui/android/appmenu:java", "//chrome/browser/ui/android/appmenu:java",
"//chrome/test/android:chrome_java_test_support", "//chrome/test/android:chrome_java_test_support",
......
...@@ -461,7 +461,6 @@ chrome_java_sources = [ ...@@ -461,7 +461,6 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/customtabs/CustomTabsClientFileProcessor.java", "java/src/org/chromium/chrome/browser/customtabs/CustomTabsClientFileProcessor.java",
"java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java", "java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java",
"java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionServiceImpl.java", "java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnectionServiceImpl.java",
"java/src/org/chromium/chrome/browser/customtabs/CustomTabsShareBroadcastReceiver.java",
"java/src/org/chromium/chrome/browser/customtabs/FirstMeaningfulPaintObserver.java", "java/src/org/chromium/chrome/browser/customtabs/FirstMeaningfulPaintObserver.java",
"java/src/org/chromium/chrome/browser/customtabs/HiddenTabHolder.java", "java/src/org/chromium/chrome/browser/customtabs/HiddenTabHolder.java",
"java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java", "java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java",
......
...@@ -924,10 +924,6 @@ ...@@ -924,10 +924,6 @@
android:exported="false" android:exported="false"
android:name="org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.DisclosureAcceptanceBroadcastReceiver"> android:name="org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.DisclosureAcceptanceBroadcastReceiver">
</receiver> # DIFF-ANCHOR: a31e6ce5 </receiver> # DIFF-ANCHOR: a31e6ce5
<receiver # DIFF-ANCHOR: 779ee86b
android:exported="false"
android:name="org.chromium.chrome.browser.customtabs.CustomTabsShareBroadcastReceiver">
</receiver> # DIFF-ANCHOR: 779ee86b
<receiver # DIFF-ANCHOR: bccc7d87 <receiver # DIFF-ANCHOR: bccc7d87
android:exported="false" android:exported="false"
android:name="org.chromium.chrome.browser.locale.LocaleChangedBroadcastReceiver"> android:name="org.chromium.chrome.browser.locale.LocaleChangedBroadcastReceiver">
......
...@@ -862,10 +862,6 @@ ...@@ -862,10 +862,6 @@
android:exported="false" android:exported="false"
android:name="org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.DisclosureAcceptanceBroadcastReceiver"> android:name="org.chromium.chrome.browser.browserservices.ui.trustedwebactivity.DisclosureAcceptanceBroadcastReceiver">
</receiver> # DIFF-ANCHOR: a31e6ce5 </receiver> # DIFF-ANCHOR: a31e6ce5
<receiver # DIFF-ANCHOR: 779ee86b
android:exported="false"
android:name="org.chromium.chrome.browser.customtabs.CustomTabsShareBroadcastReceiver">
</receiver> # DIFF-ANCHOR: 779ee86b
<receiver # DIFF-ANCHOR: bccc7d87 <receiver # DIFF-ANCHOR: bccc7d87
android:exported="false" android:exported="false"
android:name="org.chromium.chrome.browser.locale.LocaleChangedBroadcastReceiver"> android:name="org.chromium.chrome.browser.locale.LocaleChangedBroadcastReceiver">
......
...@@ -1105,9 +1105,6 @@ by a child template that "extends" this file. ...@@ -1105,9 +1105,6 @@ by a child template that "extends" this file.
<receiver android:name="org.chromium.chrome.browser.app.send_tab_to_self.SendTabToSelfNotificationReceiver" <receiver android:name="org.chromium.chrome.browser.app.send_tab_to_self.SendTabToSelfNotificationReceiver"
android:exported="false"/> android:exported="false"/>
<receiver android:name="org.chromium.chrome.browser.customtabs.CustomTabsShareBroadcastReceiver"
android:exported="false"/>
<receiver android:name="org.chromium.chrome.browser.sharing.click_to_call.ClickToCallMessageHandler$TapReceiver" <receiver android:name="org.chromium.chrome.browser.sharing.click_to_call.ClickToCallMessageHandler$TapReceiver"
android:exported="false"/> android:exported="false"/>
<receiver android:name="org.chromium.chrome.browser.sharing.shared_clipboard.SharedClipboardMessageHandler$TapReceiver" <receiver android:name="org.chromium.chrome.browser.sharing.shared_clipboard.SharedClipboardMessageHandler$TapReceiver"
......
...@@ -28,9 +28,7 @@ import androidx.browser.customtabs.CustomTabsIntent; ...@@ -28,9 +28,7 @@ import androidx.browser.customtabs.CustomTabsIntent;
import org.chromium.base.IntentUtils; import org.chromium.base.IntentUtils;
import org.chromium.base.Log; import org.chromium.base.Log;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.toolbar.ToolbarColors;
import org.chromium.components.browser_ui.widget.TintedDrawable; import org.chromium.components.browser_ui.widget.TintedDrawable;
import org.chromium.ui.util.ColorUtils;
import org.chromium.ui.widget.Toast; import org.chromium.ui.widget.Toast;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -239,26 +237,6 @@ public class CustomButtonParams { ...@@ -239,26 +237,6 @@ public class CustomButtonParams {
return new CustomButtonParams(id, bitmap, description, pendingIntent, tinted, onToolbar); return new CustomButtonParams(id, bitmap, description, pendingIntent, tinted, onToolbar);
} }
/**
* Creates and returns a {@link CustomButtonParams} for a share button in the toolbar.
*/
static CustomButtonParams createShareButton(Context context, int backgroundColor) {
int id = CustomTabsIntent.TOOLBAR_ACTION_BUTTON_ID;
String description = context.getResources().getString(R.string.share);
Intent shareIntent = new Intent(context, CustomTabsShareBroadcastReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(
context, 0, shareIntent, PendingIntent.FLAG_UPDATE_CURRENT);
TintedDrawable drawable =
TintedDrawable.constructTintedDrawable(context, R.drawable.ic_share_white_24dp);
boolean useLightTint = ColorUtils.shouldUseLightForegroundOnBackground(backgroundColor);
drawable.setTint(ToolbarColors.getThemedToolbarIconTint(context, useLightTint));
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
return new CustomButtonParams(
id, bitmap, description, pendingIntent, /*tinted=*/true, /*onToolbar=*/true);
}
/** /**
* @return The bitmap contained in the given {@link Bundle}. Will return null if input is * @return The bitmap contained in the given {@link Bundle}. Will return null if input is
* invalid. * invalid.
......
...@@ -44,7 +44,6 @@ import org.chromium.chrome.browser.IntentHandler; ...@@ -44,7 +44,6 @@ import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.app.ChromeActivity;
import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider; import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider;
import org.chromium.chrome.browser.flags.ActivityType; import org.chromium.chrome.browser.flags.ActivityType;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.version.ChromeVersionInfo; import org.chromium.chrome.browser.version.ChromeVersionInfo;
import org.chromium.components.browser_ui.styles.ChromeColors; import org.chromium.components.browser_ui.styles.ChromeColors;
import org.chromium.components.browser_ui.widget.TintedDrawable; import org.chromium.components.browser_ui.widget.TintedDrawable;
...@@ -193,7 +192,7 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid ...@@ -193,7 +192,7 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid
private List<CustomButtonParams> mCustomButtonParams; private List<CustomButtonParams> mCustomButtonParams;
private Drawable mCloseButtonIcon; private Drawable mCloseButtonIcon;
private List<Pair<String, PendingIntent>> mMenuEntries = new ArrayList<>(); private List<Pair<String, PendingIntent>> mMenuEntries = new ArrayList<>();
private boolean mShowShareItemInMenu; private boolean mShowShareItem;
private List<CustomButtonParams> mToolbarButtons = new ArrayList<>(1); private List<CustomButtonParams> mToolbarButtons = new ArrayList<>(1);
private List<CustomButtonParams> mBottombarButtons = new ArrayList<>(2); private List<CustomButtonParams> mBottombarButtons = new ArrayList<>(2);
private RemoteViews mRemoteViews; private RemoteViews mRemoteViews;
...@@ -304,8 +303,8 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid ...@@ -304,8 +303,8 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid
List<Bundle> menuItems = List<Bundle> menuItems =
IntentUtils.getParcelableArrayListExtra(intent, CustomTabsIntent.EXTRA_MENU_ITEMS); IntentUtils.getParcelableArrayListExtra(intent, CustomTabsIntent.EXTRA_MENU_ITEMS);
updateExtraMenuItems(menuItems); updateExtraMenuItems(menuItems);
addShareOption(intent, context);
mActivityType = IntentUtils.safeGetBooleanExtra( mActivityType = IntentUtils.safeGetBooleanExtra(
intent, TrustedWebUtils.EXTRA_LAUNCH_AS_TRUSTED_WEB_ACTIVITY, false) intent, TrustedWebUtils.EXTRA_LAUNCH_AS_TRUSTED_WEB_ACTIVITY, false)
...@@ -316,6 +315,9 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid ...@@ -316,6 +315,9 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid
mTrustedWebActivityDisplayMode = resolveTwaDisplayMode(); mTrustedWebActivityDisplayMode = resolveTwaDisplayMode();
mTitleVisibilityState = IntentUtils.safeGetIntExtra( mTitleVisibilityState = IntentUtils.safeGetIntExtra(
intent, CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE, CustomTabsIntent.NO_TITLE); intent, CustomTabsIntent.EXTRA_TITLE_VISIBILITY_STATE, CustomTabsIntent.NO_TITLE);
mShowShareItem = IntentUtils.safeGetBooleanExtra(intent,
CustomTabsIntent.EXTRA_DEFAULT_SHARE_MENU_ITEM,
mIsOpenedByChrome && mUiType == CustomTabsUiType.DEFAULT);
mRemoteViews = mRemoteViews =
IntentUtils.safeGetParcelableExtra(intent, CustomTabsIntent.EXTRA_REMOTEVIEWS); IntentUtils.safeGetParcelableExtra(intent, CustomTabsIntent.EXTRA_REMOTEVIEWS);
mClickableViewIds = IntentUtils.safeGetIntArrayExtra( mClickableViewIds = IntentUtils.safeGetIntArrayExtra(
...@@ -452,39 +454,6 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid ...@@ -452,39 +454,6 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid
return MAX_CUSTOM_TOOLBAR_ITEMS; return MAX_CUSTOM_TOOLBAR_ITEMS;
} }
/**
* Adds a share option to the custom tab according to the {@link
* CustomTabsIntent#EXTRA_SHARE_STATE} stored in the intent.
*
* <p>Shows share options according to the following rules:
*
* <ul>
* <li>If {@link CustomTabsIntent#SHARE_STATE_ON} or
* {@link CustomTabsIntent#SHARE_STATE_DEFAULT}, add to the top toolbar if empty, otherwise
* add to the overflow menu if it is not customized.
* <li>If {@link CustomTabsIntent#SHARE_STATE_OFF}, add to the overflow menu depending on
* {@link CustomTabsIntent#EXTRA_DEFAULT_SHARE_MENU_ITEM}.
* </ul>
*/
private void addShareOption(Intent intent, Context context) {
int shareState = IntentUtils.safeGetIntExtra(
intent, CustomTabsIntent.EXTRA_SHARE_STATE, CustomTabsIntent.SHARE_STATE_DEFAULT);
if (shareState == CustomTabsIntent.SHARE_STATE_ON
|| (shareState == CustomTabsIntent.SHARE_STATE_DEFAULT
&& ChromeFeatureList.isEnabled(
ChromeFeatureList.SHARE_BY_DEFAULT_IN_CCT))) {
if (mToolbarButtons.isEmpty()) {
mToolbarButtons.add(CustomButtonParams.createShareButton(context, mToolbarColor));
} else if (mMenuEntries.isEmpty()) {
mShowShareItemInMenu = true;
}
} else {
mShowShareItemInMenu = IntentUtils.safeGetBooleanExtra(intent,
CustomTabsIntent.EXTRA_DEFAULT_SHARE_MENU_ITEM,
mIsOpenedByChrome && mUiType == CustomTabsUiType.DEFAULT);
}
}
/** /**
* Returns the color passed from the client app. * Returns the color passed from the client app.
*/ */
...@@ -687,7 +656,7 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid ...@@ -687,7 +656,7 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid
@Override @Override
public boolean shouldShowShareMenuItem() { public boolean shouldShowShareMenuItem() {
return mShowShareItemInMenu; return mShowShareItem;
} }
@Override @Override
......
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.customtabs;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
/**
* Receives shared content broadcast from Chrome Custom Tabs and shows a share sheet to share the
* url.
*/
public final class CustomTabsShareBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String url = intent.getDataString();
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, url);
Intent chooserIntent = Intent.createChooser(shareIntent, null);
chooserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(chooserIntent);
}
}
...@@ -945,7 +945,6 @@ public class CustomTabActivityTest { ...@@ -945,7 +945,6 @@ public class CustomTabActivityTest {
public void testActionButtonBadRatio() { public void testActionButtonBadRatio() {
Bitmap expectedIcon = createTestBitmap(60, 20); Bitmap expectedIcon = createTestBitmap(60, 20);
Intent intent = createMinimalCustomTabIntent(); Intent intent = createMinimalCustomTabIntent();
CustomTabsTestUtils.setShareState(intent, CustomTabsIntent.SHARE_STATE_OFF);
CustomTabsTestUtils.addActionButtonToIntent( CustomTabsTestUtils.addActionButtonToIntent(
intent, expectedIcon, "Good test", sIdToIncrement++); intent, expectedIcon, "Good test", sIdToIncrement++);
mCustomTabActivityTestRule.startCustomTabActivityWithIntent(intent); mCustomTabActivityTestRule.startCustomTabActivityWithIntent(intent);
......
...@@ -12,10 +12,8 @@ import org.hamcrest.Matchers; ...@@ -12,10 +12,8 @@ import org.hamcrest.Matchers;
import org.junit.Assert; import org.junit.Assert;
import org.chromium.base.ApplicationStatus; import org.chromium.base.ApplicationStatus;
import org.chromium.base.FeatureList;
import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CallbackHelper;
import org.chromium.chrome.browser.DeferredStartupHandler; import org.chromium.chrome.browser.DeferredStartupHandler;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabTestUtils; import org.chromium.chrome.browser.tab.TabTestUtils;
...@@ -23,7 +21,6 @@ import org.chromium.chrome.test.ChromeActivityTestRule; ...@@ -23,7 +21,6 @@ import org.chromium.chrome.test.ChromeActivityTestRule;
import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.Criteria;
import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.test.util.CriteriaHelper;
import java.util.Collections;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
...@@ -54,10 +51,6 @@ public class CustomTabActivityTestRule extends ChromeActivityTestRule<CustomTabA ...@@ -54,10 +51,6 @@ public class CustomTabActivityTestRule extends ChromeActivityTestRule<CustomTabA
@Override @Override
public void startActivityCompletely(Intent intent) { public void startActivityCompletely(Intent intent) {
if (!FeatureList.hasTestFeatures()) {
FeatureList.setTestFeatures(
Collections.singletonMap(ChromeFeatureList.SHARE_BY_DEFAULT_IN_CCT, true));
}
putCustomTabIdInIntent(intent); putCustomTabIdInIntent(intent);
int currentIntentId = getCustomTabIdFromIntent(intent); int currentIntentId = getCustomTabIdFromIntent(intent);
......
...@@ -279,13 +279,4 @@ public class CustomTabsTestUtils { ...@@ -279,13 +279,4 @@ public class CustomTabsTestUtils {
return Bitmap.createBitmap( return Bitmap.createBitmap(
(int) (widthDp * density), (int) (heightDp * density), Bitmap.Config.ARGB_8888); (int) (widthDp * density), (int) (heightDp * density), Bitmap.Config.ARGB_8888);
} }
/**
* Sets the {@link CustomTabsIntent.ShareState} of the custom tab.
* @param intent The intent to modify.
* @param shareState The {@link CustomTabsIntent.ShareState} being set.
*/
public static void setShareState(Intent intent, int shareState) {
intent.putExtra(CustomTabsIntent.EXTRA_SHARE_STATE, shareState);
}
} }
...@@ -25,7 +25,6 @@ import org.junit.Assert; ...@@ -25,7 +25,6 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestRule;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
...@@ -39,7 +38,6 @@ import org.chromium.chrome.browser.ChromeTabbedActivity; ...@@ -39,7 +38,6 @@ import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.customtabs.CustomTabActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils; import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils;
import org.chromium.chrome.browser.document.ChromeLauncherActivity; import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.locale.DefaultSearchEngineDialogHelperUtils; import org.chromium.chrome.browser.locale.DefaultSearchEngineDialogHelperUtils;
import org.chromium.chrome.browser.locale.LocaleManager; import org.chromium.chrome.browser.locale.LocaleManager;
import org.chromium.chrome.browser.locale.LocaleManager.SearchEnginePromoType; import org.chromium.chrome.browser.locale.LocaleManager.SearchEnginePromoType;
...@@ -48,7 +46,6 @@ import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManager; ...@@ -48,7 +46,6 @@ import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManager;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.MultiActivityTestRule; import org.chromium.chrome.test.MultiActivityTestRule;
import org.chromium.chrome.test.util.browser.Features;
import org.chromium.components.policy.AbstractAppRestrictionsProvider; import org.chromium.components.policy.AbstractAppRestrictionsProvider;
import org.chromium.components.search_engines.TemplateUrl; import org.chromium.components.search_engines.TemplateUrl;
import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.UiThreadTaskTraits;
...@@ -64,13 +61,10 @@ import java.util.Set; ...@@ -64,13 +61,10 @@ import java.util.Set;
* Integration test suite for the first run experience. * Integration test suite for the first run experience.
*/ */
@RunWith(ChromeJUnit4ClassRunner.class) @RunWith(ChromeJUnit4ClassRunner.class)
@Features.EnableFeatures(ChromeFeatureList.SHARE_BY_DEFAULT_IN_CCT)
public class FirstRunIntegrationTest { public class FirstRunIntegrationTest {
@Rule
public MultiActivityTestRule mTestRule = new MultiActivityTestRule();
@Rule @Rule
public TestRule mProcessor = new Features.JUnitProcessor(); public MultiActivityTestRule mTestRule = new MultiActivityTestRule();
@Mock @Mock
public FirstRunAppRestrictionInfo mMockAppRestrictionInfo; public FirstRunAppRestrictionInfo mMockAppRestrictionInfo;
......
...@@ -19,20 +19,17 @@ import org.junit.Assert; ...@@ -19,20 +19,17 @@ import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestRule;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.UrlUtils; import org.chromium.base.test.util.UrlUtils;
import org.chromium.chrome.browser.customtabs.CustomTabActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.MultiActivityTestRule; import org.chromium.chrome.test.MultiActivityTestRule;
import org.chromium.chrome.test.TestContentProvider; import org.chromium.chrome.test.TestContentProvider;
import org.chromium.chrome.test.util.ActivityUtils; import org.chromium.chrome.test.util.ActivityUtils;
import org.chromium.chrome.test.util.browser.Features;
import org.chromium.content_public.browser.test.util.Criteria; import org.chromium.content_public.browser.test.util.Criteria;
import org.chromium.content_public.browser.test.util.CriteriaHelper; import org.chromium.content_public.browser.test.util.CriteriaHelper;
...@@ -45,14 +42,10 @@ import java.util.concurrent.Callable; ...@@ -45,14 +42,10 @@ import java.util.concurrent.Callable;
*/ */
@RunWith(ChromeJUnit4ClassRunner.class) @RunWith(ChromeJUnit4ClassRunner.class)
@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE})
@Features.EnableFeatures(ChromeFeatureList.SHARE_BY_DEFAULT_IN_CCT)
public class MediaLauncherActivityTest { public class MediaLauncherActivityTest {
@Rule @Rule
public MultiActivityTestRule mTestRule = new MultiActivityTestRule(); public MultiActivityTestRule mTestRule = new MultiActivityTestRule();
@Rule
public TestRule mProcessor = new Features.JUnitProcessor();
private Context mContext; private Context mContext;
@Before @Before
......
...@@ -379,7 +379,6 @@ public class ReengagementNotificationControllerIntegrationTest { ...@@ -379,7 +379,6 @@ public class ReengagementNotificationControllerIntegrationTest {
// as expected with test values. // as expected with test values.
features.put(ChromeFeatureList.SEARCH_ENGINE_PROMO_EXISTING_DEVICE, false); features.put(ChromeFeatureList.SEARCH_ENGINE_PROMO_EXISTING_DEVICE, false);
features.put(ChromeFeatureList.OMNIBOX_SEARCH_ENGINE_LOGO, false); features.put(ChromeFeatureList.OMNIBOX_SEARCH_ENGINE_LOGO, false);
features.put(ChromeFeatureList.SHARE_BY_DEFAULT_IN_CCT, true);
FeatureList.setTestFeatures(features); FeatureList.setTestFeatures(features);
} }
} }
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment