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

Side by Side Diff: LayoutTests/fast/canvas/webgl/webgl-context-attributes-default-value.html

Issue 795833004: Use dictionaries for context creation attributes. Eliminate custom bindings. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 <script src="resources/webgl-test.js"></script> 5 <script src="resources/webgl-test.js"></script>
6 <script> 6 <script>
7 7
8 var checkAttributes = { 8 var defaultAttributes = {
9 alpha : true, 9 alpha : true,
10 depth : true, 10 depth : true,
11 stencil : false, 11 stencil : false,
12 // FIXME: context.getContextAttributes().antialias is always false on 12 // FIXME: context.getContextAttributes().antialias is always false on
13 // content shell with --dump-render-tree option. See http://crbug.com/375682 13 // content shell with --dump-render-tree option. See http://crbug.com/375682
14 // antialias : true, 14 // antialias : true,
15 premultipliedAlpha : true, 15 premultipliedAlpha : true,
16 preserveDrawingBuffer : false, 16 preserveDrawingBuffer : false,
17 failIfMajorPerformanceCaveat : false, 17 failIfMajorPerformanceCaveat : false,
18 }; 18 };
19 19
20 var falseAttributes = {
21 alpha : false,
22 depth : false,
23 stencil : false,
24 // FIXME: context.getContextAttributes().antialias is always false on
25 // content shell with --dump-render-tree option. See http://crbug.com/375682
26 // antialias : true,
27 premultipliedAlpha : false,
28 preserveDrawingBuffer : false,
29 failIfMajorPerformanceCaveat : false,
30 };
31
20 function testAttributes(expectedAttributes, checkValue) { 32 function testAttributes(expectedAttributes, checkValue) {
21 33
22 if (arguments.length != 1 && arguments.length != 2) 34 if (arguments.length != 1 && arguments.length != 2)
23 return; 35 return;
24 36
25 var canvas = document.createElement("canvas"); 37 var canvas = document.createElement("canvas");
26 var initialAttributes = {}; 38 var initialAttributes = {};
27 var isUndefinedOrNull = arguments.length == 2 && 39 var isUndefinedOrNull = arguments.length == 2 &&
28 (checkValue == undefined || checkValue == null); 40 (checkValue == undefined || checkValue == null);
29 41
30 if (isUndefinedOrNull) 42 if (isUndefinedOrNull)
31 for (key in expectedAttributes) 43 for (key in expectedAttributes)
32 initialAttributes[key] = checkValue; 44 initialAttributes[key] = checkValue;
33 45
34 var context = create3DContext(canvas, initialAttributes); 46 var context = create3DContext(canvas, initialAttributes);
35 47
36 window.actualContextAttributes = context.getContextAttributes(); 48 window.actualContextAttributes = context.getContextAttributes();
37 49
38 for (key in expectedAttributes) 50 for (key in expectedAttributes)
39 shouldBe("actualContextAttributes." + key, 51 shouldBe("actualContextAttributes." + key,
40 expectedAttributes[key].toString()); 52 expectedAttributes[key].toString());
41 } 53 }
42 54
43 </script> 55 </script>
44 </head> 56 </head>
45 <body> 57 <body>
46 <script> 58 <script>
47 59
48 debug("Testing default value:"); 60 debug("Testing default value:");
49 testAttributes(checkAttributes); 61 testAttributes(defaultAttributes);
50 debug("") 62 debug("")
51 63
52 debug("Testing undefined value:"); 64 debug("Testing undefined value:");
53 testAttributes(checkAttributes, undefined); 65 testAttributes(defaultAttributes, undefined);
54 debug("") 66 debug("")
55 67
56 debug("Testing null value:"); 68 debug("Testing null value:");
57 testAttributes(checkAttributes, null); 69 testAttributes(falseAttributes, null);
58 debug("") 70 debug("")
59 71
60 </script> 72 </script>
61 </body> 73 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698