Bug 966244 - Part 2: Update tests. r=gene

This commit is contained in:
Albert Crespell 2014-02-11 22:05:06 +01:00
parent 9ec314f9f4
commit 16ff07b731
2 changed files with 17 additions and 1 deletions

View File

@ -19,6 +19,10 @@ function clearStore(store, callback) {
}, callback);
}
function getNetworkId(aIccId, aNetworkType) {
return aIccId + '' + aNetworkType;
}
add_test(function prepareDatabase() {
// Clear whole database to avoid starting tests with unknown state
// due to the previous tests.
@ -121,6 +125,10 @@ add_test(function test_fillResultSamples_noEmptyData() {
add_test(function test_clear() {
var networks = getNetworks();
networks.forEach(function(network, index) {
networks[index] = {network: network, networkId: getNetworkId(network.id, network.type)};
}, this);
netStatsDb.clearStats(networks, function (error, result) {
do_check_eq(error, null);
run_next_test();
@ -129,6 +137,10 @@ add_test(function test_clear() {
add_test(function test_clear_interface() {
var networks = getNetworks();
networks.forEach(function(network, index) {
networks[index] = {network: network, networkId: getNetworkId(network.id, network.type)};
}, this);
netStatsDb.clearInterfaceStats(networks[0], function (error, result) {
do_check_eq(error, null);
run_next_test();

View File

@ -19,8 +19,12 @@ add_test(function test_clearDB() {
getNetworks(function onGetNetworks(error, result) {
do_check_eq(error, null);
var networks = result;
networks.forEach(function(network, index) {
networks[index] = {network: network, networkId: NetworkStatsService.getNetworkId(network.id, network.type)};
}, this);
NetworkStatsService._db.clearStats(networks, function onDBCleared(error, result) {
do_check_eq(result, null);
do_check_eq(error, null);
run_next_test();
});
});