Chromium Code Reviews| Index: chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java |
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java |
| index bd7f447e0fd9671ce93d1f018e2ad436a1c523af..80159dc1599c397c5e2ba227c4f30f75f51dc18a 100644 |
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java |
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java |
| @@ -151,6 +151,96 @@ public class InfoBarTest extends ChromeActivityTestCaseBase<ChromeActivity> { |
| } |
| /** |
| + * 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() { |
| + getActivity() |
| + .getActivityTab() |
| + .getChromeWebContentsDelegateAndroid() |
| + .rendererUnresponsive(); |
| + } |
| + }); |
| + assertTrue("InfoBar not added", mListener.addInfoBarAnimationFinished()); |
| + |
| + // Make sure it has Kill/Wait buttons. |
| + List<InfoBar> infoBars = getActivity().getActivityTab().getInfoBarContainer().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() |
| + .getChromeWebContentsDelegateAndroid() |
| + .rendererResponsive(); |
| + } |
| + }); |
| + assertTrue("InfoBar not removed.", mListener.removeInfoBarAnimationFinished()); |
| + infoBars = getActivity().getActivityTab().getInfoBarContainer().getInfoBars(); |
| + assertTrue("Wrong infobar count", infoBars.isEmpty()); |
| + } |
| + |
| + /** |
| + * Verifies the unresponsive renderer notification creates an InfoBar. |
|
gone
2015/09/01 18:49:34
update the comment?
jdduke (slow)
2015/09/01 21:49:20
Done.
|
| + */ |
| + @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() { |
| + getActivity() |
| + .getActivityTab() |
| + .getChromeWebContentsDelegateAndroid() |
| + .rendererUnresponsive(); |
| + } |
| + }); |
| + assertTrue("InfoBar not added", mListener.addInfoBarAnimationFinished()); |
| + |
| + // Make sure it has Kill/Wait buttons. |
| + final List<InfoBar> infoBars = |
| + getActivity().getActivityTab().getInfoBarContainer().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", |
| + getActivity().getActivityTab().getInfoBarContainer().getInfoBars().isEmpty()); |
| + CriteriaHelper.pollForCriteria(new Criteria() { |
| + @Override |
|
gone
2015/09/01 18:49:34
Other places in this file indent the @Overrides by
jdduke (slow)
2015/09/01 21:49:19
Hmm, that seems to be when you put the "new Foo()
|
| + public boolean isSatisfied() { |
| + return getActivity().getActivityTab().isShowingSadTab(); |
| + } |
| + }, MAX_TIMEOUT, CHECK_INTERVAL); |
| + } |
| + |
| + /** |
| * Verify InfoBarContainers swap the WebContents they are monitoring properly. |
| */ |
| @MediumTest |