2012-01-16 04:23:28 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Test for Network API</title>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script type="application/javascript">
|
|
|
|
|
|
|
|
/** Test for Network API **/
|
|
|
|
|
2012-01-16 04:23:44 -08:00
|
|
|
function checkInterface(aInterface) {
|
|
|
|
ok(!(aInterface in window), aInterface + " should be prefixed");
|
|
|
|
ok(("Moz" + aInterface) in window, aInterface + " should be prefixed");
|
|
|
|
}
|
|
|
|
|
2012-01-16 04:23:28 -08:00
|
|
|
ok('mozConnection' in navigator, "navigator.mozConnection should exist");
|
|
|
|
|
2012-01-16 04:23:44 -08:00
|
|
|
ok(navigator.mozConnection, "navigator.mozConnection returns an object");
|
|
|
|
|
|
|
|
ok(navigator.mozConnection instanceof MozConnection,
|
|
|
|
"navigator.mozConnection is a MozConnection object");
|
2012-03-14 11:50:11 -07:00
|
|
|
ok(navigator.mozConnection instanceof EventTarget,
|
|
|
|
"navigator.mozConnection is a EventTarget object");
|
2012-01-16 04:23:44 -08:00
|
|
|
|
|
|
|
checkInterface("Connection");
|
|
|
|
|
2012-01-16 09:14:56 -08:00
|
|
|
ok('bandwidth' in navigator.mozConnection,
|
|
|
|
"bandwidth should be a Connection attribute");
|
|
|
|
is(navigator.mozConnection.bandwidth, Infinity,
|
|
|
|
"By default connection.bandwidth is equals to Infinity");
|
|
|
|
|
|
|
|
ok('metered' in navigator.mozConnection,
|
|
|
|
"metered should be a Connection attribute");
|
|
|
|
is(navigator.mozConnection.metered, false,
|
|
|
|
"By default the connection is not metered");
|
|
|
|
|
2012-01-16 04:23:28 -08:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|