mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1120530 - Don't show first run experience in Robocop tests. r=mfinkle, on a CLOSED TREE 'cos Java-only.
This commit is contained in:
parent
2ffd31115f
commit
909aba8739
@ -59,6 +59,8 @@ import org.mozilla.gecko.home.SearchEngine;
|
||||
import org.mozilla.gecko.menu.GeckoMenu;
|
||||
import org.mozilla.gecko.menu.GeckoMenuItem;
|
||||
import org.mozilla.gecko.mozglue.ContextUtils;
|
||||
import org.mozilla.gecko.mozglue.ContextUtils.SafeIntent;
|
||||
import org.mozilla.gecko.mozglue.RobocopTarget;
|
||||
import org.mozilla.gecko.preferences.ClearOnShutdownPref;
|
||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
||||
import org.mozilla.gecko.prompts.Prompt;
|
||||
@ -170,6 +172,9 @@ public class BrowserApp extends GeckoApp
|
||||
// Request ID for startActivityForResult.
|
||||
private static final int ACTIVITY_REQUEST_PREFERENCES = 1001;
|
||||
|
||||
@RobocopTarget
|
||||
public static final String EXTRA_SKIP_STARTPANE = "skipstartpane";
|
||||
|
||||
public static final String PREF_STARTPANE_ENABLED = "startpane_enabled";
|
||||
|
||||
private BrowserSearch mBrowserSearch;
|
||||
@ -682,20 +687,26 @@ public class BrowserApp extends GeckoApp
|
||||
}
|
||||
|
||||
/**
|
||||
* Check and show Onboarding start pane if Firefox has never been launched and
|
||||
* Check and show onboarding start pane if the browser has never been launched and
|
||||
* is not opening an external link from another application.
|
||||
*
|
||||
* @param context Context of application; used to show Start Pane if appropriate
|
||||
* @param intentAction Intent that launched this activity
|
||||
* @param intent Intent that launched this activity
|
||||
*/
|
||||
private void checkStartPane(Context context, String intentAction) {
|
||||
private void checkStartPane(Context context, SafeIntent intent) {
|
||||
if (intent.getBooleanExtra(EXTRA_SKIP_STARTPANE, false)) {
|
||||
// Note that we don't set the pref, so subsequent launches can result
|
||||
// in the start pane being shown.
|
||||
return;
|
||||
}
|
||||
|
||||
final StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskReads();
|
||||
|
||||
try {
|
||||
final SharedPreferences prefs = GeckoSharedPrefs.forProfile(this);
|
||||
|
||||
if (prefs.getBoolean(PREF_STARTPANE_ENABLED, false)) {
|
||||
if (!Intent.ACTION_VIEW.equals(intentAction)) {
|
||||
if (!Intent.ACTION_VIEW.equals(intent.getAction())) {
|
||||
final DialogFragment dialog = new StartPane();
|
||||
dialog.show(getSupportFragmentManager(), ONBOARD_STARTPANE_TAG);
|
||||
}
|
||||
@ -741,8 +752,8 @@ public class BrowserApp extends GeckoApp
|
||||
|
||||
@Override
|
||||
public void onAttachedToWindow() {
|
||||
// We can't show Onboarding until Gecko has finished initialization (bug 1077583).
|
||||
checkStartPane(this, getIntent().getAction());
|
||||
// We can't show the first run experience until Gecko has finished initialization (bug 1077583).
|
||||
checkStartPane(this, new SafeIntent(getIntent()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,7 @@ import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.mozilla.gecko.Actions;
|
||||
import org.mozilla.gecko.BrowserApp;
|
||||
import org.mozilla.gecko.Driver;
|
||||
import org.mozilla.gecko.Element;
|
||||
import org.mozilla.gecko.FennecNativeActions;
|
||||
@ -25,7 +26,6 @@ import org.mozilla.gecko.GeckoEvent;
|
||||
import org.mozilla.gecko.GeckoProfile;
|
||||
import org.mozilla.gecko.GeckoThread;
|
||||
import org.mozilla.gecko.GeckoThread.LaunchState;
|
||||
import org.mozilla.gecko.NewTabletUI;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.RobocopUtils;
|
||||
import org.mozilla.gecko.Tab;
|
||||
@ -113,7 +113,12 @@ abstract class BaseTest extends BaseRobocopTest {
|
||||
// Create the intent to be used with all the important arguments.
|
||||
Intent i = new Intent(Intent.ACTION_MAIN);
|
||||
mProfile = mConfig.get("profile");
|
||||
|
||||
// Don't show the first run experience.
|
||||
i.putExtra(BrowserApp.EXTRA_SKIP_STARTPANE, true);
|
||||
|
||||
i.putExtra("args", "-no-remote -profile " + mProfile);
|
||||
|
||||
String envString = mConfig.get("envvars");
|
||||
if (envString != "") {
|
||||
String[] envStrings = envString.split(",");
|
||||
|
@ -8,6 +8,7 @@ import java.util.Map;
|
||||
|
||||
import org.mozilla.gecko.Actions;
|
||||
import org.mozilla.gecko.Assert;
|
||||
import org.mozilla.gecko.BrowserApp;
|
||||
import org.mozilla.gecko.Driver;
|
||||
import org.mozilla.gecko.FennecNativeActions;
|
||||
import org.mozilla.gecko.FennecNativeDriver;
|
||||
@ -193,6 +194,9 @@ abstract class UITest extends BaseRobocopTest
|
||||
private static Intent createActivityIntent(final Map<String, String> config) {
|
||||
final Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
|
||||
// Don't show the first run experience.
|
||||
intent.putExtra(BrowserApp.EXTRA_SKIP_STARTPANE, true);
|
||||
|
||||
final String profile = config.get("profile");
|
||||
intent.putExtra("args", "-no-remote -profile " + profile);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user