| Index: chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java
|
| index 1a0fee36c1688a137730592db839b0833f6a682e..75169f35d6609cd62e5ad1ad57e2272bc1442bb9 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/video/VideoTest.java
|
| @@ -4,24 +4,14 @@
|
|
|
| package org.chromium.chrome.browser.video;
|
|
|
| -import android.support.test.InstrumentationRegistry;
|
| import android.support.test.filters.LargeTest;
|
|
|
| -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.DisableIf;
|
| import org.chromium.base.test.util.Feature;
|
| import org.chromium.base.test.util.RetryOnFailure;
|
| import org.chromium.chrome.browser.ChromeActivity;
|
| -import org.chromium.chrome.browser.ChromeSwitches;
|
| 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;
|
| @@ -31,43 +21,39 @@
|
| /**
|
| * Simple tests of html5 video.
|
| */
|
| -@RunWith(ChromeJUnit4ClassRunner.class)
|
| -@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
|
| - ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG})
|
| -public class VideoTest {
|
| - @Rule
|
| - public ChromeActivityTestRule<ChromeActivity> mActivityTestRule =
|
| - new ChromeActivityTestRule<>(ChromeActivity.class);
|
| +public class VideoTest extends ChromeActivityTestCaseBase<ChromeActivity> {
|
|
|
| - @Test
|
| + public VideoTest() {
|
| + super(ChromeActivity.class);
|
| + }
|
| +
|
| @DisableIf.Build(sdk_is_less_than = 19, message = "crbug.com/582067")
|
| @Feature({"Media", "Media-Video", "Main"})
|
| @LargeTest
|
| @RetryOnFailure
|
| public void testLoadMediaUrl() throws InterruptedException, TimeoutException {
|
| EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(
|
| - InstrumentationRegistry.getInstrumentation().getContext());
|
| + getInstrumentation().getContext());
|
| try {
|
| - Tab tab = mActivityTestRule.getActivity().getActivityTab();
|
| + Tab tab = getActivity().getActivityTab();
|
| TabTitleObserver titleObserver = new TabTitleObserver(tab, "ready_to_play");
|
| - mActivityTestRule.loadUrl(
|
| - testServer.getURL("/chrome/test/data/android/media/video-play.html"));
|
| + loadUrl(testServer.getURL("/chrome/test/data/android/media/video-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");
|
| // Now the video will play for 5 secs.
|
| // Makes sure that the video ends and title was changed.
|
| titleObserver.waitForTitleUpdate(15);
|
| - Assert.assertEquals("ended", tab.getTitle());
|
| + assertEquals("ended", tab.getTitle());
|
| } finally {
|
| testServer.stopAndDestroyServer();
|
| }
|
| }
|
|
|
| - @Before
|
| - public void setUp() throws InterruptedException {
|
| - mActivityTestRule.startMainActivityOnBlankPage();
|
| + @Override
|
| + public void startMainActivity() throws InterruptedException {
|
| + startMainActivityOnBlankPage();
|
| }
|
| }
|
|
|