Revert accidental checkin to NSS.
[wine-gecko.git] / embedding / qa / jstests / EmbedSmokeTest.txt
blob74519e5a5490648ee12e25097d2798f297db7d87
1 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
2 <html>
3 <title> Embed Smoke Test </title>
4 <!-- ***** BEGIN LICENSE BLOCK *****
5    - Version: MPL 1.1/GPL 2.0/LGPL 2.1
6    -
7    - The contents of this file are subject to the Mozilla Public License Version
8    - 1.1 (the "License"); you may not use this file except in compliance with
9    - the License. You may obtain a copy of the License at
10    - http://www.mozilla.org/MPL/
11    -
12    - Software distributed under the License is distributed on an "AS IS" basis,
13    - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14    - for the specific language governing rights and limitations under the
15    - License.
16    -
17    - The Original Code is Mozilla Communicator Test Cases.
18    -
19    - The Initial Developer of the Original Code is
20    - Netscape Communications Corporation.
21    - Portions created by the Initial Developer are Copyright (C) 1999
22    - the Initial Developer. All Rights Reserved.
23    -
24    - Contributor(s):
25    -
26    - Alternatively, the contents of this file may be used under the terms of
27    - either the GNU General Public License Version 2 or later (the "GPL"), or
28    - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29    - in which case the provisions of the GPL or the LGPL are applicable instead
30    - of those above. If you wish to allow use of your version of this file only
31    - under the terms of either the GPL or the LGPL, and not to allow others to
32    - use your version of this file under the terms of the MPL, indicate your
33    - decision by deleting the provisions above and replace them with the notice
34    - and other provisions required by the LGPL or the GPL. If you do not delete
35    - the provisions above, a recipient may use your version of this file under
36    - the terms of any one of the MPL, the GPL or the LGPL.
37    -
38    - ***** END LICENSE BLOCK ***** -->
40 <head>
42 <!-- script below is ngdriverspecific  -->
43 <script TYPE="text/javascript" SRC="http://bubblegum/ngdriver/suites/testlib.js">
44 </script>
46 <script TYPE="text/javascript">
47 var linkclick = "Fail";
48 var urlload = "Fail";
49 var fileurlload = "Fail";
50 var mozload  = "Fail";
51 var seamonkeyload = "Fail";
52 executeAllTestCases = "false";
53 mozimageload = "false";
54 seamonkeyimageload = "false";
56 function createCookie(name,value,days)
58   if (days)
59   {
60     var date = new Date();
61     date.setTime(date.getTime()+(days*24*60*60*1000));
62     var expires = "; expires="+date.toGMTString();
63   }
64   else expires = "";
66   document.cookie = name+"="+value+expires+"; path=/";
69 function readCookie(name)
71   var nameEQ = name + "=";
72   var ca = document.cookie.split(';');
73   for(var i=0;i < ca.length;i++)
74   {
75     var c = ca[i];
76     while (c.charAt(0)==' ')
77       c = c.substring(1,c.length);
78     if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
79   }
80   return null;
83 function eraseCookie(name)
85   createCookie(name,"",-1);
88 function linkfun()
90  try{
91   netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
92   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
94   var val = win.document.getElementsByTagName("title").item(0);
95   if(val)
96   {
97    var val1 = val.firstChild.data;
98    if(val1)
99    {
100      linkclick = "Pass";
101    }
102   }
104  catch(e)
106   alert("exception: " + e);
108  win.close();
109  linkwin.close();
112 function urlloaded()
114 // if(scrollbarsvisible)
115 // {
116   try{
117    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
118    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
119    var val = loadurlwin.document.getElementsByTagName("title").item(0);
120    if(val)
121    {
122      var val1 = val.firstChild.data;
123      if(val1)
124      {
125        urlload = "Pass";
126      }
127    }
128   }
129   catch(e)
130   {
131     alert("exception: " + e);
132   }
133 // }
134  loadurlwin.close();
137 function fileurlloaded()
139   try{
140     netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
141     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
143     var file = fileurl.document.getElementsByTagName("h2").item(0);
144     if(file)
145     {
146       if(file.firstChild.data == "This is a test file")
147         fileurlload = "Pass";
148     }
149   }
150   catch(e)
151   {
152     alert("exception: " + e);
153   }
154   fileurl.close();
157 function mozillaimageLoaded()
159   mozimageload = "true";
162 function seamonkeyimageLoaded()
164   seamonkeyimageload = "true";
167 function constructResults()
169   var results = "";
170   var linkclickcolor = "white";
171   var urlloadcolor = "white";
172   var fileurlloadcolor = "white";
173   var mozloadcolor  = "white";
174   var seamonkeyloadcolor = "white";
176   results = results + "<html><br>";
177   results = results + "  <table bgcolor='white' border='4'>";
178   results = results + "  <tbody>";
179   results = results + "  <caption> <center> <b> Embed SmokeTest Results </b> </center> </caption>";
180   results = results + "    <tr>";
181   results = results + "      <td> <b> Description </b> </td>";
182   results = results + "      <td> <b> Result </b> </td>";
183   results = results + "      <td> <b> Comments </b> </td>";
184   results = results + "    </tr>";
185   if( (document.form1.linkclickcheckbox.checked==true) || (executeAllTestCases=="true") )
186   {
187     if (linkclick == "Fail") linkclickcolor = "red";
188     results = results + "    <tr bgcolor = '" + linkclickcolor + "'>";
189     results = results + "      <td> Link Clicking </td>";
190     results = results + "      <td>" + linkclick + "</td>";
191     if (linkclick == "Fail")
192      results = results + "      <td>" + "Link could not be clicked" + "</td>";
193     results = results + "    </tr>";
194   }
195   if( (document.form1.loadurlcheckbox.checked==true) || (executeAllTestCases=="true") )
196   {
197     if (urlload == "Fail") urlloadcolor = "red";
198     results = results + "    <tr bgcolor = '" + urlloadcolor + "'>";
199     results = results + "      <td> URL Loading </td>";
200     results = results + "      <td>" + urlload + "</td>";
201     if (urlload == "Fail")
202       results = results + "      <td>" + "Either the URL could not be loaded or the Scrollbars donot appear" + "</td>";
203     results = results + "    </tr>";
204   }
205   if( (document.form1.loadfileurlcheckbox.checked==true) || (executeAllTestCases=="true") )
206   {
207     if (fileurlload == "Fail") fileurlloadcolor = "red";
208     results = results + "    <tr bgcolor = '" + fileurlloadcolor + "'>";
209     results = results + "      <td> File URL Loading </td>";
210     results = results + "      <td>" + fileurlload + "</td>";
211     if (fileurlload == "Fail")
212       results = results + "      <td>" + "Either the file could not be found or the content is not displayed" + "</td>";
213     results = results + "    </tr>";
214   }
215   if( (document.form1.mozillaloadcheckbox.checked==true) || (executeAllTestCases=="true") )
216   {
217     if (mozload == "Fail") mozloadcolor = "red";
218     results = results + "    <tr bgcolor = '" + mozloadcolor + "'>";
219     results = results + "      <td> Load GIF Image </td>";
220     results = results + "      <td>" + mozload + "</td>";
221     if (mozload == "Fail")
222       results = results + "      <td>" + "Image could not be found or Image could not be loaded properly" + "</td>";
223     results = results + "    </tr>";
224   }
225   if( (document.form1.seamonkeyloadcheckbox.checked==true) || (executeAllTestCases=="true") )
226   {
227     if (seamonkeyload == "Fail") seamonkeyloadcolor = "red";
228     results = results + "    <tr bgcolor = '" + seamonkeyloadcolor + "'>";
229     results = results + "      <td> Load JPEG Image </td>";
230     results = results + "      <td>" + seamonkeyload + "</td>";
231     if (seamonkeyload == "Fail")
232       results = results + "      <td>" + "Image could not be found or Image could not be loaded properly" + "</td>";
233     results = results + "    </tr>";
234   }
236   results = results + "  </tbody>";
237   results = results + "  </table>";
238   results = results + "</html>";
240   createCookie("embedsmoketest", results, 14);
241   window.location.reload();
244 function displayResults(results)
246   document.results.textarea.value = results;
247   if (top.name == "testWindow")
248   {
249         fixSubmit();
250   }
251   else
252   {
253         document.write(document.results.textarea.value);
254   }
257 function onSubmitAll()
259   executeAllTestCases = "true";
260   onSubmit();
263 function onSubmit()
265  if( (document.form1.linkclickcheckbox.checked==true) || (executeAllTestCases=="true") )
267   // link clicking
268   try
269   {
270    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
271    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
273    linkwin = window.open("");
274    if(linkwin)
275    {
276     linkwin.document.write("<a href='http://www.mozilla.org'> Click here to go to Mozilla site </a><br><br>");
277     var link1 = linkwin.document.getElementsByTagName("a").item(0);
278     if (link1)
279     {
280      win = window.open(link1);
281      if (win)
282      {
283       win.onload = setTimeout("linkfun();", 1000);
284      }
285     }
286    }
287   }
288   catch(e)
289   {
290    alert("exception:" + e);
291   }
293  if( (document.form1.loadurlcheckbox.checked==true) || (executeAllTestCases=="true") )
295   // Loading new window
296   try
297   {
298    netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
299    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
301    loadurlwin = window.open("http://www.mozilla.org");
302    if (loadurlwin)
303    {
304     //scrollbarsvisible = loadurlwin.scrollbars.visible;
305     loadurlwin.onload = setTimeout("urlloaded();", 1000);
306    }
307   }
308   catch(e)
309   {
310    alert("exception:" + e);
311   }
313  if( (document.form1.loadfileurlcheckbox.checked==true) || (executeAllTestCases=="true") )
315   fileurl = window.open("test.html");
316   if (fileurl)
317   {
318    fileurl.onload = setTimeout("fileurlloaded();", 1000);
319   }
321  if( (document.form1.mozillaloadcheckbox.checked==true) || (executeAllTestCases=="true") )
323    if(mozimageload=="true")
324      mozload = "Pass";
326  if( (document.form1.seamonkeyloadcheckbox.checked==true) || (executeAllTestCases=="true") )
328    if(seamonkeyimageload=="true")
329      seamonkeyload = "Pass";
332  setTimeout("constructResults();", 6000);
335 </script>
336 </head>
337 <body>
339 <!-- form below is ngdriverspecific  -->
340 <form name="results" action="/ngdriver/cgi-bin/writeresults.cgi" method="post">
341 <script TYPE="text/javascript">
342 document.write('<input name="resultsfile" type="hidden" value="' + window.opener.document.resultsform.resultsfile.value + '">');
343 </script>
344 <input type="hidden" name="textarea">
345 </form>
347 <script TYPE="text/javascript">
348 if(readCookie("embedsmoketest") == null)
350   document.write("<h2> Choose the test cases you want to run: </h2>");
351   document.write("<br><br>");
352   document.write("<form NAME='form1'>");
353   document.write("<input type='checkbox' name='linkclickcheckbox'><b> Click a Link on a Page </b></input>");
354   document.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
355   document.write(" [");
356   document.write("<a href='http://mozilla.org/quality/embed/plans/EmbedSmokeTestPlan.html#first'>Click to see description</a> ");
357   document.write("]<br>");
358   document.write("<input type='checkbox' name='loadurlcheckbox'><b> Load a URL </b></input>");
359   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;");
360   document.write(" [");
361   document.write("<a href='http://mozilla.org/quality/embed/plans/EmbedSmokeTestPlan.html#second'>Click to see description</a> ");
362   document.write("]<br>");
363   document.write("<input type='checkbox' name='loadfileurlcheckbox'><b> Load a File URL [Content Loading]</b></input>");
364   document.write("&nbsp;");
365   document.write(" [");
366   document.write("<a href='http://mozilla.org/quality/embed/plans/EmbedSmokeTestPlan.html#third'>Click to see description</a> ");
367   document.write("]<br>");
368   document.write("<input type='checkbox' name='mozillaloadcheckbox'><b> Load GIF Image</b></input>");
369   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;");
370   document.write(" [");
371   document.write("<a href='http://mozilla.org/quality/embed/plans/EmbedSmokeTestPlan.html#fourth'>Click to see description</a> ");
372   document.write("]<br>");
373   document.write("<input type='checkbox' name='seamonkeyloadcheckbox'><b> Load JPEG Image</b></input>");
374   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;");
375   document.write(" [");
376   document.write("<a href='http://mozilla.org/quality/embed/plans/EmbedSmokeTestPlan.html#fifth'>Click to see description</a> ");
377   document.write("]<br>");
378   document.write("</form>");
379   document.write("<br>");
380   document.write("<button type='button' onClick='onSubmit()'> Execute Selected Testcases </button>");
381   document.write("  ");
382   document.write("<button type='button' onClick='onSubmitAll()'> Execute All Testcases </button>");
384   document.write('<img src="images/mozilla-banner.gif" height=0 width=0 onLoad = "mozillaimageLoaded();">');
385   document.write('<img src="images/seamonkey.jpg" height=0 width=0 onLoad = "seamonkeyimageLoaded();">');
388 else
390   cookieValue = readCookie("embedsmoketest");
391   eraseCookie("embedsmoketest");
392   displayResults(cookieValue);
395 </script>
396 </body>
397 </html>