1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
2 |
<html> |
3 |
<head> |
4 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
5 |
<title>JsUnit Test Container Controller</title> |
6 |
<script language="javascript" type="text/javascript"> |
7 |
var containerReady = false; |
8 |
|
9 |
function init() { |
10 |
containerReady = true; |
11 |
} |
12 |
|
13 |
function isPageLoaded() { |
14 |
if (!containerReady) |
15 |
return false; |
16 |
|
17 |
var isTestPageLoaded = false; |
18 |
|
19 |
try { |
20 |
// attempt to access the var isTestPageLoaded in the testFrame |
21 |
if (typeof(top.testManager.containerTestFrame.isTestPageLoaded) != 'undefined') { |
22 |
isTestPageLoaded = top.testManager.containerTestFrame.isTestPageLoaded; |
23 |
} |
24 |
|
25 |
// ok, if the above did not throw an exception, then the |
26 |
// variable is defined. If the onload has not fired in the |
27 |
// testFrame then isTestPageLoaded is still false. Otherwise |
28 |
// the testFrame has set it to true |
29 |
} |
30 |
catch (e) { |
31 |
// an error occured while attempting to access the isTestPageLoaded |
32 |
// in the testFrame, therefore the testFrame has not loaded yet |
33 |
isTestPageLoaded = false; |
34 |
} |
35 |
return isTestPageLoaded; |
36 |
} |
37 |
|
38 |
function isContainerReady() { |
39 |
return containerReady; |
40 |
} |
41 |
|
42 |
function setNotReady() { |
43 |
try { |
44 |
// attempt to set the isTestPageLoaded variable |
45 |
// in the test frame to false. |
46 |
top.testManager.containerTestFrame.isTestPageLoaded = false; |
47 |
} |
48 |
catch (e) { |
49 |
// testFrame.isTestPageLoaded not available... ignore |
50 |
} |
51 |
} |
52 |
function setTestPage(testPageURI) { |
53 |
setNotReady(); |
54 |
top.jsUnitParseParms(testPageURI); |
55 |
testPageURI = appendCacheBusterParameterTo(testPageURI); |
56 |
try { |
57 |
top.testManager.containerTestFrame.location.href = testPageURI; |
58 |
} catch (e) { |
59 |
} |
60 |
} |
61 |
|
62 |
function appendCacheBusterParameterTo(testPageURI) { |
63 |
if (testPageURI.indexOf("?") == -1) |
64 |
testPageURI += "?"; |
65 |
else |
66 |
testPageURI += "&"; |
67 |
testPageURI += "cacheBuster="; |
68 |
testPageURI += new Date().getTime(); |
69 |
return testPageURI; |
70 |
} |
71 |
</script> |
72 |
</head> |
73 |
|
74 |
<body onload="init()"> |
75 |
Test Container Controller |
76 |
</body> |
77 |
</html> |