зеркало из https://github.com/mozilla/gecko-dev.git
Automated smoketests for mfcEmbed.
This commit is contained in:
Родитель
98a07cce4d
Коммит
48d5cd8ba3
|
@ -3,7 +3,7 @@
|
|||
<title> Embed Smoke Test </title>
|
||||
<!-- Descrpt: Embed Smoke Test
|
||||
Author: dsirnapalli@netscape.com
|
||||
Revs: 08.13.01 - Created
|
||||
Revs: 09.20.01 - Created
|
||||
|
||||
- The contents of this file are subject to the Mozilla Public
|
||||
- License Version 1.1 (the "License"); you may not use this file
|
||||
|
@ -24,36 +24,145 @@
|
|||
-
|
||||
- Contributor(s):
|
||||
-->
|
||||
|
||||
<head>
|
||||
|
||||
<!-- script below is ngdriverspecific -->
|
||||
<script TYPE="text/javascript" SRC="http://bubblegum/ngdriver/suites/testlib.js">
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var mozload = "Fail";
|
||||
var seamonkeyload = "Fail";
|
||||
var pageload = "Fail";
|
||||
<script TYPE="text/javascript">
|
||||
var linkclick = "Fail";
|
||||
var urlload = "Fail";
|
||||
var win;
|
||||
var newwin;
|
||||
var fileurlload = "Fail";
|
||||
var dirurlload = "Fail";
|
||||
var mozload = "Fail";
|
||||
var seamonkeyload = "Fail";
|
||||
|
||||
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 link()
|
||||
{
|
||||
linkclick = "Pass";
|
||||
win.close();
|
||||
}
|
||||
|
||||
function urlloaded()
|
||||
{
|
||||
if(scrollbarsvisible)
|
||||
urlload = "Pass";
|
||||
newwin.close();
|
||||
}
|
||||
|
||||
function fileurlloaded()
|
||||
{
|
||||
var file = fileurl.document.getElementsByTagName("h2").item(0);
|
||||
if(file)
|
||||
{
|
||||
if(file.firstChild.data == "This is a test file")
|
||||
fileurlload = "Pass";
|
||||
}
|
||||
fileurl.close();
|
||||
}
|
||||
|
||||
function dirurlloaded()
|
||||
{
|
||||
dirurlload = "Pass";
|
||||
// dirurl.close();
|
||||
}
|
||||
|
||||
function mozillaimageLoaded()
|
||||
{
|
||||
mozload = "Pass";
|
||||
}
|
||||
|
||||
function seamonkeyimageLoaded()
|
||||
{
|
||||
seamonkeyload = "Pass";
|
||||
}
|
||||
|
||||
function onSubmit()
|
||||
{
|
||||
if (document.form1.linkclickcheckbox.checked)
|
||||
val = "true";
|
||||
else
|
||||
val = "false";
|
||||
if (document.form1.loadurlcheckbox.checked)
|
||||
val = val + "," + "true";
|
||||
else
|
||||
val = val + "," + "false";
|
||||
if (document.form1.loadfileurlcheckbox.checked)
|
||||
val = val + "," + "true";
|
||||
else
|
||||
val = val + "," + "false";
|
||||
if (document.form1.loaddireurlcheckbox.checked)
|
||||
val = val + "," + "true";
|
||||
else
|
||||
val = val + "," + "false";
|
||||
if (document.form1.mozillaloadcheckbox.checked)
|
||||
val = val + "," + "true";
|
||||
else
|
||||
val = val + "," + "false";
|
||||
if (document.form1.seamonkeyloadcheckbox.checked)
|
||||
val = val + "," + "true";
|
||||
else
|
||||
val = val + "," + "false";
|
||||
|
||||
submit();
|
||||
}
|
||||
|
||||
function onSubmitAll()
|
||||
{
|
||||
val = "true,true,true,true,true,true";
|
||||
submit();
|
||||
}
|
||||
|
||||
function submit()
|
||||
{
|
||||
val = val + ",";
|
||||
createCookie("embedsmoketest", val, 14);
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
function constructResults()
|
||||
{
|
||||
var results = "";
|
||||
var mozloadcolor = "white";
|
||||
var seamonkeyloadcolor = "white";
|
||||
var pageloadcolor = "white";
|
||||
var linkclickcolor = "white";
|
||||
var urlloadcolor = "white";
|
||||
|
||||
if (mozload == "Fail") mozloadcolor = "red";
|
||||
if (seamonkeyload == "Fail") seamonkeyloadcolor = "red";
|
||||
if (pageload == "Fail") pageloadcolor = "red";
|
||||
if (linkclick == "Fail") linkclickcolor = "red";
|
||||
if (urlload == "Fail") urlloadcolor = "red";
|
||||
var fileurlloadcolor = "white";
|
||||
var dirurlloadcolor = "white";
|
||||
var mozloadcolor = "white";
|
||||
var seamonkeyloadcolor = "white";
|
||||
|
||||
results = results + "<html><br>";
|
||||
results = results + " <table bgcolor='white' border='4'>";
|
||||
|
@ -62,28 +171,68 @@ function constructResults()
|
|||
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>";
|
||||
results = results + " <tr bgcolor = '" + mozloadcolor + "'>";
|
||||
results = results + " <td> Mozilla Image Loaded[GIF] </td>";
|
||||
results = results + " <td>" + mozload + "</td>";
|
||||
results = results + " </tr>";
|
||||
results = results + " <tr bgcolor = '" + seamonkeyloadcolor + "'>";
|
||||
results = results + " <td> SeaMonkey Image Loaded[JPEG] </td>";
|
||||
results = results + " <td>" + seamonkeyload + "</td>";
|
||||
results = results + " </tr>";
|
||||
results = results + " <tr bgcolor = '" + linkclickcolor + "'>";
|
||||
results = results + " <td> Link Clicking </td>";
|
||||
results = results + " <td>" + linkclick + "</td>";
|
||||
results = results + " </tr>";
|
||||
results = results + " <tr bgcolor = '" + urlloadcolor + "'>";
|
||||
results = results + " <td> URL Loading </td>";
|
||||
results = results + " <td>" + urlload + "</td>";
|
||||
results = results + " </tr>";
|
||||
results = results + " <tr bgcolor = '" + pageloadcolor + "'>";
|
||||
results = results + " <td> PageLoaded </td>";
|
||||
results = results + " <td>" + pageload + "</td>";
|
||||
results = results + " </tr>";
|
||||
results = results + " <tbody>";
|
||||
if(linkclickchecked == "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(urlloadchecked == "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(fileurlloadchecked == "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(dirurlloadchecked == "true")
|
||||
{
|
||||
if (dirurlload == "Fail") dirurlloadcolor = "red";
|
||||
results = results + " <tr bgcolor = '" + dirurlloadcolor + "'>";
|
||||
results = results + " <td> Directory URL Loading </td>";
|
||||
results = results + " <td>" + dirurlload + "</td>";
|
||||
results = results + " </tr>";
|
||||
}
|
||||
if(mozillaloadchecked == "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(seamonkeyloadchecked == "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>";
|
||||
|
||||
|
@ -103,102 +252,67 @@ function displayResults(results)
|
|||
}
|
||||
}
|
||||
|
||||
function mozillaimageLoaded()
|
||||
function loadTestCases()
|
||||
{
|
||||
mozload = "Pass";
|
||||
}
|
||||
if(linkclickchecked == "true")
|
||||
{
|
||||
// link clicking
|
||||
document.write('<a href="http://www.mozilla.org"> Click here to go to Mozilla site </a><br><br>');
|
||||
var link = document.getElementsByTagName("a").item(0);
|
||||
if (link)
|
||||
{
|
||||
win = window.open(link);
|
||||
if (win)
|
||||
{
|
||||
win.onload = setTimeout("link();", 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(urlloadchecked == "true")
|
||||
{
|
||||
// Loading new window
|
||||
newwin = window.open("http://www.yahoo.com");
|
||||
scrollbarsvisible = newwin.scrollbars.visible;
|
||||
if (newwin)
|
||||
{
|
||||
newwin.onload = setTimeout("urlloaded();", 1000);
|
||||
}
|
||||
}
|
||||
if(fileurlloadchecked == "true")
|
||||
{
|
||||
fileurl = window.open("file://D:/suites/embedding/test.html");
|
||||
if (fileurl)
|
||||
{
|
||||
fileurl.onload = setTimeout("fileurlloaded();", 1000);
|
||||
}
|
||||
}
|
||||
if(dirurlloadchecked == "true")
|
||||
{
|
||||
dirurl = window.open("file://D:/suites/embedding");
|
||||
if (dirurl)
|
||||
{
|
||||
dirurl.onload = setTimeout("dirurlloaded();", 1000);
|
||||
}
|
||||
}
|
||||
if(mozillaloadchecked == "true")
|
||||
{
|
||||
// gif image
|
||||
document.write('<center><img src="images/mozilla-banner.gif" height=58 width=600 onLoad = "mozillaimageLoaded();"></center>');
|
||||
}
|
||||
if(seamonkeyloadchecked == "true")
|
||||
{
|
||||
// jpg image
|
||||
document.write('<center>');
|
||||
document.write('<img SRC="images/seamonkey.jpg" height=183 width=300 onLoad = "seamonkeyimageLoaded();">');
|
||||
document.write('</center>');
|
||||
}
|
||||
|
||||
function seamonkeyimageLoaded()
|
||||
{
|
||||
seamonkeyload = "Pass";
|
||||
}
|
||||
|
||||
function link()
|
||||
{
|
||||
linkclick = "Pass";
|
||||
win.close();
|
||||
}
|
||||
|
||||
function urlloaded()
|
||||
{
|
||||
//alert(newwin.scrollbars.visible);
|
||||
// if (newwin.scrollbars.visible == "true")
|
||||
urlload = "Pass";
|
||||
newwin.close();
|
||||
}
|
||||
|
||||
function pageLoaded()
|
||||
{
|
||||
if (usingGecko == "False")
|
||||
{
|
||||
displayResults("<b> You cannot execute this test case. The Browser you are using doesnot use Gecko Engine. Try with other browser.<b>");
|
||||
}
|
||||
else
|
||||
{
|
||||
pageload = "Pass";
|
||||
setTimeout("constructResults();", 1000);
|
||||
}
|
||||
setTimeout("constructResults();", 3000);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<script TYPE="text/javascript">
|
||||
|
||||
function testPage()
|
||||
{
|
||||
// simpletext
|
||||
document.write('<center><b> This is a Test Page </b></center>');
|
||||
|
||||
// gif image
|
||||
document.write('<center><img src="images/mozilla-banner.gif" height=58 width=600 onLoad = "mozillaimageLoaded();"></center>');
|
||||
document.write('<br> <br>');
|
||||
|
||||
// simple table
|
||||
document.write('<table bgcolor="blue" border="4">');
|
||||
document.write('<tbody>');
|
||||
document.write('<caption> <center> <b> Test Table </b> </center> </caption>');
|
||||
document.write('<tr>');
|
||||
document.write(' <td> <b> Cell1 </b> </td>');
|
||||
document.write(' <td> <b> Cell2 </b> </td>');
|
||||
document.write('</tr>');
|
||||
document.write('<tr>');
|
||||
document.write(' <td> <b> Cell3 </b> </td>');
|
||||
document.write(' <td> <b> Cell4 </b> </td>');
|
||||
document.write('</tr>');
|
||||
document.write('</tbody>');
|
||||
document.write('</table><br>');
|
||||
|
||||
// jpg image
|
||||
document.write('<center>');
|
||||
document.write('<img SRC="images/seamonkey.jpg" height=183 width=300 onLoad = "seamonkeyimageLoaded();">');
|
||||
document.write('</center>');
|
||||
|
||||
// link clicking
|
||||
// document.write('<a href="http://www.mozilla.org"> Click here to go to Mozilla site </a><br><br>');
|
||||
// var link = document.getElementsByTagName("a").item(0);
|
||||
// if (link)
|
||||
// {
|
||||
// win = window.open(link);
|
||||
// if (win)
|
||||
// {
|
||||
// win.onload = setTimeout("link();", 1000);
|
||||
// }
|
||||
// alert("one");
|
||||
// }
|
||||
|
||||
// Loading new window
|
||||
newwin = window.open("http://www.yahoo.com");
|
||||
// alert(newwin.scrollbars.visible);
|
||||
if (newwin)
|
||||
{
|
||||
newwin.onload = setTimeout("urlloaded();", 1000);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body onLoad = "pageLoaded();">
|
||||
<body>
|
||||
|
||||
<!-- form below is ngdriverspecific -->
|
||||
<form name="results" action="/ngdriver/cgi-bin/writeresults.cgi" method="post">
|
||||
|
@ -209,14 +323,48 @@ document.write('<input name="resultsfile" type="hidden" value="' + window.opener
|
|||
</form>
|
||||
|
||||
<script TYPE="text/javascript">
|
||||
var userAgent = navigator.userAgent;
|
||||
var usingGecko = "False";
|
||||
if (userAgent.search("Gecko") != -1)
|
||||
if(readCookie("embedsmoketest") == null)
|
||||
{
|
||||
usingGecko = "True";
|
||||
testPage();
|
||||
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><br>");
|
||||
document.write("<input type='checkbox' name='loadurlcheckbox'><b> Load a URL </b></input><br>");
|
||||
document.write("<input type='checkbox' name='loadfileurlcheckbox'><b> Load a File URL [Content Loading]</b></input><br>");
|
||||
document.write("<input type='checkbox' name='loaddireurlcheckbox'><b> Load a File URL [Directory Loading]</b></input><br>");
|
||||
document.write("<input type='checkbox' name='mozillaloadcheckbox'><b> Load GIF Image</b></input><br>");
|
||||
document.write("<input type='checkbox' name='seamonkeyloadcheckbox'><b> Load JPEG Image</b></input><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>");
|
||||
}
|
||||
else
|
||||
{
|
||||
cookieValue = readCookie("embedsmoketest");
|
||||
startindex = 0;
|
||||
endindex = cookieValue.indexOf(',', startindex);
|
||||
linkclickchecked = cookieValue.substring(startindex, endindex);
|
||||
startindex = endindex + 1;
|
||||
endindex = cookieValue.indexOf(',', startindex);
|
||||
urlloadchecked = cookieValue.substring(startindex, endindex);
|
||||
startindex = endindex + 1;
|
||||
endindex = cookieValue.indexOf(',', startindex);
|
||||
fileurlloadchecked = cookieValue.substring(startindex, endindex);
|
||||
startindex = endindex + 1;
|
||||
endindex = cookieValue.indexOf(',', startindex);
|
||||
dirurlloadchecked = cookieValue.substring(startindex, endindex);
|
||||
startindex = endindex + 1;
|
||||
endindex = cookieValue.indexOf(',', startindex);
|
||||
mozillaloadchecked = cookieValue.substring(startindex, endindex);
|
||||
startindex = endindex + 1;
|
||||
endindex = cookieValue.indexOf(',', startindex);
|
||||
seamonkeyloadchecked = cookieValue.substring(startindex, endindex);
|
||||
|
||||
eraseCookie("embedsmoketest");
|
||||
loadTestCases();
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче