browser/devtools/netmonitor/test/browser_net_cyrillic-02.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Tests if cyrillic text is rendered correctly in the source editor
     6  * when loaded directly from an HTML page.
     7  */
     9 function test() {
    10   initNetMonitor(CYRILLIC_URL).then(([aTab, aDebuggee, aMonitor]) => {
    11     info("Starting test... ");
    13     let { document, Editor, NetMonitorView } = aMonitor.panelWin;
    14     let { RequestsMenu } = NetMonitorView;
    16     RequestsMenu.lazyUpdate = false;
    18     waitForNetworkEvents(aMonitor, 1).then(() => {
    19       verifyRequestItemTarget(RequestsMenu.getItemAtIndex(0),
    20         "GET", CYRILLIC_URL, {
    21           status: 200,
    22           statusText: "OK"
    23         });
    25       EventUtils.sendMouseEvent({ type: "mousedown" },
    26         document.getElementById("details-pane-toggle"));
    27       EventUtils.sendMouseEvent({ type: "mousedown" },
    28         document.querySelectorAll("#details-pane tab")[3]);
    30       let RESPONSE_BODY_DISPLAYED = aMonitor.panelWin.EVENTS.RESPONSE_BODY_DISPLAYED;
    31       waitFor(aMonitor.panelWin, RESPONSE_BODY_DISPLAYED).then(() =>
    32         NetMonitorView.editor("#response-content-textarea")
    33       ).then((aEditor) => {
    34         is(aEditor.getText().indexOf("\u044F"), 302, // я
    35           "The text shown in the source editor is incorrect.");
    36         is(aEditor.getMode(), Editor.modes.html,
    37           "The mode active in the source editor is incorrect.");
    39         teardown(aMonitor).then(finish);
    40       });
    41     });
    43     aDebuggee.location.reload();
    44   });
    45 }

mercurial