selenium-webdriver 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/chrome/prebuilt/Win32/Release/npchromedriver.dll +0 -0
- data/chrome/prebuilt/x64/Release/npchromedriver.dll +0 -0
- data/chrome/src/extension/background.js +1 -0
- data/chrome/src/extension/content_script.js +182 -177
- data/chrome/src/extension/manifest-nonwin.json +1 -1
- data/chrome/src/extension/manifest-win.json +1 -1
- data/chrome/src/rb/lib/selenium/webdriver/chrome/bridge.rb +9 -3
- data/chrome/src/rb/lib/selenium/webdriver/chrome/launcher.rb +1 -1
- data/common/src/js/core/Blank.html +7 -0
- data/common/src/js/core/InjectedRemoteRunner.html +8 -0
- data/common/src/js/core/RemoteRunner.html +101 -0
- data/common/src/js/core/SeleniumLog.html +109 -0
- data/common/src/js/core/TestPrompt.html +145 -0
- data/common/src/js/core/TestRunner-splash.html +55 -0
- data/common/src/js/core/TestRunner.html +177 -0
- data/common/src/js/core/icons/all.png +0 -0
- data/common/src/js/core/icons/continue.png +0 -0
- data/common/src/js/core/icons/continue_disabled.png +0 -0
- data/common/src/js/core/icons/pause.png +0 -0
- data/common/src/js/core/icons/pause_disabled.png +0 -0
- data/common/src/js/core/icons/selected.png +0 -0
- data/common/src/js/core/icons/step.png +0 -0
- data/common/src/js/core/icons/step_disabled.png +0 -0
- data/common/src/js/core/lib/cssQuery/cssQuery-p.js +6 -0
- data/common/src/js/core/lib/cssQuery/src/cssQuery-level2.js +142 -0
- data/common/src/js/core/lib/cssQuery/src/cssQuery-level3.js +150 -0
- data/common/src/js/core/lib/cssQuery/src/cssQuery-standard.js +53 -0
- data/common/src/js/core/lib/cssQuery/src/cssQuery.js +356 -0
- data/common/src/js/core/lib/prototype.js +2006 -0
- data/common/src/js/core/lib/scriptaculous/builder.js +101 -0
- data/common/src/js/core/lib/scriptaculous/controls.js +815 -0
- data/common/src/js/core/lib/scriptaculous/dragdrop.js +915 -0
- data/common/src/js/core/lib/scriptaculous/effects.js +958 -0
- data/common/src/js/core/lib/scriptaculous/scriptaculous.js +47 -0
- data/common/src/js/core/lib/scriptaculous/slider.js +283 -0
- data/common/src/js/core/lib/scriptaculous/unittest.js +383 -0
- data/common/src/js/core/lib/snapsie.js +91 -0
- data/common/src/js/core/scripts/find_matching_child.js +69 -0
- data/common/src/js/core/scripts/htmlutils.js +1623 -0
- data/common/src/js/core/scripts/injection.html +72 -0
- data/common/src/js/core/scripts/selenium-api.js +3294 -0
- data/common/src/js/core/scripts/selenium-browserbot.js +2430 -0
- data/common/src/js/core/scripts/selenium-browserdetect.js +153 -0
- data/common/src/js/core/scripts/selenium-commandhandlers.js +379 -0
- data/common/src/js/core/scripts/selenium-executionloop.js +175 -0
- data/common/src/js/core/scripts/selenium-logging.js +148 -0
- data/common/src/js/core/scripts/selenium-remoterunner.js +695 -0
- data/common/src/js/core/scripts/selenium-testrunner.js +1362 -0
- data/common/src/js/core/scripts/selenium-version.js +5 -0
- data/common/src/js/core/scripts/ui-doc.html +808 -0
- data/common/src/js/core/scripts/ui-element.js +1644 -0
- data/common/src/js/core/scripts/ui-map-sample.js +979 -0
- data/common/src/js/core/scripts/user-extensions.js +3 -0
- data/common/src/js/core/scripts/user-extensions.js.sample +75 -0
- data/common/src/js/core/scripts/xmlextras.js +153 -0
- data/common/src/js/core/selenium-logo.png +0 -0
- data/common/src/js/core/selenium-test.css +43 -0
- data/common/src/js/core/selenium.css +316 -0
- data/common/src/js/core/xpath/dom.js +566 -0
- data/common/src/js/core/xpath/javascript-xpath-0.1.11.js +2816 -0
- data/common/src/js/core/xpath/util.js +549 -0
- data/common/src/js/core/xpath/xmltoken.js +149 -0
- data/common/src/js/core/xpath/xpath.js +2481 -0
- data/common/src/js/jsunit/app/css/jsUnitStyle.css +50 -0
- data/common/src/js/jsunit/app/css/readme +10 -0
- data/common/src/js/jsunit/app/emptyPage.html +11 -0
- data/common/src/js/jsunit/app/jsUnitCore.js +534 -0
- data/common/src/js/jsunit/app/jsUnitMockTimeout.js +81 -0
- data/common/src/js/jsunit/app/jsUnitTestManager.js +705 -0
- data/common/src/js/jsunit/app/jsUnitTestSuite.js +44 -0
- data/common/src/js/jsunit/app/jsUnitTracer.js +102 -0
- data/common/src/js/jsunit/app/jsUnitVersionCheck.js +59 -0
- data/common/src/js/jsunit/app/main-counts-errors.html +12 -0
- data/common/src/js/jsunit/app/main-counts-failures.html +13 -0
- data/common/src/js/jsunit/app/main-counts-runs.html +13 -0
- data/common/src/js/jsunit/app/main-counts.html +21 -0
- data/common/src/js/jsunit/app/main-data.html +178 -0
- data/common/src/js/jsunit/app/main-errors.html +23 -0
- data/common/src/js/jsunit/app/main-frame.html +19 -0
- data/common/src/js/jsunit/app/main-loader.html +45 -0
- data/common/src/js/jsunit/app/main-progress.html +25 -0
- data/common/src/js/jsunit/app/main-results.html +67 -0
- data/common/src/js/jsunit/app/main-status.html +13 -0
- data/common/src/js/jsunit/app/testContainer.html +16 -0
- data/common/src/js/jsunit/app/testContainerController.html +77 -0
- data/common/src/js/jsunit/app/xbDebug.js +306 -0
- data/common/src/js/jsunit/changelog.txt +60 -0
- data/common/src/js/jsunit/css/jsUnitStyle.css +83 -0
- data/common/src/js/jsunit/images/green.gif +0 -0
- data/common/src/js/jsunit/images/logo_jsunit.gif +0 -0
- data/common/src/js/jsunit/images/powerby-transparent.gif +0 -0
- data/common/src/js/jsunit/images/red.gif +0 -0
- data/common/src/js/jsunit/licenses/JDOM_license.txt +56 -0
- data/common/src/js/jsunit/licenses/Jetty_license.html +213 -0
- data/common/src/js/jsunit/licenses/MPL-1.1.txt +470 -0
- data/common/src/js/jsunit/licenses/gpl-2.txt +340 -0
- data/common/src/js/jsunit/licenses/index.html +141 -0
- data/common/src/js/jsunit/licenses/lgpl-2.1.txt +504 -0
- data/common/src/js/jsunit/licenses/mpl-tri-license-c.txt +35 -0
- data/common/src/js/jsunit/licenses/mpl-tri-license-html.txt +35 -0
- data/common/src/js/jsunit/readme.txt +19 -0
- data/common/src/js/jsunit/testRunner.html +167 -0
- data/common/src/js/jsunit/version.txt +1 -0
- data/common/src/rb/README +29 -0
- data/common/src/rb/lib/selenium/webdriver/driver.rb +124 -12
- data/common/src/rb/lib/selenium/webdriver/element.rb +119 -3
- data/common/src/rb/lib/selenium/webdriver/error.rb +1 -2
- data/common/src/rb/lib/selenium/webdriver/find.rb +19 -2
- data/common/src/rb/lib/selenium/webdriver/keys.rb +5 -1
- data/common/src/rb/lib/selenium/webdriver/navigation.rb +8 -4
- data/common/src/rb/lib/selenium/webdriver/platform.rb +4 -2
- data/common/src/rb/lib/selenium/webdriver/target_locator.rb +18 -0
- data/firefox/prebuilt/Win32/Release/webdriver-firefox.dll +0 -0
- data/firefox/prebuilt/linux/Release/libwebdriver-firefox.so +0 -0
- data/firefox/prebuilt/linux/Release/x_ignore_nofocus.so +0 -0
- data/firefox/prebuilt/linux64/Release/libwebdriver-firefox.so +0 -0
- data/firefox/prebuilt/linux64/Release/x_ignore_nofocus.so +0 -0
- data/firefox/src/extension/components/utils.js +13 -2
- data/firefox/src/extension/install.rdf +1 -1
- data/firefox/src/rb/lib/selenium/webdriver/firefox.rb +3 -2
- data/firefox/src/rb/lib/selenium/webdriver/firefox/binary.rb +1 -7
- data/firefox/src/rb/lib/selenium/webdriver/firefox/bridge.rb +11 -4
- data/firefox/src/rb/lib/selenium/webdriver/firefox/profile.rb +56 -15
- data/firefox/src/rb/lib/selenium/webdriver/firefox/util.rb +1 -1
- data/jobbie/prebuilt/Win32/Release/InternetExplorerDriver.dll +0 -0
- data/jobbie/prebuilt/x64/Release/InternetExplorerDriver.dll +0 -0
- data/jobbie/src/rb/lib/selenium/webdriver/ie/bridge.rb +10 -5
- data/jobbie/src/rb/lib/selenium/webdriver/ie/util.rb +9 -10
- data/remote/client/src/rb/lib/selenium/webdriver/remote/bridge.rb +4 -2
- data/remote/client/src/rb/lib/selenium/webdriver/remote/capabilities.rb +23 -23
- metadata +103 -6
- data/jobbie/prebuilt/Win32/Release/webdriver-ie-test.dll +0 -0
- data/jobbie/prebuilt/Win32/Release/webdriver-ie.dll +0 -0
- data/jobbie/prebuilt/x64/Release/webdriver-ie-test.dll +0 -0
- data/jobbie/prebuilt/x64/Release/webdriver-ie.dll +0 -0
@@ -0,0 +1,81 @@
|
|
1
|
+
// Mock setTimeout, clearTimeout
|
2
|
+
// Contributed by Pivotal Computer Systems, www.pivotalsf.com
|
3
|
+
|
4
|
+
var Clock = {
|
5
|
+
timeoutsMade: 0,
|
6
|
+
scheduledFunctions: {},
|
7
|
+
nowMillis: 0,
|
8
|
+
reset: function() {
|
9
|
+
this.scheduledFunctions = {};
|
10
|
+
this.nowMillis = 0;
|
11
|
+
this.timeoutsMade = 0;
|
12
|
+
},
|
13
|
+
tick: function(millis) {
|
14
|
+
var oldMillis = this.nowMillis;
|
15
|
+
var newMillis = oldMillis + millis;
|
16
|
+
this.runFunctionsWithinRange(oldMillis, newMillis);
|
17
|
+
this.nowMillis = newMillis;
|
18
|
+
},
|
19
|
+
runFunctionsWithinRange: function(oldMillis, nowMillis) {
|
20
|
+
var scheduledFunc;
|
21
|
+
var funcsToRun = [];
|
22
|
+
for (var timeoutKey in this.scheduledFunctions) {
|
23
|
+
scheduledFunc = this.scheduledFunctions[timeoutKey];
|
24
|
+
if (scheduledFunc != undefined &&
|
25
|
+
scheduledFunc.runAtMillis >= oldMillis &&
|
26
|
+
scheduledFunc.runAtMillis <= nowMillis) {
|
27
|
+
funcsToRun.push(scheduledFunc);
|
28
|
+
this.scheduledFunctions[timeoutKey] = undefined;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
if (funcsToRun.length > 0) {
|
33
|
+
funcsToRun.sort(function(a, b) {
|
34
|
+
return a.runAtMillis - b.runAtMillis;
|
35
|
+
});
|
36
|
+
for (var i = 0; i < funcsToRun.length; ++i) {
|
37
|
+
try {
|
38
|
+
this.nowMillis = funcsToRun[i].runAtMillis;
|
39
|
+
funcsToRun[i].funcToCall();
|
40
|
+
if (funcsToRun[i].recurring) {
|
41
|
+
Clock.scheduleFunction(funcsToRun[i].timeoutKey,
|
42
|
+
funcsToRun[i].funcToCall,
|
43
|
+
funcsToRun[i].millis,
|
44
|
+
true);
|
45
|
+
}
|
46
|
+
} catch(e) {
|
47
|
+
}
|
48
|
+
}
|
49
|
+
this.runFunctionsWithinRange(oldMillis, nowMillis);
|
50
|
+
}
|
51
|
+
},
|
52
|
+
scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
|
53
|
+
Clock.scheduledFunctions[timeoutKey] = {
|
54
|
+
runAtMillis: Clock.nowMillis + millis,
|
55
|
+
funcToCall: funcToCall,
|
56
|
+
recurring: recurring,
|
57
|
+
timeoutKey: timeoutKey,
|
58
|
+
millis: millis
|
59
|
+
};
|
60
|
+
}
|
61
|
+
};
|
62
|
+
|
63
|
+
function setTimeout(funcToCall, millis) {
|
64
|
+
Clock.timeoutsMade = Clock.timeoutsMade + 1;
|
65
|
+
Clock.scheduleFunction(Clock.timeoutsMade, funcToCall, millis, false);
|
66
|
+
return Clock.timeoutsMade;
|
67
|
+
}
|
68
|
+
|
69
|
+
function setInterval(funcToCall, millis) {
|
70
|
+
Clock.timeoutsMade = Clock.timeoutsMade + 1;
|
71
|
+
Clock.scheduleFunction(Clock.timeoutsMade, funcToCall, millis, true);
|
72
|
+
return Clock.timeoutsMade;
|
73
|
+
}
|
74
|
+
|
75
|
+
function clearTimeout(timeoutKey) {
|
76
|
+
Clock.scheduledFunctions[timeoutKey] = undefined;
|
77
|
+
}
|
78
|
+
|
79
|
+
function clearInterval(timeoutKey) {
|
80
|
+
Clock.scheduledFunctions[timeoutKey] = undefined;
|
81
|
+
}
|
@@ -0,0 +1,705 @@
|
|
1
|
+
function jsUnitTestManager() {
|
2
|
+
this._windowForAllProblemMessages = null;
|
3
|
+
|
4
|
+
this.container = top.frames.testContainer
|
5
|
+
this.documentLoader = top.frames.documentLoader;
|
6
|
+
this.mainFrame = top.frames.mainFrame;
|
7
|
+
|
8
|
+
this.containerController = this.container.frames.testContainerController;
|
9
|
+
this.containerTestFrame = this.container.frames.testFrame;
|
10
|
+
|
11
|
+
var mainData = this.mainFrame.frames.mainData;
|
12
|
+
|
13
|
+
// form elements on mainData frame
|
14
|
+
this.testFileName = mainData.document.testRunnerForm.testFileName;
|
15
|
+
this.runButton = mainData.document.testRunnerForm.runButton;
|
16
|
+
this.traceLevel = mainData.document.testRunnerForm.traceLevel;
|
17
|
+
this.closeTraceWindowOnNewRun = mainData.document.testRunnerForm.closeTraceWindowOnNewRun;
|
18
|
+
this.timeout = mainData.document.testRunnerForm.timeout;
|
19
|
+
this.setUpPageTimeout = mainData.document.testRunnerForm.setUpPageTimeout;
|
20
|
+
|
21
|
+
// image output
|
22
|
+
this.progressBar = this.mainFrame.frames.mainProgress.document.progress;
|
23
|
+
|
24
|
+
this.problemsListField = this.mainFrame.frames.mainErrors.document.testRunnerForm.problemsList;
|
25
|
+
this.testCaseResultsField = this.mainFrame.frames.mainResults.document.resultsForm.testCases;
|
26
|
+
this.resultsTimeField = this.mainFrame.frames.mainResults.document.resultsForm.time;
|
27
|
+
|
28
|
+
// 'layer' output frames
|
29
|
+
this.uiFrames = new Object();
|
30
|
+
this.uiFrames.mainStatus = this.mainFrame.frames.mainStatus;
|
31
|
+
|
32
|
+
var mainCounts = this.mainFrame.frames.mainCounts;
|
33
|
+
|
34
|
+
this.uiFrames.mainCountsErrors = mainCounts.frames.mainCountsErrors;
|
35
|
+
this.uiFrames.mainCountsFailures = mainCounts.frames.mainCountsFailures;
|
36
|
+
this.uiFrames.mainCountsRuns = mainCounts.frames.mainCountsRuns;
|
37
|
+
this._baseURL = "";
|
38
|
+
|
39
|
+
this.setup();
|
40
|
+
}
|
41
|
+
|
42
|
+
// seconds to wait for each test page to load
|
43
|
+
jsUnitTestManager.TESTPAGE_WAIT_SEC = 120;
|
44
|
+
jsUnitTestManager.TIMEOUT_LENGTH = 20;
|
45
|
+
|
46
|
+
// seconds to wait for setUpPage to complete
|
47
|
+
jsUnitTestManager.SETUPPAGE_TIMEOUT = 120;
|
48
|
+
|
49
|
+
// milliseconds to wait between polls on setUpPages
|
50
|
+
jsUnitTestManager.SETUPPAGE_INTERVAL = 100;
|
51
|
+
|
52
|
+
jsUnitTestManager.RESTORED_HTML_DIV_ID = "jsUnitRestoredHTML";
|
53
|
+
|
54
|
+
jsUnitTestManager.prototype.setup = function () {
|
55
|
+
this.totalCount = 0;
|
56
|
+
this.errorCount = 0;
|
57
|
+
this.failureCount = 0;
|
58
|
+
this._suiteStack = Array();
|
59
|
+
|
60
|
+
var initialSuite = new top.jsUnitTestSuite();
|
61
|
+
push(this._suiteStack, initialSuite);
|
62
|
+
}
|
63
|
+
|
64
|
+
jsUnitTestManager.prototype.start = function () {
|
65
|
+
this._baseURL = this.resolveUserEnteredTestFileName();
|
66
|
+
var firstQuery = this._baseURL.indexOf("?");
|
67
|
+
if (firstQuery >= 0) {
|
68
|
+
this._baseURL = this._baseURL.substring(0, firstQuery);
|
69
|
+
}
|
70
|
+
var lastSlash = this._baseURL.lastIndexOf("/");
|
71
|
+
var lastRevSlash = this._baseURL.lastIndexOf("\\");
|
72
|
+
if (lastRevSlash > lastSlash) {
|
73
|
+
lastSlash = lastRevSlash;
|
74
|
+
}
|
75
|
+
if (lastSlash > 0) {
|
76
|
+
this._baseURL = this._baseURL.substring(0, lastSlash + 1);
|
77
|
+
}
|
78
|
+
|
79
|
+
this._timeRunStarted = new Date();
|
80
|
+
this.initialize();
|
81
|
+
setTimeout('top.testManager._nextPage();', jsUnitTestManager.TIMEOUT_LENGTH);
|
82
|
+
}
|
83
|
+
|
84
|
+
jsUnitTestManager.prototype.getBaseURL = function () {
|
85
|
+
return this._baseURL;
|
86
|
+
}
|
87
|
+
|
88
|
+
jsUnitTestManager.prototype.doneLoadingPage = function (pageName) {
|
89
|
+
//this.containerTestFrame.setTracer(top.tracer);
|
90
|
+
this._testFileName = pageName;
|
91
|
+
if (this.isTestPageSuite())
|
92
|
+
this._handleNewSuite();
|
93
|
+
else
|
94
|
+
{
|
95
|
+
this._testIndex = 0;
|
96
|
+
this._testsInPage = this.getTestFunctionNames();
|
97
|
+
this._numberOfTestsInPage = this._testsInPage.length;
|
98
|
+
this._runTest();
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
jsUnitTestManager.prototype._handleNewSuite = function () {
|
103
|
+
var allegedSuite = this.containerTestFrame.suite();
|
104
|
+
if (allegedSuite.isjsUnitTestSuite) {
|
105
|
+
var newSuite = allegedSuite.clone();
|
106
|
+
if (newSuite.containsTestPages())
|
107
|
+
push(this._suiteStack, newSuite);
|
108
|
+
this._nextPage();
|
109
|
+
}
|
110
|
+
else {
|
111
|
+
this.fatalError('Invalid test suite in file ' + this._testFileName);
|
112
|
+
this.abort();
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
jsUnitTestManager.prototype._runTest = function () {
|
117
|
+
if (this._testIndex + 1 > this._numberOfTestsInPage)
|
118
|
+
{
|
119
|
+
// execute tearDownPage *synchronously*
|
120
|
+
// (unlike setUpPage which is asynchronous)
|
121
|
+
if (typeof this.containerTestFrame.tearDownPage == 'function') {
|
122
|
+
this.containerTestFrame.tearDownPage();
|
123
|
+
}
|
124
|
+
|
125
|
+
this._nextPage();
|
126
|
+
return;
|
127
|
+
}
|
128
|
+
|
129
|
+
if (this._testIndex == 0) {
|
130
|
+
this.storeRestoredHTML();
|
131
|
+
if (typeof(this.containerTestFrame.setUpPage) == 'function') {
|
132
|
+
// first test for this page and a setUpPage is defined
|
133
|
+
if (typeof(this.containerTestFrame.setUpPageStatus) == 'undefined') {
|
134
|
+
// setUpPage() not called yet, so call it
|
135
|
+
this.containerTestFrame.setUpPageStatus = false;
|
136
|
+
this.containerTestFrame.startTime = new Date();
|
137
|
+
this.containerTestFrame.setUpPage();
|
138
|
+
// try test again later
|
139
|
+
setTimeout('top.testManager._runTest()', jsUnitTestManager.SETUPPAGE_INTERVAL);
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
|
143
|
+
if (this.containerTestFrame.setUpPageStatus != 'complete') {
|
144
|
+
top.status = 'setUpPage not completed... ' + this.containerTestFrame.setUpPageStatus + ' ' + (new Date());
|
145
|
+
if ((new Date() - this.containerTestFrame.startTime) / 1000 > this.getsetUpPageTimeout()) {
|
146
|
+
this.fatalError('setUpPage timed out without completing.');
|
147
|
+
if (!this.userConfirm('Retry Test Run?')) {
|
148
|
+
this.abort();
|
149
|
+
return;
|
150
|
+
}
|
151
|
+
this.containerTestFrame.startTime = (new Date());
|
152
|
+
}
|
153
|
+
// try test again later
|
154
|
+
setTimeout('top.testManager._runTest()', jsUnitTestManager.SETUPPAGE_INTERVAL);
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
|
160
|
+
top.status = '';
|
161
|
+
// either not first test, or no setUpPage defined, or setUpPage completed
|
162
|
+
this.executeTestFunction(this._testsInPage[this._testIndex]);
|
163
|
+
this.totalCount++;
|
164
|
+
this.updateProgressIndicators();
|
165
|
+
this._testIndex++;
|
166
|
+
setTimeout('top.testManager._runTest()', jsUnitTestManager.TIMEOUT_LENGTH);
|
167
|
+
}
|
168
|
+
|
169
|
+
jsUnitTestManager.prototype._done = function () {
|
170
|
+
var secondsSinceRunBegan = (new Date() - this._timeRunStarted) / 1000;
|
171
|
+
this.setStatus('Done (' + secondsSinceRunBegan + ' seconds)');
|
172
|
+
this._cleanUp();
|
173
|
+
if (top.shouldSubmitResults()) {
|
174
|
+
this.resultsTimeField.value = secondsSinceRunBegan;
|
175
|
+
top.submitResults();
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
jsUnitTestManager.prototype._nextPage = function () {
|
180
|
+
this._restoredHTML = null;
|
181
|
+
if (this._currentSuite().hasMorePages()) {
|
182
|
+
this.loadPage(this._currentSuite().nextPage());
|
183
|
+
}
|
184
|
+
else {
|
185
|
+
pop(this._suiteStack);
|
186
|
+
if (this._currentSuite() == null)
|
187
|
+
this._done();
|
188
|
+
else
|
189
|
+
this._nextPage();
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
jsUnitTestManager.prototype._currentSuite = function () {
|
194
|
+
var suite = null;
|
195
|
+
|
196
|
+
if (this._suiteStack && this._suiteStack.length > 0)
|
197
|
+
suite = this._suiteStack[this._suiteStack.length - 1];
|
198
|
+
|
199
|
+
return suite;
|
200
|
+
}
|
201
|
+
|
202
|
+
jsUnitTestManager.prototype.calculateProgressBarProportion = function () {
|
203
|
+
if (this.totalCount == 0)
|
204
|
+
return 0;
|
205
|
+
var currentDivisor = 1;
|
206
|
+
var result = 0;
|
207
|
+
|
208
|
+
for (var i = 0; i < this._suiteStack.length; i++) {
|
209
|
+
var aSuite = this._suiteStack[i];
|
210
|
+
currentDivisor *= aSuite.testPages.length;
|
211
|
+
result += (aSuite.pageIndex - 1) / currentDivisor;
|
212
|
+
}
|
213
|
+
result += (this._testIndex + 1) / (this._numberOfTestsInPage * currentDivisor);
|
214
|
+
return result;
|
215
|
+
}
|
216
|
+
|
217
|
+
jsUnitTestManager.prototype._cleanUp = function () {
|
218
|
+
this.containerController.setTestPage('./app/emptyPage.html');
|
219
|
+
this.finalize();
|
220
|
+
top.tracer.finalize();
|
221
|
+
}
|
222
|
+
|
223
|
+
jsUnitTestManager.prototype.abort = function () {
|
224
|
+
this.setStatus('Aborted');
|
225
|
+
this._cleanUp();
|
226
|
+
}
|
227
|
+
|
228
|
+
jsUnitTestManager.prototype.getTimeout = function () {
|
229
|
+
var result = jsUnitTestManager.TESTPAGE_WAIT_SEC;
|
230
|
+
try {
|
231
|
+
result = eval(this.timeout.value);
|
232
|
+
}
|
233
|
+
catch (e) {
|
234
|
+
}
|
235
|
+
return result;
|
236
|
+
}
|
237
|
+
|
238
|
+
jsUnitTestManager.prototype.getsetUpPageTimeout = function () {
|
239
|
+
var result = jsUnitTestManager.SETUPPAGE_TIMEOUT;
|
240
|
+
try {
|
241
|
+
result = eval(this.setUpPageTimeout.value);
|
242
|
+
}
|
243
|
+
catch (e) {
|
244
|
+
}
|
245
|
+
return result;
|
246
|
+
}
|
247
|
+
|
248
|
+
jsUnitTestManager.prototype.isTestPageSuite = function () {
|
249
|
+
var result = false;
|
250
|
+
if (typeof(this.containerTestFrame.suite) == 'function')
|
251
|
+
{
|
252
|
+
result = true;
|
253
|
+
}
|
254
|
+
return result;
|
255
|
+
}
|
256
|
+
|
257
|
+
jsUnitTestManager.prototype.getTestFunctionNames = function () {
|
258
|
+
var testFrame = this.containerTestFrame;
|
259
|
+
var testFunctionNames = new Array();
|
260
|
+
var i;
|
261
|
+
|
262
|
+
if (testFrame && typeof(testFrame.exposeTestFunctionNames) == 'function')
|
263
|
+
return testFrame.exposeTestFunctionNames();
|
264
|
+
|
265
|
+
if (testFrame &&
|
266
|
+
testFrame.document &&
|
267
|
+
typeof(testFrame.document.scripts) != 'undefined' &&
|
268
|
+
testFrame.document.scripts.length > 0) { // IE5 and up
|
269
|
+
var scriptsInTestFrame = testFrame.document.scripts;
|
270
|
+
|
271
|
+
for (i = 0; i < scriptsInTestFrame.length; i++) {
|
272
|
+
var someNames = this._extractTestFunctionNamesFromScript(scriptsInTestFrame[i]);
|
273
|
+
if (someNames)
|
274
|
+
testFunctionNames = testFunctionNames.concat(someNames);
|
275
|
+
}
|
276
|
+
}
|
277
|
+
else {
|
278
|
+
for (i in testFrame) {
|
279
|
+
if (i.substring(0, 4) == 'test' && typeof(testFrame[i]) == 'function')
|
280
|
+
push(testFunctionNames, i);
|
281
|
+
}
|
282
|
+
}
|
283
|
+
return testFunctionNames;
|
284
|
+
}
|
285
|
+
|
286
|
+
jsUnitTestManager.prototype._extractTestFunctionNamesFromScript = function (aScript) {
|
287
|
+
var result;
|
288
|
+
var remainingScriptToInspect = aScript.text;
|
289
|
+
var currentIndex = this._indexOfTestFunctionIn(remainingScriptToInspect);
|
290
|
+
while (currentIndex != -1) {
|
291
|
+
if (!result)
|
292
|
+
result = new Array();
|
293
|
+
|
294
|
+
var fragment = remainingScriptToInspect.substring(currentIndex, remainingScriptToInspect.length);
|
295
|
+
result = result.concat(fragment.substring('function '.length, fragment.indexOf('(')));
|
296
|
+
remainingScriptToInspect = remainingScriptToInspect.substring(currentIndex + 12, remainingScriptToInspect.length);
|
297
|
+
currentIndex = this._indexOfTestFunctionIn(remainingScriptToInspect);
|
298
|
+
}
|
299
|
+
return result;
|
300
|
+
}
|
301
|
+
|
302
|
+
jsUnitTestManager.prototype._indexOfTestFunctionIn = function (string) {
|
303
|
+
return string.indexOf('function test');
|
304
|
+
}
|
305
|
+
|
306
|
+
jsUnitTestManager.prototype.loadPage = function (testFileName) {
|
307
|
+
this._testFileName = testFileName;
|
308
|
+
this._loadAttemptStartTime = new Date();
|
309
|
+
this.setStatus('Opening Test Page "' + this._testFileName + '"');
|
310
|
+
this.containerController.setTestPage(this._testFileName);
|
311
|
+
this._callBackWhenPageIsLoaded();
|
312
|
+
}
|
313
|
+
|
314
|
+
jsUnitTestManager.prototype._callBackWhenPageIsLoaded = function () {
|
315
|
+
if ((new Date() - this._loadAttemptStartTime) / 1000 > this.getTimeout()) {
|
316
|
+
this.fatalError('Reading Test Page ' + this._testFileName + ' timed out.\nMake sure that the file exists and is a Test Page.');
|
317
|
+
if (this.userConfirm('Retry Test Run?')) {
|
318
|
+
this.loadPage(this._testFileName);
|
319
|
+
return;
|
320
|
+
} else {
|
321
|
+
this.abort();
|
322
|
+
return;
|
323
|
+
}
|
324
|
+
}
|
325
|
+
if (!this._isTestFrameLoaded()) {
|
326
|
+
setTimeout('top.testManager._callBackWhenPageIsLoaded();', jsUnitTestManager.TIMEOUT_LENGTH);
|
327
|
+
return;
|
328
|
+
}
|
329
|
+
this.doneLoadingPage(this._testFileName);
|
330
|
+
}
|
331
|
+
|
332
|
+
jsUnitTestManager.prototype._isTestFrameLoaded = function () {
|
333
|
+
try {
|
334
|
+
return this.containerController.isPageLoaded();
|
335
|
+
}
|
336
|
+
catch (e) {
|
337
|
+
}
|
338
|
+
return false;
|
339
|
+
}
|
340
|
+
|
341
|
+
jsUnitTestManager.prototype.executeTestFunction = function (functionName) {
|
342
|
+
this._testFunctionName = functionName;
|
343
|
+
this.setStatus('Running test "' + this._testFunctionName + '"');
|
344
|
+
var excep = null;
|
345
|
+
var timeBefore = new Date();
|
346
|
+
try {
|
347
|
+
if (this._restoredHTML)
|
348
|
+
top.testContainer.testFrame.document.getElementById(jsUnitTestManager.RESTORED_HTML_DIV_ID).innerHTML = this._restoredHTML;
|
349
|
+
if (this.containerTestFrame.setUp !== JSUNIT_UNDEFINED_VALUE)
|
350
|
+
this.containerTestFrame.setUp();
|
351
|
+
this.containerTestFrame[this._testFunctionName]();
|
352
|
+
}
|
353
|
+
catch (e1) {
|
354
|
+
excep = e1;
|
355
|
+
}
|
356
|
+
finally {
|
357
|
+
try {
|
358
|
+
if (this.containerTestFrame.tearDown !== JSUNIT_UNDEFINED_VALUE)
|
359
|
+
this.containerTestFrame.tearDown();
|
360
|
+
}
|
361
|
+
catch (e2) {
|
362
|
+
//Unlike JUnit, only assign a tearDown exception to excep if there is not already an exception from the test body
|
363
|
+
if (excep == null)
|
364
|
+
excep = e2;
|
365
|
+
}
|
366
|
+
}
|
367
|
+
var timeTaken = (new Date() - timeBefore) / 1000;
|
368
|
+
if (excep != null)
|
369
|
+
this._handleTestException(excep);
|
370
|
+
var serializedTestCaseString = this._currentTestFunctionNameWithTestPageName(true) + "|" + timeTaken + "|";
|
371
|
+
if (excep == null)
|
372
|
+
serializedTestCaseString += "S||";
|
373
|
+
else {
|
374
|
+
if (typeof(excep.isJsUnitException) != 'undefined' && excep.isJsUnitException)
|
375
|
+
serializedTestCaseString += "F|";
|
376
|
+
else {
|
377
|
+
serializedTestCaseString += "E|";
|
378
|
+
}
|
379
|
+
serializedTestCaseString += this._problemDetailMessageFor(excep);
|
380
|
+
}
|
381
|
+
this._addOption(this.testCaseResultsField,
|
382
|
+
serializedTestCaseString,
|
383
|
+
serializedTestCaseString);
|
384
|
+
}
|
385
|
+
|
386
|
+
jsUnitTestManager.prototype._currentTestFunctionNameWithTestPageName = function(useFullyQualifiedTestPageName) {
|
387
|
+
var testURL = this.containerTestFrame.location.href;
|
388
|
+
var testQuery = testURL.indexOf("?");
|
389
|
+
if (testQuery >= 0) {
|
390
|
+
testURL = testURL.substring(0, testQuery);
|
391
|
+
}
|
392
|
+
if (!useFullyQualifiedTestPageName) {
|
393
|
+
if (testURL.substring(0, this._baseURL.length) == this._baseURL)
|
394
|
+
testURL = testURL.substring(this._baseURL.length);
|
395
|
+
}
|
396
|
+
return testURL + ':' + this._testFunctionName;
|
397
|
+
}
|
398
|
+
|
399
|
+
jsUnitTestManager.prototype._addOption = function(listField, problemValue, problemMessage) {
|
400
|
+
if (typeof(listField.ownerDocument) != 'undefined'
|
401
|
+
&& typeof(listField.ownerDocument.createElement) != 'undefined') {
|
402
|
+
// DOM Level 2 HTML method.
|
403
|
+
// this is required for Opera 7 since appending to the end of the
|
404
|
+
// options array does not work, and adding an Option created by new Option()
|
405
|
+
// and appended by listField.options.add() fails due to WRONG_DOCUMENT_ERR
|
406
|
+
var problemDocument = listField.ownerDocument;
|
407
|
+
var errOption = problemDocument.createElement('option');
|
408
|
+
errOption.setAttribute('value', problemValue);
|
409
|
+
errOption.appendChild(problemDocument.createTextNode(problemMessage));
|
410
|
+
listField.appendChild(errOption);
|
411
|
+
}
|
412
|
+
else {
|
413
|
+
// new Option() is DOM 0
|
414
|
+
errOption = new Option(problemMessage, problemValue);
|
415
|
+
if (typeof(listField.add) != 'undefined') {
|
416
|
+
// DOM 2 HTML
|
417
|
+
listField.add(errOption, null);
|
418
|
+
}
|
419
|
+
else if (typeof(listField.options.add) != 'undefined') {
|
420
|
+
// DOM 0
|
421
|
+
listField.options.add(errOption, null);
|
422
|
+
}
|
423
|
+
else {
|
424
|
+
// DOM 0
|
425
|
+
listField.options[listField.length] = errOption;
|
426
|
+
}
|
427
|
+
}
|
428
|
+
}
|
429
|
+
|
430
|
+
jsUnitTestManager.prototype._handleTestException = function (excep) {
|
431
|
+
var problemMessage = this._currentTestFunctionNameWithTestPageName(false) + ' ';
|
432
|
+
var errOption;
|
433
|
+
if (typeof(excep.isJsUnitException) == 'undefined' || !excep.isJsUnitException) {
|
434
|
+
problemMessage += 'had an error';
|
435
|
+
this.errorCount++;
|
436
|
+
}
|
437
|
+
else {
|
438
|
+
problemMessage += 'failed';
|
439
|
+
this.failureCount++;
|
440
|
+
}
|
441
|
+
var listField = this.problemsListField;
|
442
|
+
this._addOption(listField,
|
443
|
+
this._problemDetailMessageFor(excep),
|
444
|
+
problemMessage);
|
445
|
+
}
|
446
|
+
|
447
|
+
jsUnitTestManager.prototype._problemDetailMessageFor = function (excep) {
|
448
|
+
var result = null;
|
449
|
+
if (typeof(excep.isJsUnitException) != 'undefined' && excep.isJsUnitException) {
|
450
|
+
result = '';
|
451
|
+
if (excep.comment != null)
|
452
|
+
result += ('"' + excep.comment + '"\n');
|
453
|
+
|
454
|
+
result += excep.jsUnitMessage;
|
455
|
+
|
456
|
+
if (excep.stackTrace)
|
457
|
+
result += '\n\nStack trace follows:\n' + excep.stackTrace;
|
458
|
+
}
|
459
|
+
else {
|
460
|
+
result = 'Error message is:\n"';
|
461
|
+
result +=
|
462
|
+
(typeof(excep.description) == 'undefined') ?
|
463
|
+
excep :
|
464
|
+
excep.description;
|
465
|
+
result += '"';
|
466
|
+
if (typeof(excep.stack) != 'undefined') // Mozilla only
|
467
|
+
result += '\n\nStack trace follows:\n' + excep.stack;
|
468
|
+
}
|
469
|
+
return result;
|
470
|
+
}
|
471
|
+
|
472
|
+
jsUnitTestManager.prototype._setTextOnLayer = function (layerName, str) {
|
473
|
+
try {
|
474
|
+
var content;
|
475
|
+
if (content = this.uiFrames[layerName].document.getElementById('content'))
|
476
|
+
content.innerHTML = str;
|
477
|
+
else
|
478
|
+
throw 'No content div found.';
|
479
|
+
}
|
480
|
+
catch (e) {
|
481
|
+
var html = '';
|
482
|
+
html += '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
|
483
|
+
html += '<html><head><link rel="stylesheet" type="text/css" href="css/jsUnitStyle.css"><\/head>';
|
484
|
+
html += '<body><div id="content">';
|
485
|
+
html += str;
|
486
|
+
html += '<\/div><\/body>';
|
487
|
+
html += '<\/html>';
|
488
|
+
this.uiFrames[layerName].document.write(html);
|
489
|
+
this.uiFrames[layerName].document.close();
|
490
|
+
}
|
491
|
+
}
|
492
|
+
|
493
|
+
jsUnitTestManager.prototype.setStatus = function (str) {
|
494
|
+
this._setTextOnLayer('mainStatus', '<b>Status:<\/b> ' + str);
|
495
|
+
}
|
496
|
+
|
497
|
+
jsUnitTestManager.prototype._setErrors = function (n) {
|
498
|
+
this._setTextOnLayer('mainCountsErrors', '<b>Errors: <\/b>' + n);
|
499
|
+
}
|
500
|
+
|
501
|
+
jsUnitTestManager.prototype._setFailures = function (n) {
|
502
|
+
this._setTextOnLayer('mainCountsFailures', '<b>Failures:<\/b> ' + n);
|
503
|
+
}
|
504
|
+
|
505
|
+
jsUnitTestManager.prototype._setTotal = function (n) {
|
506
|
+
this._setTextOnLayer('mainCountsRuns', '<b>Runs:<\/b> ' + n);
|
507
|
+
}
|
508
|
+
|
509
|
+
jsUnitTestManager.prototype._setProgressBarImage = function (imgName) {
|
510
|
+
this.progressBar.src = imgName;
|
511
|
+
}
|
512
|
+
|
513
|
+
jsUnitTestManager.prototype._setProgressBarWidth = function (w) {
|
514
|
+
this.progressBar.width = w;
|
515
|
+
}
|
516
|
+
|
517
|
+
jsUnitTestManager.prototype.updateProgressIndicators = function () {
|
518
|
+
this._setTotal(this.totalCount);
|
519
|
+
this._setErrors(this.errorCount);
|
520
|
+
this._setFailures(this.failureCount);
|
521
|
+
this._setProgressBarWidth(300 * this.calculateProgressBarProportion());
|
522
|
+
|
523
|
+
if (this.errorCount > 0 || this.failureCount > 0)
|
524
|
+
this._setProgressBarImage('../images/red.gif');
|
525
|
+
else
|
526
|
+
this._setProgressBarImage('../images/green.gif');
|
527
|
+
}
|
528
|
+
|
529
|
+
jsUnitTestManager.prototype.showMessageForSelectedProblemTest = function () {
|
530
|
+
var problemTestIndex = this.problemsListField.selectedIndex;
|
531
|
+
if (problemTestIndex != -1)
|
532
|
+
this.fatalError(this.problemsListField[problemTestIndex].value);
|
533
|
+
}
|
534
|
+
|
535
|
+
jsUnitTestManager.prototype.showMessagesForAllProblemTests = function () {
|
536
|
+
if (this.problemsListField.length == 0)
|
537
|
+
return;
|
538
|
+
|
539
|
+
try {
|
540
|
+
if (this._windowForAllProblemMessages && !this._windowForAllProblemMessages.closed)
|
541
|
+
this._windowForAllProblemMessages.close();
|
542
|
+
}
|
543
|
+
catch(e) {
|
544
|
+
}
|
545
|
+
|
546
|
+
this._windowForAllProblemMessages = window.open('', '', 'width=600, height=350,status=no,resizable=yes,scrollbars=yes');
|
547
|
+
var resDoc = this._windowForAllProblemMessages.document;
|
548
|
+
resDoc.write('<html><head><link rel="stylesheet" href="../css/jsUnitStyle.css"><title>Tests with problems - JsUnit<\/title><head><body>');
|
549
|
+
resDoc.write('<p class="jsUnitSubHeading">Tests with problems (' + this.problemsListField.length + ' total) - JsUnit<\/p>');
|
550
|
+
resDoc.write('<p class="jsUnitSubSubHeading"><i>Running on ' + navigator.userAgent + '</i></p>');
|
551
|
+
for (var i = 0; i < this.problemsListField.length; i++)
|
552
|
+
{
|
553
|
+
resDoc.write('<p class="jsUnitDefault">');
|
554
|
+
resDoc.write('<b>' + (i + 1) + '. ');
|
555
|
+
resDoc.write(this.problemsListField[i].text);
|
556
|
+
resDoc.write('<\/b><\/p><p><pre>');
|
557
|
+
resDoc.write(this._makeHTMLSafe(this.problemsListField[i].value));
|
558
|
+
resDoc.write('<\/pre><\/p>');
|
559
|
+
}
|
560
|
+
|
561
|
+
resDoc.write('<\/body><\/html>');
|
562
|
+
resDoc.close();
|
563
|
+
}
|
564
|
+
|
565
|
+
jsUnitTestManager.prototype._makeHTMLSafe = function (string) {
|
566
|
+
string = string.replace(/&/g, '&');
|
567
|
+
string = string.replace(/</g, '<');
|
568
|
+
string = string.replace(/>/g, '>');
|
569
|
+
return string;
|
570
|
+
}
|
571
|
+
|
572
|
+
jsUnitTestManager.prototype._clearProblemsList = function () {
|
573
|
+
var listField = this.problemsListField;
|
574
|
+
var initialLength = listField.options.length;
|
575
|
+
|
576
|
+
for (var i = 0; i < initialLength; i++)
|
577
|
+
listField.remove(0);
|
578
|
+
}
|
579
|
+
|
580
|
+
jsUnitTestManager.prototype.initialize = function () {
|
581
|
+
this.setStatus('Initializing...');
|
582
|
+
this._setRunButtonEnabled(false);
|
583
|
+
this._clearProblemsList();
|
584
|
+
this.updateProgressIndicators();
|
585
|
+
this.setStatus('Done initializing');
|
586
|
+
}
|
587
|
+
|
588
|
+
jsUnitTestManager.prototype.finalize = function () {
|
589
|
+
this._setRunButtonEnabled(true);
|
590
|
+
}
|
591
|
+
|
592
|
+
jsUnitTestManager.prototype._setRunButtonEnabled = function (b) {
|
593
|
+
this.runButton.disabled = !b;
|
594
|
+
}
|
595
|
+
|
596
|
+
jsUnitTestManager.prototype.getTestFileName = function () {
|
597
|
+
var rawEnteredFileName = this.testFileName.value;
|
598
|
+
var result = rawEnteredFileName;
|
599
|
+
|
600
|
+
while (result.indexOf('\\') != -1)
|
601
|
+
result = result.replace('\\', '/');
|
602
|
+
|
603
|
+
return result;
|
604
|
+
}
|
605
|
+
|
606
|
+
jsUnitTestManager.prototype.getTestFunctionName = function () {
|
607
|
+
return this._testFunctionName;
|
608
|
+
}
|
609
|
+
|
610
|
+
jsUnitTestManager.prototype.resolveUserEnteredTestFileName = function (rawText) {
|
611
|
+
var userEnteredTestFileName = top.testManager.getTestFileName();
|
612
|
+
|
613
|
+
// only test for file:// since Opera uses a different format
|
614
|
+
if (userEnteredTestFileName.indexOf('http://') == 0 || userEnteredTestFileName.indexOf('https://') == 0 || userEnteredTestFileName.indexOf('file://') == 0)
|
615
|
+
return userEnteredTestFileName;
|
616
|
+
|
617
|
+
return getTestFileProtocol() + this.getTestFileName();
|
618
|
+
}
|
619
|
+
|
620
|
+
jsUnitTestManager.prototype.storeRestoredHTML = function () {
|
621
|
+
if (document.getElementById && top.testContainer.testFrame.document.getElementById(jsUnitTestManager.RESTORED_HTML_DIV_ID))
|
622
|
+
this._restoredHTML = top.testContainer.testFrame.document.getElementById(jsUnitTestManager.RESTORED_HTML_DIV_ID).innerHTML;
|
623
|
+
}
|
624
|
+
|
625
|
+
jsUnitTestManager.prototype.fatalError = function(aMessage) {
|
626
|
+
if (top.shouldSubmitResults())
|
627
|
+
this.setStatus(aMessage);
|
628
|
+
else
|
629
|
+
alert(aMessage);
|
630
|
+
}
|
631
|
+
|
632
|
+
jsUnitTestManager.prototype.userConfirm = function(aMessage) {
|
633
|
+
if (top.shouldSubmitResults())
|
634
|
+
return false;
|
635
|
+
else
|
636
|
+
return confirm(aMessage);
|
637
|
+
}
|
638
|
+
|
639
|
+
function getTestFileProtocol() {
|
640
|
+
return getDocumentProtocol();
|
641
|
+
}
|
642
|
+
|
643
|
+
function getDocumentProtocol() {
|
644
|
+
var protocol = top.document.location.protocol;
|
645
|
+
|
646
|
+
if (protocol == "file:")
|
647
|
+
return "file:///";
|
648
|
+
|
649
|
+
if (protocol == "http:")
|
650
|
+
return "http://";
|
651
|
+
|
652
|
+
if (protocol == 'https:')
|
653
|
+
return 'https://';
|
654
|
+
|
655
|
+
if (protocol == "chrome:")
|
656
|
+
return "chrome://";
|
657
|
+
|
658
|
+
return null;
|
659
|
+
}
|
660
|
+
|
661
|
+
function browserSupportsReadingFullPathFromFileField() {
|
662
|
+
return !isOpera() && !isIE7();
|
663
|
+
}
|
664
|
+
|
665
|
+
function isOpera() {
|
666
|
+
return navigator.userAgent.toLowerCase().indexOf("opera") != -1;
|
667
|
+
}
|
668
|
+
|
669
|
+
function isIE7() {
|
670
|
+
return navigator.userAgent.toLowerCase().indexOf("msie 7") != -1;
|
671
|
+
}
|
672
|
+
|
673
|
+
function isBeingRunOverHTTP() {
|
674
|
+
return getDocumentProtocol() == "http://";
|
675
|
+
}
|
676
|
+
|
677
|
+
function getWebserver() {
|
678
|
+
if (isBeingRunOverHTTP()) {
|
679
|
+
var myUrl = location.href;
|
680
|
+
var myUrlWithProtocolStripped = myUrl.substring(myUrl.indexOf("/") + 2);
|
681
|
+
return myUrlWithProtocolStripped.substring(0, myUrlWithProtocolStripped.indexOf("/"));
|
682
|
+
}
|
683
|
+
return null;
|
684
|
+
}
|
685
|
+
|
686
|
+
// the functions push(anArray, anObject) and pop(anArray)
|
687
|
+
// exist because the JavaScript Array.push(anObject) and Array.pop()
|
688
|
+
// functions are not available in IE 5.0
|
689
|
+
|
690
|
+
function push(anArray, anObject) {
|
691
|
+
anArray[anArray.length] = anObject;
|
692
|
+
}
|
693
|
+
|
694
|
+
function pop(anArray) {
|
695
|
+
if (anArray.length >= 1) {
|
696
|
+
delete anArray[anArray.length - 1];
|
697
|
+
anArray.length--;
|
698
|
+
}
|
699
|
+
}
|
700
|
+
|
701
|
+
if (xbDEBUG.on) {
|
702
|
+
xbDebugTraceObject('window', 'jsUnitTestManager');
|
703
|
+
xbDebugTraceFunction('window', 'getTestFileProtocol');
|
704
|
+
xbDebugTraceFunction('window', 'getDocumentProtocol');
|
705
|
+
}
|