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

Unified Diff: LayoutTests/http/tests/images/image-with-origin-header.html

Issue 201143002: Update image data upon changing the img.crossorigin attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix underlying script Created 6 years, 9 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 | « LayoutTests/TestExpectations ('k') | LayoutTests/http/tests/images/image-with-origin-header-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/images/image-with-origin-header.html
diff --git a/LayoutTests/http/tests/images/image-with-origin-header.html b/LayoutTests/http/tests/images/image-with-origin-header.html
index 6cca7e4c5bf09f18d2ea09f6a37092eb5c4a505d..0ea247fa00bf8866f400e636ab7cc30bdd3cd458 100644
--- a/LayoutTests/http/tests/images/image-with-origin-header.html
+++ b/LayoutTests/http/tests/images/image-with-origin-header.html
@@ -1,28 +1,33 @@
-<!DOCTYPE html>
-<body>
+<!DOCTYPE HTML>
<script src="/js-test-resources/js-test.js"></script>
<script>
- description("Tests that the order of setting the src of an image element and its crossOrigin attribute doesn't matter");
- jsTestIsAsync = true;
+description("Tests that the order of setting the src of an image element and its crossOrigin attribute doesn't matter");
+window.jsTestIsAsync = true;
- var img = new Image();
- img.src="http://127.0.0.1:8000/resources/origin.php?1";
- img.crossOrigin = "anonymous";
- var img2 = new Image();
- img2.crossOrigin = "anonymous";
- img2.src="http://127.0.0.1:8000/resources/origin.php?2";
+// Resource returns a 100x100 image if Origin: is present, a 200x200 one if not.
+var testImageURL = "http://127.0.0.1:8000/resources/origin.php";
+var successWidth = 100;
- var srcFirstHasOrigin = false;
- var srcLastHasOrigin = false;
- document.body.onload = function() {
- srcFirstHasOrigin = (img.width == 100)
- // srcFirstHasOrigin should be true per spec - see http://crbug.com/341047
- shouldBeFalse('srcFirstHasOrigin');
- srcLastHasOrigin = (img2.width == 100)
- shouldBeTrue('srcLastHasOrigin');
+function checkIfDone() {
+ if ("loaded" in img1 && "loaded" in img2)
finishJSTest();
- };
+}
+
+function createImage() {
+ var img = new Image();
+ img.onload = function () {
+ (img.width == successWidth ? testPassed : testFailed)("Origin: present in request.");
+ img.loaded = true;
+ checkIfDone();
+ }
+ return img;
+}
+
+var img1 = createImage();
+img1.src = testImageURL + "?1";
+img1.crossOrigin = "anonymous";
+var img2 = createImage();
+img2.crossOrigin = "anonymous";
+img2.src = testImageURL + "?2";
</script>
-</body>
-</html>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/http/tests/images/image-with-origin-header-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698