Index: third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas-svg.html |
diff --git a/third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas-svg.html b/third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas-svg.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1d8715a96fa4d3c6295cca4714dfa387189004c8 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/images/color-profile-image-canvas-svg.html |
@@ -0,0 +1,63 @@ |
+<!DOCTYPE html> |
+<html> |
+<script src="../../resources/run-after-layout-and-paint.js"></script> |
+ |
+<style> |
+ canvas, img { margin-bottom: -10px; } |
+</style> |
+ |
+<body style="overflow: hidden"> |
+ <!-- The blue sector of the canvas images should be at 12 o'clock. --> |
+ <p title="html canvas 2d element"> |
+ <canvas width="700px" height="200px" /> |
+ </p> |
+ <!-- The blue sector of the source images should be at 12 o'clock. --> |
+ <img title="source image to draw on canvas"> |
+</body> |
+ |
+<script> |
+if (window.testRunner) { |
+ testRunner.dumpAsTextWithPixelResults(); |
+ testRunner.waitUntilDone(); |
+} |
+ |
+window.onload = function() { |
+ if (window.internals) |
+ internals.settings.setImageColorProfilesEnabled(true); |
+ |
+ var image = document.querySelector('img'); |
+ image.onload = function() { |
+ runAfterLayoutAndPaint(window.testRunner ? changeColorProfile : profileChanged); |
+ }; |
+ |
+ image.src = 'resources/color-profile-image-data-url.svg'; |
+}; |
+ |
+function changeColorProfile() { |
+ window.testRunner.setColorProfile('sRGB', profileChanged); |
+} |
+ |
+function profileChanged() { |
+ setTimeout(drawImageToCanvas, 0, document.querySelector('img')); |
+} |
+ |
+function drawImageToCanvas(image) { |
+ var canvas = document.querySelector('canvas'); |
+ canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height); |
+ |
+ canvas.getContext('2d').drawImage(image, 0, 0); |
+ |
+ if (window.testRunner) |
+ runAfterLayoutAndPaint(setWhackedColorProfile); |
+} |
+ |
+function setWhackedColorProfile() { |
+ if (window.testRunner) |
+ window.testRunner.setColorProfile('whacked', done); |
+} |
+ |
+function done() { |
+ setTimeout(function() { window.testRunner.notifyDone() }, 0); |
+} |
+</script> |
+</html> |