Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: LayoutTests/svg/dynamic-updates/resources/SVGTestCase.js

Issue 54473004: Make js-test-post a noop. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add mac NeedsRebaselines Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Force activating pixel tests - this variable is used in fast/js/resources/js- test-pre.js, when calling setDumpAsText(). 1 // Force activating pixel tests - this variable is used in fast/js/resources/js- test-pre.js, when calling setDumpAsText().
2 window.enablePixelTesting = true; 2 window.enablePixelTesting = true;
3 3
4 var svgNS = "http://www.w3.org/2000/svg"; 4 var svgNS = "http://www.w3.org/2000/svg";
5 var xlinkNS = "http://www.w3.org/1999/xlink"; 5 var xlinkNS = "http://www.w3.org/1999/xlink";
6 var xhtmlNS = "http://www.w3.org/1999/xhtml"; 6 var xhtmlNS = "http://www.w3.org/1999/xhtml";
7 7
8 var rootSVGElement; 8 var rootSVGElement;
9 var iframeElement; 9 var iframeElement;
10 10
11 function createSVGElement(name) { 11 function createSVGElement(name) {
12 return document.createElementNS(svgNS, "svg:" + name); 12 return document.createElementNS(svgNS, "svg:" + name);
13 } 13 }
14 14
15 function shouldHaveBBox(element, width, height) 15 function shouldHaveBBox(element, width, height)
16 { 16 {
17 shouldBe(element + ".getBBox().width", width); 17 shouldBe(element + ".getBBox().width", width);
18 shouldBe(element + ".getBBox().height", height); 18 shouldBe(element + ".getBBox().height", height);
19 } 19 }
20 20
21 function createSVGTestCase() { 21 function createSVGTestCase() {
22 window.jsTestIsAsync = true;
22 if (window.testRunner) 23 if (window.testRunner)
23 testRunner.waitUntilDone(); 24 testRunner.waitUntilDone();
24 25
25 rootSVGElement = createSVGElement("svg"); 26 rootSVGElement = createSVGElement("svg");
26 rootSVGElement.setAttribute("width", "300"); 27 rootSVGElement.setAttribute("width", "300");
27 rootSVGElement.setAttribute("height", "300"); 28 rootSVGElement.setAttribute("height", "300");
28 29
29 var bodyElement = document.documentElement.lastChild; 30 var bodyElement = document.documentElement.lastChild;
30 bodyElement.insertBefore(rootSVGElement, document.getElementById("descriptio n")); 31 bodyElement.insertBefore(rootSVGElement, document.getElementById("descriptio n"));
31 } 32 }
32 33
33 function embedSVGTestCase(uri) { 34 function embedSVGTestCase(uri) {
35 window.jsTestIsAsync = true;
34 if (window.testRunner) 36 if (window.testRunner)
35 testRunner.waitUntilDone(); 37 testRunner.waitUntilDone();
36 38
37 iframeElement = document.createElement("iframe"); 39 iframeElement = document.createElement("iframe");
38 iframeElement.setAttribute("style", "width: 300px; height: 300px;"); 40 iframeElement.setAttribute("style", "width: 300px; height: 300px;");
39 iframeElement.setAttribute("src", uri); 41 iframeElement.setAttribute("src", uri);
40 iframeElement.setAttribute("onload", "iframeLoaded()"); 42 iframeElement.setAttribute("onload", "iframeLoaded()");
41 43
42 var bodyElement = document.documentElement.lastChild; 44 var bodyElement = document.documentElement.lastChild;
43 bodyElement.insertBefore(iframeElement, document.getElementById("description ")); 45 bodyElement.insertBefore(iframeElement, document.getElementById("description "));
44 } 46 }
45 47
46 function iframeLoaded() { 48 function iframeLoaded() {
47 rootSVGElement = iframeElement.getSVGDocument().rootElement; 49 rootSVGElement = iframeElement.getSVGDocument().rootElement;
48 } 50 }
49 51
50 function clickAt(x, y) { 52 function clickAt(x, y) {
51 // Translation due to <h1> above us 53 // Translation due to <h1> above us
52 x = x + rootSVGElement.offsetLeft; 54 x = x + rootSVGElement.offsetLeft;
53 y = y + rootSVGElement.offsetTop; 55 y = y + rootSVGElement.offsetTop;
54 56
55 if (window.eventSender) { 57 if (window.eventSender) {
56 eventSender.mouseMoveTo(x, y); 58 eventSender.mouseMoveTo(x, y);
57 eventSender.mouseDown(); 59 eventSender.mouseDown();
58 eventSender.mouseUp(); 60 eventSender.mouseUp();
59 } 61 }
60 } 62 }
61 63
62 function completeTest() { 64 function completeTest() {
63 var script = document.createElement("script"); 65 finishJSTest();
64
65 script.onload = function() {
66 if (window.testRunner)
67 testRunner.notifyDone();
68 };
69
70 script.src = "../../fast/js/resources/js-test-post.js";
71 document.body.appendChild(script);
72 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698