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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-resize.html

Issue 2808353005: Make offscreen canvas resizing test deterministic (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-resize.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-resize.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-resize.html
index 0b58369e5f64ae8a969672abf369afe037ca3ffd..41c32670ee339f671a6c9ec5bf23477ac92436e5 100644
--- a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-resize.html
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-resize.html
@@ -159,31 +159,35 @@ async_test(function(t) {
}
});
// Set timeout acts as a sync barrier to allow commit to propagate
+ // TODO(junov): Use the Promise returned by commit to schedule after the
+ // commit. (crbug.com/709484)
setTimeout(function(){
- t.step(function() {
- // Verify that commit() asynchronously updates the size of its placeholder canvas.
- assert_equals(placeholder.width, 10);
- assert_equals(placeholder.height, 20);
- });
- t.step(function() {
- // Verify that width/height attributes are still settable even though they have no effect.
- placeholder.width = 50;
- placeholder.height = 60;
- assert_equals(placeholder.width, 50);
- assert_equals(placeholder.height, 60);
- });
- createImageBitmap(placeholder).then(image => {
+ setTimeout(function(){
t.step(function() {
- // Verify that an image grabbed from the placeholder has the correct dimensions
- assert_equals(image.width, 30);
- assert_equals(image.height, 40);
+ // Verify that commit() asynchronously updates the size of its placeholder canvas.
+ assert_equals(placeholder.width, 10);
+ assert_equals(placeholder.height, 20);
});
- asyncStepsCompleted = asyncStepsCompleted + 1;
- if (asyncStepsCompleted == 2) {
- t.done();
- }
- });
- }, 1);
+ t.step(function() {
+ // Verify that width/height attributes are still settable even though they have no effect.
+ placeholder.width = 50;
+ placeholder.height = 60;
+ assert_equals(placeholder.width, 50);
+ assert_equals(placeholder.height, 60);
+ });
+ createImageBitmap(placeholder).then(image => {
+ t.step(function() {
+ // Verify that an image grabbed from the placeholder has the correct dimensions
+ assert_equals(image.width, 30);
+ assert_equals(image.height, 40);
+ });
+ asyncStepsCompleted = asyncStepsCompleted + 1;
+ if (asyncStepsCompleted == 2) {
+ t.done();
+ }
+ });
+ }, 0);
+ }, 0);
}, "Verify that resizing an OffscreenCanvas with a webgl context propagates the new size to its placeholder canvas asynchronously, upon commit.");
async_test(function(t){
@@ -197,23 +201,27 @@ async_test(function(t){
ctx.fillRect(0, 0, 10, 10);
ctx.commit();
// Set timeout acts as a sync barrier to allow commit to propagate
- setTimeout(function(){
- var testCanvas = document.createElement('canvas');
- testCanvas.width = testCanvas.height = 20;
- testCtx = testCanvas.getContext('2d');
- testCtx.drawImage(placeholder, 0, 0);
- var pixel1 = testCtx.getImageData(9, 9, 1, 1).data;
- var pixel2 = testCtx.getImageData(9, 10, 1, 1).data;
- var pixel3 = testCtx.getImageData(10, 9, 1, 1).data;
- t.step(function() {
- assert_equals(placeholder.width, 1);
- assert_equals(placeholder.height, 1);
- assert_array_equals(pixel1, [0, 255, 0, 255]);
- assert_array_equals(pixel2, [0, 0, 0, 0]);
- assert_array_equals(pixel3, [0, 0, 0, 0]);
- });
- t.done();
- }, 1);
+ // TODO(junov): Use the Promise returned by commit to schedule after the
+ // commit. (crbug.com/709484)
+ setTimeout(function() {
+ setTimeout(function() {
+ var testCanvas = document.createElement('canvas');
+ testCanvas.width = testCanvas.height = 20;
+ testCtx = testCanvas.getContext('2d');
+ testCtx.drawImage(placeholder, 0, 0);
+ var pixel1 = testCtx.getImageData(9, 9, 1, 1).data;
+ var pixel2 = testCtx.getImageData(9, 10, 1, 1).data;
+ var pixel3 = testCtx.getImageData(10, 9, 1, 1).data;
+ t.step(function() {
+ assert_equals(placeholder.width, 1);
+ assert_equals(placeholder.height, 1);
+ assert_array_equals(pixel1, [0, 255, 0, 255]);
+ assert_array_equals(pixel2, [0, 0, 0, 0]);
+ assert_array_equals(pixel3, [0, 0, 0, 0]);
+ });
+ t.done();
+ }, 0);
+ }, 0);
}, "Verify that drawImage uses the size of the committed frame as the intinsic size of a placeholder canvas.");
</script>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698