Bug 1187233 part 2 - Fix test_networkstats_service_proxy.js to not rely on the old behavior. r=jwalden
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 21 Oct 2015 15:52:20 +0200
changeset 302164 2e1180c9e5ce5cb476835e0478a66915334c0f66
parent 302163 daeb62169623368206c10c232148c04aa22aed6f
child 302165 f9323837e0d24b338dc6ee8b54ee7009b57f4a56
push id5392
push userraliiev@mozilla.com
push dateMon, 14 Dec 2015 20:08:23 +0000
treeherdermozilla-beta@16ce8562a975 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs1187233
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1187233 part 2 - Fix test_networkstats_service_proxy.js to not rely on the old behavior. r=jwalden
dom/network/tests/unit_stats/test_networkstats_service_proxy.js
--- a/dom/network/tests/unit_stats/test_networkstats_service_proxy.js
+++ b/dom/network/tests/unit_stats/test_networkstats_service_proxy.js
@@ -56,26 +56,24 @@ add_test(function test_saveAppStats() {
       var key2 = 1 + "" + false + "" + mobileNetId + "";
 
       do_check_eq(Object.keys(cachedStats).length, 2);
       do_check_eq(cachedStats[key1].appId, 1);
       do_check_eq(cachedStats[key1].isInBrowser, false);
       do_check_eq(cachedStats[key1].serviceType.length, 0);
       do_check_eq(cachedStats[key1].networkId, wifi.id);
       do_check_eq(cachedStats[key1].networkType, wifi.type);
-      do_check_eq(new Date(cachedStats[key1].date).getTime() / 1000,
-                  Math.floor(timestamp / 1000));
+      do_check_eq(cachedStats[key1].date.getTime(), timestamp);
       do_check_eq(cachedStats[key1].rxBytes, 10);
       do_check_eq(cachedStats[key1].txBytes, 20);
       do_check_eq(cachedStats[key2].appId, 1);
       do_check_eq(cachedStats[key1].serviceType.length, 0);
       do_check_eq(cachedStats[key2].networkId, mobile.id);
       do_check_eq(cachedStats[key2].networkType, mobile.type);
-      do_check_eq(new Date(cachedStats[key2].date).getTime() / 1000,
-                  Math.floor(timestamp / 1000));
+      do_check_eq(cachedStats[key2].date.getTime(), timestamp);
       do_check_eq(cachedStats[key2].rxBytes, 10);
       do_check_eq(cachedStats[key2].txBytes, 20);
 
       run_next_test();
     });
   });
 });
 
@@ -108,26 +106,24 @@ add_test(function test_saveServiceStats(
         var key2 = 0 + "" + false + "" + serviceType + mobileNetId + "";
 
         do_check_eq(Object.keys(cachedStats).length, 2);
         do_check_eq(cachedStats[key1].appId, 0);
         do_check_eq(cachedStats[key1].isInBrowser, false);
         do_check_eq(cachedStats[key1].serviceType, serviceType);
         do_check_eq(cachedStats[key1].networkId, wifi.id);
         do_check_eq(cachedStats[key1].networkType, wifi.type);
-        do_check_eq(new Date(cachedStats[key1].date).getTime() / 1000,
-                    Math.floor(timestamp / 1000));
+        do_check_eq(cachedStats[key1].date.getTime(), timestamp);
         do_check_eq(cachedStats[key1].rxBytes, 10);
         do_check_eq(cachedStats[key1].txBytes, 20);
         do_check_eq(cachedStats[key2].appId, 0);
         do_check_eq(cachedStats[key1].serviceType, serviceType);
         do_check_eq(cachedStats[key2].networkId, mobile.id);
         do_check_eq(cachedStats[key2].networkType, mobile.type);
-        do_check_eq(new Date(cachedStats[key2].date).getTime() / 1000,
-                    Math.floor(timestamp / 1000));
+        do_check_eq(cachedStats[key2].date.getTime(), timestamp);
         do_check_eq(cachedStats[key2].rxBytes, 10);
         do_check_eq(cachedStats[key2].txBytes, 20);
 
         run_next_test();
       });
     });
   });
 });
@@ -152,18 +148,17 @@ add_test(function test_saveStatsWithDiff
         var cachedStats = NetworkStatsService.cachedStats;
         var key = 2 + "" + false + "" +
                   NetworkStatsService.getNetworkId(mobile.id, mobile.type);
         do_check_eq(Object.keys(cachedStats).length, 1);
         do_check_eq(cachedStats[key].appId, 2);
         do_check_eq(cachedStats[key].isInBrowser, false);
         do_check_eq(cachedStats[key].networkId, mobile.id);
         do_check_eq(cachedStats[key].networkType, mobile.type);
-        do_check_eq(new Date(cachedStats[key].date).getTime() / 1000,
-                    Math.floor(tomorrow.getTime() / 1000));
+        do_check_eq(cachedStats[key].date.getTime(), tomorrow.getTime());
         do_check_eq(cachedStats[key].rxBytes, 30);
         do_check_eq(cachedStats[key].txBytes, 40);
 
         run_next_test();
       });
     });
   });
 });