Ejemplo n.º 1
0
  /** Verifies the hung renderer InfoBar can kill the hung renderer. */
  @Smoke
  @MediumTest
  @Feature({"Browser", "Main"})
  public void testInfoBarForHungRendererCanKillRenderer() throws InterruptedException {
    loadUrl(HELLO_WORLD_URL);

    // Fake an unresponsive renderer signal.
    ThreadUtils.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            CommandLine.getInstance().appendSwitch(ChromeSwitches.ENABLE_HUNG_RENDERER_INFOBAR);
            getActivity()
                .getActivityTab()
                .getTabWebContentsDelegateAndroid()
                .rendererUnresponsive();
          }
        });
    assertTrue("InfoBar not added", mListener.addInfoBarAnimationFinished());

    // Make sure it has Kill/Wait buttons.
    final List<InfoBar> infoBars = getInfoBars();
    assertEquals("Wrong infobar count", 1, infoBars.size());
    assertTrue(InfoBarUtil.hasPrimaryButton(infoBars.get(0)));
    assertTrue(InfoBarUtil.hasSecondaryButton(infoBars.get(0)));

    // Activite the Kill button.
    ThreadUtils.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            InfoBarUtil.clickPrimaryButton(infoBars.get(0));
          }
        });

    // The renderer should have been killed and the InfoBar removed.
    assertTrue("InfoBar not removed.", mListener.removeInfoBarAnimationFinished());
    assertTrue("Wrong infobar count", getInfoBars().isEmpty());
    CriteriaHelper.pollForCriteria(
        new Criteria() {
          @Override
          public boolean isSatisfied() {
            return getActivity().getActivityTab().isShowingSadTab();
          }
        },
        MAX_TIMEOUT,
        CHECK_INTERVAL);
  }
Ejemplo n.º 2
0
  /** Verify Geolocation creates an InfoBar. */
  @Smoke
  @MediumTest
  @Feature({"Browser", "Main"})
  public void testInfoBarForGeolocation() throws InterruptedException {
    LocationSettingsTestUtil.setSystemLocationSettingEnabled(true);
    loadUrl(mTestServer.getURL(GEOLOCATION_PAGE));
    assertTrue("InfoBar not added", mListener.addInfoBarAnimationFinished());

    // Make sure it has OK/Cancel buttons.
    List<InfoBar> infoBars = getInfoBars();
    assertEquals("Wrong infobar count", 1, infoBars.size());
    assertTrue(InfoBarUtil.hasPrimaryButton(infoBars.get(0)));
    assertTrue(InfoBarUtil.hasSecondaryButton(infoBars.get(0)));

    loadUrl(HELLO_WORLD_URL);
    assertTrue("InfoBar not removed.", mListener.removeInfoBarAnimationFinished());
    assertTrue("Wrong infobar count", getInfoBars().isEmpty());
  }
Ejemplo n.º 3
0
  /** Verify PopUp InfoBar. */
  @Smoke
  @MediumTest
  @Feature({"Browser", "Main"})
  public void testInfoBarForPopUp() throws InterruptedException {
    loadUrl(mTestServer.getURL(POPUP_PAGE));
    assertTrue("InfoBar not added", mListener.addInfoBarAnimationFinished());

    List<InfoBar> infoBars = getInfoBars();
    assertEquals("Wrong infobar count", 1, infoBars.size());
    assertTrue(InfoBarUtil.hasPrimaryButton(infoBars.get(0)));
    assertFalse(InfoBarUtil.hasSecondaryButton(infoBars.get(0)));
    InfoBarUtil.clickPrimaryButton(infoBars.get(0));
    assertTrue("InfoBar not removed.", mListener.removeInfoBarAnimationFinished());
    assertEquals("Wrong infobar count", 0, infoBars.size());

    // A second load should not show the infobar.
    loadUrl(mTestServer.getURL(POPUP_PAGE));
    assertFalse("InfoBar added when it should not", mListener.addInfoBarAnimationFinished());
  }
Ejemplo n.º 4
0
  /** Verifies the unresponsive renderer notification creates an InfoBar. */
  @Smoke
  @MediumTest
  @Feature({"Browser", "Main"})
  public void testInfoBarForHungRenderer() throws InterruptedException {
    loadUrl(HELLO_WORLD_URL);

    // Fake an unresponsive renderer signal.
    ThreadUtils.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            CommandLine.getInstance().appendSwitch(ChromeSwitches.ENABLE_HUNG_RENDERER_INFOBAR);
            getActivity()
                .getActivityTab()
                .getTabWebContentsDelegateAndroid()
                .rendererUnresponsive();
          }
        });
    assertTrue("InfoBar not added", mListener.addInfoBarAnimationFinished());

    // Make sure it has Kill/Wait buttons.
    List<InfoBar> infoBars = getInfoBars();
    assertEquals("Wrong infobar count", 1, infoBars.size());
    assertTrue(InfoBarUtil.hasPrimaryButton(infoBars.get(0)));
    assertTrue(InfoBarUtil.hasSecondaryButton(infoBars.get(0)));

    // Fake a responsive renderer signal.
    ThreadUtils.runOnUiThread(
        new Runnable() {
          @Override
          public void run() {
            getActivity().getActivityTab().getTabWebContentsDelegateAndroid().rendererResponsive();
          }
        });
    assertTrue("InfoBar not removed.", mListener.removeInfoBarAnimationFinished());
    assertTrue("Wrong infobar count", getInfoBars().isEmpty());
  }