browser/devtools/netmonitor/test/browser_net_copy_url.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/netmonitor/test/browser_net_copy_url.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +/**
     1.8 + * Tests if copying a request's url works.
     1.9 + */
    1.10 +
    1.11 +function test() {
    1.12 +  initNetMonitor(CUSTOM_GET_URL).then(([aTab, aDebuggee, aMonitor]) => {
    1.13 +    info("Starting test... ");
    1.14 +
    1.15 +    let { NetMonitorView } = aMonitor.panelWin;
    1.16 +    let { RequestsMenu } = NetMonitorView;
    1.17 +
    1.18 +    waitForNetworkEvents(aMonitor, 1).then(() => {
    1.19 +      let requestItem = RequestsMenu.getItemAtIndex(0);
    1.20 +      RequestsMenu.selectedItem = requestItem;
    1.21 +
    1.22 +      waitForClipboard(requestItem.attachment.url, function setup() {
    1.23 +        RequestsMenu.copyUrl();
    1.24 +      }, function onSuccess() {
    1.25 +        ok(true, "Clipboard contains the currently selected item's url.");
    1.26 +        cleanUp();
    1.27 +      }, function onFailure() {
    1.28 +        ok(false, "Copying the currently selected item's url was unsuccessful.");
    1.29 +        cleanUp();
    1.30 +      });
    1.31 +    });
    1.32 +
    1.33 +    aDebuggee.performRequests(1);
    1.34 +
    1.35 +    function cleanUp(){
    1.36 +      teardown(aMonitor).then(finish);
    1.37 +    }
    1.38 +  });
    1.39 +}

mercurial