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/debugger/test/mochitest/browser_dbg_listtabs-03.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/debugger/test/mochitest/browser_dbg_listtabs-03.js')
-rw-r--r-- | devtools/client/debugger/test/mochitest/browser_dbg_listtabs-03.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_listtabs-03.js b/devtools/client/debugger/test/mochitest/browser_dbg_listtabs-03.js new file mode 100644 index 000000000..d5584dcdb --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg_listtabs-03.js @@ -0,0 +1,61 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Make sure the listTabs request works as specified. + */ + +const TAB1_URL = EXAMPLE_URL + "doc_empty-tab-01.html"; + +var gTab1, gTab1Actor, gTab2, gTab2Actor, gClient; + +function test() { + if (!DebuggerServer.initialized) { + DebuggerServer.init(); + DebuggerServer.addBrowserActors(); + } + + let transport = DebuggerServer.connectPipe(); + gClient = new DebuggerClient(transport); + gClient.connect().then(Task.async(function* ([aType, aTraits]) { + is(aType, "browser", + "Root actor should identify itself as a browser."); + let tab = yield addTab(TAB1_URL); + + let { tabs } = yield gClient.listTabs(); + is(tabs.length, 2, "Should be two tabs"); + let tabGrip = tabs.filter(a => a.url == TAB1_URL).pop(); + ok(tabGrip, "Should have an actor for the tab"); + + let response = yield gClient.request({ to: tabGrip.actor, type: "attach" }); + is(response.type, "tabAttached", "Should have attached"); + + response = yield gClient.listTabs(); + tabs = response.tabs; + + response = yield gClient.request({ to: tabGrip.actor, type: "detach" }); + is(response.type, "detached", "Should have detached"); + + let newGrip = tabs.filter(a => a.url == TAB1_URL).pop(); + is(newGrip.actor, tabGrip.actor, "Should have the same actor for the same tab"); + + response = yield gClient.request({ to: tabGrip.actor, type: "attach" }); + is(response.type, "tabAttached", "Should have attached"); + response = yield gClient.request({ to: tabGrip.actor, type: "detach" }); + is(response.type, "detached", "Should have detached"); + + yield removeTab(tab); + yield gClient.close(); + finish(); + })); +} + +registerCleanupFunction(function () { + gTab1 = null; + gTab1Actor = null; + gTab2 = null; + gTab2Actor = null; + gClient = null; +}); |