W3C home > Mailing lists > Public > public-html-commits@w3.org > February 2010

html5/tests/submission/Microsoft/htmldom loader.html,NONE,1.1

From: Kris Krueger via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 25 Feb 2010 15:40:04 +0000
To: public-html-commits@w3.org
Message-Id: <E1Nkfoq-0003H8-EE@lionel-hutz.w3.org>
Update of /sources/public/html5/tests/submission/Microsoft/htmldom
In directory hutz:/tmp/cvs-serv12574/submission/Microsoft/htmldom

Added Files:
	loader.html 
Log Message:
Simple loader to load up a test page

--- NEW FILE: loader.html ---
<!DOCTYPE html>
<html>
    <head>
        <title>HTML 5 Test Suite: HTML DOM Loader</title>
        <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
        <link rel="help" href="http://www.w3.org/TR/html5/browsers.html" />
    </head>
    <body onload='LoadTestContent()'>
        <div id='testdescription'>Test passes if the word PASS appears below.</div>
        <script type="text/javascript">

            // This is just a simple page that can load up and run the older 
            // DOM Level HTML Tests
            // The test page is passed in as parameter
            // Test page contains a exposeTestFunctionNames function 
            // that the exports the tests to be runfrom testScript
            //
            // http://foo.bar/htmldom/loader.html?area01.html

            //var TestScript  = "anchor02.html";

            var TestScript  = location.search.split('?')[1];

            // Add more tests upon passing increment the 'count'
            var ExpectedPasses = 1;
            var ActualPasses   = 0;

            function RunTest()
            {

                try
                {            
                    ActualPasses = CallTest();
                
                    if (ExpectedPasses == ActualPasses)
                    {
                        document.getElementById('testresult').innerHTML = 'Pass';
                    }

                    document.getElementById('testspassed').innerHTML = ActualPasses + "/" + ExpectedPasses;
                }

                // TODO all the 'asserts' will return a string, so upon error store in console
                catch(ex)
                {
                    document.getElementById('testresult').innerHTML = 'Fail';
                    console.log(ex);
                }

            }
            function CallTest()
            {
                var cPassedTests = 0;

                // builder.contentType is used alot so set this local variable
                document.getElementById('testframe').contentWindow.builder = new Object();
                document.getElementById('testframe').contentWindow.builder.contentType = "text/html";

                var aTests = document.getElementById('testframe').contentWindow.exposeTestFunctionNames();

                for (var cTests=0;cTests<aTests.length;cTests++)
                {
                    eval("document.getElementById('testframe').contentWindow." + aTests[cTests] + "();");
                    cPassedTests++;
                }

                return cPassedTests;
            }

            function LoadTestContent() 
            {
                var frame = document.getElementById('testframe');

                frame.setAttribute('onload', 'RunTest()');
                frame.setAttribute('src', TestScript);
            }

        </script>
        <span id='testresult'>Running</span>
        <span id='testspassed'>0/1</span>
        <iframe id='testframe' style="display: block; kvisibility: hidden; kwidth: 0px; kheight:0px;" >Test Frame</iframe>
    </body>
</html> 
 
Received on Thursday, 25 February 2010 15:40:05 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 25 February 2010 15:40:06 GMT