<!doctype html>
<html>
<head>
<title>css-module-crossorigin</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<h1>css-module-crossorigin</h1>
<iframe id="import-WithCORS" src="resources/crossorigin-import-with-cors.sub.html"></iframe>
<iframe id="import-NoCORS" src="resources/crossorigin-import-without-cors.sub.html"></iframe>
<iframe id="import-parseerror-WithCors" src="resources/crossorigin-import-parse-error-with-cors.sub.html"></iframe>
<script>
var tests = [
{ "obj": async_test("Imported CSS module, cross-origin with CORS"), "id": "import-WithCORS", "expected": "imported CSS: #test { background-color: rgb(255, 0, 0); }" },
{ "obj": async_test("Imported CSS module, cross-origin, missing CORS ACAO header"), "id": "import-NoCORS", "expected": "error" },
{ "obj": async_test("Imported CSS module with parse error, cross-origin, with CORS"), "id": "import-parseerror-WithCors", "expected": "imported CSS rules count: 0" },
];
window.addEventListener("load", function () {
tests.forEach(function (test) {
var target = document.getElementById(test.id);
test.obj.step(function () {
assert_equals(target.contentDocument._log, test.expected, "Unexpected _log value");
});
test.obj.done();
});
});
</script>
</body>
</html>