Bug 869123: Hide share test as it expects a popup window. [r=mfinkle]
☠☠ backed out by c2a8c555821e ☠ ☠
authorSriram Ramasubramanian <sriram@mozilla.com>
Wed, 29 May 2013 20:08:05 -0700
changeset 140516 e9593bf12a5970daf85ca7701a747806315c3942
parent 140515 f9c1d3eb3ce633367dbde13dc1af1cc15f9d1ff3
child 140517 4a0cf16e2f87f10d08a0d7dd44e22a2a05017705
push id3911
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 20:17:26 +0000
treeherdermozilla-aurora@7e26ca8db92b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs869123
milestone24.0a1
Bug 869123: Hide share test as it expects a popup window. [r=mfinkle]
mobile/android/base/tests/testShareLink.java.in
--- a/mobile/android/base/tests/testShareLink.java.in
+++ b/mobile/android/base/tests/testShareLink.java.in
@@ -6,16 +6,17 @@ import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.widget.ListView;
 import android.view.View;
 import android.view.ViewGroup;
 import java.util.ArrayList;
 import java.util.List;
 import android.app.Activity;
+import android.os.Build;
 import android.util.DisplayMetrics;
 
 /**
  * This test covers the opening and content of the Share Link pop-up list
  * The test opens the Share menu from the app menu, the URL bar, a link context menu and the Awesomescreen tabs
  */
 public class testShareLink extends BaseTest {
     ListView list;
@@ -29,21 +30,26 @@ public class testShareLink extends BaseT
     public void testShareLink() {
         url = getAbsoluteUrl("/robocop/robocop_big_link.html");
         ArrayList<String> shareOptions;
         blockForGeckoReady();
 
         loadUrl(url);
         waitForText("Big Link"); // Waiting for page title to ensure the page is loaded
         selectMenuItem("Share");
-        waitForText("Share via");
+        if (Build.VERSION.SDK_INT >= 14) {
+            // Check for our own sync in the submenu.
+            waitForText("Sync$");
+        } else {
+            waitForText("Share via");
+        }
 
         // Get list of current avaliable share activities and verify them
         shareOptions = getShareOptions();
-        ArrayList<String> displayedOptions = getSharePopupOption();
+        ArrayList<String> displayedOptions = getShareOptionsList();
         for (String option:shareOptions) {
              // Verify if the option is present in the list of displayed share options
              mAsserter.ok(optionDisplayed(option, displayedOptions), "Share option found", option);
         }
 
         // Test share from the awesomebar context menu
         mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Close the share menu
         mSolo.clickLongOnText("Big Link");
@@ -142,16 +148,36 @@ public class testShareLink extends BaseT
                            }
                       }
                   }
              }
         }
         return displayedOptions;
     }
 
+    public ArrayList<String> getShareSubMenuOption() {
+        ArrayList<String> displayedOptions = new ArrayList();
+        ListView shareMenu = getDisplayedShareList();
+        for (int i = 0; i < shareMenu.getAdapter().getCount();i++) {
+             View shareItem = shareMenu.getAdapter().getView(i, null, null);
+             if (shareItem instanceof android.widget.TextView) {
+                 displayedOptions.add(((android.widget.TextView)shareItem).getText().toString());
+             }
+        }
+        return displayedOptions;
+    }
+
+    public ArrayList<String> getShareOptionsList() {
+        if (Build.VERSION.SDK_INT >= 14) {
+            return getShareSubMenuOption();
+        } else {
+            return getSharePopupOption();
+        }
+    }
+
     private boolean optionDisplayed(String shareOption, ArrayList<String> displayedOptions) {
         for (String displayedOption: displayedOptions) {
             if (shareOption.equals(displayedOption)) {
                 return true;
             }
         }
         return false;
     }