Bug 1116615 - Use TextUtils.equals to avoid null string issues r=mcomella
authorMark Finkle <mfinkle@mozilla.com>
Wed, 31 Dec 2014 12:55:42 -0500
changeset 247597 d3c44062ebbb2606978acdf898b407dfbe9146ff
parent 247596 355be9b24453e69c64f8b35900cd170af777fc0d
child 247598 0d284cdc38f6a7031d811a12638f6d8f619e730a
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1116615
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1116615 - Use TextUtils.equals to avoid null string issues r=mcomella
mobile/android/base/tests/components/AppMenuComponent.java
--- a/mobile/android/base/tests/components/AppMenuComponent.java
+++ b/mobile/android/base/tests/components/AppMenuComponent.java
@@ -14,16 +14,17 @@ import java.util.List;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.menu.MenuItemActionBar;
 import org.mozilla.gecko.menu.MenuItemDefault;
 import org.mozilla.gecko.tests.UITestContext;
 import org.mozilla.gecko.tests.helpers.DeviceHelper;
 import org.mozilla.gecko.tests.helpers.WaitHelper;
 import org.mozilla.gecko.util.HardwareUtils;
 
+import android.text.TextUtils;
 import android.view.View;
 import android.widget.TextView;
 
 import com.jayway.android.robotium.solo.Condition;
 import com.jayway.android.robotium.solo.RobotiumUtils;
 import com.jayway.android.robotium.solo.Solo;
 
 /**
@@ -158,35 +159,35 @@ public class AppMenuComponent extends Ba
      */
     private View findAppMenuItemView(String text) {
         mSolo.waitForText(text, 1, MAX_WAITTIME_FOR_MENU_UPDATE_IN_MS);
 
         final List<View> views = mSolo.getViews();
 
         final List<MenuItemActionBar> menuItemActionBarList = RobotiumUtils.filterViews(MenuItemActionBar.class, views);
         for (MenuItemActionBar menuItem : menuItemActionBarList) {
-            if (menuItem.getContentDescription().equals(text)) {
+            if (TextUtils.equals(menuItem.getContentDescription(), text)) {
                 return menuItem;
             }
         }
 
         final List<MenuItemDefault> menuItemDefaultList = RobotiumUtils.filterViews(MenuItemDefault.class, views);
         for (MenuItemDefault menuItem : menuItemDefaultList) {
-            if (menuItem.getText().equals(text)) {
+            if (TextUtils.equals(menuItem.getText(), text)) {
                 return menuItem;
             }
         }
 
         // On Android 2.3, menu items may be instances of
         // com.android.internal.view.menu.ListMenuItemView, each with a child
         // android.widget.RelativeLayout which in turn has a child
         // TextView with the appropriate text.
         final List<TextView> textViewList = RobotiumUtils.filterViews(TextView.class, views);
         for (TextView textView : textViewList) {
-            if (textView.getText().equals(text)) {
+            if (TextUtils.equals(textView.getText(), text)) {
                 View relativeLayout = (View) textView.getParent();
                 View listMenuItemView = (View)relativeLayout.getParent();
                 return listMenuItemView;
             }
         }
         return null;
     }