browser/devtools/shadereditor/test/browser_se_editors-error-tooltip.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 error tooltips can be opened from the editor's gutter when there's
     6  * a shader compilation error.
     7  */
     9 function ifWebGLSupported() {
    10   let [target, debuggee, panel] = yield initShaderEditor(SIMPLE_CANVAS_URL);
    11   let { gFront, EVENTS, ShadersEditorsView } = panel.panelWin;
    13   reload(target);
    14   yield promise.all([
    15     once(gFront, "program-linked"),
    16     once(panel.panelWin, EVENTS.SOURCES_SHOWN)
    17   ]);
    19   let vsEditor = yield ShadersEditorsView._getEditor("vs");
    20   let fsEditor = yield ShadersEditorsView._getEditor("fs");
    22   vsEditor.replaceText("vec3", { line: 7, ch: 22 }, { line: 7, ch: 26 });
    23   yield once(panel.panelWin, EVENTS.SHADER_COMPILED);
    25   // Synthesizing 'mouseenter' events doesn't work, hack around this by
    26   // manually calling the event listener with the expected arguments.
    27   let editorDocument = vsEditor.container.contentDocument;
    28   let marker = editorDocument.querySelector(".error");
    29   let parsed = ShadersEditorsView._errors.vs[0].messages;
    30   ShadersEditorsView._onMarkerMouseEnter(7, marker, parsed);
    32   let tooltip = marker._markerErrorsTooltip;
    33   ok(tooltip, "A tooltip was created successfully.");
    35   let content = tooltip.content;
    36   ok(tooltip.content,
    37     "Some tooltip's content was set.");
    38   ok(tooltip.content.className.contains("devtools-tooltip-simple-text-container"),
    39     "The tooltip's content container was created correctly.");
    41   let messages = content.childNodes;
    42   is(messages.length, 2,
    43     "There are two messages displayed in the tooltip.");
    44   ok(messages[0].className.contains("devtools-tooltip-simple-text"),
    45     "The first message was created correctly.");
    46   ok(messages[1].className.contains("devtools-tooltip-simple-text"),
    47     "The second message was created correctly.");
    49   ok(messages[0].textContent.contains("'constructor' : too many arguments"),
    50     "The first message contains the correct text.");
    51   ok(messages[1].textContent.contains("'assign' : cannot convert"),
    52     "The second message contains the correct text.");
    54   yield teardown(panel);
    55   finish();
    56 }

mercurial