Exemplo n.º 1
0
  /**
   * Checks if the First Run needs to be launched.
   *
   * @return The intent to launch the First Run Experience if necessary, or null.
   * @param context The context.
   * @param fromIntent The intent that was used to launch Chrome.
   * @param forLightweightFre Whether this is a check for the Lightweight First Run Experience.
   */
  public static Intent checkIfFirstRunIsNecessary(
      Context context, Intent fromIntent, boolean forLightweightFre) {
    // If FRE is disabled (e.g. in tests), proceed directly to the intent handling.
    if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE)
        || ApiCompatibilityUtils.isDemoUser(context)) {
      return null;
    }

    // If Chrome isn't opened via the Chrome icon, and the user accepted the ToS
    // in the Setup Wizard, skip any First Run Experience screens and proceed directly
    // to the intent handling.
    final boolean fromChromeIcon =
        fromIntent != null && TextUtils.equals(fromIntent.getAction(), Intent.ACTION_MAIN);
    if (!fromChromeIcon && ToSAckedReceiver.checkAnyUserHasSeenToS(context)) return null;

    final boolean baseFreComplete = FirstRunStatus.getFirstRunFlowComplete(context);
    if (!baseFreComplete) {
      if (forLightweightFre
          && CommandLine.getInstance()
              .hasSwitch(ChromeSwitches.ENABLE_LIGHTWEIGHT_FIRST_RUN_EXPERIENCE)) {
        if (!FirstRunStatus.shouldSkipWelcomePage(context)
            && !FirstRunStatus.getLightweightFirstRunFlowComplete(context)) {
          return createLightweightFirstRunIntent(context, fromChromeIcon);
        }
      } else {
        return createGenericFirstRunIntent(context, fromChromeIcon);
      }
    }

    // Promo pages are removed, so there is nothing else to show in FRE.
    return null;
  }
Exemplo n.º 2
0
  /**
   * Once native is loaded we can consult the command-line (set via about:flags) and also finch
   * state to see if we should enable WebAPKs.
   */
  public static void cacheEnabledStateForNextLaunch() {
    boolean wasEnabled = isEnabledInPrefs();
    CommandLine instance = CommandLine.getInstance();
    String experiment = FieldTrialList.findFullName(WEBAPK_DISABLE_EXPERIMENT_NAME);
    boolean isEnabled =
        (!WEBAPK_RUNTIME_DISABLED.equals(experiment)
            && instance.hasSwitch(ChromeSwitches.ENABLE_WEBAPK));

    if (isEnabled != wasEnabled) {
      Log.d(TAG, "WebApk setting changed (%s => %s)", wasEnabled, isEnabled);
      ChromePreferenceManager.getInstance(ContextUtils.getApplicationContext())
          .setCachedWebApkRuntimeEnabled(isEnabled);
    }
  }
Exemplo n.º 3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AwShellResourceProvider.registerResources(this);

    ContentApplication.initCommandLine(this);
    waitForDebuggerIfNeeded();

    AwBrowserProcess.loadLibrary(this);

    if (CommandLine.getInstance().hasSwitch(AwShellSwitches.ENABLE_ATRACE)) {
      Log.e(TAG, "Enabling Android trace.");
      TraceEvent.setATraceEnabled(true);
    }

    setContentView(R.layout.testshell_activity);

    mAwTestContainerView = createAwTestContainerView();

    mWebContents = mAwTestContainerView.getContentViewCore().getWebContents();
    mNavigationController = mWebContents.getNavigationController();
    LinearLayout contentContainer = (LinearLayout) findViewById(R.id.content_container);
    mAwTestContainerView.setLayoutParams(
        new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 1f));
    contentContainer.addView(mAwTestContainerView);
    mAwTestContainerView.requestFocus();

    initializeUrlField();
    initializeNavigationButtons();

    String startupUrl = getUrlFromIntent(getIntent());
    if (TextUtils.isEmpty(startupUrl)) {
      startupUrl = INITIAL_URL;
    }

    mAwTestContainerView.getAwContents().loadUrl(new LoadUrlParams(startupUrl));
    AwContents.setShouldDownloadFavicons();
    mUrlTextView.setText(startupUrl);

    if (CommandLine.getInstance().hasSwitch(ENABLE_DATA_REDUCTION_PROXY)) {
      String key = CommandLine.getInstance().getSwitchValue(DATA_REDUCTION_PROXY_KEY);
      if (key != null && !key.isEmpty()) {
        AwContentsStatics.setDataReductionProxyKey(key);
        AwContentsStatics.setDataReductionProxyEnabled(true);
      }
    }
  }
Exemplo n.º 4
0
 private void waitForDebuggerIfNeeded() {
   if (CommandLine.getInstance().hasSwitch(BaseSwitches.WAIT_FOR_JAVA_DEBUGGER)) {
     Log.e(TAG, "Waiting for Java debugger to connect...");
     android.os.Debug.waitForDebugger();
     Log.e(TAG, "Java debugger connected. Resuming execution.");
   }
 }
Exemplo n.º 5
0
  /** Turn on StrictMode detection based on build and command-line switches. */
  @UiThread
  // FindBugs doesn't like conditionals with compile time results
  @SuppressFBWarnings("UCF_USELESS_CONTROL_FLOW")
  public static void configureStrictMode() {
    assert ThreadUtils.runningOnUiThread();
    if (sIsStrictModeAlreadyConfigured) {
      return;
    }
    sIsStrictModeAlreadyConfigured = true;

    StrictMode.ThreadPolicy.Builder threadPolicy =
        new StrictMode.ThreadPolicy.Builder(StrictMode.getThreadPolicy());
    StrictMode.VmPolicy.Builder vmPolicy =
        new StrictMode.VmPolicy.Builder(StrictMode.getVmPolicy());

    CommandLine commandLine = CommandLine.getInstance();
    if ("eng".equals(Build.TYPE)
        || BuildConfig.DCHECK_IS_ON
        || ChromeVersionInfo.isLocalBuild()
        || commandLine.hasSwitch(ChromeSwitches.STRICT_MODE)) {
      turnOnDetection(threadPolicy, vmPolicy);
      addDefaultPenalties(threadPolicy, vmPolicy);
      if ("death".equals(commandLine.getSwitchValue(ChromeSwitches.STRICT_MODE))) {
        addThreadDeathPenalty(threadPolicy);
        addVmDeathPenalty(vmPolicy);
      } else if ("testing".equals(commandLine.getSwitchValue(ChromeSwitches.STRICT_MODE))) {
        addThreadDeathPenalty(threadPolicy);
        // Currently VmDeathPolicy kills the process, and is not visible on bot test output.
      }
    }
    // Enroll 1% of dev sessions into StrictMode watch. This is done client-side rather than
    // through finch because this decision is as early as possible in the browser initialization
    // process. We need to detect early start-up StrictMode violations before loading native and
    // before warming the SharedPreferences (that is a violation in an of itself). We will
    // closely monitor this on dev channel.
    boolean enableStrictModeWatch =
        (ChromeVersionInfo.isDevBuild() && Math.random() < UPLOAD_PROBABILITY);
    if ((ChromeVersionInfo.isLocalBuild() && !BuildConfig.DCHECK_IS_ON) || enableStrictModeWatch) {
      turnOnDetection(threadPolicy, vmPolicy);
      initializeStrictModeWatch();
    }

    StrictMode.setThreadPolicy(threadPolicy.build());
    StrictMode.setVmPolicy(vmPolicy.build());
  }
Exemplo n.º 6
0
  @SmallTest
  @Feature({"Preferences"})
  public void testEqualsHashCodeCompareTo() {
    CommandLine.init(null);
    loadNativeLibraryAndInitBrowserProcess();

    Object[][] testData = {
      {0, "http://google.com", "http://google.com"},
      {-1, "[*.]google.com", "http://google.com"},
      {-1, "[*.]google.com", "http://a.google.com"},
      {-1, "[*.]a.com", "[*.]b.com"},
      {0, "[*.]google.com", "google.com"},
      {-1, "[*.]google.com", "a.google.com"},
      {-1, "http://google.com", "http://a.google.com"},
      {-1, "http://a.google.com", "http://a.a.google.com"},
      {-1, "http://a.a.google.com", "http://a.b.google.com"},
      {1, "http://a.b.google.com", "http://google.com"},
      {-1, "http://google.com", "https://google.com"},
      {-1, "http://google.com", "https://a.google.com"},
      {1, "https://b.google.com", "https://a.google.com"},
      {-1, "http://a.com", "http://b.com"},
      {-1, "http://a.com", "http://a.b.com"}
    };

    for (int i = 0; i < testData.length; ++i) {
      Object[] testRow = testData[i];

      int compareToResult = (Integer) testRow[0];

      String string1 = (String) testRow[1];
      String string2 = (String) testRow[2];

      WebsiteAddress addr1 = WebsiteAddress.create(string1);
      WebsiteAddress addr2 = WebsiteAddress.create(string2);

      assertEquals(
          "\"" + string1 + "\" vs \"" + string2 + "\"",
          compareToResult,
          Integer.signum(addr1.compareTo(addr2)));

      // Test that swapping arguments gives an opposite result.
      assertEquals(
          "\"" + string2 + "\" vs \"" + string1 + "\"",
          -compareToResult,
          Integer.signum(addr2.compareTo(addr1)));

      if (compareToResult == 0) {
        assertTrue(addr1.equals(addr2));
        assertTrue(addr2.equals(addr1));
        assertEquals(addr1.hashCode(), addr2.hashCode());
      } else {
        assertFalse(addr1.equals(addr2));
        assertFalse(addr2.equals(addr1));
        // Note: hash codes could still be the same.
      }
    }
  }
Exemplo n.º 7
0
  @Override
  public void setUp() throws Exception {
    super.setUp();

    CommandLine.init(null);
    loadNativeLibraryAndInitBrowserProcess();
    IntentHandler.setTestIntentsEnabled(false);
    mIntentHandler = new IntentHandler(null, null);
    mIntent = new Intent();
  }
  /** Reset the environment before each test. */
  @Before
  public void beforeTest() {
    // TODO(dgn): Remove when command line flags are not used anymore to detect debug
    // see http://crbug.com/469649
    CommandLine.init(new String[] {});

    // We need to initialize the ApplicationStatus to avoid DCHECKs
    ApplicationStatus.initialize((BaseChromiumApplication) Robolectric.application);

    ShadowMediaRouter.sMediaRouter = null;
    ShadowMediaRouter.sCallback = null;
    DummyMediaRouteController.sMediaRouteSelector = mock(MediaRouteSelector.class);
  }
Exemplo n.º 9
0
  /** Starts determining parameters for the First Run. Once finished, calls onFlowIsKnown(). */
  public void start() {
    if (CommandLine.getInstance().hasSwitch(ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE)
        || ApiCompatibilityUtils.isDemoUser(mActivity)) {
      onFlowIsKnown(null);
      return;
    }

    if (!mLaunchProperties.getBoolean(FirstRunActivity.EXTRA_USE_FRE_FLOW_SEQUENCER)) {
      onFlowIsKnown(mLaunchProperties);
      return;
    }

    new AndroidEduAndChildAccountHelper() {
      @Override
      public void onParametersReady() {
        processFreEnvironment(isAndroidEduDevice(), hasChildAccount());
      }
    }.start(mActivity.getApplicationContext());
  }
Exemplo n.º 10
0
  @Override
  public void onFinishInflate() {
    super.onFinishInflate();
    mLocationBar = (LocationBar) findViewById(R.id.location_bar);

    mHomeButton = (TintedImageButton) findViewById(R.id.home_button);
    mBackButton = (TintedImageButton) findViewById(R.id.back_button);
    mForwardButton = (TintedImageButton) findViewById(R.id.forward_button);
    mReloadButton = (TintedImageButton) findViewById(R.id.refresh_button);
    mShowTabStack =
        DeviceClassManager.isAccessibilityModeEnabled(getContext())
            || CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_TABLET_TAB_STACK);

    mTabSwitcherButtonDrawable =
        TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), false);
    mTabSwitcherButtonDrawableLight =
        TabSwitcherDrawable.createTabSwitcherDrawable(getResources(), true);

    mAccessibilitySwitcherButton = (ImageButton) findViewById(R.id.tab_switcher_button);
    mAccessibilitySwitcherButton.setImageDrawable(mTabSwitcherButtonDrawable);
    updateSwitcherButtonVisibility(mShowTabStack);

    mBookmarkButton = (TintedImageButton) findViewById(R.id.bookmark_button);

    mMenuButton = (TintedImageButton) findViewById(R.id.menu_button);
    mMenuButtonWrapper.setVisibility(shouldShowMenuButton() ? View.VISIBLE : View.GONE);

    if (mAccessibilitySwitcherButton.getVisibility() == View.GONE
        && mMenuButtonWrapper.getVisibility() == View.GONE) {
      ApiCompatibilityUtils.setPaddingRelative(
          (View) mMenuButtonWrapper.getParent(),
          0,
          0,
          getResources().getDimensionPixelSize(R.dimen.tablet_toolbar_end_padding),
          0);
    }
  }
  /**
   * The {@link DeviceClassManager} constructor should be self contained and rely on system
   * information and command line flags.
   */
  private DeviceClassManager() {
    // Device based configurations.
    if (SysUtils.isLowEndDevice()) {
      mEnableSnapshots = false;
      mEnableLayerDecorationCache = true;
      mEnableAccessibilityLayout = true;
      mEnableAnimations = false;
      mEnablePrerendering = false;
      mEnableToolbarSwipe = false;
      mDisableDomainReliability = true;
    } else {
      mEnableSnapshots = true;
      mEnableLayerDecorationCache = true;
      mEnableAccessibilityLayout = false;
      mEnableAnimations = true;
      mEnablePrerendering = true;
      mEnableToolbarSwipe = true;
      mDisableDomainReliability = false;
    }

    if (DeviceFormFactor.isTablet(ApplicationStatus.getApplicationContext())) {
      mEnableAccessibilityLayout = false;
    }

    // Flag based configurations.
    CommandLine commandLine = CommandLine.getInstance();
    mEnableAccessibilityLayout |=
        commandLine.hasSwitch(ChromeSwitches.ENABLE_ACCESSIBILITY_TAB_SWITCHER);
    mEnableFullscreen = !commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN);
    mEnableUndo = commandLine.hasSwitch(ChromeSwitches.ENABLE_HIGH_END_UI_UNDO);
    mEnableToolbarSwipeInDocumentMode =
        commandLine.hasSwitch(ChromeSwitches.ENABLE_TOOLBAR_SWIPE_IN_DOCUMENT_MODE);

    // Related features.
    if (mEnableAccessibilityLayout) {
      mEnableAnimations = false;
    }

    if (SysUtils.isLowEndDevice() || mEnableAccessibilityLayout) {
      mEnableUndo = true;
    }
  }
Exemplo n.º 12
0
 @Override
 public void onAccessibilityStatusChanged(boolean enabled) {
   mShowTabStack =
       enabled || CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_TABLET_TAB_STACK);
   updateSwitcherButtonVisibility(enabled);
 }
  @SmallTest
  @Feature({"Android-AppBase"})
  @UiThreadTest
  public void testAllowCrashDumpUploadNowCellDev() {
    CommandLine.init(null);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_ALWAYS,
        CONNECTED,
        WIFI_ON,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_OK);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_ALWAYS,
        DISCONNECTED,
        WIFI_ON,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_NOT_PERMITTED);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_ALWAYS,
        CONNECTED,
        WIFI_OFF,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_OK);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_ALWAYS,
        DISCONNECTED,
        WIFI_OFF,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_NOT_PERMITTED);

    runTest(
        CELLULAR_DEVICE,
        UPLOAD_WIFI_ONLY,
        CONNECTED,
        WIFI_ON,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_OK);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_WIFI_ONLY,
        DISCONNECTED,
        WIFI_ON,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_NOT_PERMITTED);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_WIFI_ONLY,
        CONNECTED,
        WIFI_OFF,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_NOT_PERMITTED);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_WIFI_ONLY,
        DISCONNECTED,
        WIFI_OFF,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_NOT_PERMITTED);

    runTest(
        CELLULAR_DEVICE,
        UPLOAD_NEVER,
        CONNECTED,
        WIFI_ON,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_NOT_PERMITTED);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_NEVER,
        DISCONNECTED,
        WIFI_ON,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_NOT_PERMITTED);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_NEVER,
        CONNECTED,
        WIFI_OFF,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_NOT_PERMITTED);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_NEVER,
        DISCONNECTED,
        WIFI_OFF,
        EXPERIMENT_DISABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_NOT_PERMITTED);

    runTest(
        CELLULAR_DEVICE,
        UPLOAD_ALWAYS,
        CONNECTED,
        WIFI_ON,
        EXPERIMENT_ENABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_DISABLED,
        UPLOAD_OK);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_ALWAYS,
        DISCONNECTED,
        WIFI_ON,
        EXPERIMENT_ENABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_DISABLED,
        UPLOAD_NOT_PERMITTED);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_WIFI_ONLY,
        CONNECTED,
        WIFI_ON,
        EXPERIMENT_ENABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_DISABLED,
        UPLOAD_OK);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_NEVER,
        CONNECTED,
        WIFI_ON,
        EXPERIMENT_ENABLED,
        METRIC_REPORTING_NOT_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_NOT_PERMITTED);

    runTest(
        CELLULAR_DEVICE,
        UPLOAD_ALWAYS,
        CONNECTED,
        WIFI_ON,
        EXPERIMENT_ENABLED,
        METRIC_REPORTING_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_OK);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_ALWAYS,
        CONNECTED,
        WIFI_OFF,
        EXPERIMENT_ENABLED,
        METRIC_REPORTING_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_OK);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_ALWAYS,
        CONNECTED,
        WIFI_ON,
        EXPERIMENT_ENABLED,
        METRIC_REPORTING_SET,
        METRIC_REPORTING_DISABLED,
        UPLOAD_NOT_PERMITTED);
    runTest(
        CELLULAR_DEVICE,
        UPLOAD_ALWAYS,
        DISCONNECTED,
        WIFI_ON,
        EXPERIMENT_ENABLED,
        METRIC_REPORTING_SET,
        METRIC_REPORTING_ENABLED,
        UPLOAD_NOT_PERMITTED);
  }
Exemplo n.º 14
0
  private void initialize(Context context) {

    Log.i("Ludei", "***************************");
    Log.i("Ludei", "Initializing Ludei WebView+");
    Log.i("Ludei", "**************************");

    if (!staticInitialization) {
      PathUtils.setPrivateDataDirectorySuffix(PRIVATE_DATA_DIRECTORY_SUFFIX);
      ResourceExtractor.setMandatoryPaksToExtract(MANDATORY_PAK_FILES);
      ResourceProvider.registerResources();
      staticInitialization = true;
    }

    this.ctx = context;
    if (mProxyWebView == null) {
      mProxyWebView = new LudeiWebView(context, null, 0, this);
    }
    mBridge =
        new LudeiContentsClientBridge(
            mProxyWebView, new LudeiDefaultWebChromeClient(this.ctx, this));
    mDelegate = new LudeiContentViewDelegate(this, mBridge);

    // Initializing the command line must occur before loading the library.
    if (!CommandLine.isInitialized()) {
      CommandLine.initFromFile(COMMAND_LINE_FILE);
      String[] commandLineParams = null; // getCommandLineParamsFromIntent(getIntent());

      if (commandLineParams != null) {
        CommandLine.getInstance().appendSwitchesAndArguments(commandLineParams);
      }
      CommandLine.getInstance().appendSwitch("allow-file-access-from-files");
      if (!LudeiContentView.REMOTE_DEBUGGING) {
        CommandLine.getInstance().appendSwitch("disable-remote-debugging");
      }
      CommandLine.getInstance().appendSwitch("ignore-gpu-blacklist");
    }
    waitForDebuggerIfNeeded();

    DeviceUtils.addDeviceSpecificUserAgentSwitch(context);
    try {
      org.chromium.base.library_loader.LibraryLoader.ensureInitialized();
    } catch (ProcessInitException e) {
      Log.e(TAG, "ContentView initialization failed.", e);
      // Since the library failed to initialize nothing in the application
      // can work, so kill the whole application not just the activity
      System.exit(-1);
      return;
    }

    mSettings = LudeiWebSettingsProxy.Create(context, (new LudeiWebSettings(context, true, false)));
    shellManager = new ShellManager(context, null, this, mDelegate);

    WindowAndroid mWindowAndroid = new ActivityWindowAndroid((Activity) ctx);
    // mWindowAndroid.restoreInstanceState(savedInstanceState);
    shellManager.setWindow(
        mWindowAndroid,
        new Runnable() {
          @Override
          public void run() {
            LudeiContentView.this.onReadyToRender();
          }
        });

    if (CommandLine.getInstance().hasSwitch(ContentSwitches.DUMP_RENDER_TREE)) {
      try {
        BrowserStartupController.get(context).startBrowserProcessesSync(true);
      } catch (ProcessInitException e) {
        Log.e(TAG, "Failed to load native library.", e);
        System.exit(-1);
      }
    } else {
      try {
        BrowserStartupController.get(context)
            .startBrowserProcessesAsync(
                new BrowserStartupController.StartupCallback() {
                  @Override
                  public void onSuccess(boolean alreadyStarted) {
                    // finishInitialization(savedInstanceState);
                    finishInitialization(null);
                  }

                  @Override
                  public void onFailure() {
                    initializationFailed();
                  }
                });
      } catch (ProcessInitException e) {
        Log.e(TAG, "Unable to load native library.", e);
        System.exit(-1);
      }
    }
  }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   CommandLine.getInstance().appendSwitch(ContentSwitches.ENABLE_CREDENTIAL_MANAGER_API);
   loadNativeLibraryAndInitBrowserProcess();
 }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   CommandLine.init(new String[0]);
   mContext = new TestContext();
 }
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   mDelegate.setContext(getInstrumentation().getContext());
   CommandLine.init(new String[0]);
 }