pjs/embedding/qa/jstests/EmbedSmokeTest.txt

397 строки
13 KiB
Plaintext

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<title> Embed Smoke Test </title>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is Mozilla Communicator Test Cases.
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation.
- Portions created by the Initial Developer are Copyright (C) 1999
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<head>
<!-- script below is ngdriverspecific -->
<script TYPE="text/javascript" SRC="http://bubblegum/ngdriver/suites/testlib.js">
</script>
<script TYPE="text/javascript">
var linkclick = "Fail";
var urlload = "Fail";
var fileurlload = "Fail";
var mozload = "Fail";
var seamonkeyload = "Fail";
executeAllTestCases = "false";
mozimageload = "false";
seamonkeyimageload = "false";
function createCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ')
c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name)
{
createCookie(name,"",-1);
}
function linkfun()
{
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var val = win.document.getElementsByTagName("title").item(0);
if(val)
{
var val1 = val.firstChild.data;
if(val1)
{
linkclick = "Pass";
}
}
}
catch(e)
{
alert("exception: " + e);
}
win.close();
linkwin.close();
}
function urlloaded()
{
// if(scrollbarsvisible)
// {
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var val = loadurlwin.document.getElementsByTagName("title").item(0);
if(val)
{
var val1 = val.firstChild.data;
if(val1)
{
urlload = "Pass";
}
}
}
catch(e)
{
alert("exception: " + e);
}
// }
loadurlwin.close();
}
function fileurlloaded()
{
try{
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var file = fileurl.document.getElementsByTagName("h2").item(0);
if(file)
{
if(file.firstChild.data == "This is a test file")
fileurlload = "Pass";
}
}
catch(e)
{
alert("exception: " + e);
}
fileurl.close();
}
function mozillaimageLoaded()
{
mozimageload = "true";
}
function seamonkeyimageLoaded()
{
seamonkeyimageload = "true";
}
function constructResults()
{
var results = "";
var linkclickcolor = "white";
var urlloadcolor = "white";
var fileurlloadcolor = "white";
var mozloadcolor = "white";
var seamonkeyloadcolor = "white";
results = results + "<html><br>";
results = results + " <table bgcolor='white' border='4'>";
results = results + " <tbody>";
results = results + " <caption> <center> <b> Embed SmokeTest Results </b> </center> </caption>";
results = results + " <tr>";
results = results + " <td> <b> Description </b> </td>";
results = results + " <td> <b> Result </b> </td>";
results = results + " <td> <b> Comments </b> </td>";
results = results + " </tr>";
if( (document.form1.linkclickcheckbox.checked==true) || (executeAllTestCases=="true") )
{
if (linkclick == "Fail") linkclickcolor = "red";
results = results + " <tr bgcolor = '" + linkclickcolor + "'>";
results = results + " <td> Link Clicking </td>";
results = results + " <td>" + linkclick + "</td>";
if (linkclick == "Fail")
results = results + " <td>" + "Link could not be clicked" + "</td>";
results = results + " </tr>";
}
if( (document.form1.loadurlcheckbox.checked==true) || (executeAllTestCases=="true") )
{
if (urlload == "Fail") urlloadcolor = "red";
results = results + " <tr bgcolor = '" + urlloadcolor + "'>";
results = results + " <td> URL Loading </td>";
results = results + " <td>" + urlload + "</td>";
if (urlload == "Fail")
results = results + " <td>" + "Either the URL could not be loaded or the Scrollbars donot appear" + "</td>";
results = results + " </tr>";
}
if( (document.form1.loadfileurlcheckbox.checked==true) || (executeAllTestCases=="true") )
{
if (fileurlload == "Fail") fileurlloadcolor = "red";
results = results + " <tr bgcolor = '" + fileurlloadcolor + "'>";
results = results + " <td> File URL Loading </td>";
results = results + " <td>" + fileurlload + "</td>";
if (fileurlload == "Fail")
results = results + " <td>" + "Either the file could not be found or the content is not displayed" + "</td>";
results = results + " </tr>";
}
if( (document.form1.mozillaloadcheckbox.checked==true) || (executeAllTestCases=="true") )
{
if (mozload == "Fail") mozloadcolor = "red";
results = results + " <tr bgcolor = '" + mozloadcolor + "'>";
results = results + " <td> Load GIF Image </td>";
results = results + " <td>" + mozload + "</td>";
if (mozload == "Fail")
results = results + " <td>" + "Image could not be found or Image could not be loaded properly" + "</td>";
results = results + " </tr>";
}
if( (document.form1.seamonkeyloadcheckbox.checked==true) || (executeAllTestCases=="true") )
{
if (seamonkeyload == "Fail") seamonkeyloadcolor = "red";
results = results + " <tr bgcolor = '" + seamonkeyloadcolor + "'>";
results = results + " <td> Load JPEG Image </td>";
results = results + " <td>" + seamonkeyload + "</td>";
if (seamonkeyload == "Fail")
results = results + " <td>" + "Image could not be found or Image could not be loaded properly" + "</td>";
results = results + " </tr>";
}
results = results + " </tbody>";
results = results + " </table>";
results = results + "</html>";
createCookie("embedsmoketest", results, 14);
window.location.reload();
}
function displayResults(results)
{
document.results.textarea.value = results;
if (top.name == "testWindow")
{
fixSubmit();
}
else
{
document.write(document.results.textarea.value);
}
}
function onSubmitAll()
{
executeAllTestCases = "true";
onSubmit();
}
function onSubmit()
{
if( (document.form1.linkclickcheckbox.checked==true) || (executeAllTestCases=="true") )
{
// link clicking
try
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
linkwin = window.open("");
if(linkwin)
{
linkwin.document.write("<a href='http://www.mozilla.org'> Click here to go to Mozilla site </a><br><br>");
var link1 = linkwin.document.getElementsByTagName("a").item(0);
if (link1)
{
win = window.open(link1);
if (win)
{
win.onload = setTimeout("linkfun();", 1000);
}
}
}
}
catch(e)
{
alert("exception:" + e);
}
}
if( (document.form1.loadurlcheckbox.checked==true) || (executeAllTestCases=="true") )
{
// Loading new window
try
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
loadurlwin = window.open("http://www.mozilla.org");
if (loadurlwin)
{
//scrollbarsvisible = loadurlwin.scrollbars.visible;
loadurlwin.onload = setTimeout("urlloaded();", 1000);
}
}
catch(e)
{
alert("exception:" + e);
}
}
if( (document.form1.loadfileurlcheckbox.checked==true) || (executeAllTestCases=="true") )
{
fileurl = window.open("test.html");
if (fileurl)
{
fileurl.onload = setTimeout("fileurlloaded();", 1000);
}
}
if( (document.form1.mozillaloadcheckbox.checked==true) || (executeAllTestCases=="true") )
{
if(mozimageload=="true")
mozload = "Pass";
}
if( (document.form1.seamonkeyloadcheckbox.checked==true) || (executeAllTestCases=="true") )
{
if(seamonkeyimageload=="true")
seamonkeyload = "Pass";
}
setTimeout("constructResults();", 6000);
}
</script>
</head>
<body>
<!-- form below is ngdriverspecific -->
<form name="results" action="/ngdriver/cgi-bin/writeresults.cgi" method="post">
<script TYPE="text/javascript">
document.write('<input name="resultsfile" type="hidden" value="' + window.opener.document.resultsform.resultsfile.value + '">');
</script>
<input type="hidden" name="textarea">
</form>
<script TYPE="text/javascript">
if(readCookie("embedsmoketest") == null)
{
document.write("<h2> Choose the test cases you want to run: </h2>");
document.write("<br><br>");
document.write("<form NAME='form1'>");
document.write("<input type='checkbox' name='linkclickcheckbox'><b> Click a Link on a Page </b></input>");
document.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
document.write(" [");
document.write("<a href='http://mozilla.org/quality/embed/plans/EmbedSmokeTestPlan.html#first'>Click to see description</a> ");
document.write("]<br>");
document.write("<input type='checkbox' name='loadurlcheckbox'><b> Load a URL </b></input>");
document.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
document.write(" [");
document.write("<a href='http://mozilla.org/quality/embed/plans/EmbedSmokeTestPlan.html#second'>Click to see description</a> ");
document.write("]<br>");
document.write("<input type='checkbox' name='loadfileurlcheckbox'><b> Load a File URL [Content Loading]</b></input>");
document.write("&nbsp;");
document.write(" [");
document.write("<a href='http://mozilla.org/quality/embed/plans/EmbedSmokeTestPlan.html#third'>Click to see description</a> ");
document.write("]<br>");
document.write("<input type='checkbox' name='mozillaloadcheckbox'><b> Load GIF Image</b></input>");
document.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
document.write(" [");
document.write("<a href='http://mozilla.org/quality/embed/plans/EmbedSmokeTestPlan.html#fourth'>Click to see description</a> ");
document.write("]<br>");
document.write("<input type='checkbox' name='seamonkeyloadcheckbox'><b> Load JPEG Image</b></input>");
document.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
document.write(" [");
document.write("<a href='http://mozilla.org/quality/embed/plans/EmbedSmokeTestPlan.html#fifth'>Click to see description</a> ");
document.write("]<br>");
document.write("</form>");
document.write("<br>");
document.write("<button type='button' onClick='onSubmit()'> Execute Selected Testcases </button>");
document.write(" ");
document.write("<button type='button' onClick='onSubmitAll()'> Execute All Testcases </button>");
document.write('<img src="images/mozilla-banner.gif" height=0 width=0 onLoad = "mozillaimageLoaded();">');
document.write('<img src="images/seamonkey.jpg" height=0 width=0 onLoad = "seamonkeyimageLoaded();">');
}
else
{
cookieValue = readCookie("embedsmoketest");
eraseCookie("embedsmoketest");
displayResults(cookieValue);
}
</script>
</body>
</html>