Mozilla/mozilla/embedding/qa/jstests/sHistory/NsISHistoryTestCase1.html
depstein%netscape.com 233bc64c25 Updated sHistory script so it works in embedding apps (i.e. MfcEmbed). Added read-only txt version of script. not part of the build.
git-svn-id: svn://10.0.0.236/trunk@129961 18797224-902f-48f8-a5cc-f745e15eee43
2002-09-18 21:15:30 +00:00

135 lines
3.6 KiB
HTML

<html>
<!-- Descrpt: Test nsIAccessible Interface attributes and methods
for HTML ANCHOR Node
Author: depstein@netscape.com
Last Updated:09.18.02.
- 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
- Corp. Portions created by Netscape Communications Corp. are
- Copyright (C) 1999 Netscape Communications Corp. All
- Rights Reserved.
-
- Contributor(s):
-->
<head>
<title> nsISHistory Interface Test Case </title>
<script TYPE="text/javascript" SRC="nsISHistoryTestLib.js"></script>
<script TYPE="text/javascript">
var urlList = ["http://www.intel.com",
"http://www.yahoo.com",
"http://www.mozilla.org"
];
var cnt = 0;
var testWin = null;
var sHistory = null;
var count = 0;
var index = 0;
var maxLength = 100;
testWin = window.open('about:blank', "testWin");
setTimeout("loadPages();", 2000);
function loadPages()
{
var urlTotal = urlList.length;
var initTime = 10000;
callSHistInit(cnt);
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
// Load pages sequentially in the child window
testWin.location = urlList[cnt++];
if (cnt == urlTotal)
setTimeout("sHistoryTests()", 5000);
else
setTimeout("loadPages()", 6000);
}
function callSHistInit(cnt)
{
// Calls the sHistoryInit() function to create sHistory object
if (cnt == 0)
sHistory = sHistoryInit(testWin);
}
function sHistoryTests()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserAccess");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
// begins testing session history interface;
if (!sHistory)
{
alert("Unable to get session history");
return;
}
alert("Testing nsISHistory interfaces\n");
count = testHistoryCount(sHistory); // GetCount()
alert("global count: " + count);
index = testHistoryIndex(sHistory); // GetIndex()
alert ("global index: " + index);
maxLength = testMaxLength(sHistory); // GetMaxLength()
alert ("global maxLength: " + maxLength);
// Test GetEntryAtIndex()
for(cnt = 0; cnt < count; cnt++) {
entry = testGetEntryAtIndex(sHistory, cnt, false);
if (entry)
alert("GetEntryAtIndex() Valid, cnt = " + cnt);
else
alert("GetEntryAtIndex() Invalid, cnt = " + cnt);
} // for
// Test the enumerator
var simpleEnum = testSimpleEnum(sHistory); // Get simple enumerator
alert("global simpleEnum: " + simpleEnum);
if (simpleEnum) {
var enumCnt = 0;
while (simpleEnum.hasMoreElements())
{
nextObj = simpleEnum.getNext();
alert("global nextObj: " + nextObj);
if (!nextObj)
continue;
nextHE = nextObj.QueryInterface(Components.interfaces.nsIHistoryEntry);
alert("global nextHE: " + nextHE);
if (!nextHE)
continue;
testHistoryEntry(nextHE, enumCnt);
enumCnt++;
} // while
} // if simplenum
}
</script>
</head>
<body>
<script TYPE="text/javascript">
</script>
</body>
</html>