Bug 1357639 - part6 : list all test tasks in the ctor.
It's easy to know what test tasks we'll run in this test.
MozReview-Commit-ID: DdtFp4pOXlC
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAudioFocus.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAudioFocus.java
@@ -8,16 +8,27 @@ import org.mozilla.gecko.media.AudioFocu
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();
+ }
+
+ 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,
@@ -60,19 +71,16 @@ public class testAudioFocus extends Medi
State.OWN_FOCUS,
"Should own audio focus.");
info("- abandon audio focus -");
getAudioFocusAgent().notifyStoppedPlaying();
mAsserter.is(getAudioFocusAgent().getAudioFocusState(),
State.LOST_FOCUS,
"Should lose audio focus.");
-
- info("- run next test : testAudioFocusChanged -");
- testAudioFocusChanged();
}
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.");
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testMediaControl.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testMediaControl.java
@@ -11,16 +11,33 @@ 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();
+ }
+
+ private void testBasicBehaviors() {
info("- load URL -");
final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
loadUrlAndWait(MEDIA_URL);
info("- check whether audio starts playing -");
checkIfMediaPlayingSuccess(true /* playing */);
info("- simulate media control pause -");
@@ -32,19 +49,16 @@ public class testMediaControl extends Me
checkIfMediaPlayingSuccess(true /* playing */);
info("- simulate media control stop -");
notifyMediaControlService(MediaControlService.ACTION_STOP);
checkIfMediaPlayingSuccess(false /* paused */, true /* clear notification */);
info("- close tab -");
closeAllTabs();
-
- info("- run next test : testNavigateOutThePage -");
- testNavigateOutThePage();
}
private void testNavigateOutThePage() {
info("- load URL -");
final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
loadUrlAndWait(MEDIA_URL);
info("- check whether audio starts playing -");
@@ -79,19 +93,16 @@ public class testMediaControl extends Me
checkIfMediaPlayingSuccess(true /* playing */);
info("- simulate lose audio focus -");
getAudioFocusAgent().changeAudioFocus(AudioManager.AUDIOFOCUS_LOSS);
checkIfMediaPlayingSuccess(false /* paused */);
info("- close tab -");
closeAllTabs();
-
- info("- run next test : testSwitchTab -");
- testSwitchTab();
}
private void testSwitchTab() {
info("- load URL -");
final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
loadUrlAndWait(MEDIA_URL);
info("- check whether audio starts playing -");
@@ -101,19 +112,16 @@ public class testMediaControl extends Me
final String BLANK_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
addTab(BLANK_URL);
info("- the media control shouldn't be changed -");
checkMediaNotificationStates(true /* playing */);
info("- close tab -");
closeAllTabs();
-
- info("- run next test : testCloseTab -");
- testCloseTab();
}
private void testCloseTab() {
info("- load URL -");
final String MEDIA_URL = getAbsoluteUrl(mStringHelper.ROBOCOP_MEDIA_PLAYBACK_LOOP_URL);
loadUrlAndWait(MEDIA_URL);
info("- check whether audio starts playing -");