author | Mark Banner <standard8@mozilla.com> |
Fri, 30 Jan 2015 20:49:33 +0000 | |
changeset 226902 | f59defcc1b3615bc52c3e55abbc5100d388263da |
parent 226901 | 9289992e25ebda9b89259a4efb868c9519494c47 |
child 226903 | bc7023dd813043a27d808e67b81918d7d994a58b |
push id | 54950 |
push user | philringnalda@gmail.com |
push date | Sat, 31 Jan 2015 17:14:09 +0000 |
treeherder | mozilla-inbound@37cbadfe1bc1 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | MattN |
bugs | 1093780 |
milestone | 38.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
|
browser/components/uitour/test/browser_UITour_loop.js | file | annotate | diff | comparison | revisions |
--- a/browser/components/uitour/test/browser_UITour_loop.js +++ b/browser/components/uitour/test/browser_UITour_loop.js @@ -11,16 +11,26 @@ let loopPanel = document.getElementById( Components.utils.import("resource:///modules/UITour.jsm"); const { LoopRooms } = Components.utils.import("resource:///modules/loop/LoopRooms.jsm", {}); function test() { UITourTest(); } +function runOffline(fun) { + return (done) => { + Services.io.offline = true; + fun(function onComplete() { + Services.io.offline = false; + done(); + }); + } +} + let tests = [ taskify(function* test_menu_show_hide() { ise(loopButton.open, false, "Menu should initially be closed"); gContentAPI.showMenu("loop"); yield waitForConditionPromise(() => { return loopButton.open; }, "Menu should be visible after showMenu()"); @@ -89,34 +99,34 @@ let tests = [ yield Promise.all(hiddenPromises); isnot(infoPanel.state, "open", "Info panel should have automatically hid"); isnot(highlightPanel.state, "open", "Highlight panel should have automatically hid"); done(); }), "Info panel should be anchored to the new room button"); }); }); }, - function test_notifyLoopChatWindowOpenedClosed(done) { + runOffline(function test_notifyLoopChatWindowOpenedClosed(done) { gContentAPI.observe((event, params) => { is(event, "Loop:ChatWindowOpened", "Check Loop:ChatWindowOpened notification"); gContentAPI.observe((event, params) => { is(event, "Loop:ChatWindowShown", "Check Loop:ChatWindowShown notification"); gContentAPI.observe((event, params) => { is(event, "Loop:ChatWindowClosed", "Check Loop:ChatWindowClosed notification"); gContentAPI.observe((event, params) => { ok(false, "No more notifications should have arrived"); }); }); done(); }); document.querySelector("#pinnedchats > chatbox").close(); }); LoopRooms.open("fakeTourRoom"); - }, - function test_notifyLoopRoomURLCopied(done) { + }), + runOffline(function test_notifyLoopRoomURLCopied(done) { gContentAPI.observe((event, params) => { is(event, "Loop:ChatWindowOpened", "Loop chat window should've opened"); gContentAPI.observe((event, params) => { is(event, "Loop:ChatWindowShown", "Check Loop:ChatWindowShown notification"); let chat = document.querySelector("#pinnedchats > chatbox"); gContentAPI.observe((event, params) => { is(event, "Loop:RoomURLCopied", "Check Loop:RoomURLCopied notification"); @@ -126,18 +136,18 @@ let tests = [ chat.close(); done(); }); chat.content.contentDocument.querySelector(".btn-copy").click(); }); }); setupFakeRoom(); LoopRooms.open("fakeTourRoom"); - }, - function test_notifyLoopRoomURLEmailed(done) { + }), + runOffline(function test_notifyLoopRoomURLEmailed(done) { gContentAPI.observe((event, params) => { is(event, "Loop:ChatWindowOpened", "Loop chat window should've opened"); gContentAPI.observe((event, params) => { is(event, "Loop:ChatWindowShown", "Check Loop:ChatWindowShown notification"); let chat = document.querySelector("#pinnedchats > chatbox"); let composeEmailCalled = false; @@ -157,17 +167,17 @@ let tests = [ ok(recipient, "composeEmail should be invoked with at least a recipient value"); composeEmailCalled = true; chatWin.navigator.wrappedJSObject.mozLoop.composeEmail = oldComposeEmail; }; chatWin.document.querySelector(".btn-email").click(); }); }); LoopRooms.open("fakeTourRoom"); - }, + }), taskify(function* test_arrow_panel_position() { ise(loopButton.open, false, "Menu should initially be closed"); let popup = document.getElementById("UITourTooltip"); yield showMenuPromise("loop"); let currentTarget = "loop-newRoom"; yield showInfoPromise(currentTarget, "This is " + currentTarget, "My arrow should be on the side"); @@ -269,16 +279,17 @@ if (Services.prefs.getBoolPref("loop.ena loopButton = window.LoopUI.toolbarButton.node; // The targets to highlight only appear after getting started is launched. Services.prefs.setBoolPref("loop.gettingStarted.seen", true); registerCleanupFunction(() => { Services.prefs.clearUserPref("loop.gettingStarted.resumeOnFirstJoin"); Services.prefs.clearUserPref("loop.gettingStarted.seen"); Services.prefs.clearUserPref("loop.gettingStarted.url"); + Services.io.offline = false; // Copied from browser/components/loop/test/mochitest/head.js // Remove the iframe after each test. This also avoids mochitest complaining // about leaks on shutdown as we intentionally hold the iframe open for the // life of the application. let frameId = loopButton.getAttribute("notificationFrameId"); let frame = document.getElementById(frameId); if (frame) {