browser/devtools/netmonitor/test/browser_net_cyrillic-02.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_cyrillic-02.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     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 cyrillic text is rendered correctly in the source editor
     1.9 + * when loaded directly from an HTML page.
    1.10 + */
    1.11 +
    1.12 +function test() {
    1.13 +  initNetMonitor(CYRILLIC_URL).then(([aTab, aDebuggee, aMonitor]) => {
    1.14 +    info("Starting test... ");
    1.15 +
    1.16 +    let { document, Editor, NetMonitorView } = aMonitor.panelWin;
    1.17 +    let { RequestsMenu } = NetMonitorView;
    1.18 +
    1.19 +    RequestsMenu.lazyUpdate = false;
    1.20 +
    1.21 +    waitForNetworkEvents(aMonitor, 1).then(() => {
    1.22 +      verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
    1.23 +        "GET", CYRILLIC_URL, {
    1.24 +          status: 200,
    1.25 +          statusText: "OK"
    1.26 +        });
    1.27 +
    1.28 +      EventUtils.sendMouseEvent({ type: "mousedown" },
    1.29 +        document.getElementById("details-pane-toggle"));
    1.30 +      EventUtils.sendMouseEvent({ type: "mousedown" },
    1.31 +        document.querySelectorAll("#details-pane tab")[3]);
    1.32 +
    1.33 +      let RESPONSE_BODY_DISPLAYED = aMonitor.panelWin.EVENTS.RESPONSE_BODY_DISPLAYED;
    1.34 +      waitFor(aMonitor.panelWin, RESPONSE_BODY_DISPLAYED).then(() =>
    1.35 +        NetMonitorView.editor("#response-content-textarea")
    1.36 +      ).then((aEditor) => {
    1.37 +        is(aEditor.getText().indexOf("\u044F"), 302, // я
    1.38 +          "The text shown in the source editor is incorrect.");
    1.39 +        is(aEditor.getMode(), Editor.modes.html,
    1.40 +          "The mode active in the source editor is incorrect.");
    1.41 +
    1.42 +        teardown(aMonitor).then(finish);
    1.43 +      });
    1.44 +    });
    1.45 +
    1.46 +    aDebuggee.location.reload();
    1.47 +  });
    1.48 +}

mercurial