Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/infobar/InfoBarTest.java

Issue 1299513002: [Android] Add support for a hung renderer dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..7a9f18b7936eb95491868e2c5ceaf055e63df03f 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 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() {
+ 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
+ public boolean isSatisfied() {
+ return getActivity().getActivityTab().isShowingSadTab();
+ }
+ }, MAX_TIMEOUT, CHECK_INTERVAL);
+ }
+
+ /**
* Verify InfoBarContainers swap the WebContents they are monitoring properly.
*/
@MediumTest
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698