diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/aboutdebugging/test/browser_tabs.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/aboutdebugging/test/browser_tabs.js')
-rw-r--r-- | devtools/client/aboutdebugging/test/browser_tabs.js | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/devtools/client/aboutdebugging/test/browser_tabs.js b/devtools/client/aboutdebugging/test/browser_tabs.js new file mode 100644 index 000000000..8cdeef17d --- /dev/null +++ b/devtools/client/aboutdebugging/test/browser_tabs.js @@ -0,0 +1,59 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const TAB_URL = "data:text/html,<title>foo</title>"; + +add_task(function* setup() { + yield SpecialPowers.pushPrefEnv({ + set: [["dom.ipc.processCount", 1]] + }); +}); + +add_task(function* () { + let { tab, document } = yield openAboutDebugging("tabs"); + + // Wait for initial tabs list which may be empty + let tabsElement = getTabList(document); + if (tabsElement.querySelectorAll(".target-name").length == 0) { + yield waitForMutation(tabsElement, { childList: true }); + } + // Refresh tabsElement to get the .target-list element + tabsElement = getTabList(document); + + let names = [...tabsElement.querySelectorAll(".target-name")]; + let initialTabCount = names.length; + + // Open a new tab in background and wait for its addition in the UI + let onNewTab = waitForMutation(tabsElement, { childList: true }); + let newTab = yield addTab(TAB_URL, { background: true }); + yield onNewTab; + + // Check that the new tab appears in the UI, but with an empty name + let newNames = [...tabsElement.querySelectorAll(".target-name")]; + newNames = newNames.filter(node => !names.includes(node)); + is(newNames.length, 1, "A new tab appeared in the list"); + let newTabTarget = newNames[0]; + + // Then wait for title update, but on slow test runner, the title may already + // be set to the expected value + if (newTabTarget.textContent != "foo") { + yield waitForContentMutation(newTabTarget); + } + + // Check that the new tab appears in the UI + is(newTabTarget.textContent, "foo", "The tab title got updated"); + is(newTabTarget.title, TAB_URL, "The tab tooltip is the url"); + + // Finally, close the tab + let onTabsUpdate = waitForMutation(tabsElement, { childList: true }); + yield removeTab(newTab); + yield onTabsUpdate; + + // Check that the tab disappeared from the UI + names = [...tabsElement.querySelectorAll("#tabs .target-name")]; + is(names.length, initialTabCount, "The tab disappeared from the UI"); + + yield closeAboutDebugging(tab); +}); |