diff --git a/dom/network/tests/unit_stats/test_networkstats_db.js b/dom/network/tests/unit_stats/test_networkstats_db.js index ffce85ec70a5..40414fa15ea8 100644 --- a/dom/network/tests/unit_stats/test_networkstats_db.js +++ b/dom/network/tests/unit_stats/test_networkstats_db.js @@ -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(); diff --git a/dom/network/tests/unit_stats/test_networkstats_service.js b/dom/network/tests/unit_stats/test_networkstats_service.js index 8cd893c1962f..9c72dc532257 100644 --- a/dom/network/tests/unit_stats/test_networkstats_service.js +++ b/dom/network/tests/unit_stats/test_networkstats_service.js @@ -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(); }); });