@Override
 protected void setUp() throws Exception {
   super.setUp();
   AwContents.setShouldDownloadFavicons();
   mContentsClient = new TestAwContentsClient();
   AwTestContainerView testContainerView = createAwTestContainerViewOnMainSync(mContentsClient);
   mAwContents = testContainerView.getAwContents();
   mWebServer = TestWebServer.start();
 }
Exemplo n.º 2
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);
      }
    }
  }