author Mounir Lamouri <>
Wed, 14 Mar 2012 19:50:11 +0100
changeset 89664 0b4e3c7608ab657bcfec929ffbc1ae3e6c659009
parent 84742 778597344568aa509f3731056fad9501307977a3
child 89670 e94edfdb1f5bd5c29dc54cfb83768f9c84f3f4de
permissions -rw-r--r--
Bug 735261 - navigator.mozConnection should be an instance of EventTarget. r=smaug

  <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"/>
<p id="display"></p>
<div id="content" style="display: none">
<pre id="test">
<script type="application/javascript">

/** Test for Network API **/

function checkInterface(aInterface) {
  ok(!(aInterface in window), aInterface + " should be prefixed");
  ok(("Moz" + aInterface) in window, aInterface + " should be prefixed");

ok('mozConnection' in navigator, "navigator.mozConnection should exist");

ok(navigator.mozConnection, "navigator.mozConnection returns an object");

ok(navigator.mozConnection instanceof MozConnection,
   "navigator.mozConnection is a MozConnection object");
ok(navigator.mozConnection instanceof EventTarget,
   "navigator.mozConnection is a EventTarget object");


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");