Bug 1220929 - Add test for RemotePage's portsForBrowser. r=Mossop
authorMike Conley <mconley@mozilla.com>
Thu, 05 Nov 2015 10:43:09 -0500
changeset 273739 fa183fc905e2a9831cf7f765bb5fa63d36ee2744
parent 273738 f531919a3be6a3e7436d782f6e28893eed7b15aa
child 273740 e2b3c92f2953fada805db20e04dc90a20fdcec97
push id68366
push usercbook@mozilla.com
push dateMon, 23 Nov 2015 13:31:58 +0000
treeherdermozilla-inbound@eff4131a3e4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop
bugs1220929
milestone45.0a1
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 1220929 - Add test for RemotePage's portsForBrowser. r=Mossop
toolkit/modules/tests/browser/browser_RemotePageManager.js
--- a/toolkit/modules/tests/browser/browser_RemotePageManager.js
+++ b/toolkit/modules/tests/browser/browser_RemotePageManager.js
@@ -382,8 +382,19 @@ add_task(function* send_data2() {
   port.sendAsyncMessage("SendData2", {data});
   let message = yield waitForMessage(port, "ReceivedData2");
 
   ok(message.data.result, message.data.status);
 
   gBrowser.removeCurrentTab();
 });
 
+add_task(function* get_ports_for_browser() {
+  let pages = new RemotePages(TEST_URL);
+  let port = yield waitForPage(pages);
+  // waitForPage creates a new tab and selects it by default, so
+  // the selected tab should be the one hosting this port.
+  let browser = gBrowser.selectedBrowser;
+  let foundPorts = pages.portsForBrowser(browser);
+  is(foundPorts.length, 1, "There should only be one port for this simple page");
+  is(foundPorts[0], port, "Should find the port");
+  gBrowser.removeCurrentTab();
+});