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

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

Issue 290143007: canvas.getContext with alpha:undefined should behave like alpha:true (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/canvas/webgl/webgl-context-attributes-default-value.html
diff --git a/LayoutTests/fast/canvas/webgl/webgl-context-attributes-default-value.html b/LayoutTests/fast/canvas/webgl/webgl-context-attributes-default-value.html
new file mode 100644
index 0000000000000000000000000000000000000000..faacec9cecba3b7b068a8782a4f3de0f1bbbbdfe
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/webgl-context-attributes-default-value.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../resources/js-test.js"></script>
+<script src="resources/webgl-test.js"></script>
+<script>
+
+ var checkAttributes = {
+ alpha : true,
+ depth : true,
+ stencil : false,
+ // FIXME: context.getContextAttributes().antialias is always false on
+ // content shell with --dump-render-tree option. See http://crbug.com/375682
+ // antialias : true,
+ premultipliedAlpha : true,
+ 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(checkAttributes);
+ debug("")
+
+ debug("Testing undefined value:");
+ testAttributes(checkAttributes, undefined);
+ debug("")
+
+ debug("Testing null value:");
+ testAttributes(checkAttributes, null);
+ debug("")
+
+</script>
+</body>

Powered by Google App Engine
This is Rietveld 408576698