<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
if (window.internals) {
    internals.clearMemoryCache();
    internals.invalidateFontCache();
}
window.jsTestIsAsync = true;
var font = new FontFace("WebFont", "url('../../resources/Ahem.ttf') format('truetype')");
shouldBeEqualToString("font.status", "unloaded");
var set1 = new FontFaceSet([font]);
var set2 = new FontFaceSet([font]);
shouldBeEqualToString("set1.status", "loaded");
shouldBeEqualToString("set2.status", "loaded");
font.load();
shouldBeEqualToString("font.status", "loading");
shouldBeEqualToString("set1.status", "loading");
shouldBeEqualToString("set2.status", "loading");
var count = 0;
set1.ready.then(function() {
    ++count;
    if (count == 2)
        finishJSTest();
}, function() {
    testFailed("Promise should not be rejected.");
    finishJSTest();
});
set1.ready.then(function() {
    ++count;
    if (count == 2)
        finishJSTest();
}, function() {
    testFailed("Promise should not be rejected.");
    finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
