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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-placeholder-image-source-with-worker.html

Issue 2778483002: Synchronize commits at end of JS task (Closed)
Patch Set: fix layout test Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <title>Test using a placeholder canvas as an image source.</title> 2 <title>Test using a placeholder canvas as an image source.</title>
3 <script src="../../resources/testharness.js"></script> 3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script> 4 <script src="../../resources/testharnessreport.js"></script>
5 5
6 <script id='myWorker' type='text/worker'> 6 <script id='myWorker' type='text/worker'>
7 var ctx; 7 var ctx;
8 self.onmessage = function(msg) { 8 self.onmessage = function(msg) {
9 ctx = msg.data.getContext('2d'); 9 ctx = msg.data.getContext('2d');
10 ctx.fillStyle = '#0f0'; 10 ctx.fillStyle = '#0f0';
11 ctx.fillRect(0, 0, 100, 100); 11 ctx.fillRect(0, 0, 100, 100);
12 ctx.commit(); 12 var p = ctx.commit();
13 13
14 self.postMessage("done"); 14 p.then(function() {
15 self.postMessage("done");
16 });
15 }; 17 };
16 </script> 18 </script>
17 19
18 <script> 20 <script>
19 var t = async_test("Test that using a placeholder canvas as a source image acces ses the image that was committed to the associated OffscreenCanvas in a worker." ); 21 var t = async_test("Test that using a placeholder canvas as a source image acces ses the image that was committed to the associated OffscreenCanvas in a worker." );
20 var canvas = document.createElement('canvas'); 22 var canvas = document.createElement('canvas');
21 canvas.width = 100; 23 canvas.width = 100;
22 canvas.height = 100; 24 canvas.height = 100;
23 var offscreen = canvas.transferControlToOffscreen(); 25 var offscreen = canvas.transferControlToOffscreen();
24 26
(...skipping 20 matching lines...) Expand all
45 function verifyImage(image, description) { 47 function verifyImage(image, description) {
46 var testCanvas = document.createElement('canvas'); 48 var testCanvas = document.createElement('canvas');
47 var testCtx = testCanvas.getContext('2d'); 49 var testCtx = testCanvas.getContext('2d');
48 testCtx.drawImage(image, 0, 0); 50 testCtx.drawImage(image, 0, 0);
49 51
50 t.step(function() { 52 t.step(function() {
51 var pixel = testCtx.getImageData(50, 50, 1, 1).data; 53 var pixel = testCtx.getImageData(50, 50, 1, 1).data;
52 assert_array_equals(pixel, [0, 255, 0, 255], description); 54 assert_array_equals(pixel, [0, 255, 0, 255], description);
53 }); 55 });
54 } 56 }
55 </script> 57 </script>
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/pixel_test_pages.py ('k') | third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698