blob: 97750863a7ec282f162d1d19979b9bdda3c1f2a3 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
<script>
var defaultAttributes = {
alpha : true,
depth : true,
stencil : false,
// FIXME: context.getContextAttributes().antialias is always false on
// content shell with --run-layout-test option. See http://crbug.com/375682
// antialias : true,
premultipliedAlpha : true,
preserveDrawingBuffer : false,
failIfMajorPerformanceCaveat : false,
};
var falseAttributes = {
alpha : false,
depth : false,
stencil : false,
// FIXME: context.getContextAttributes().antialias is always false on
// content shell with --run-layout-test option. See http://crbug.com/375682
// antialias : true,
premultipliedAlpha : false,
preserveDrawingBuffer : false,
failIfMajorPerformanceCaveat : false,
};
function testAttributes(expectedAttributes, checkValue) {
if (arguments.length != 1 && arguments.length != 2)
return;
var canvas = document.createElement("canvas");
var initialAttributes = {};
var isUndefinedOrNull = arguments.length == 2 &&
(checkValue == undefined || checkValue == null);
if (isUndefinedOrNull)
for (key in expectedAttributes)
initialAttributes[key] = checkValue;
var context = create3DContext(canvas, initialAttributes);
window.actualContextAttributes = context.getContextAttributes();
for (key in expectedAttributes)
shouldBe("actualContextAttributes." + key,
expectedAttributes[key].toString());
}
</script>
</head>
<body>
<script>
debug("Testing default value:");
testAttributes(defaultAttributes);
debug("")
debug("Testing undefined value:");
testAttributes(defaultAttributes, undefined);
debug("")
debug("Testing null value:");
testAttributes(falseAttributes, null);
debug("")
</script>
</body>