Index: chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java |
index f2a69ea8fcaa5058ab263f4b3781392c7fd7fa4d..2465227c6ca82c89361a36453d2191cbbb7ef9b2 100644 |
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/AudioTest.java |
@@ -4,20 +4,9 @@ |
package org.chromium.chrome.browser; |
-import android.support.test.InstrumentationRegistry; |
- |
-import org.junit.After; |
-import org.junit.Assert; |
-import org.junit.Before; |
-import org.junit.Rule; |
-import org.junit.Test; |
-import org.junit.runner.RunWith; |
- |
-import org.chromium.base.test.util.CommandLineFlags; |
import org.chromium.base.test.util.FlakyTest; |
import org.chromium.chrome.browser.tab.Tab; |
-import org.chromium.chrome.test.ChromeActivityTestRule; |
-import org.chromium.chrome.test.ChromeJUnit4ClassRunner; |
+import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
import org.chromium.chrome.test.util.browser.TabTitleObserver; |
import org.chromium.content.browser.test.util.DOMUtils; |
import org.chromium.net.test.EmbeddedTestServer; |
@@ -27,26 +16,24 @@ |
/** |
* Simple HTML5 audio tests. |
*/ |
-@RunWith(ChromeJUnit4ClassRunner.class) |
-@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, |
- ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG}) |
-public class AudioTest { |
- @Rule |
- public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = |
- new ChromeActivityTestRule<>(ChromeActivity.class); |
+public class AudioTest extends ChromeActivityTestCaseBase<ChromeActivity> { |
private EmbeddedTestServer mTestServer; |
- @Before |
- public void setUp() throws Exception { |
- mActivityTestRule.startMainActivityOnBlankPage(); |
- mTestServer = EmbeddedTestServer.createAndStartServer( |
- InstrumentationRegistry.getInstrumentation().getContext()); |
+ public AudioTest() { |
+ super(ChromeActivity.class); |
} |
- @After |
- public void tearDown() throws Exception { |
+ @Override |
+ protected void setUp() throws Exception { |
+ super.setUp(); |
+ mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation().getContext()); |
+ } |
+ |
+ @Override |
+ protected void tearDown() throws Exception { |
mTestServer.stopAndDestroyServer(); |
+ super.tearDown(); |
} |
/** |
@@ -55,21 +42,24 @@ |
* @MediumTest |
*/ |
// TODO(jbudorick): Attempt to reenable this after the server switch has stabilized. |
- @Test |
@FlakyTest(message = "crbug.com/331122") |
public void testPlayMp3() throws InterruptedException, TimeoutException { |
- Tab tab = mActivityTestRule.getActivity().getActivityTab(); |
+ Tab tab = getActivity().getActivityTab(); |
TabTitleObserver titleObserver = new TabTitleObserver(tab, "ready_to_play"); |
- mActivityTestRule.loadUrl( |
- mTestServer.getURL("/chrome/test/data/android/media/audio-play.html")); |
+ loadUrl(mTestServer.getURL("/chrome/test/data/android/media/audio-play.html")); |
titleObserver.waitForTitleUpdate(5); |
- Assert.assertEquals("ready_to_play", tab.getTitle()); |
+ assertEquals("ready_to_play", tab.getTitle()); |
titleObserver = new TabTitleObserver(tab, "ended"); |
DOMUtils.clickNode(tab.getContentViewCore(), "button1"); |
// Make sure that the audio playback "ended" and title is changed. |
titleObserver.waitForTitleUpdate(15); |
- Assert.assertEquals("ended", tab.getTitle()); |
+ assertEquals("ended", tab.getTitle()); |
+ } |
+ |
+ @Override |
+ public void startMainActivity() throws InterruptedException { |
+ startMainActivityOnBlankPage(); |
} |
} |