1 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
3 <title> Embed Smoke Test </title>
4 <!-- ***** BEGIN LICENSE BLOCK *****
5 - Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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
17 - The Original Code is Mozilla Communicator Test Cases.
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.
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.
38 - ***** END LICENSE BLOCK ***** -->
42 <!-- script below is ngdriverspecific -->
43 <script TYPE="text/javascript" SRC="http://bubblegum/ngdriver/suites/testlib.js">
46 <script TYPE="text/javascript">
47 var linkclick = "Fail";
49 var fileurlload = "Fail";
51 var seamonkeyload = "Fail";
52 executeAllTestCases = "false";
53 mozimageload = "false";
54 seamonkeyimageload = "false";
56 function createCookie(name,value,days)
60 var date = new Date();
61 date.setTime(date.getTime()+(days*24*60*60*1000));
62 var expires = "; expires="+date.toGMTString();
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++)
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);
83 function eraseCookie(name)
85 createCookie(name,"",-1);
91 netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
92 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
94 var val = win.document.getElementsByTagName("title").item(0);
97 var val1 = val.firstChild.data;
106 alert("exception: " + e);
114 // if(scrollbarsvisible)
117 netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
118 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
119 var val = loadurlwin.document.getElementsByTagName("title").item(0);
122 var val1 = val.firstChild.data;
131 alert("exception: " + e);
137 function fileurlloaded()
140 netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
141 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
143 var file = fileurl.document.getElementsByTagName("h2").item(0);
146 if(file.firstChild.data == "This is a test file")
147 fileurlload = "Pass";
152 alert("exception: " + e);
157 function mozillaimageLoaded()
159 mozimageload = "true";
162 function seamonkeyimageLoaded()
164 seamonkeyimageload = "true";
167 function constructResults()
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") )
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>";
195 if( (document.form1.loadurlcheckbox.checked==true) || (executeAllTestCases=="true") )
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>";
205 if( (document.form1.loadfileurlcheckbox.checked==true) || (executeAllTestCases=="true") )
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>";
215 if( (document.form1.mozillaloadcheckbox.checked==true) || (executeAllTestCases=="true") )
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>";
225 if( (document.form1.seamonkeyloadcheckbox.checked==true) || (executeAllTestCases=="true") )
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>";
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")
253 document.write(document.results.textarea.value);
257 function onSubmitAll()
259 executeAllTestCases = "true";
265 if( (document.form1.linkclickcheckbox.checked==true) || (executeAllTestCases=="true") )
270 netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
271 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
273 linkwin = window.open("");
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);
280 win = window.open(link1);
283 win.onload = setTimeout("linkfun();", 1000);
290 alert("exception:" + e);
293 if( (document.form1.loadurlcheckbox.checked==true) || (executeAllTestCases=="true") )
295 // Loading new window
298 netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
299 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
301 loadurlwin = window.open("http://www.mozilla.org");
304 //scrollbarsvisible = loadurlwin.scrollbars.visible;
305 loadurlwin.onload = setTimeout("urlloaded();", 1000);
310 alert("exception:" + e);
313 if( (document.form1.loadfileurlcheckbox.checked==true) || (executeAllTestCases=="true") )
315 fileurl = window.open("test.html");
318 fileurl.onload = setTimeout("fileurlloaded();", 1000);
321 if( (document.form1.mozillaloadcheckbox.checked==true) || (executeAllTestCases=="true") )
323 if(mozimageload=="true")
326 if( (document.form1.seamonkeyloadcheckbox.checked==true) || (executeAllTestCases=="true") )
328 if(seamonkeyimageload=="true")
329 seamonkeyload = "Pass";
332 setTimeout("constructResults();", 6000);
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 + '">');
344 <input type="hidden" name="textarea">
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(" ");
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(" ");
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(" ");
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(" ");
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(" ");
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>");
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();">');
390 cookieValue = readCookie("embedsmoketest");
391 eraseCookie("embedsmoketest");
392 displayResults(cookieValue);