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.

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

mercurial