pjs/embedding/qa/jstests/EmbedSmokeTest.txt

397 строки
13 KiB
Plaintext
Исходник Обычный вид История

2001-08-15 03:32:00 +04:00
<!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/
2001-08-15 03:32:00 +04:00
-
- 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.
2001-08-15 03:32:00 +04:00
-
- 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.
2001-08-15 03:32:00 +04:00
-
- 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 ***** -->
2001-09-20 22:48:06 +04:00
2001-08-15 03:32:00 +04:00
<head>
<!-- script below is ngdriverspecific -->
<script TYPE="text/javascript" SRC="http://bubblegum/ngdriver/suites/testlib.js">
</script>
2001-09-20 22:48:06 +04:00
<script TYPE="text/javascript">
2001-09-05 23:25:49 +04:00
var linkclick = "Fail";
var urlload = "Fail";
2001-09-20 22:48:06 +04:00
var fileurlload = "Fail";
var mozload = "Fail";
var seamonkeyload = "Fail";
2001-10-23 04:36:37 +04:00
executeAllTestCases = "false";
mozimageload = "false";
seamonkeyimageload = "false";
2001-08-15 03:32:00 +04:00
2001-09-20 22:48:06 +04:00
function createCookie(name,value,days)
2001-08-15 03:32:00 +04:00
{
2001-09-20 22:48:06 +04:00
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else expires = "";
2001-08-15 03:32:00 +04:00
2001-09-20 22:48:06 +04:00
document.cookie = name+"="+value+expires+"; path=/";
}
2001-09-20 22:48:06 +04:00
function readCookie(name)
{
2001-09-20 22:48:06 +04:00
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
2001-09-20 22:48:06 +04:00
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);
}
2001-09-20 22:48:06 +04:00
return null;
}
function eraseCookie(name)
{
createCookie(name,"",-1);
}
2001-10-23 04:36:37 +04:00
function linkfun()
2001-09-20 22:48:06 +04:00
{
2001-10-23 04:36:37 +04:00
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();
2001-09-20 22:48:06 +04:00
}
function urlloaded()
{
2001-10-23 04:36:37 +04:00
// 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();
2001-09-20 22:48:06 +04:00
}
function fileurlloaded()
{
2001-10-23 04:36:37 +04:00
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)
{
2001-10-23 04:36:37 +04:00
alert("exception: " + e);
}
2001-09-20 22:48:06 +04:00
fileurl.close();
}
function mozillaimageLoaded()
{
2001-10-23 04:36:37 +04:00
mozimageload = "true";
}
function seamonkeyimageLoaded()
{
2001-10-23 04:36:37 +04:00
seamonkeyimageload = "true";
2001-09-05 23:25:49 +04:00
}
2001-09-20 22:48:06 +04:00
function constructResults()
2001-08-15 03:32:00 +04:00
{
2001-09-20 22:48:06 +04:00
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>";
2001-10-23 04:36:37 +04:00
if( (document.form1.linkclickcheckbox.checked==true) || (executeAllTestCases=="true") )
{
2001-09-20 22:48:06 +04:00
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>";
}
2001-10-23 04:36:37 +04:00
if( (document.form1.loadurlcheckbox.checked==true) || (executeAllTestCases=="true") )
{
2001-09-20 22:48:06 +04:00
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>";
}
2001-10-23 04:36:37 +04:00
if( (document.form1.loadfileurlcheckbox.checked==true) || (executeAllTestCases=="true") )
2001-09-20 22:48:06 +04:00
{
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>";
}
2001-10-23 04:36:37 +04:00
if( (document.form1.mozillaloadcheckbox.checked==true) || (executeAllTestCases=="true") )
2001-09-20 22:48:06 +04:00
{
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>";
}
2001-10-23 04:36:37 +04:00
if( (document.form1.seamonkeyloadcheckbox.checked==true) || (executeAllTestCases=="true") )
2001-09-20 22:48:06 +04:00
{
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>";
}
2001-08-15 03:32:00 +04:00
2001-09-20 22:48:06 +04:00
results = results + " </tbody>";
results = results + " </table>";
results = results + "</html>";
2001-10-23 04:36:37 +04:00
createCookie("embedsmoketest", results, 14);
window.location.reload();
2001-09-20 22:48:06 +04:00
}
2001-09-20 22:48:06 +04:00
function displayResults(results)
{
document.results.textarea.value = results;
if (top.name == "testWindow")
{
fixSubmit();
}
else
2001-09-05 23:25:49 +04:00
{
2001-09-20 22:48:06 +04:00
document.write(document.results.textarea.value);
2001-09-05 23:25:49 +04:00
}
}
2001-10-23 04:36:37 +04:00
function onSubmitAll()
{
executeAllTestCases = "true";
onSubmit();
}
function onSubmit()
2001-09-20 22:48:06 +04:00
{
2001-10-23 04:36:37 +04:00
if( (document.form1.linkclickcheckbox.checked==true) || (executeAllTestCases=="true") )
2001-09-20 22:48:06 +04:00
{
2001-10-23 04:36:37 +04:00
// link clicking
try
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
linkwin = window.open("");
if(linkwin)
2001-09-20 22:48:06 +04:00
{
2001-10-23 04:36:37 +04:00
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);
2001-09-20 22:48:06 +04:00
if (win)
{
2001-10-23 04:36:37 +04:00
win.onload = setTimeout("linkfun();", 1000);
2001-09-20 22:48:06 +04:00
}
2001-10-23 04:36:37 +04:00
}
2001-09-20 22:48:06 +04:00
}
2001-10-23 04:36:37 +04:00
}
catch(e)
{
alert("exception:" + e);
}
2001-09-20 22:48:06 +04:00
}
2001-10-23 04:36:37 +04:00
if( (document.form1.loadurlcheckbox.checked==true) || (executeAllTestCases=="true") )
2001-09-20 22:48:06 +04:00
{
2001-10-23 04:36:37 +04:00
// Loading new window
try
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
loadurlwin = window.open("http://www.mozilla.org");
if (loadurlwin)
2001-09-20 22:48:06 +04:00
{
2001-10-23 04:36:37 +04:00
//scrollbarsvisible = loadurlwin.scrollbars.visible;
loadurlwin.onload = setTimeout("urlloaded();", 1000);
2001-09-20 22:48:06 +04:00
}
2001-10-23 04:36:37 +04:00
}
catch(e)
{
alert("exception:" + e);
}
2001-09-20 22:48:06 +04:00
}
2001-10-23 04:36:37 +04:00
if( (document.form1.loadfileurlcheckbox.checked==true) || (executeAllTestCases=="true") )
2001-09-20 22:48:06 +04:00
{
2001-10-23 04:36:37 +04:00
fileurl = window.open("test.html");
if (fileurl)
{
fileurl.onload = setTimeout("fileurlloaded();", 1000);
}
2001-09-20 22:48:06 +04:00
}
2001-10-23 04:36:37 +04:00
if( (document.form1.mozillaloadcheckbox.checked==true) || (executeAllTestCases=="true") )
2001-09-20 22:48:06 +04:00
{
2001-10-23 04:36:37 +04:00
if(mozimageload=="true")
mozload = "Pass";
2001-09-20 22:48:06 +04:00
}
2001-10-23 04:36:37 +04:00
if( (document.form1.seamonkeyloadcheckbox.checked==true) || (executeAllTestCases=="true") )
2001-09-20 22:48:06 +04:00
{
2001-10-23 04:36:37 +04:00
if(seamonkeyimageload=="true")
seamonkeyload = "Pass";
2001-09-20 22:48:06 +04:00
}
2001-08-15 03:32:00 +04:00
2001-10-23 04:36:37 +04:00
setTimeout("constructResults();", 6000);
2001-09-20 22:48:06 +04:00
}
</script>
</head>
<body>
2001-08-15 03:32:00 +04:00
<!-- 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">
2001-09-20 22:48:06 +04:00
if(readCookie("embedsmoketest") == null)
{
2001-10-23 04:36:37 +04:00
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();">');
}
2001-09-20 22:48:06 +04:00
else
{
2001-10-23 04:36:37 +04:00
cookieValue = readCookie("embedsmoketest");
eraseCookie("embedsmoketest");
displayResults(cookieValue);
2001-09-20 22:48:06 +04:00
}
2001-10-23 04:36:37 +04:00
2001-09-20 22:48:06 +04:00
</script>
2001-08-15 03:32:00 +04:00
</body>
</html>