Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | function test() { |
michael@0 | 5 | waitForExplicitFinish(); |
michael@0 | 6 | |
michael@0 | 7 | let url = "http://mochi.test:8888/browser/browser/base/content/test/general/test_wyciwyg_copying.html"; |
michael@0 | 8 | let tab = gBrowser.selectedTab = gBrowser.addTab(url); |
michael@0 | 9 | tab.linkedBrowser.addEventListener("pageshow", function () { |
michael@0 | 10 | let btn = content.document.getElementById("btn"); |
michael@0 | 11 | executeSoon(function () { |
michael@0 | 12 | EventUtils.synthesizeMouseAtCenter(btn, {}, content); |
michael@0 | 13 | let currentURL = gBrowser.currentURI.spec; |
michael@0 | 14 | ok(/^wyciwyg:\/\//i.test(currentURL), currentURL + " is a wyciwyg URI"); |
michael@0 | 15 | |
michael@0 | 16 | executeSoon(function () { |
michael@0 | 17 | testURLBarCopy(url, endTest); |
michael@0 | 18 | }); |
michael@0 | 19 | }); |
michael@0 | 20 | }, false); |
michael@0 | 21 | |
michael@0 | 22 | function endTest() { |
michael@0 | 23 | while (gBrowser.tabs.length > 1) |
michael@0 | 24 | gBrowser.removeCurrentTab(); |
michael@0 | 25 | finish(); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | function testURLBarCopy(targetValue, cb) { |
michael@0 | 29 | info("Expecting copy of: " + targetValue); |
michael@0 | 30 | waitForClipboard(targetValue, function () { |
michael@0 | 31 | gURLBar.focus(); |
michael@0 | 32 | gURLBar.select(); |
michael@0 | 33 | |
michael@0 | 34 | goDoCommand("cmd_copy"); |
michael@0 | 35 | }, cb, cb); |
michael@0 | 36 | } |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 |