OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> |
| 5 <script src="resources/webgl-test.js"></script> |
| 6 <script> |
| 7 |
| 8 var checkAttributes = { |
| 9 alpha : true, |
| 10 depth : true, |
| 11 stencil : false, |
| 12 // FIXME: context.getContextAttributes().antialias is always false on |
| 13 // content shell with --dump-render-tree option. See http://crbug.com/375682 |
| 14 // antialias : true, |
| 15 premultipliedAlpha : true, |
| 16 preserveDrawingBuffer : false, |
| 17 failIfMajorPerformanceCaveat : false, |
| 18 }; |
| 19 |
| 20 function testAttributes(expectedAttributes, checkValue) { |
| 21 |
| 22 if (arguments.length != 1 && arguments.length != 2) |
| 23 return; |
| 24 |
| 25 var canvas = document.createElement("canvas"); |
| 26 var initialAttributes = {}; |
| 27 var isUndefinedOrNull = arguments.length == 2 && |
| 28 (checkValue == undefined || checkValue == null); |
| 29 |
| 30 if (isUndefinedOrNull) |
| 31 for (key in expectedAttributes) |
| 32 initialAttributes[key] = checkValue; |
| 33 |
| 34 var context = create3DContext(canvas, initialAttributes); |
| 35 |
| 36 window.actualContextAttributes = context.getContextAttributes(); |
| 37 |
| 38 for (key in expectedAttributes) |
| 39 shouldBe("actualContextAttributes." + key, |
| 40 expectedAttributes[key].toString()); |
| 41 } |
| 42 |
| 43 </script> |
| 44 </head> |
| 45 <body> |
| 46 <script> |
| 47 |
| 48 debug("Testing default value:"); |
| 49 testAttributes(checkAttributes); |
| 50 debug("") |
| 51 |
| 52 debug("Testing undefined value:"); |
| 53 testAttributes(checkAttributes, undefined); |
| 54 debug("") |
| 55 |
| 56 debug("Testing null value:"); |
| 57 testAttributes(checkAttributes, null); |
| 58 debug("") |
| 59 |
| 60 </script> |
| 61 </body> |
OLD | NEW |