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

Side by Side Diff: LayoutTests/inspector/profiler/canvas2d/canvas2d-api-changes.html

Issue 1073863003: DevTools: remove Canvas profiler from DevTools source base. See details in the bug. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: tests gone Created 5 years, 8 months 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
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script>
5
6 var CanvasRenderingContext2DResource = {};
7
8 /**
9 * @const
10 * @type {Array.<string>}
11 */
12 CanvasRenderingContext2DResource.AttributeProperties = [
13 "strokeStyle",
14 "fillStyle",
15 "globalAlpha",
16 "lineWidth",
17 "lineCap",
18 "lineJoin",
19 "miterLimit",
20 "shadowOffsetX",
21 "shadowOffsetY",
22 "shadowBlur",
23 "shadowColor",
24 "globalCompositeOperation",
25 "font",
26 "textAlign",
27 "textBaseline",
28 "lineDashOffset",
29 "imageSmoothingEnabled",
30 // FIXME: Temporary properties implemented in JSC, but not in V8.
31 "webkitLineDash",
32 "webkitLineDashOffset"
33 ];
34
35 /**
36 * @const
37 * @type {Array.<string>}
38 */
39 CanvasRenderingContext2DResource.PathMethods = [
40 "beginPath",
41 "moveTo",
42 "closePath",
43 "lineTo",
44 "quadraticCurveTo",
45 "bezierCurveTo",
46 "arcTo",
47 "arc",
48 "rect",
49 "ellipse"
50 ];
51
52 /**
53 * @const
54 * @type {Array.<string>}
55 */
56 CanvasRenderingContext2DResource.TransformationMatrixMethods = [
57 "scale",
58 "rotate",
59 "translate",
60 "transform",
61 "setTransform",
62 "resetTransform"
63 ];
64
65 /**
66 * @const
67 * @type {Array.<string>}
68 */
69 CanvasRenderingContext2DResource.IgnoreProperties = [
70 "canvas",
71 "createLinearGradient",
72 "createRadialGradient",
73 "createPattern",
74 "save",
75 "restore",
76 "clip",
77 "getLineDash",
78 "setLineDash",
79 // Ignore the properties below.
80 "clearRect",
81 "clearShadow",
82 "createImageData",
83 "drawFocusIfNeeded",
84 "drawImage",
85 "drawImageFromRect",
86 "fill",
87 "fillRect",
88 "fillText",
89 "getContextAttributes",
90 "getImageData",
91 "isPointInPath",
92 "isPointInStroke",
93 "measureText",
94 "putImageData",
95 "setAlpha",
96 "setCompositeOperation",
97 "setFillColor",
98 "setLineCap",
99 "setLineJoin",
100 "setLineWidth",
101 "setMiterLimit",
102 "setShadow",
103 "setStrokeColor",
104 "stroke",
105 "strokeRect",
106 "strokeText",
107 ];
108
109 function collectPropertyNames(obj)
110 {
111 var propertyNames = [];
112 for (var property in obj)
113 propertyNames.push(property);
114 propertyNames.sort();
115 return propertyNames;
116 }
117
118 function test()
119 {
120 var canvas = document.createElement("canvas");
121 var ctx = canvas.getContext("2d");
122 if (!ctx) {
123 output("ERROR: Could not create canvas 2D context.");
124 return;
125 }
126 output("New properties and functions that should be manually examined (shoul d be empty to pass the test):");
127 var propertyNames = collectPropertyNames(ctx);
128 var trackedProperties = CanvasRenderingContext2DResource.AttributeProperties .concat(CanvasRenderingContext2DResource.PathMethods, CanvasRenderingContext2DRe source.TransformationMatrixMethods, CanvasRenderingContext2DResource.IgnorePrope rties);
129 for (var i = 0; i < propertyNames.length; ++i) {
130 var property = propertyNames[i];
131 if (trackedProperties.indexOf(property) !== -1)
132 continue;
133 output(property);
134 }
135
136 var gradient = ctx.createLinearGradient(0, 0, 1, 1);
137 if (!gradient) {
138 output("ERROR: Could not create a gradient object.");
139 return;
140 }
141 output("New properties and functions of CanvasGradient object that should be manually examined (should be empty to pass the test):");
142 propertyNames = collectPropertyNames(gradient);
143 for (var i = 0; i < propertyNames.length; ++i) {
144 var property = propertyNames[i];
145 if (property === "addColorStop")
146 continue;
147 output(property);
148 }
149
150 var pattern = ctx.createPattern(canvas, "repeat");
151 if (!pattern) {
152 output("ERROR: Could not create a pattern object.");
153 return;
154 }
155 output("New properties and functions of CanvasPattern object that should be manually examined (should be empty to pass the test):");
156 for (var property in pattern) {
157 if (property == "setTransform")
158 continue;
159 output(property);
160 }
161 }
162
163 function runTest()
164 {
165 if (window.testRunner) {
166 testRunner.dumpAsText();
167 testRunner.waitUntilDone();
168 }
169 try {
170 test();
171 } finally {
172 if (window.testRunner)
173 testRunner.notifyDone();
174 }
175 }
176
177 </script>
178 </head>
179 <body onload="runTest()">
180 <p>
181 Test to catch Canvas 2D API changes.
182 If this test should ever fail, we should re-examine the Canvas 2D state saving/r estoring logic in the
183 InjectedScriptModule to include any latest changes to the API.
184
185 </p>
186 </body>
187 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698