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

[Instant Start] Ignore background time in TabSwitcherOnReturn=Immediate

When TabSwitcherOnReturn is set to "Immediate", the tab switcher should
show up immediately regardless of whether the last background timestamp
is available or not.

"Immediate" is a setting for dev testing only.

Bug: 1016952
Change-Id: I3ac40d6695089ea9b14e3841b8834ae3a6b44b7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1877812Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708934}
parent 8cbf43ab
......@@ -37,14 +37,14 @@ public final class ReturnToChromeExperimentsUtil {
* @return true if past threshold, false if not past threshold or experiment cannot be loaded.
*/
public static boolean shouldShowTabSwitcher(final long lastBackgroundedTimeMillis) {
if (lastBackgroundedTimeMillis == -1) {
// No last background timestamp set, use control behavior.
return false;
}
int tabSwitcherAfterMillis = ChromeFeatureList.getFieldTrialParamByFeatureAsInt(
ChromeFeatureList.TAB_SWITCHER_ON_RETURN, TAB_SWITCHER_ON_RETURN_MS, -1);
if (lastBackgroundedTimeMillis == -1) {
// No last background timestamp set, use control behavior unless "immediate" was set.
return tabSwitcherAfterMillis == 0;
}
if (tabSwitcherAfterMillis < 0) {
// If no value for experiment, use control behavior.
return false;
......
......@@ -55,7 +55,7 @@ public class ReturnToChromeTest {
public void setUp() {
FeatureUtilities.setGridTabSwitcherEnabledForTesting(true);
mActivityTestRule.startMainActivityFromLauncher();
mActivityTestRule.startMainActivityOnBlankPage();
mActivity = mActivityTestRule.getActivity();
setupTabs();
......
......@@ -113,8 +113,7 @@ public class BottomSheetTestRule extends ChromeTabbedActivityTestRule {
setSheetState(mStartingBottomSheetState, /* animate = */ false);
}
public void startMainActivityOnBottomSheet(@BottomSheet.SheetState int startingSheetState)
throws InterruptedException {
public void startMainActivityOnBottomSheet(@BottomSheet.SheetState int startingSheetState) {
mStartingBottomSheetState = startingSheetState;
startMainActivityOnBlankPage();
}
......@@ -124,7 +123,7 @@ public class BottomSheetTestRule extends ChromeTabbedActivityTestRule {
// ActivityTestRule interface. To work round this override the methods that start activities.
// See https://crbug.com/726444.
@Override
public void startMainActivityOnBlankPage() throws InterruptedException {
public void startMainActivityOnBlankPage() {
super.startMainActivityOnBlankPage();
afterStartingActivity();
}
......
......@@ -400,7 +400,7 @@ public class ChromeActivityTestRule<T extends ChromeActivity> extends ActivityTe
* Starts the Main activity and open a blank page.
* This is faster and less flakyness-prone than starting on the NTP.
*/
public void startMainActivityOnBlankPage() throws InterruptedException {
public void startMainActivityOnBlankPage() {
startMainActivityWithURL("about:blank");
}
......
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