| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.infobar; | 5 package org.chromium.chrome.browser.infobar; |
| 6 | 6 |
| 7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
| 8 | 8 |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.support.test.filters.MediumTest; | 10 import android.support.test.filters.MediumTest; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 loadUrl(mTestServer.getURL(POPUP_PAGE)); | 118 loadUrl(mTestServer.getURL(POPUP_PAGE)); |
| 119 mListener.addInfoBarAnimationFinished("InfoBar not added"); | 119 mListener.addInfoBarAnimationFinished("InfoBar not added"); |
| 120 | 120 |
| 121 List<InfoBar> infoBars = getInfoBars(); | 121 List<InfoBar> infoBars = getInfoBars(); |
| 122 assertEquals("Wrong infobar count", 1, infoBars.size()); | 122 assertEquals("Wrong infobar count", 1, infoBars.size()); |
| 123 assertTrue(InfoBarUtil.hasPrimaryButton(infoBars.get(0))); | 123 assertTrue(InfoBarUtil.hasPrimaryButton(infoBars.get(0))); |
| 124 assertFalse(InfoBarUtil.hasSecondaryButton(infoBars.get(0))); | 124 assertFalse(InfoBarUtil.hasSecondaryButton(infoBars.get(0))); |
| 125 InfoBarUtil.clickPrimaryButton(infoBars.get(0)); | 125 InfoBarUtil.clickPrimaryButton(infoBars.get(0)); |
| 126 mListener.removeInfoBarAnimationFinished("InfoBar not removed."); | 126 mListener.removeInfoBarAnimationFinished("InfoBar not removed."); |
| 127 assertEquals("Wrong infobar count", 0, infoBars.size()); | 127 assertEquals("Wrong infobar count", 0, infoBars.size()); |
| 128 assertNotNull(infoBars.get(0).getSnackbarManager()); |
| 128 | 129 |
| 129 // A second load should not show the infobar. | 130 // A second load should not show the infobar. |
| 130 loadUrl(mTestServer.getURL(POPUP_PAGE)); | 131 loadUrl(mTestServer.getURL(POPUP_PAGE)); |
| 131 mListener.addInfoBarAnimationFinished("InfoBar added when it should not"
); | 132 mListener.addInfoBarAnimationFinished("InfoBar added when it should not"
); |
| 132 } | 133 } |
| 133 | 134 |
| 134 /** | 135 /** |
| 135 * Verify Geolocation creates an InfoBar. | 136 * Verify Geolocation creates an InfoBar. |
| 136 */ | 137 */ |
| 137 @MediumTest | 138 @MediumTest |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 assertEquals("Wrong infobar count", 0, getInfoBars().size()); | 485 assertEquals("Wrong infobar count", 0, getInfoBars().size()); |
| 485 | 486 |
| 486 // Revisiting the original page should make the InfoBar reappear. | 487 // Revisiting the original page should make the InfoBar reappear. |
| 487 InfoBarTestAnimationListener addListener = new InfoBarTestAnimationListe
ner(); | 488 InfoBarTestAnimationListener addListener = new InfoBarTestAnimationListe
ner(); |
| 488 getActivity().getActivityTab().getInfoBarContainer().addAnimationListene
r(addListener); | 489 getActivity().getActivityTab().getInfoBarContainer().addAnimationListene
r(addListener); |
| 489 loadUrl(mTestServer.getURL(GEOLOCATION_PAGE)); | 490 loadUrl(mTestServer.getURL(GEOLOCATION_PAGE)); |
| 490 addListener.addInfoBarAnimationFinished("InfoBar not added"); | 491 addListener.addInfoBarAnimationFinished("InfoBar not added"); |
| 491 assertEquals("Wrong infobar count", 1, getInfoBars().size()); | 492 assertEquals("Wrong infobar count", 1, getInfoBars().size()); |
| 492 } | 493 } |
| 493 } | 494 } |
| OLD | NEW |