Commit 2cf6a04f authored by Wei-Yin Chen (陳威尹)'s avatar Wei-Yin Chen (陳威尹) Committed by Commit Bot

Turn on partner customizations on all pre-stable channels

crrev.com/c/704398 unified the availability of partner customizations
like bookmarks, homepage, etc. The rule was: they are available if
Chrome is a system package, or is force-enabled by a command line
argument "--allow-partner-customization".

Hiding behind a command line argument reduced the benefit of staged
deployment, and lowered the real world coverage.

Now the rule is: partner customizations are available if Chrome is a
system package, or is on pre-stable channels.

Bug: 617284, 773623
Change-Id: I594c0313781cc9c10ab73d6e0f4d7e837d578d46
Reviewed-on: https://chromium-review.googlesource.com/719472
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509475}
parent 3627230a
...@@ -81,13 +81,6 @@ public abstract class ChromeSwitches { ...@@ -81,13 +81,6 @@ public abstract class ChromeSwitches {
*/ */
public static final String DISABLE_TAB_MERGING_FOR_TESTING = "disable-tab-merging"; public static final String DISABLE_TAB_MERGING_FOR_TESTING = "disable-tab-merging";
/**
* Force-enable partner customization for testing.
* Partner customization includes configurations from PartnerBookmarksProvider and
* PartnerBrowserCustomizations.
*/
public static final String ALLOW_PARTNER_CUSTOMIZATION = "allow-partner-customization";
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
// Native Switches // Native Switches
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -8,11 +8,10 @@ import android.content.Context; ...@@ -8,11 +8,10 @@ import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import org.chromium.base.CommandLine;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
import org.chromium.base.Log; import org.chromium.base.Log;
import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ChromeVersionInfo;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -45,10 +44,10 @@ public class PartnerBookmarksShim { ...@@ -45,10 +44,10 @@ public class PartnerBookmarksShim {
if (skip) { if (skip) {
Log.i(TAG, "Skip reading partner bookmarks since recent result was empty."); Log.i(TAG, "Skip reading partner bookmarks since recent result was empty.");
} }
boolean systemOrForced = boolean systemOrPreStable =
(context.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) == 1 (context.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) == 1
|| CommandLine.getInstance().hasSwitch(ChromeSwitches.ALLOW_PARTNER_CUSTOMIZATION); || !ChromeVersionInfo.isStableBuild();
if (skip || !systemOrForced) { if (skip || !systemOrPreStable) {
reader.onBookmarksRead(); reader.onBookmarksRead();
return; return;
} }
......
...@@ -19,6 +19,7 @@ import org.chromium.base.ThreadUtils; ...@@ -19,6 +19,7 @@ import org.chromium.base.ThreadUtils;
import org.chromium.base.VisibleForTesting; import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.CalledByNative;
import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.ChromeVersionInfo;
import org.chromium.chrome.browser.UrlConstants; import org.chromium.chrome.browser.UrlConstants;
import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksReader; import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksReader;
...@@ -178,11 +179,10 @@ public class PartnerBrowserCustomizations { ...@@ -178,11 +179,10 @@ public class PartnerBrowserCustomizations {
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
try { try {
boolean systemOrForced = boolean systemOrPreStable =
(context.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) == 1 (context.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) == 1
|| CommandLine.getInstance().hasSwitch( || !ChromeVersionInfo.isStableBuild();
ChromeSwitches.ALLOW_PARTNER_CUSTOMIZATION); if (!systemOrPreStable) {
if (!systemOrForced) {
// Only allow partner customization if this browser is a system package, or // Only allow partner customization if this browser is a system package, or
// forced for testing purposes. // forced for testing purposes.
return null; return null;
......
...@@ -146,6 +146,7 @@ public class BookmarkTest { ...@@ -146,6 +146,7 @@ public class BookmarkTest {
// Click star button to bookmark the current tab. // Click star button to bookmark the current tab.
MenuUtils.invokeCustomMenuActionSync(InstrumentationRegistry.getInstrumentation(), MenuUtils.invokeCustomMenuActionSync(InstrumentationRegistry.getInstrumentation(),
mActivityTestRule.getActivity(), R.id.bookmark_this_page_id); mActivityTestRule.getActivity(), R.id.bookmark_this_page_id);
BookmarkTestUtil.waitForBookmarkModelLoaded();
// All actions with BookmarkModel needs to run on UI thread. // All actions with BookmarkModel needs to run on UI thread.
ThreadUtils.runOnUiThreadBlocking(new Runnable() { ThreadUtils.runOnUiThreadBlocking(new Runnable() {
@Override @Override
......
...@@ -19,9 +19,7 @@ import org.junit.Test; ...@@ -19,9 +19,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomizationsProvider; import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomizationsProvider;
...@@ -29,9 +27,6 @@ import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomiz ...@@ -29,9 +27,6 @@ import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomiz
* Unit tests for the partner disabling bookmarks editing functionality. * Unit tests for the partner disabling bookmarks editing functionality.
*/ */
@RunWith(ChromeJUnit4ClassRunner.class) @RunWith(ChromeJUnit4ClassRunner.class)
@CommandLineFlags.Add({
ChromeSwitches.ALLOW_PARTNER_CUSTOMIZATION,
})
public class PartnerDisableBookmarksEditingUnitTest { public class PartnerDisableBookmarksEditingUnitTest {
@Rule @Rule
public BasePartnerBrowserCustomizationUnitTestRule mTestRule = public BasePartnerBrowserCustomizationUnitTestRule mTestRule =
......
...@@ -42,7 +42,6 @@ import java.util.concurrent.ExecutionException; ...@@ -42,7 +42,6 @@ import java.util.concurrent.ExecutionException;
@CommandLineFlags.Add({ @CommandLineFlags.Add({
ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG, ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG,
ChromeSwitches.ALLOW_PARTNER_CUSTOMIZATION,
}) })
public class PartnerDisableIncognitoModeIntegrationTest { public class PartnerDisableIncognitoModeIntegrationTest {
@Rule @Rule
......
...@@ -19,9 +19,7 @@ import org.junit.Test; ...@@ -19,9 +19,7 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomizationsProvider; import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomizationsProvider;
...@@ -29,9 +27,6 @@ import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomiz ...@@ -29,9 +27,6 @@ import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomiz
* Unit tests for the partner disabling incognito mode functionality. * Unit tests for the partner disabling incognito mode functionality.
*/ */
@RunWith(ChromeJUnit4ClassRunner.class) @RunWith(ChromeJUnit4ClassRunner.class)
@CommandLineFlags.Add({
ChromeSwitches.ALLOW_PARTNER_CUSTOMIZATION,
})
public class PartnerDisableIncognitoModeUnitTest { public class PartnerDisableIncognitoModeUnitTest {
@Rule @Rule
public BasePartnerBrowserCustomizationUnitTestRule mTestRule = public BasePartnerBrowserCustomizationUnitTestRule mTestRule =
......
...@@ -57,7 +57,6 @@ import java.util.concurrent.TimeoutException; ...@@ -57,7 +57,6 @@ import java.util.concurrent.TimeoutException;
@CommandLineFlags.Add({ @CommandLineFlags.Add({
ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG, ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG,
ChromeSwitches.ALLOW_PARTNER_CUSTOMIZATION,
}) })
public class PartnerHomepageIntegrationTest { public class PartnerHomepageIntegrationTest {
@Rule @Rule
......
...@@ -18,10 +18,8 @@ import org.junit.Test; ...@@ -18,10 +18,8 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.RetryOnFailure; import org.chromium.base.test.util.RetryOnFailure;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomizationsDelayedProvider; import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomizationsDelayedProvider;
import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomizationsProvider; import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomizationsProvider;
...@@ -30,9 +28,6 @@ import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomiz ...@@ -30,9 +28,6 @@ import org.chromium.chrome.test.partnercustomizations.TestPartnerBrowserCustomiz
* Unit test suite for partner homepage. * Unit test suite for partner homepage.
*/ */
@RunWith(ChromeJUnit4ClassRunner.class) @RunWith(ChromeJUnit4ClassRunner.class)
@CommandLineFlags.Add({
ChromeSwitches.ALLOW_PARTNER_CUSTOMIZATION,
})
public class PartnerHomepageUnitTest { public class PartnerHomepageUnitTest {
@Rule @Rule
public BasePartnerBrowserCustomizationUnitTestRule mTestRule = public BasePartnerBrowserCustomizationUnitTestRule mTestRule =
......
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