Bug 1357639 - part6 : list all test tasks in the ctor. draft
authorAlastor Wu <alwu@mozilla.com>
Mon, 08 May 2017 14:10:51 +0800
changeset 573968 2cab8e891a72b5b3f6d15a0ff5a234205b23d90e
parent 573967 a207eeb9c343a3d1a7d7e32a8616ec35b0ab34e2
child 573969 a65956ccc2f2bd86c0b6b1101f15a1b86c250fc0
push id57550
push useralwu@mozilla.com
push dateMon, 08 May 2017 07:06:13 +0000
bugs1357639
milestone55.0a1
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
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAudioFocus.java
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testMediaControl.java
--- 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 -");