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

This commit is contained in:
Albert Crespell 2014-02-11 22:05:06 +01:00
Родитель ae10708769
Коммит 1cbc513fd3
2 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

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

Просмотреть файл

@ -19,8 +19,12 @@ add_test(function test_clearDB() {
getNetworks(function onGetNetworks(error, result) { getNetworks(function onGetNetworks(error, result) {
do_check_eq(error, null); do_check_eq(error, null);
var networks = result; 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) { NetworkStatsService._db.clearStats(networks, function onDBCleared(error, result) {
do_check_eq(result, null); do_check_eq(error, null);
run_next_test(); run_next_test();
}); });
}); });