Moving Offscreencanvas Printing tests to WPT

To implement the printing tests I followed the doc suggestions.
https://web-platform-tests.org/writing-tests/print-reftests.html

Bug: 1259367
Change-Id: I09f451204affeb0c66281eb5d2e1cde3cdce1617
diff --git a/html/canvas/offscreen/manual/offscreencanvas-2d-print.html b/html/canvas/offscreen/manual/offscreencanvas-2d-print.html
new file mode 100644
index 0000000..07cca83
--- /dev/null
+++ b/html/canvas/offscreen/manual/offscreencanvas-2d-print.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<title>Test that we can print 2d canvases</title>
+<meta name=fuzzy content="maxDifference=5;totalPixels=10">
+<link rel="match" href="offscreencanvas-2d-ref.html">
+<canvas id='canvas'></canvas>
+<script>
+var documentCanvas = document.getElementById('canvas');
+documentCanvas.width = documentCanvas.height = 100;
+var offscreenContext = documentCanvas.transferControlToOffscreen().getContext(
+  "2d");
+offscreenContext.fillStyle = "green";
+offscreenContext.fillRect(0, 0, 100, 100);
+
+// For testing that the offscreen canvas has drawn
+var testCanvas = document.createElement("canvas");
+var testContext = testCanvas.getContext("2d");
+
+// Make sure that the canvas has been drawn to before capturing
+function waitForCanvasToDraw() {
+  return new Promise(resolve => {
+    var testPixel = function() {
+      testContext.drawImage(documentCanvas, 0, 0);
+      // Get the pixel in the upper left corner
+      var pixel = testContext.getImageData(0, 0, 1, 1).data;
+      if (pixel[0] === 0 && pixel[1] === 0 && pixel[2] === 0) {
+        // pixel is still empty, wait
+        requestAnimationFrame(testPixel);
+        return;
+      } else {
+        resolve();
+      }
+    }
+    testPixel();
+  });
+}
+</script>
diff --git a/html/canvas/offscreen/manual/offscreencanvas-2d-ref.html b/html/canvas/offscreen/manual/offscreencanvas-2d-ref.html
new file mode 100644
index 0000000..a8f4ff7
--- /dev/null
+++ b/html/canvas/offscreen/manual/offscreencanvas-2d-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<title>Test that we can print 2d canvases</title>
+<meta name=fuzzy content="maxDifference=5;totalPixels=10">
+<canvas id='c'></canvas>
+<script>
+var can = document.getElementById('c');
+can.width = can.height = 100;
+var ctx = can.getContext("2d");
+ctx.fillStyle = 'green';
+ctx.fillRect(0, 0, 100, 100);
+</script>
diff --git a/html/canvas/offscreen/manual/offscreencanvas-webgl-print.html b/html/canvas/offscreen/manual/offscreencanvas-webgl-print.html
new file mode 100644
index 0000000..29cd2b1
--- /dev/null
+++ b/html/canvas/offscreen/manual/offscreencanvas-webgl-print.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<title>Test that we can print webgl canvases</title>
+<meta name=fuzzy content="maxDifference=5;totalPixels=10">
+<link rel="match" href="offscreencanvas-webgl-ref.html">
+<canvas id='canvas'></canvas>
+<script>
+var documentCanvas = document.getElementById('canvas');
+documentCanvas.width = documentCanvas.height = 100;
+var offscreenContext = documentCanvas.transferControlToOffscreen().getContext(
+  "webgl", {preserveDrawingBuffer: true});
+offscreenContext.clearColor(0, 1, 0, 1);
+offscreenContext.clear(offscreenContext.COLOR_BUFFER_BIT);
+var pixel = new Uint8Array(4);
+
+// For testing that the offscreen canvas has drawn
+var testCanvas = document.createElement("canvas");
+var testContext = testCanvas.getContext("2d");
+
+// Make sure that the canvas has been drawn to before capturing
+function waitForCanvasToDraw() {
+  return new Promise(resolve => {
+    var testPixel = function() {
+      testContext.drawImage(documentCanvas, 0, 0);
+      // Get the pixel in the upper left corner
+      var pixel = testContext.getImageData(0, 0, 1, 1).data;
+      if (pixel[0] === 0 && pixel[1] === 0 && pixel[2] === 0) {
+        // pixel is still empty, wait
+        requestAnimationFrame(testPixel);
+        return;
+      } else {
+        resolve();
+      }
+    }
+    testPixel();
+  });
+}
+
+waitForCanvasToDraw().then(() => {
+  document.addEventListener("TestRendered", () => {
+    document.documentElement.classList.remove("reftest-wait");
+  });
+});
+
+</script>
\ No newline at end of file
diff --git a/html/canvas/offscreen/manual/offscreencanvas-webgl-ref.html b/html/canvas/offscreen/manual/offscreencanvas-webgl-ref.html
new file mode 100644
index 0000000..a625206
--- /dev/null
+++ b/html/canvas/offscreen/manual/offscreencanvas-webgl-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<title>Test that we can print webgl canvases</title>
+<meta name=fuzzy content="maxDifference=5;totalPixels=10">
+<canvas id='c'></canvas>
+<script>
+var can = document.getElementById('c');
+can.width = can.height = 100;
+var ctx = can.getContext("webgl");
+ctx.clearColor(0, 1, 0, 1);
+ctx.clear(ctx.COLOR_BUFFER_BIT);
+</script>