Bug 896576 - [fig] Remove [getBookmarksList] from BaseTest, r=margaret
authorMark Capella <markcapella@twcny.rr.com>
Mon, 29 Jul 2013 19:28:04 -0400
changeset 143483 9b7ae4a52863ad0fec89b479fdbdbf40664ae546
parent 143482 1fc9bcc1d4ab5487ef25cd373f0c46a8496c6741
child 143484 a0890fdc1346a5782bb11a9d832822022f0d4d57
push id25130
push userlrocha@mozilla.com
push dateWed, 21 Aug 2013 09:41:27 +0000
treeherdermozilla-central@b2486721572e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs896576
milestone25.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 896576 - [fig] Remove [getBookmarksList] from BaseTest, r=margaret
mobile/android/base/tests/BaseTest.java.in
mobile/android/base/tests/robocop_autophone.ini
mobile/android/base/tests/testBookmark.java.in
mobile/android/base/tests/testBookmarklets.java.in
mobile/android/base/tests/testBookmarksTab.java.in
mobile/android/base/tests/testShareLink.java.in
--- a/mobile/android/base/tests/BaseTest.java.in
+++ b/mobile/android/base/tests/BaseTest.java.in
@@ -531,22 +531,16 @@ abstract class BaseTest extends Activity
                 return true;
         }
         return false;
     }
 
     /**
      * FIXME: Write new versions of these methods and update their consumers to use the new about:home pages.
      */
-    protected ListView getBookmarksList(String waitText, int expectedChildCount) {
-        return null;
-    }
-    protected ListView getBookmarksList(String waitText) {
-        return null;
-    }
     protected ListView getHistoryList(String waitText, int expectedChildCount) {
         return null;
     }
     protected ListView getHistoryList(String waitText) {
         return null;
     }
 
     public long addOrUpdateBookmark(String title, String url, boolean bookmarklet) {
--- a/mobile/android/base/tests/robocop_autophone.ini
+++ b/mobile/android/base/tests/robocop_autophone.ini
@@ -10,19 +10,16 @@
 #[testAxisLocking]
 # fails on gs2, nexus one, lg revolution, droid pro, nexus s
 
 [testBookmark]
 # fails on gs2 4.0.3
 
 [testBookmarklets]
 
-[testBookmarksTab]
-# fails on gs2 4.0.3, droid pro (random)
-
 [testBrowserProvider]
 # fails on gs2 4.0.3
 
 #[testClearPrivateData]
 # fails on gs2, nexus-one, lg revolution, droid pro, nexus s
 
 #[testDoorHanger]
 # fails on gs2, nexus-one, lg revolution, droid pro, nexus s
--- a/mobile/android/base/tests/testBookmark.java.in
+++ b/mobile/android/base/tests/testBookmark.java.in
@@ -58,16 +58,17 @@ public class testBookmark extends PixelT
         }
     }
 
     public void runAwesomeScreenTest() {
         final long PAINT_CLEAR_DELAY = 1000;  // milliseconds
 
         blockForGeckoReady();
 
+        /* Removed by Bug 896576 - [fig] Remove [getBookmarksList] from BaseTest
         // Open the bookmark list and check the root folder view
         ListView bookmarksList = getBookmarksList(ABOUT_HOME_URL, DEFAULT_BOOKMARKS_COUNT);
 
         mAsserter.ok(bookmarksList != null, "checking that bookmarks list exists", "bookmarks list exists and has " +
                 DEFAULT_BOOKMARKS_COUNT + " children (the default bookmarks)");
 
         // No folders should be visible if no desktop bookmarks exist
         int count = bookmarksList.getAdapter().getCount();
@@ -90,16 +91,17 @@ public class testBookmark extends PixelT
         View child = bookmarksList.getChildAt(1);
         mAsserter.ok(child != null, "list item can be retrieved", child != null ? child.toString() : "null!");
         mSolo.clickOnView(child);
         paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
         paintExpecter.unregisterListener();
 
         // Clean up the bookmark we created
         deleteBookmark();
+        */
     }
 
     private boolean waitForBookmarked(final boolean isBookmarked) {
         waitForTest(new BooleanTest() {
             @Override
             public boolean test() {
                 try {
                    return isBookmarked == (Boolean)mIsBookmarked.invoke(null, getActivity().getContentResolver(), BOOKMARK_URL);
--- a/mobile/android/base/tests/testBookmarklets.java.in
+++ b/mobile/android/base/tests/testBookmarklets.java.in
@@ -35,16 +35,17 @@ public class testBookmarklets extends Pi
         }, 3000);
         mAsserter.is(alerted, false, "Alert was not shown for user-entered bookmarklet");
 
         // add the bookmarklet to the database. there's currently no way to
         // add this using the UI, so we go through the content provider.
         addOrUpdateBookmark(title, js, true);
 
         // verify that bookmarklets clicked in awesomescreen work
+        /*  Removed by Bug 896576 - [fig] Remove [getBookmarksList] from BaseTest
         ListView bookmarks = getBookmarksList(title);
 
         Boolean found = false;
         if (bookmarks == null) {
             mAsserter.is(true, true, "Did not find the bookmarks section in the awesomebar");
         } else {
             for (int i = 0; i < bookmarks.getAdapter().getCount(); i++) {
                 Cursor c = (Cursor)bookmarks.getItemAtPosition(i);
@@ -54,16 +55,17 @@ public class testBookmarklets extends Pi
                     mAsserter.is(1, 1, "Found bookmarklet added to bookmarks: " + js);
                     mSolo.clickOnView(bookmarks.getChildAt(i));
                 }
             }
         }
         if (!found) {
             mAsserter.is(found, true, "Found the bookmark: " + js + " and clicked on it");
         }
+        */
 
         alerted = waitForTest(new BooleanTest() {
             @Override
             public boolean test() {
                 return mSolo.searchButton("OK", true) && mSolo.searchText("12.34", true);
             }
         }, 3000);
         mAsserter.is(alerted, true, "Alert was shown for clicked bookmarklet");
deleted file mode 100644
--- a/mobile/android/base/tests/testBookmarksTab.java.in
+++ /dev/null
@@ -1,225 +0,0 @@
-#filter substitution
-package @ANDROID_PACKAGE_NAME@.tests;
-
-import @ANDROID_PACKAGE_NAME@.*;
-import android.view.ViewGroup;
-import android.view.View;
-import android.widget.ListView;
-import android.widget.TextView;
-import android.widget.ImageView;
-import android.text.TextUtils;
-
-import java.util.ArrayList;
-
-/**
- * Tests the Bookmarks Tab
- * - opening the bookmarks tab
- * - items look correct
- * - clicking on an item
- * - long tapping on an item
- * - editing the name, url and keyword of a bookmark from the context menu
- * - removing a bookmark
- */
-public class testBookmarksTab extends BaseTest {
-    private View mFirstChild;
-    private ListView list;
-
-    @Override
-    protected int getTestType() {
-        return TEST_MOCHITEST;
-    }
-
-    public void testBookmarksTab() {
-        blockForGeckoReady();
-        String url = "http://www.example.com";
-
-        // add one page to desktop folders so that we can see them
-        addOrUpdateBookmark("BOOKMARK_TITLE", url, false);
-
-        testList(url);
-        testContextMenu(url);
-    }
-
-    private void testList(String url) {
-        View child;
-        final int bookmarksCount = DEFAULT_BOOKMARKS_COUNT + 1;
-        ListView list = getBookmarksList(DEFAULT_BOOKMARKS_URLS[0], bookmarksCount);
-        mAsserter.isnot(list, null, "checking that bookmarks list exists and has " +
-                bookmarksCount + " children (defaults + a folder)");
-
-        int count = list.getAdapter().getCount();
-        for (int i = count - 1; i >= 0; i--) {
-            child = list.getChildAt(i);
-            compareRow(child, i == 0 ? 1 : 2, 1);
-        }
-
-        child = list.getChildAt(0);
-        mAsserter.ok(child != null, "first list item can be retrieved", child != null ? child.toString() : "null!");
-        mSolo.clickOnView(child);
-        waitForText("Bookmarks Toolbar");
-
-        count = list.getAdapter().getCount();
-        mAsserter.is(count, 4, "desktop folder has correct number of children");
-        for (int i = count - 1; i >= 0; i--) {
-            child = list.getChildAt(i);
-            compareRow(child, 1, i == 0 ? 0 : 1);
-        }
-
-        child = list.getChildAt(1);
-        mAsserter.ok(child != null, "second list item can be retrieved", child != null ? child.toString() : "null!");
-        mSolo.clickOnView(child);
-        waitForText("BOOKMARK_TITLE");
-
-        count = list.getAdapter().getCount();
-        mAsserter.is(count, 2, "toolbar folder has correct number of children");
-        for (int i = count - 1; i >= 0; i--) {
-            child = list.getChildAt(i);
-            compareRow(child, i == 0 ? 1:2, i == 0 ? 0:1);
-        }
-
-        // Test backing out of the folder using the back button
-        mActions.sendSpecialKey(Actions.SpecialKey.BACK);
-        mAsserter.ok(mSolo.waitForText("Bookmarks Toolbar"), "Back moved up one level", "");
-
-        mActions.sendSpecialKey(Actions.SpecialKey.BACK);
-        mAsserter.ok(mSolo.waitForText("about:home"), "Back moved up one level", "");
-
-        mActions.sendSpecialKey(Actions.SpecialKey.BACK);
-    }
-
-    private void testContextMenu(String url) {
-        list = getBookmarksList(url);
-        // wait for the bookmarks list to be populated
-        View child;
-        mFirstChild = null;
-        boolean success = waitForTest(new BooleanTest() {
-            @Override
-            public boolean test() {
-                mFirstChild = list.getChildAt(1);
-                if (mFirstChild == null) {
-                    return false;
-                }
-                if (mFirstChild instanceof android.view.ViewGroup) {
-                    ViewGroup group = (ViewGroup)mFirstChild;
-                    if (group.getChildCount() < 1) {
-                        return false;
-                    }
-                    for (int i = 0; i < group.getChildCount(); i++) {
-                        View grandChild = group.getChildAt(i);
-                        if (grandChild instanceof android.widget.TextView) {
-                            mAsserter.ok(true, "found TextView:", ((android.widget.TextView)grandChild).getText().toString());
-                        }
-                    }
-                } else {
-                    mAsserter.dumpLog("first child not a ViewGroup: "+mFirstChild);
-                    return false;
-                }
-                return true;
-            }
-        }, MAX_WAIT_MS);
-        if (success == true && mFirstChild != null) {
-            mAsserter.dumpLog("clickLongOnView: "+mFirstChild);
-
-            // long tap on a bookmark should show a context menu with an edit option
-            mSolo.clickLongOnView(mFirstChild);
-
-            // TODO: Test clicking these does the right thing
-            mAsserter.ok(mSolo.waitForText("Open in New Tab"), "Context menu has Open in New Tab option", "Open in New Tab");
-            mAsserter.ok(mSolo.waitForText("Share"), "Context menu has Share option", "Share");
-            mAsserter.ok(mSolo.searchText("Edit", true), "Context menu has Edit option", "Edit");
-            mAsserter.ok(mSolo.searchText("Remove", true), "Context menu has Remove option", "Remove");
-            mAsserter.ok(mSolo.searchText("Add to Home Screen", true), "Context menu has Add to Home Screen option", "Add to Home Screen");
-
-            // press back to exit the context menu
-            mActions.sendSpecialKey(Actions.SpecialKey.BACK);
-
-            // test long tap on a folder, this should fail but will still open the folder
-            child = list.getChildAt(0);
-            mAsserter.ok(child != null, "first list item can be retrieved", child != null ? child.toString() : "null!");
-            mSolo.clickLongOnView(child);
-            mAsserter.is(mSolo.waitForText("Share"), false, "Folders have no context menu");
-        } else {
-            mAsserter.ok(false, "waiting for bookmark item", "bookmark item available");
-        }
-
-        list = getBookmarksList(url);
-
-        // Test edit bookmark name
-        editBookmark(1,0," Bookmark Name ",list);
-        mAsserter.is(checkBookmarkEdit(1," Bookmark Name ",list), true, "Bookmark Name was changed");
-
-        // Test edit bookmark link
-        editBookmark(1,1," Bookmark Link ",list);
-        mAsserter.is(checkBookmarkEdit(1,"Bookmark Link",list), true, "Bookmark Link was changed");
-
-        // Test edit bookmark keyword
-        editBookmark(1,2," BookmarkKeyword ",list);
-        mAsserter.is(checkBookmarkEdit(1,"BookmarkKeyword",list), true, "Bookmark Keyword was changed");
-
-        // Remove Bookmark from Context Menu
-        waitForText("Bookmarks");
-        child = list.getChildAt(1);
-        mAsserter.ok(child != null, "second list item can be retrieved", child != null ? child.toString() : "null!");
-        mSolo.clickLongOnView(child);
-        waitForText("Remove");
-        mSolo.clickOnText("Remove");
-
-        // Wait for the toaster notification
-        waitForText("Bookmark removed");
-
-        // Verify Bookmark is removed
-        child = list.getChildAt(1);
-        mAsserter.ok(child != null, "second list item can be retrieved", child != null ? child.toString() : "null!");
-        mSolo.clickLongOnView(child);
-        waitForText("Share");
-        mAsserter.is(mSolo.searchText("Bookmark Name"), false, "Removed bookmark has been deleted");
-        mActions.sendSpecialKey(Actions.SpecialKey.BACK); // Exit the Context Menu
-
-        // back again to exit the awesomebar
-        mActions.sendSpecialKey(Actions.SpecialKey.BACK);
-    }
-
-    private void compareRow(View child, int numTextViews, int numImageViews) {
-        if (child == null) {
-            // this list item may be obscured or offscreen
-            mAsserter.dumpLog("ListView child not available for comparison - offscreen?");
-            return;
-        }
-        ArrayList<View> views = mSolo.getViews(child);
-        ArrayList<ImageView> imageViews = new ArrayList<ImageView>();
-        ArrayList<TextView> textViews = new ArrayList<TextView>();
-
-        for (int j = 0; j < views.size(); j++) {
-            View v = views.get(j);
-            if (v instanceof TextView) {
-                TextView t = (TextView)v;
-                textViews.add(t);
-
-                String string = t.getText().toString();
-                mAsserter.ok(!TextUtils.isEmpty(string), "TextView is filled in", string);
-            } else if (v instanceof ImageView) {
-                imageViews.add((ImageView)v);
-            }
-        }
-
-        int visible = 0;
-        for (int j = 0; j < imageViews.size(); j++) {
-            ImageView img = imageViews.get(j);
-            visible += (img.getVisibility() == View.VISIBLE) ? 1 : 0;
-        }
-        mAsserter.is(visible, numImageViews, "Correct number of ImageViews visible");
-
-        visible = 0;
-        for (int j = 0; j < textViews.size(); j++) {
-            TextView text = textViews.get(j);
-            visible += (text.getVisibility() == View.VISIBLE) ? 1 : 0;
-        }
-        mAsserter.is(textViews.size(), numTextViews, "Correct number of TextViews visible");
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        deleteBookmark("BOOKMARK_TITLE");
-        super.tearDown();
-    }
-}
--- a/mobile/android/base/tests/testShareLink.java.in
+++ b/mobile/android/base/tests/testShareLink.java.in
@@ -81,16 +81,17 @@ public class testShareLink extends BaseT
             mSolo.clickLongOnView(allpages);
             verifySharePopup(shareOptions,"Top Sites");
         } else {
             // The view should not be null but sometimes getChildAt fails
             // TODO: Investigate why this fails
             mAsserter.todo_isnot(allpages, null, "View should not be null but sometimes it is");
         }
 
+        //  Removed by Bug 896576 - [fig] Remove [getBookmarksList] from BaseTest
         // Test the share popup in the Bookmarks tab
         ListView blist = getBookmarksList("about:firefox");
         View bookmark = blist.getChildAt(1); // Getting child at 1 because 0 might be the Desktop folder
         mSolo.clickLongOnView(bookmark);
         verifySharePopup(shareOptions,"bookmarks");
 
         // Test the share popup in the History tab
         ListView hlist = getHistoryList("Today|Yesterday");