diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:00:38 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:00:38 -0500 |
commit | 8148615da179fdd60f19018e13b4e94b95609cc6 (patch) | |
tree | 771fccdd99fa3adf35fdd2c81d8197b415a89b91 /browser/base/content/test/general/browser_bug581253.js | |
parent | 494802c1be7888025b95260d23db187467d2b9dd (diff) | |
download | UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.gz UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.lz UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.xz UXP-8148615da179fdd60f19018e13b4e94b95609cc6.zip |
Remove browser tests - Part 1: The Tests (except for experiments)
Diffstat (limited to 'browser/base/content/test/general/browser_bug581253.js')
-rw-r--r-- | browser/base/content/test/general/browser_bug581253.js | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/browser/base/content/test/general/browser_bug581253.js b/browser/base/content/test/general/browser_bug581253.js deleted file mode 100644 index 0c537c3d3..000000000 --- a/browser/base/content/test/general/browser_bug581253.js +++ /dev/null @@ -1,86 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -var testURL = "data:text/plain,nothing but plain text"; -var testTag = "581253_tag"; -var timerID = -1; - -function test() { - registerCleanupFunction(function() { - PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId); - if (timerID > 0) { - clearTimeout(timerID); - } - }); - waitForExplicitFinish(); - - let tab = gBrowser.selectedTab = gBrowser.addTab(); - tab.linkedBrowser.addEventListener("load", (function(event) { - tab.linkedBrowser.removeEventListener("load", arguments.callee, true); - - let uri = makeURI(testURL); - let bmTxn = - new PlacesCreateBookmarkTransaction(uri, - PlacesUtils.unfiledBookmarksFolderId, - -1, "", null, []); - PlacesUtils.transactionManager.doTransaction(bmTxn); - - ok(PlacesUtils.bookmarks.isBookmarked(uri), "the test url is bookmarked"); - waitForStarChange(true, onStarred); - }), true); - - content.location = testURL; -} - -function waitForStarChange(aValue, aCallback) { - let expectedStatus = aValue ? BookmarkingUI.STATUS_STARRED - : BookmarkingUI.STATUS_UNSTARRED; - if (BookmarkingUI.status == BookmarkingUI.STATUS_UPDATING || - BookmarkingUI.status != expectedStatus) { - info("Waiting for star button change."); - setTimeout(waitForStarChange, 50, aValue, aCallback); - return; - } - aCallback(); -} - -function onStarred() { - is(BookmarkingUI.status, BookmarkingUI.STATUS_STARRED, - "star button indicates that the page is bookmarked"); - - let uri = makeURI(testURL); - let tagTxn = new PlacesTagURITransaction(uri, [testTag]); - PlacesUtils.transactionManager.doTransaction(tagTxn); - - StarUI.panel.addEventListener("popupshown", onPanelShown, false); - BookmarkingUI.star.click(); -} - -function onPanelShown(aEvent) { - if (aEvent.target == StarUI.panel) { - StarUI.panel.removeEventListener("popupshown", arguments.callee, false); - let tagsField = document.getElementById("editBMPanel_tagsField"); - ok(tagsField.value == testTag, "tags field value was set"); - tagsField.focus(); - - StarUI.panel.addEventListener("popuphidden", onPanelHidden, false); - let removeButton = document.getElementById("editBookmarkPanelRemoveButton"); - removeButton.click(); - } -} - -function onPanelHidden(aEvent) { - if (aEvent.target == StarUI.panel) { - StarUI.panel.removeEventListener("popuphidden", arguments.callee, false); - - executeSoon(function() { - ok(!PlacesUtils.bookmarks.isBookmarked(makeURI(testURL)), - "the bookmark for the test url has been removed"); - is(BookmarkingUI.status, BookmarkingUI.STATUS_UNSTARRED, - "star button indicates that the bookmark has been removed"); - gBrowser.removeCurrentTab(); - PlacesTestUtils.clearHistory().then(finish); - }); - } -} |