Bug 570720 - Intermittent failure in browser_library_search.js when default livemark feed includes "dummy". r=mak
authorDrew Willcoxon <adw@mozilla.com>
Wed, 09 Jun 2010 14:08:11 -0700
changeset 43421 81c4ee650d5e3e5ffd1fbcbe676bd8b8ee65132e
parent 43420 0eed88315d8e189368222233f67dbdc033ac2b95
child 43422 e7aef5f9125918c43b23e2170b54155a59d9ba99
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs570720
milestone1.9.3a5pre
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 570720 - Intermittent failure in browser_library_search.js when default livemark feed includes "dummy". r=mak
browser/components/places/tests/browser/Makefile.in
browser/components/places/tests/browser/browser_library_search.js
--- a/browser/components/places/tests/browser/Makefile.in
+++ b/browser/components/places/tests/browser/Makefile.in
@@ -49,25 +49,23 @@ include $(topsrcdir)/config/rules.mk
 	browser_library_left_pane_fixnames.js \
 	browser_425884.js \
 	browser_423515.js \
 	browser_410196_paste_into_tags.js \
 	browser_457473_no_copy_guid.js \
 	browser_sort_in_library.js \
 	browser_library_open_leak.js \
 	browser_library_panel_leak.js \
+	browser_library_search.js \
 	browser_history_sidebar_search.js \
 	browser_bookmarksProperties.js \
 	browser_forgetthissite_single.js \
 	browser_library_left_pane_commands.js \
 	browser_drag_bookmarks_on_toolbar.js \
 	browser_library_middleclick.js \
 	browser_library_views_liveupdate.js \
 	browser_views_liveupdate.js \
 	browser_sidebarpanels_click.js \
 	browser_library_infoBox.js \
 	$(NULL)
 
-# Test disabled because it's failing every time!  See bug 570720.
-#	browser_library_search.js \
-
 libs:: $(_BROWSER_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
--- a/browser/components/places/tests/browser/browser_library_search.js
+++ b/browser/components/places/tests/browser/browser_library_search.js
@@ -54,17 +54,17 @@
  *   3. ensures that the folder scope button is disabled appropriate to the
  *      folder,
  *   4. if the folder scope button is enabled clicks it,
  *   5. resets the search and ensures that the content tree is correct and that
  *      the search UI is hidden, and
  *   6. if folder scope was clicked, searches again and ensures folder scope
  *      remains selected.
  */
- 
+
 const TEST_URL = "http://dummy.mozilla.org/";
 
 // Add your tests here.  Each is a function that's called by testHelper().
 var testCases = [
 
   // All Bookmarks
   function () {
     var defScope = getDefaultScope(PlacesUIUtils.allBookmarksFolderId);
@@ -219,21 +219,25 @@ function search(aFolderId, aSearchStr, a
   if (aSearchStr) {
     is(query.searchTerms, aSearchStr,
        "Content tree's searchTerms should be text in search box");
     is(doc.getElementById("searchModifiers").hidden, false,
        "Scope bar should not be hidden after searching");
     if (getSelectedScopeButtonId() == "scopeBarHistory" ||
         getSelectedScopeButtonId() == "scopeBarAll" ||
         aFolderId == PlacesUtils.bookmarks.unfiledBookmarksFolder) {
-      // Check that search has returned a valid result.
-      contentTree.view.selection.select(0);
-      var foundNode = contentTree.selectedNode;
-      isnot(foundNode, null, "Found a valid node");
-      is(foundNode.uri, TEST_URL);
+      // Check that the target node exists in the tree's search results.
+      var node = null;
+      for (var i = 0; i < contentTree.view.rowCount; i++) {
+        node = contentTree.view.nodeForTreeIndex(i);
+        if (node.uri === TEST_URL)
+          break;
+      }
+      isnot(node, null, "At least the target node should be in the tree");
+      is(node.uri, TEST_URL, "URI of node should match target URL");
     }
   }
   else {
     is(query.hasSearchTerms, false,
        "Content tree's searchTerms should not exist after search reset");
     ok(doc.getElementById("searchModifiers").hidden,
        "Scope bar should be hidden after search reset");
   }