4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"resources/webgl-test.js"></script>
8 var defaultAttributes
= {
12 // FIXME: context.getContextAttributes().antialias is always false on
13 // content shell with --run-layout-test option. See http://crbug.com/375682
15 premultipliedAlpha
: true,
16 preserveDrawingBuffer
: false,
17 failIfMajorPerformanceCaveat
: false,
20 var falseAttributes
= {
24 // FIXME: context.getContextAttributes().antialias is always false on
25 // content shell with --run-layout-test option. See http://crbug.com/375682
27 premultipliedAlpha
: false,
28 preserveDrawingBuffer
: false,
29 failIfMajorPerformanceCaveat
: false,
32 function testAttributes(expectedAttributes
, checkValue
) {
34 if (arguments
.length
!= 1 && arguments
.length
!= 2)
37 var canvas
= document
.createElement("canvas");
38 var initialAttributes
= {};
39 var isUndefinedOrNull
= arguments
.length
== 2 &&
40 (checkValue
== undefined || checkValue
== null);
42 if (isUndefinedOrNull
)
43 for (key
in expectedAttributes
)
44 initialAttributes
[key
] = checkValue
;
46 var context
= create3DContext(canvas
, initialAttributes
);
48 window
.actualContextAttributes
= context
.getContextAttributes();
50 for (key
in expectedAttributes
)
51 shouldBe("actualContextAttributes." + key
,
52 expectedAttributes
[key
].toString());
60 debug("Testing default value:");
61 testAttributes(defaultAttributes
);
64 debug("Testing undefined value:");
65 testAttributes(defaultAttributes
, undefined);
68 debug("Testing null value:");
69 testAttributes(falseAttributes
, null);