Bug 1158275 - testAddSearchEngine: Verify search engines in search result list and search engine bar. r=mcomella
authorSebastian Kaspari <s.kaspari@gmail.com>
Thu, 04 Jun 2015 10:35:47 -0700
changeset 248023 d7ed7208e7f432758f5d3cff1b158417744fcfaa
parent 248022 8e5abcb55c356a3a4e34205453ff3e9d66f79c2d
child 248024 68e277743ff810d09a0998b8f1915e87c6909eb2
push id60888
push userkwierso@gmail.com
push dateThu, 11 Jun 2015 01:38:38 +0000
treeherdermozilla-inbound@39e638ed06bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs1158275
milestone41.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 1158275 - testAddSearchEngine: Verify search engines in search result list and search engine bar. r=mcomella
mobile/android/tests/browser/robocop/testAddSearchEngine.java
--- a/mobile/android/tests/browser/robocop/testAddSearchEngine.java
+++ b/mobile/android/tests/browser/robocop/testAddSearchEngine.java
@@ -8,19 +8,20 @@ import java.io.File;
 import java.util.ArrayList;
 
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 import org.mozilla.gecko.Actions;
 import org.mozilla.gecko.GeckoProfile;
 import org.mozilla.gecko.home.HomePager;
+import org.mozilla.gecko.home.SearchEngineBar;
+import org.mozilla.gecko.R;
 
 import android.widget.ImageView;
-import android.widget.ListAdapter;
 import android.widget.ListView;
 
 import com.jayway.android.robotium.solo.Condition;
 
 /**
  * Test adding a search engine from an input field context menu.
  * 1. Get the number of existing search engines from the SearchEngine:Data event and as displayed in about:home.
  * 2. Load a page with a text field, open the context menu and add a search engine from the page.
@@ -140,25 +141,27 @@ public class testAddSearchEngine extends
      * @param expectedCount The expected number of search engines.
      */
     public void verifyDisplayedSearchEnginesCount(final int expectedCount) {
         mSolo.clearEditText(0);
         mActions.sendKeys(SEARCH_TEXT);
         boolean correctNumSearchEnginesDisplayed = waitForCondition(new Condition() {
             @Override
             public boolean isSatisfied() {
-                ListView list = findListViewWithTag(HomePager.LIST_TAG_BROWSER_SEARCH);
-                if (list == null) {
+                ListView searchResultList = findListViewWithTag(HomePager.LIST_TAG_BROWSER_SEARCH);
+                if (searchResultList == null || searchResultList.getAdapter() == null) {
                     return false;
                 }
-                ListAdapter adapter = list.getAdapter();
-                if (adapter == null) {
+
+                SearchEngineBar searchEngineBar = (SearchEngineBar) mSolo.getView(R.id.search_engine_bar);
+                if (searchEngineBar == null || searchEngineBar.getAdapter() == null) {
                     return false;
                 }
-                return (adapter.getCount() == expectedCount);
+
+                return (searchResultList.getAdapter().getCount() + searchEngineBar.getAdapter().getCount() == expectedCount);
             }
         }, MAX_WAIT_TEST_MS);
 
         // Exit about:home
         mActions.sendSpecialKey(Actions.SpecialKey.BACK);
         waitForText(mStringHelper.ROBOCOP_BLANK_PAGE_01_TITLE);
         mAsserter.ok(correctNumSearchEnginesDisplayed, expectedCount + " Search Engines should be displayed" , "The correct number of Search Engines has been displayed");
     }