Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: ecf9dfb8d1
Fetching contributors…

Cannot retrieve contributors at this time

file 84 lines (67 sloc) 2.356 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
<html>
<head>
<script>
function print(message, color)
{
    var paragraph = document.createElement("div");
    paragraph.appendChild(document.createTextNode(message));
    paragraph.style.fontFamily = "monospace";
    if (color)
        paragraph.style.color = color;
    document.getElementById("console").appendChild(paragraph);
}

function write(s)
{
    document.getElementById('pre').appendChild(document.createTextNode(s));
}

function shouldBe(a, b)
{
    var evalA = eval(a);
    if (evalA == b)
        print("PASS: " + a + " should be " + b + " and is.", "green");
    else
        print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
}

var embed;

function test()
{
    if (window.testRunner)
        testRunner.dumpAsText();
        
    embed = document.getElementById('embed');
    print("[Embed is element specified in markup]");

    embed.align = 1;
    embed.height = 1;
    embed.name = 1;
    embed.width = 1;
    embed.type = 1; // setting the type attribute should not effect the plugin once loaded
    embed.src = 1; // setting the source attribute should not effect the plugin once loaded

    shouldBe("embed.getAttribute('align')", 1);
    shouldBe("embed.getAttribute('height')", 1);
    shouldBe("embed.getAttribute('name')", 1);
    shouldBe("embed.getAttribute('width')", 1);
    shouldBe("embed.getAttribute('type')", 1);
    shouldBe("embed.getAttribute('src')", 1);
    shouldBe("typeof embed.testCallback", "function");

    print("----------");
    
    embed = document.createElement('embed');
    print("[Embed is dynamically created element with only type specified]");

    embed.style.visibility = "hidden";
    embed.type = "application/x-webkit-test-netscape";
    document.body.appendChild(embed);
    shouldBe("typeof embed.testCallback", "function");
    
    print("----------");
    
    embed = document.createElement('embed');
    print("[Embed is dynamically created element with only src specified]");

    embed.style.visibility = "hidden";
    embed.src = "resources/test.testnetscape";
    document.body.appendChild(embed);
    shouldBe("typeof embed.testCallback", "function");
}
</script>
</head>

<body onload="test();">

<hr>
<div id='console'></div>

<embed style="visibility: hidden" type="application/x-webkit-test-netscape" id='embed'></embed>

</body>
</html>
Something went wrong with that request. Please try again.