OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.chrome.browser.infobar; |
| 6 |
| 7 import android.test.FlakyTest; |
| 8 |
| 9 import org.chromium.base.test.util.Feature; |
| 10 import org.chromium.chrome.browser.ChromeActivity; |
| 11 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
| 12 import org.chromium.chrome.test.util.InfoBarTestAnimationListener; |
| 13 import org.chromium.chrome.test.util.InfoBarUtil; |
| 14 import org.chromium.chrome.test.util.TestHttpServerClient; |
| 15 |
| 16 /** |
| 17 * Tests for the translate infobar, assumes it runs on a system with language |
| 18 * preferences set to English. |
| 19 * |
| 20 * TODO(newt): merge this with TranslateInfoBarTest after upstreaming. |
| 21 */ |
| 22 public class TranslateInfoBarTest2 extends ChromeActivityTestCaseBase<ChromeActi
vity> { |
| 23 private static final String TRANSLATE_PAGE = "chrome/test/data/translate/fr_
test.html"; |
| 24 private InfoBarTestAnimationListener mListener; |
| 25 |
| 26 public TranslateInfoBarTest2() { |
| 27 super(ChromeActivity.class); |
| 28 } |
| 29 |
| 30 @Override |
| 31 protected void setUp() throws Exception { |
| 32 super.setUp(); |
| 33 InfoBarContainer container = |
| 34 getActivity().getActivityTab().getInfoBarContainer(); |
| 35 mListener = new InfoBarTestAnimationListener(); |
| 36 container.setAnimationListener(mListener); |
| 37 } |
| 38 |
| 39 /** |
| 40 * Test infobar transitions. |
| 41 */ |
| 42 /* |
| 43 * Bug http://crbug.com/267079. |
| 44 * @MediumTest |
| 45 */ |
| 46 @FlakyTest |
| 47 @Feature({"Browser", "Main"}) |
| 48 public void testInfoBarTranslate() throws InterruptedException { |
| 49 loadUrl(TestHttpServerClient.getUrl(TRANSLATE_PAGE)); |
| 50 assertTrue("InfoBar not Added", mListener.addInfoBarAnimationFinished())
; |
| 51 InfoBar infoBar = getInfoBars().get(0); |
| 52 assertTrue(InfoBarUtil.hasPrimaryButton(infoBar)); |
| 53 assertTrue(InfoBarUtil.hasSecondaryButton(infoBar)); |
| 54 assertTrue(InfoBarUtil.clickPrimaryButton(infoBar)); |
| 55 assertTrue("BEFORE -> TRANSLATING transition not Swapped.", |
| 56 mListener.swapInfoBarAnimationFinished()); |
| 57 assertTrue("TRANSLATING -> ERROR transition not Swapped.", |
| 58 mListener.swapInfoBarAnimationFinished()); |
| 59 } |
| 60 |
| 61 @Override |
| 62 public void startMainActivity() throws InterruptedException { |
| 63 startMainActivityFromLauncher(); |
| 64 } |
| 65 } |
OLD | NEW |