browser/base/content/test/general/browser_wyciwyg_urlbarCopying.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/general/browser_wyciwyg_urlbarCopying.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function test() {
     1.8 +  waitForExplicitFinish();
     1.9 +
    1.10 +  let url = "http://mochi.test:8888/browser/browser/base/content/test/general/test_wyciwyg_copying.html";
    1.11 +  let tab = gBrowser.selectedTab = gBrowser.addTab(url);
    1.12 +  tab.linkedBrowser.addEventListener("pageshow", function () {
    1.13 +    let btn = content.document.getElementById("btn");
    1.14 +    executeSoon(function () {
    1.15 +      EventUtils.synthesizeMouseAtCenter(btn, {}, content);
    1.16 +      let currentURL = gBrowser.currentURI.spec;
    1.17 +      ok(/^wyciwyg:\/\//i.test(currentURL), currentURL + " is a wyciwyg URI");
    1.18 +
    1.19 +      executeSoon(function () {
    1.20 +        testURLBarCopy(url, endTest);
    1.21 +      });
    1.22 +    });
    1.23 +  }, false);
    1.24 +
    1.25 +  function endTest() {
    1.26 +    while (gBrowser.tabs.length > 1)
    1.27 +      gBrowser.removeCurrentTab();
    1.28 +    finish();
    1.29 +  }
    1.30 +
    1.31 +  function testURLBarCopy(targetValue, cb) {
    1.32 +    info("Expecting copy of: " + targetValue);
    1.33 +    waitForClipboard(targetValue, function () {
    1.34 +      gURLBar.focus();
    1.35 +      gURLBar.select();
    1.36 +
    1.37 +      goDoCommand("cmd_copy");
    1.38 +    }, cb, cb);
    1.39 +  }
    1.40 +}
    1.41 +
    1.42 +

mercurial