author | Ryan Willoughby <ryan.willoughby@nitobi.com> |
Tue, 06 Jul 2010 11:31:19 -0700 | |
changeset 0 | 54063d8b0412 |
permissions | -rwxr-xr-x |
0
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
2 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
3 |
<head> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
4 |
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
5 |
<title>QUnit results for PhoneGap JS API</title> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
6 |
<!-- You need the following two files in the same directory for QUnit to run. --> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
7 |
<link rel="stylesheet" type="text/css" href="qunit.css" /> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
8 |
<script type="text/javascript" src="qunit.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
9 |
<!-- Make sure you copy in phonegap.js from the PhoneGap repository (that's what you're testing, right?) --> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
10 |
<script type="text/javascript" src="phonegap.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
11 |
<script type="text/javascript"> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
12 |
function Tests() { |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
13 |
this.TEST_TIMEOUT = 15000; |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
14 |
}; |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
15 |
var tests = new Tests(); |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
16 |
|
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
17 |
// Runs each function in Tests that contains 'Tests' in the name. |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
18 |
function run() { |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
19 |
for (var t in tests) { |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
20 |
if (t.indexOf('Tests') > -1) { |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
21 |
tests[t](); |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
22 |
} |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
23 |
} |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
24 |
alert('Test run complete.'); |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
25 |
} |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
26 |
function loadTests() { |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
27 |
// Shitty hack here: check for BlackBerry browser and timeout the test runner, or simply attach test runner |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
28 |
// to the deviceready event if we have any other platform that can handle events. |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
29 |
if (navigator.userAgent.indexOf('Browzr') > -1) { |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
30 |
setTimeout(run, 250); |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
31 |
} else { |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
32 |
var state = document.readyState; |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
33 |
if (state == "loaded" || state == "complete") { |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
34 |
run(); |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
35 |
} else { |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
36 |
document.addEventListener('deviceready', run, false); |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
37 |
} |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
38 |
} |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
39 |
} |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
40 |
</script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
41 |
<script type="text/javascript" src="tests/accelerometer.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
42 |
<script type="text/javascript" src="tests/contacts.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
43 |
<script type="text/javascript" src="tests/camera.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
44 |
<script type="text/javascript" src="tests/device.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
45 |
<script type="text/javascript" src="tests/file.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
46 |
<script type="text/javascript" src="tests/geolocation.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
47 |
<script type="text/javascript" src="tests/map.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
48 |
<script type="text/javascript" src="tests/network.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
49 |
<script type="text/javascript" src="tests/notification.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
50 |
<script type="text/javascript" src="tests/orientation.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
51 |
<script type="text/javascript" src="tests/sms.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
52 |
<script type="text/javascript" src="tests/telephony.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
53 |
<script type="text/javascript" src="tests/storage.tests.js"></script> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
54 |
</head> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
55 |
<body onload="loadTests();"> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
56 |
<h1 id="qunit-header">Mobile Spec (PhoneGap) Tests</h1> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
57 |
<h2 id="qunit-banner"></h2> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
58 |
<h2 id="qunit-userAgent"></h2> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
59 |
<ol id="qunit-tests"></ol> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
60 |
</body> |
54063d8b0412
initial commit of PhoneGap WRT framework, licensing and test code
Ryan Willoughby <ryan.willoughby@nitobi.com>
parents:
diff
changeset
|
61 |
</html> |