Bug 600871 - Fix timeout in browser_bookmarks.js test [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 30 Sep 2010 11:07:37 -0700
changeset 2113 bedc4384560b893feffce5d5d44c26f47ea2fbf4
parent 2112 c0915b9c0abbeef9558dcc6521cf89c2afdd19fa
child 2114 15f6e169870b82f0babc43f7cb6cba35236e3942
push id1779
push usermbrubeck@mozilla.com
push dateThu, 30 Sep 2010 18:08:07 +0000
reviewersmfinkle
bugs600871
Bug 600871 - Fix timeout in browser_bookmarks.js test [r=mfinkle]
chrome/tests/browser_bookmarks.js
--- a/chrome/tests/browser_bookmarks.js
+++ b/chrome/tests/browser_bookmarks.js
@@ -77,17 +77,17 @@ gTests.push({
 
 //------------------------------------------------------------------------------
 // Case: Test clicking on a bookmark loads the web page
 gTests.push({
   desc: "Test clicking on a bookmark loads the web page",
   _currentTab: null,
 
   run: function() {
-    this._currentTab = Browser.addTab(testURL_01, true);
+    this._currentTab = Browser.addTab(testURL_02, true);
 
     // Need to wait until the page is loaded
     messageManager.addMessageListener("pageshow", function(aMessage) {
       if (gCurrentTest._currentTab.browser.currentURI.spec != "about:blank") {
         messageManager.removeMessageListener(aMessage.name, arguments.callee);
         gCurrentTest.onPageReady();
       }
     });
@@ -96,31 +96,33 @@ gTests.push({
   onPageReady: function() {
     // Open the bookmark list
     BrowserUI.doCommand("cmd_bookmarks");
 
     waitFor(gCurrentTest.onBookmarksReady, function() { return BrowserUI.activePanel == BookmarkList });
   },
 
   onBookmarksReady: function() {
+    let bookmarkitem = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_01);
+    bookmarkitem.control.scrollBoxObject.ensureElementIsVisible(bookmarkitem);
+
+    isnot(bookmarkitem, null, "Found the bookmark");
+    is(bookmarkitem.getAttribute("uri"), testURL_01, "Bookmark has the right URL via attribute");
+    is(bookmarkitem.spec, testURL_01, "Bookmark has the right URL via property");
+
     // Create a listener for the opening bookmark
     messageManager.addMessageListener("pageshow", function(aMessage) {
       messageManager.removeMessageListener(aMessage.name, arguments.callee);
       is(gCurrentTest._currentTab.browser.currentURI.spec, testURL_01, "Opened the right bookmark");
 
       Browser.closeTab(gCurrentTest._currentTab);
 
       runNextTest();
     });
 
-    let bookmarkitem = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_01);
-    isnot(bookmarkitem, null, "Found the bookmark");
-    is(bookmarkitem.getAttribute("uri"), testURL_01, "Bookmark has the right URL via attribute");
-    is(bookmarkitem.spec, testURL_01, "Bookmark has the right URL via property");
-
     EventUtils.synthesizeMouse(bookmarkitem, bookmarkitem.width / 2, bookmarkitem.height / 2, {});
   }
 });
 
 //------------------------------------------------------------------------------
 // Case: Test editing URI of existing bookmark
 gTests.push({
   desc: "Test editing URI of existing bookmark",