Backed out changeset 2adc92ca8808 (bug 1351087) for test failures in own test
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 22 May 2017 12:18:58 +0200
changeset 394031 b479558ee0437038dcf55adcb982412268a95ab2
parent 394030 cf1d4e65a1d1b7f2b1d33116669b2298212228c5
child 394032 c7475dd59d76fdccc5b3de45900d37387b6d0bbc
push id7336
push usercbook@mozilla.com
push dateMon, 22 May 2017 10:19:16 +0000
treeherdermozilla-beta@b479558ee043 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1351087
milestone54.0
backs out2adc92ca880875a4728d3499154a76fadcadfa0a
Backed out changeset 2adc92ca8808 (bug 1351087) for test failures in own test
mobile/android/tests/browser/robocop/no_audio_track.webm
mobile/android/tests/browser/robocop/robocop_media_playback_js.html
mobile/android/tests/browser/robocop/silent_audio_track.webm
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/MediaPlaybackTest.java
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAudioFocus.java
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testMediaControl.java
deleted file mode 100644
index 9207017fb60eee73a7789694e7ec41b23cfcd9c6..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/mobile/android/tests/browser/robocop/robocop_media_playback_js.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<audio id="testAudio"                     src="audio.ogg" loop></audio>
-<video id="testMediaWithSilentAudioTrack" src="silent_audio_track.webm" loop></audio>
-<video id="testMediaWithoutAudioTrack"    src="no_audio_track.webm" loop></audio>
-<script type="application/javascript" src="robocop_head.js"></script>
-<script type="text/javascript">
-var audio = document.getElementById("testAudio");
-var mediaWithSilentAudioTrack = document.getElementById("testMediaWithSilentAudioTrack");
-var mediaWithoutAudioTrack = document.getElementById("testMediaWithoutAudioTrack");
-
-let test = {
-  play_audio : function() {
-    audio.play();
-  },
-
-  pause_audio : function() {
-    audio.pause();
-  },
-
-  adjust_audio_volume : function(volume) {
-    audio.volume = volume;
-  },
-
-  adjust_audio_muted : function(muted) {
-    audio.muted = muted;
-  },
-
-  finish_test: function() {
-    java.disconnect();
-  },
-
-  play_media_with_silent_audio_track: function() {
-    mediaWithSilentAudioTrack.play();
-  },
-
-  pause_media_with_silent_audio_track: function() {
-    mediaWithSilentAudioTrack.pause();
-  },
-
-  play_media_without_audio_track: function() {
-    mediaWithoutAudioTrack.play();
-  },
-
-  pause_media_without_audio_track: function() {
-    mediaWithoutAudioTrack.pause();
-  },
-};
-
-var java = new JavaBridge(test);
-
-</script>
deleted file mode 100644
index 8e08a86c45b49a673eb0895138b2e070b4171e66..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/MediaPlaybackTest.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.tests;
-
-import org.mozilla.gecko.Actions;
-import org.mozilla.gecko.R;
-import org.mozilla.gecko.Tab;
-import org.mozilla.gecko.Tabs;
-import org.mozilla.gecko.media.AudioFocusAgent;
-import org.mozilla.gecko.media.AudioFocusAgent.State;
-import org.mozilla.gecko.media.MediaControlService;
-import org.mozilla.gecko.tests.helpers.JavascriptBridge;
-
-import android.content.Intent;
-import android.content.Context;
-
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.graphics.drawable.Icon;
-import android.os.Build;
-import android.service.notification.StatusBarNotification;
-
-import com.robotium.solo.Condition;
-
-abstract class MediaPlaybackTest extends BaseTest {
-    private Context mContext;
-    private int mPrevIcon = 0;
-    protected String mPrevURL = "";
-    private JavascriptBridge mJs;
-
-    private static final int UI_CHANGED_WAIT_MS = 6000;
-
-    protected final void info(String msg) {
-        mAsserter.dumpLog(msg);
-    }
-
-    protected final Context getContext() {
-        if (mContext == null) {
-            mContext = getInstrumentation().getTargetContext();
-        }
-        return mContext;
-    }
-
-    /**
-     * Get the system active notification and check whether its UI icon has
-     * been changed.
-     */
-    protected final void waitUntilNotificationUIChanged() {
-        if (!isAvailableToCheckNotification()) {
-            return;
-        }
-        waitForCondition(new Condition() {
-            @Override
-            public boolean isSatisfied() {
-                NotificationManager notificationManager = (NotificationManager)
-                    getContext().getSystemService(Context.NOTIFICATION_SERVICE);
-                StatusBarNotification[] sbns = notificationManager.getActiveNotifications();
-                /**
-                 * Make sure the notification content changed.
-                 * (1) icon changed :
-                 * same website, but playback state changed. eg. play -> pause
-                 * (2) title changed :
-                 * play new media from different tab, and change notification
-                 * content for the new tab.
-                 */
-                boolean findCorrectNotification = false;
-                for (int idx = 0; idx < sbns.length; idx++) {
-                    if (sbns[idx].getId() != R.id.mediaControlNotification) {
-                       continue;
-                    }
-                    findCorrectNotification = true;
-                    final Notification notification = sbns[idx].getNotification();
-                    if ((notification.actions.length == 1 &&
-                         notification.actions[0].icon != mPrevIcon) ||
-                         notification.extras.getString(Notification.EXTRA_TEXT) != mPrevURL) {
-                        mPrevIcon = notification.actions[0].icon;
-                        mPrevURL = notification.extras.getString(Notification.EXTRA_TEXT);
-                        return true;
-                    }
-                }
-
-                // The notification was cleared.
-                if (!findCorrectNotification && mPrevIcon != 0) {
-                    mPrevIcon = 0;
-                    mPrevURL = "";
-                    return true;
-                }
-                return false;
-            }
-        }, UI_CHANGED_WAIT_MS);
-    }
-
-    /**
-     * Use these methods to wait the tab playing related states changed.
-     */
-    protected final void waitUntilTabMediaStarted(final Tab tab) {
-        if (tab.isMediaPlaying()) {
-            return;
-        }
-        // Tab:MediaPlaybackChange would be dispatched when media started or
-        // ended, but it won't be dispatched when we pause/resume media via
-        // media control.
-        Actions.EventExpecter contentEventExpecter =
-                mActions.expectGlobalEvent(Actions.EventType.UI, "Tab:MediaPlaybackChange");
-        contentEventExpecter.blockForEvent();
-        contentEventExpecter.unregisterListener();
-    }
-
-    private final void waitUntilTabAudioPlayingStateChanged(final Tab tab,
-                                                            final boolean isTabPlaying) {
-        if (tab.isAudioPlaying() == isTabPlaying) {
-            return;
-        }
-        waitForCondition(new Condition() {
-            @Override
-            public boolean isSatisfied() {
-                return tab.isAudioPlaying() == isTabPlaying;
-            }
-        }, MAX_WAIT_MS);
-    }
-
-    private final void waitUntilTabMediaPlaybackChanged(final Tab tab,
-                                                        final boolean isTabPlaying) {
-        if (tab.isMediaPlaying() == isTabPlaying) {
-            return;
-        }
-        waitForCondition(new Condition() {
-            @Override
-            public boolean isSatisfied() {
-                return tab.isMediaPlaying() == isTabPlaying;
-            }
-        }, MAX_WAIT_MS);
-    }
-
-    /**
-     * These methods are used to check Tab's playing related attributes.
-     * isMediaPlaying : is any media playing (might be audible or non-audbile)
-     * isAudioPlaying : is any audible media playing
-     */
-    protected final void checkTabMediaPlayingState(final Tab tab,
-                                                   final boolean isTabPlaying) {
-        waitUntilTabMediaPlaybackChanged(tab, isTabPlaying);
-        mAsserter.ok(isTabPlaying == tab.isMediaPlaying(),
-                     "Checking the media playing state of tab, isTabPlaying = " + isTabPlaying,
-                     "Tab's media playing state is correct.");
-    }
-
-    protected final void checkTabAudioPlayingState(final Tab tab,
-                                                   final boolean isTabPlaying) {
-        waitUntilTabAudioPlayingStateChanged(tab, isTabPlaying);
-        mAsserter.ok(isTabPlaying == tab.isAudioPlaying(),
-                     "Checking the audio playing state of tab, isTabPlaying = " + isTabPlaying,
-                     "Tab's audio playing state is correct.");
-    }
-
-    /**
-     * Since we can't testing media control via clicking the media control, we
-     * directly send intent to service to simulate the behavior.
-     */
-    protected final void notifyMediaControlService(String action) {
-        Intent intent = new Intent(getContext(), MediaControlService.class);
-        intent.setAction(action);
-        getContext().startService(intent);
-    }
-
-    /**
-     * Use these methods when both media control and audio focus state should
-     * be changed and you want to check whether the changing are correct or not.
-     * Checking selected tab is default option.
-     */
-    protected final void checkIfMediaPlayingSuccess(boolean isTabPlaying) {
-        checkIfMediaPlayingSuccess(isTabPlaying, false);
-    }
-
-    protected final void checkIfMediaPlayingSuccess(boolean isTabPlaying,
-                                                    boolean clearNotification) {
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        checkTabMediaPlayingState(tab, isTabPlaying);
-        checkMediaNotificationStatesAfterChanged(tab, isTabPlaying, clearNotification);
-
-        checkTabAudioPlayingState(tab, isTabPlaying);
-        checkAudioFocusStateAfterChanged(isTabPlaying);
-    }
-
-    /**
-     * This method is used to check whether notification states are correct or
-     * not after notification UI changed.
-     */
-    protected final void checkMediaNotificationStatesAfterChanged(final Tab tab,
-                                                                  final boolean isTabPlaying) {
-        checkMediaNotificationStatesAfterChanged(tab, isTabPlaying, false);
-    }
-
-    protected final void checkMediaNotificationStatesAfterChanged(final Tab tab,
-                                                                  final boolean isTabPlaying,
-                                                                  final boolean clearNotification) {
-        waitUntilNotificationUIChanged();
-
-        if (clearNotification) {
-            checkIfMediaNotificationBeCleared();
-        } else {
-            checkMediaNotificationStates(tab, isTabPlaying);
-        }
-    }
-
-    protected final void checkMediaNotificationStates(final Tab tab,
-                                                      final boolean isTabPlaying) {
-        if (!isAvailableToCheckNotification()) {
-            return;
-        }
-        NotificationManager notificationManager = (NotificationManager)
-            getContext().getSystemService(Context.NOTIFICATION_SERVICE);
-
-        StatusBarNotification[] sbns = notificationManager.getActiveNotifications();
-        boolean findCorrectNotification = false;
-        for (int idx = 0; idx < sbns.length; idx++) {
-            if (sbns[idx].getId() == R.id.mediaControlNotification) {
-                findCorrectNotification = true;
-                break;
-            }
-        }
-        mAsserter.ok(findCorrectNotification,
-                     "Showing correct notification in system's status bar.",
-                     "Check system notification");
-
-        Notification notification = sbns[0].getNotification();
-        mAsserter.is(notification.icon,
-                     R.drawable.flat_icon,
-                     "Notification shows correct small icon.");
-        mAsserter.is(notification.extras.get(Notification.EXTRA_TITLE),
-                     tab.getTitle(),
-                     "Notification shows correct title.");
-        mAsserter.is(notification.extras.get(Notification.EXTRA_TEXT),
-                     tab.getURL(),
-                     "Notification shows correct text.");
-        mAsserter.is(notification.actions.length, 1,
-                     "Only has one action in notification.");
-        mAsserter.is(notification.actions[0].title,
-                     getContext().getString(isTabPlaying ? R.string.media_pause : R.string.media_play),
-                     "Action has correct title.");
-        mAsserter.is(notification.actions[0].icon,
-                     isTabPlaying ? R.drawable.ic_media_pause : R.drawable.ic_media_play,
-                     "Action has correct icon.");
-    }
-
-    protected final void checkIfMediaNotificationBeCleared() {
-        if (!isAvailableToCheckNotification()) {
-            return;
-        }
-        NotificationManager notificationManager = (NotificationManager)
-            getContext().getSystemService(Context.NOTIFICATION_SERVICE);
-        StatusBarNotification[] sbns = notificationManager.getActiveNotifications();
-
-        boolean findCorrectNotification = false;
-        for (int idx = 0; idx < sbns.length; idx++) {
-            if (sbns[idx].getId() == R.id.mediaControlNotification) {
-                findCorrectNotification = true;
-                break;
-            }
-        }
-        mAsserter.ok(!findCorrectNotification,
-                     "Should not have notification in system's status bar.",
-                     "Check system notification.");
-    }
-
-    /**
-     * This method is used to check whether audio focus state are correct or
-     * not after tab's audio playing state changed.
-     */
-    protected final void checkAudioFocusStateAfterChanged(boolean isTabPlaying) {
-        if (isTabPlaying) {
-            mAsserter.is(AudioFocusAgent.getInstance().getAudioFocusState(),
-                         State.OWN_FOCUS,
-                         "Audio focus state is correct.");
-        } else {
-            boolean isLostFocus =
-                AudioFocusAgent.getInstance().getAudioFocusState().equals(State.LOST_FOCUS) ||
-                AudioFocusAgent.getInstance().getAudioFocusState().equals(State.LOST_FOCUS_TRANSIENT);
-            mAsserter.ok(isLostFocus,
-                         "Checking the audio focus when the tab is not playing",
-                         "Audio focus state is correct.");
-        }
-    }
-
-    protected final AudioFocusAgent getAudioFocusAgent() {
-        return AudioFocusAgent.getInstance();
-    }
-
-    protected final void requestAudioFocus() {
-        getAudioFocusAgent().notifyStartedPlaying();
-        if (getAudioFocusAgent().getAudioFocusState() == State.OWN_FOCUS) {
-            return;
-        }
-
-        // Request audio focus might fail, depend on the andriod's audio mode.
-        waitForCondition(new Condition() {
-            @Override
-            public boolean isSatisfied() {
-                getAudioFocusAgent().notifyStartedPlaying();
-                return getAudioFocusAgent().getAudioFocusState() == State.OWN_FOCUS;
-            }
-        }, MAX_WAIT_MS);
-    }
-
-    /**
-     * The method NotificationManager.getActiveNotifications() is only avaiable
-     * after version 23, so we need to check version ensure running the test on
-     * the correct version.
-     */
-    protected final void checkAndroidVersionForMediaControlTest() {
-        mAsserter.ok(isAvailableToCheckNotification(),
-                     "Checking the android version for media control testing",
-                     "The API to check system notification is only available after version 23.");
-    }
-
-    protected final boolean isAvailableToCheckNotification() {
-        return Build.VERSION.SDK_INT >= 23;
-    }
-
-     /**
-     * Can communicte with JS bey getJS(), but caller should create and destroy
-     * JSBridge manually.
-     */
-    protected JavascriptBridge getJS() {
-        mAsserter.ok(mJs != null,
-                     "JSBridege existence check",
-                     "Should connect JSBridge before using JS!");
-        return mJs;
-    }
-
-    protected void createJSBridge() {
-        mAsserter.ok(mJs == null,
-                     "JSBridege existence check",
-                     "Should not recreate the JSBridge!");
-        mJs = new JavascriptBridge(this, mActions, mAsserter);
-    }
-
-    protected void destroyJSBridge() {
-        mAsserter.ok(mJs != null,
-                     "JSBridege existence check",
-                     "Should create JSBridge before destroy it!");
-        mJs.disconnect();
-        mJs = null;
-    }
-}
deleted file mode 100644
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAudioFocus.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.tests;
-
-import org.mozilla.gecko.Tab;
-import org.mozilla.gecko.Tabs;
-import org.mozilla.gecko.media.AudioFocusAgent.State;
-
-import android.media.AudioManager;
-
-public class testAudioFocus extends MediaPlaybackTest {
-    public void testAudioFocus() {
-        info("- wait for gecko ready -");
-        blockForGeckoReady();
-
-        info("- run test : testBasicAbility -");
-        testBasicAbility();
-
-        info("- run test : testAudioFocusChanged -");
-        testAudioFocusChanged();
-
-        info("- run test : testSwitchTab -");
-        testSwitchTab();
-
-        info("- run test : testAdjustMediaVolumeOrMuted -");
-        testAdjustMediaVolumeOrMuted();
-
-        info("- run test : testMediaWithSilentAudioTrack -");
-        testMediaWithSilentAudioTrack();
-
-        info("- run test : testMediaWithoutAudioTrack -");
-        testMediaWithoutAudioTrack();
-    }
-
-    private void testBasicAbility() {
-        info("- check audio focus in the beginning -");
-        mAsserter.is(getAudioFocusAgent().getAudioFocusState(),
-                     State.LOST_FOCUS,
-                     "Should not own audio focus.");
-
-        info("- request audio focus -");
-        requestAudioFocus();
-        mAsserter.ok(true,
-                     "Check audio focus state",
-                     "Should own audio focus.");
-
-        info("- simulate losing audio focus transiently -");
-        getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_LOSS_TRANSIENT);
-        mAsserter.is(getAudioFocusAgent().getAudioFocusState(),
-                     State.LOST_FOCUS_TRANSIENT,
-                     "Should lose audio focus.");
-
-        info("- simulate gaining audio focus again -");
-        getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_GAIN);
-        mAsserter.is(getAudioFocusAgent().getAudioFocusState(),
-                     State.OWN_FOCUS,
-                     "Should own audio focus.");
-
-        info("- simulate losing audio focus and can duck -");
-        getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK);
-        mAsserter.is(getAudioFocusAgent().getAudioFocusState(),
-                     State.LOST_FOCUS_TRANSIENT_CAN_DUCK,
-                     "Should lose audio focus and can duck.");
-
-        info("- simulate gaining audio focus again -");
-        getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_GAIN);
-        mAsserter.is(getAudioFocusAgent().getAudioFocusState(),
-                     State.OWN_FOCUS,
-                     "Should own audio focus.");
-
-        info("- simulate losing audio focus -");
-        getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_LOSS);
-        mAsserter.is(getAudioFocusAgent().getAudioFocusState(),
-                     State.LOST_FOCUS,
-                     "Should lose audio focus.");
-
-        info("- request audio focus -");
-        requestAudioFocus();
-        mAsserter.is(getAudioFocusAgent().getAudioFocusState(),
-                     State.OWN_FOCUS,
-                     "Should own audio focus.");
-
-        info("- abandon audio focus -");
-        getAudioFocusAgent().notifyStoppedPlaying();
-        mAsserter.is(getAudioFocusAgent().getAudioFocusState(),
-                     State.LOST_FOCUS,
-                     "Should lose audio focus.");
-    }
-
-    private void testAudioFocusChanged() {
-        info("- check audio focus in the beginning -");
-        mAsserter.is(getAudioFocusAgent().getAudioFocusState(),
-                     State.LOST_FOCUS,
-                     "Should not request audio focus before media starts.");
-
-        info("- load URL with looping audio file -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-
-        info("- wait tab becomes audible -");
-        checkTabAudioPlayingState(tab, true /* audible */);
-        checkAudioFocusStateAfterChanged(true);
-
-        info("- simulate losing audio focus transiently -");
-        getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_LOSS_TRANSIENT);
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- simulate gaining audio focus again -");
-        getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_GAIN);
-        checkTabAudioPlayingState(tab, true /* audible */);
-        checkAudioFocusStateAfterChanged(true);
-
-        info("- simulate losing audio focus -");
-        getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_LOSS);
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- close tab -");
-        closeAllTabs();
-    }
-
-    private void testSwitchTab() {
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-
-        info("- wait tab becomes audible -");
-        checkTabAudioPlayingState(tab, true /* audible */);
-        checkAudioFocusStateAfterChanged(true);
-
-        info("- switch to the another tab -");
-        final String BLANK_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
-        addTab(BLANK_URL);
-
-        info("- should still own the audio focus -");
-        checkAudioFocusStateAfterChanged(true);
-
-        info("- close tab -");
-        closeAllTabs();
-    }
-
-   /**
-     * Audio focus should only be requested when media is audible.
-     */
-    private void testAdjustMediaVolumeOrMuted() {
-        info("- create JSBridge -");
-        createJSBridge();
-
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_JS_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- play media -");
-        getJS().syncCall("play_audio");
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-
-        info("- wait tab becomes audible -");
-        checkTabAudioPlayingState(tab, true /* audible */);
-        checkAudioFocusStateAfterChanged(true);
-
-        info("- change media's volume to 0.0 -");
-        getJS().syncCall("adjust_audio_volume", 0.0);
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- change media's volume to 1.0 -");
-        getJS().syncCall("adjust_audio_volume", 1.0);
-        checkTabAudioPlayingState(tab, true /* audible */);
-        checkAudioFocusStateAfterChanged(true);
-
-        info("- mute media -");
-        getJS().syncCall("adjust_audio_muted", true);
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- unmute media -");
-        getJS().syncCall("adjust_audio_muted", false);
-        checkTabAudioPlayingState(tab, true /* audible */);
-        checkAudioFocusStateAfterChanged(true);
-
-        info("- pause media -");
-        getJS().syncCall("pause_audio");
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- close tab -");
-        closeAllTabs();
-
-        info("- destroy JSBridge -");
-        destroyJSBridge();
-    }
-
-    private void testMediaWithSilentAudioTrack() {
-        info("- create JSBridge -");
-        createJSBridge();
-
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_JS_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- play media with silent audio track -");
-        getJS().syncCall("play_media_with_silent_audio_track");
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-
-        info("- tab should be non-audible and should not request audio focus -");
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- pause media -");
-        getJS().syncCall("pause_media_without_audio_track");
-
-        info("- tab should be non-audible and should not request audio focus -");
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- close tab -");
-        closeAllTabs();
-
-        info("- destroy JSBridge -");
-        destroyJSBridge();
-    }
-
-    private void testMediaWithoutAudioTrack() {
-        info("- create JSBridge -");
-        createJSBridge();
-
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_JS_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- play media without audio track -");
-        getJS().syncCall("play_media_without_audio_track");
-
-        // We can't know whether it starts or not for media without audio track,
-        // because we won't dispatch Tab:MediaPlaybackChange event for this kind
-        // of media. So we just check the state multiple times to make sure we
-        // don't request audio focus.
-        info("- tab should be non-audible and should not request audio focus -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- tab should be non-audible and should not request audio focus -");
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- tab should be non-audible and should not request audio focus -");
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- tab should be non-audible and should not request audio focus -");
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- tab should be non-audible and should not request audio focus -");
-        checkTabAudioPlayingState(tab, false /* non-audible */);
-        checkAudioFocusStateAfterChanged(false);
-
-        info("- pause media -");
-        getJS().syncCall("pause_media_without_audio_track");
-
-        info("- close tab -");
-        closeAllTabs();
-
-        info("- destroy JSBridge -");
-        destroyJSBridge();
-    }
-}
deleted file mode 100644
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testMediaControl.java
+++ /dev/null
@@ -1,451 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.tests;
-
-import org.mozilla.gecko.Tab;
-import org.mozilla.gecko.Tabs;
-import org.mozilla.gecko.media.MediaControlService;
-
-import android.media.AudioManager;
-
-public class testMediaControl extends MediaPlaybackTest {
-    public void testMediaControl() {
-        info("- ensure the test is running on correct Android version -");
-        checkAndroidVersionForMediaControlTest();
-
-        info("- wait for gecko ready -");
-        blockForGeckoReady();
-
-        info("- run test : testBasicBehaviors -");
-        testBasicBehaviors();
-
-        info("- run test : testNavigateOutThePage -");
-        testNavigateOutThePage();
-
-        info("- run test : testAudioFocusChanged -");
-        testAudioFocusChanged();
-
-        info("- run test : testSwitchTab -");
-        testSwitchTab();
-
-        info("- run test : testCloseTab -");
-        testCloseTab();
-
-        info("- run test : testResumeMediaFromPage -");
-        testResumeMediaFromPage();
-
-        info("- run test : testAdjustMediaVolumeOrMuted -");
-        testAdjustMediaVolumeOrMuted();
-
-        info("- run test : testMediaWithSilentAudioTrack -");
-        testMediaWithSilentAudioTrack();
-
-        info("- run test : testMediaWithoutAudioTrack -");
-        testMediaWithoutAudioTrack();
-
-        info("- run test : testAudioCompetingForMediaWithSilentAudioTrack -");
-        testAudioCompetingForMediaWithSilentAudioTrack();
-
-        info("- run test : testAudioCompetingForMediaWithoutAudioTrack -");
-        testAudioCompetingForMediaWithoutAudioTrack();
-    }
-
-    private void testBasicBehaviors() {
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-
-        info("- check whether audio starts playing -");
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- simulate media control pause -");
-        notifyMediaControlService(MediaControlService.ACTION_PAUSE);
-        checkIfMediaPlayingSuccess(false /* paused */);
-
-        info("- simulate media control resume -");
-        notifyMediaControlService(MediaControlService.ACTION_RESUME);
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- simulate media control stop -");
-        notifyMediaControlService(MediaControlService.ACTION_STOP);
-        checkIfMediaPlayingSuccess(false /* paused */, true /* clear notification */);
-
-        info("- close tab -");
-        closeAllTabs();
-    }
-
-    private void testNavigateOutThePage() {
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-
-        info("- check whether audio starts playing -");
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- navigate out the present page -");
-        final String BLANK_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
-        loadUrlAndWait(BLANK_URL);
-        checkIfMediaPlayingSuccess(false /* paused */, true /* clear notification */);
-
-        info("- close tab -");
-        closeAllTabs();
-
-        info("- run next test : testAudioFocusChanged -");
-        testAudioFocusChanged();
-    }
-
-    private void testAudioFocusChanged() {
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-
-        info("- check whether audio starts playing -");
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- simulate lose audio focus transiently -");
-        getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_LOSS_TRANSIENT);
-        checkIfMediaPlayingSuccess(false /* paused */);
-
-        info("- simulate gain audio focus again -");
-        getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_GAIN);
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- simulate lose audio focus -");
-        getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_LOSS);
-        checkIfMediaPlayingSuccess(false /* paused */);
-
-        info("- close tab -");
-        closeAllTabs();
-    }
-
-    private void testSwitchTab() {
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-
-        info("- check whether audio starts playing -");
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- switch to the another tab -");
-        final String BLANK_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
-        addTab(BLANK_URL);
-
-        info("- the media control shouldn't be changed and display the info of audible tab -");
-        checkMediaNotificationStates(tab, true /* playing */);
-
-        info("- close tab -");
-        closeAllTabs();
-    }
-
-    private void testCloseTab() {
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-
-        info("- check whether audio starts playing -");
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- close audible tab -");
-        Tabs.getInstance().closeTab(tab);
-
-        info("- media control should disappear -");
-        waitUntilNotificationUIChanged();
-        checkIfMediaNotificationBeCleared();
-
-        info("- close tab -");
-        closeAllTabs();
-    }
-
-   /**
-     * Media control and audio focus should be changed as well when user resume
-     * media from page, instead of from media control.
-     */
-    private void testResumeMediaFromPage() {
-        info("- create JSBridge -");
-        createJSBridge();
-
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_JS_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- play media -");
-        getJS().syncCall("play_audio");
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- simulate media control pause -");
-        notifyMediaControlService(MediaControlService.ACTION_PAUSE);
-        checkIfMediaPlayingSuccess(false /* paused */);
-
-        info("- resume media from page -");
-        getJS().syncCall("play_audio");
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- pause media from page -");
-        getJS().syncCall("pause_audio");
-        checkIfMediaPlayingSuccess(false /* paused */, true /* clear notification */);
-
-        info("- close tab -");
-        closeAllTabs();
-
-        info("- destroy JSBridge -");
-        destroyJSBridge();
-    }
-
-    /**
-     * There are three situations that media would be non-audible,
-     * (1) media is muted/set volume to ZERO
-     * (2) media has silent audio track
-     * (3) media doesn't have audio track
-     * We would show the media control for (1) and (2), but won't show it for (3).
-     */
-    private void testAdjustMediaVolumeOrMuted() {
-        info("- create JSBridge -");
-        createJSBridge();
-
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_JS_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- play media -");
-        getJS().syncCall("play_audio");
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- change media's volume to 0.0 -");
-        getJS().syncCall("adjust_audio_volume", 0.0);
-        checkMediaNotificationStates(tab, true);
-
-        info("- change media's volume to 1.0 -");
-        getJS().syncCall("adjust_audio_volume", 1.0);
-        checkMediaNotificationStates(tab, true);
-
-        info("- mute media -");
-        getJS().syncCall("adjust_audio_muted", true);
-        checkMediaNotificationStates(tab, true);
-
-        info("- unmute media -");
-        getJS().syncCall("adjust_audio_muted", false);
-        checkMediaNotificationStates(tab, true);
-
-        info("- pause media -");
-        getJS().syncCall("pause_audio");
-        checkIfMediaPlayingSuccess(false /* paused */, true /* clear notification */);
-
-        info("- close tab -");
-        closeAllTabs();
-
-        info("- destroy JSBridge -");
-        destroyJSBridge();
-    }
-
-    private void testMediaWithSilentAudioTrack() {
-        info("- create JSBridge -");
-        createJSBridge();
-
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_JS_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- play media with silent audio track -");
-        getJS().syncCall("play_media_with_silent_audio_track");
-
-        info("- wait until media starts playing -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(tab);
-
-        info("- media control should be displayed -");
-        checkTabMediaPlayingState(tab, true);
-        checkMediaNotificationStatesAfterChanged(tab,
-                                                 true /* playing */);
-
-        info("- pause media with silent audio track -");
-        getJS().syncCall("pause_media_with_silent_audio_track");
-
-        info("- media control should disappear -");
-        checkMediaNotificationStatesAfterChanged(tab,
-                                                 false /* non-playing */,
-                                                 true /* clear control */);
-        info("- close tab -");
-        closeAllTabs();
-
-        info("- destroy JSBridge -");
-        destroyJSBridge();
-    }
-
-    private void testMediaWithoutAudioTrack() {
-        info("- create JSBridge -");
-        createJSBridge();
-
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_JS_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- play media -");
-        getJS().syncCall("play_media_without_audio_track");
-
-        // We can't know whether it starts or not for media without audio track,
-        // because we won't dispatch Tab:MediaPlaybackChange event for this kind
-        // of media. So we just check the state multiple times to make sure we
-        // don't show the media control.
-        info("- should not show control -");
-        final Tab tab = Tabs.getInstance().getSelectedTab();
-        checkTabMediaPlayingState(tab, false);
-        checkIfMediaNotificationBeCleared();
-
-        info("- should not show control -");
-        checkTabMediaPlayingState(tab, false);
-        checkIfMediaNotificationBeCleared();
-
-        info("- should not show control -");
-        checkTabMediaPlayingState(tab, false);
-        checkIfMediaNotificationBeCleared();
-
-        info("- should not show control -");
-        checkTabMediaPlayingState(tab, false);
-        checkIfMediaNotificationBeCleared();
-
-        info("- should not show control -");
-        checkTabMediaPlayingState(tab, false);
-        checkIfMediaNotificationBeCleared();
-
-        info("- pause media -");
-        getJS().syncCall("pause_media_without_audio_track");
-
-        info("- close tab -");
-        closeAllTabs();
-
-        info("- destroy JSBridge -");
-        destroyJSBridge();
-    }
-
-    /**
-     * There are three situations that media would be non-audible,
-     * (1) media is muted/set volume to ZERO
-     * (2) media has silent audio track
-     * (3) media doesn't have audio track
-     * (1) and (2) would involve in the audio competing within tabs, but (3)
-     * won't, because (3) are more likely GIF-like video and we don't want it
-     * interrupts background audio playback.
-     */
-    private void testAudioCompetingForMediaWithSilentAudioTrack() {
-        info("- create JSBridge -");
-        createJSBridge();
-
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- wait until media starts playing -");
-        final Tab audibleTab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(audibleTab);
-
-        info("- check whether audio starts playing -");
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- switch to the another tab -");
-        final String MEDIA_JS_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_JS_URL);
-        addTab(MEDIA_JS_URL);
-
-        info("- play silent media from new tab -");
-        getJS().syncCall("play_media_with_silent_audio_track");
-
-        info("- wait until silent media starts playing -");
-        Tab silentTab = Tabs.getInstance().getFirstTabForUrl(MEDIA_JS_URL);
-        waitUntilTabMediaStarted(silentTab);
-
-        info("- audible tab should be stopped because of audio competing -");
-        checkTabMediaPlayingState(audibleTab, false);
-        checkTabAudioPlayingState(audibleTab, false);
-
-        info("- should show media control for silent tab -");
-        checkMediaNotificationStatesAfterChanged(silentTab,
-                                                 true /* playing */);
-
-        info("- pause silent media -");
-        getJS().syncCall("play_media_with_silent_audio_track");
-
-        info("- close tabs -");
-        closeAllTabs();
-
-        info("- destroy JSBridge -");
-        destroyJSBridge();
-    }
-
-    private void testAudioCompetingForMediaWithoutAudioTrack() {
-        info("- create JSBridge -");
-        createJSBridge();
-
-        info("- load URL -");
-        final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
-        loadUrlAndWait(MEDIA_URL);
-
-        info("- wait until media starts playing -");
-        final Tab audibleTab = Tabs.getInstance().getSelectedTab();
-        waitUntilTabMediaStarted(audibleTab);
-
-        info("- check whether audio starts playing -");
-        checkIfMediaPlayingSuccess(true /* playing */);
-
-        info("- switch to the another tab -");
-        final String MEDIA_JS_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_JS_URL);
-        addTab(MEDIA_JS_URL);
-
-        info("- play silent media from new tab -");
-        getJS().syncCall("play_media_without_audio_track");
-
-        // Same with testMediaWithoutAudioTrack, we can't know when the media
-        // has started, so just check the states multiple times.
-        info("- audible tab should still be playing and show media control -");
-        checkTabMediaPlayingState(audibleTab, true);
-        checkTabAudioPlayingState(audibleTab, true);
-        checkMediaNotificationStates(audibleTab, true /* playing */);
-
-        info("- audible tab should still be playing and show media control -");
-        checkTabMediaPlayingState(audibleTab, true);
-        checkTabAudioPlayingState(audibleTab, true);
-        checkMediaNotificationStates(audibleTab, true /* playing */);
-
-        info("- audible tab should still be playing and show media control -");
-        checkTabMediaPlayingState(audibleTab, true);
-        checkTabAudioPlayingState(audibleTab, true);
-        checkMediaNotificationStates(audibleTab, true /* playing */);
-
-        info("- pause sielent media -");
-        getJS().syncCall("pause_media_without_audio_track");
-
-        info("- close tabs -");
-        closeAllTabs();
-
-        info("- destroy JSBridge -");
-        destroyJSBridge();
-    }
-}