blob: 4f33872cecef0aa37c6093d8dde4c20116f93f4b [file] [log] [blame]
description('Tests that updates to the connection event causes new events to fire.');
var bandwidth = 10;
var metered = false;
var connection = navigator.webkitConnection;
function checkNetworkInformation() {
shouldBe("typeof connection.bandwidth", '"number"');
shouldBe("typeof connection.metered", '"boolean"');
}
function setNetworkInformation() {
internals.setNetworkInformation('webkitnetworkinfochange', bandwidth, metered);
}
function firstListener() {
checkNetworkInformation();
connection.removeEventListener('webkitnetworkinfochange', firstListener);
connection.addEventListener('webkitnetworkinfochange', updateListener);
bandwidth = 5;
metered = true;
setNetworkInformation();
}
function updateListener(event) {
checkNetworkInformation(event);
finishJSTest();
}
connection.addEventListener('webkitnetworkinfochange', firstListener);
setNetworkInformation();
window.jsTestIsAsync = true;