Bug 1167132 - Part 14: [NetworkManager] Move network information into a separate interface (NetStats). r=ethan
authorJessica Jong <jjong@mozilla.com>
Wed, 29 Jul 2015 02:15:00 -0400
changeset 286956 efa5238b30d6f5a408931eb3cd994ff63bce241c
parent 286955 1db1eb705ba9e981cb3a792202b314ff967b42b4
child 286957 e684f5746f2fa8973755d0de8d92d5df62312163
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersethan
bugs1167132
milestone42.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 1167132 - Part 14: [NetworkManager] Move network information into a separate interface (NetStats). r=ethan
dom/network/NetworkStatsService.jsm
dom/network/NetworkStatsServiceProxy.js
dom/network/TCPSocket.js
dom/network/interfaces/nsINetworkStatsServiceProxy.idl
dom/network/tests/unit_stats/test_networkstats_db.js
dom/network/tests/unit_stats/test_networkstats_service.js
dom/network/tests/unit_stats/test_networkstats_service_proxy.js
--- a/dom/network/NetworkStatsService.jsm
+++ b/dom/network/NetworkStatsService.jsm
@@ -21,18 +21,18 @@ Cu.import("resource://gre/modules/Networ
 Cu.import("resource://gre/modules/Timer.jsm");
 
 const NET_NETWORKSTATSSERVICE_CONTRACTID = "@mozilla.org/network/netstatsservice;1";
 const NET_NETWORKSTATSSERVICE_CID = Components.ID("{18725604-e9ac-488a-8aa0-2471e7f6c0a4}");
 
 const TOPIC_BANDWIDTH_CONTROL = "netd-bandwidth-control"
 
 const TOPIC_CONNECTION_STATE_CHANGED = "network-connection-state-changed";
-const NET_TYPE_WIFI = Ci.nsINetworkInterface.NETWORK_TYPE_WIFI;
-const NET_TYPE_MOBILE = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE;
+const NET_TYPE_WIFI = Ci.nsINetworkInfo.NETWORK_TYPE_WIFI;
+const NET_TYPE_MOBILE = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE;
 
 // Networks have different status that NetworkStats API needs to be aware of.
 // Network is present and ready, so NetworkManager provides the whole info.
 const NETWORK_STATUS_READY   = 0;
 // Network is present but hasn't established a connection yet (e.g. SIM that has not
 // enabled 3G since boot).
 const NETWORK_STATUS_STANDBY = 1;
 // Network is not present, but stored in database by the previous connections.
@@ -187,20 +187,20 @@ this.NetworkStatsService = {
   observe: function observe(aSubject, aTopic, aData) {
     switch (aTopic) {
       case TOPIC_CONNECTION_STATE_CHANGED:
 
         // If new interface is registered (notified from NetworkService),
         // the stats are updated for the new interface without waiting to
         // complete the updating period.
 
-        let network = aSubject.QueryInterface(Ci.nsINetworkInterface);
-        debug("Network " + network.name + " of type " + network.type + " status change");
+        let networkInfo = aSubject.QueryInterface(Ci.nsINetworkInfo);
+        debug("Network " + networkInfo.name + " of type " + networkInfo.type + " status change");
 
-        let netId = this.convertNetworkInterface(network);
+        let netId = this.convertNetworkInfo(networkInfo);
         if (!netId) {
           break;
         }
 
         this._updateCurrentAlarm(netId);
 
         debug("NetId: " + netId);
         this.updateStats(netId);
@@ -264,43 +264,43 @@ this.NetworkStatsService = {
                                       NET_TYPE_MOBILE);
         networks[netId] = { id : icc.iccInfo.iccid,
                             type: NET_TYPE_MOBILE };
       }
     }
     return networks;
   },
 
-  convertNetworkInterface: function(aNetwork) {
-    if (aNetwork.type != NET_TYPE_MOBILE &&
-        aNetwork.type != NET_TYPE_WIFI) {
+  convertNetworkInfo: function(aNetworkInfo) {
+    if (aNetworkInfo.type != NET_TYPE_MOBILE &&
+        aNetworkInfo.type != NET_TYPE_WIFI) {
       return null;
     }
 
     let id = '0';
-    if (aNetwork.type == NET_TYPE_MOBILE) {
-      if (!(aNetwork instanceof Ci.nsIRilNetworkInterface)) {
-        debug("Error! Mobile network should be an nsIRilNetworkInterface!");
+    if (aNetworkInfo.type == NET_TYPE_MOBILE) {
+      if (!(aNetworkInfo instanceof Ci.nsIRilNetworkInfo)) {
+        debug("Error! Mobile network should be an nsIRilNetworkInfo!");
         return null;
       }
 
-      let rilNetwork = aNetwork.QueryInterface(Ci.nsIRilNetworkInterface);
+      let rilNetwork = aNetworkInfo.QueryInterface(Ci.nsIRilNetworkInfo);
       id = rilNetwork.iccId;
     }
 
-    let netId = this.getNetworkId(id, aNetwork.type);
+    let netId = this.getNetworkId(id, aNetworkInfo.type);
 
     if (!this._networks[netId]) {
       this._networks[netId] = Object.create(null);
       this._networks[netId].network = { id: id,
-                                        type: aNetwork.type };
+                                        type: aNetworkInfo.type };
     }
 
     this._networks[netId].status = NETWORK_STATUS_READY;
-    this._networks[netId].interfaceName = aNetwork.name;
+    this._networks[netId].interfaceName = aNetworkInfo.name;
     return netId;
   },
 
   getNetworkId: function getNetworkId(aIccId, aNetworkType) {
     return aIccId + '' + aNetworkType;
   },
 
   /* Function to ensure that one network is valid. The network is valid if its status is
@@ -733,20 +733,20 @@ this.NetworkStatsService = {
         aCallback(true, "OK");
       }
     });
   },
 
   /*
    * Function responsible for receiving stats which are not from netd.
    */
-  saveStats: function saveStats(aAppId, aIsInBrowser, aServiceType, aNetwork,
+  saveStats: function saveStats(aAppId, aIsInBrowser, aServiceType, aNetworkInfo,
                                 aTimeStamp, aRxBytes, aTxBytes, aIsAccumulative,
                                 aCallback) {
-    let netId = this.convertNetworkInterface(aNetwork);
+    let netId = this.convertNetworkInfo(aNetworkInfo);
     if (!netId) {
       if (aCallback) {
         aCallback(false, "Invalid network type");
       }
       return;
     }
 
     // Check if |aConnectionType|, |aAppId| and |aServiceType| are valid.
--- a/dom/network/NetworkStatsServiceProxy.js
+++ b/dom/network/NetworkStatsServiceProxy.js
@@ -24,66 +24,66 @@ function NetworkStatsServiceProxy() {
   }
 }
 
 NetworkStatsServiceProxy.prototype = {
   /*
    * Function called in the protocol layer (HTTP, FTP, WebSocket ...etc)
    * to pass the per-app stats to NetworkStatsService.
    */
-  saveAppStats: function saveAppStats(aAppId, aIsInBrowser, aNetwork, aTimeStamp,
+  saveAppStats: function saveAppStats(aAppId, aIsInBrowser, aNetworkInfo, aTimeStamp,
                                       aRxBytes, aTxBytes, aIsAccumulative,
                                       aCallback) {
-    if (!aNetwork) {
+    if (!aNetworkInfo) {
       if (DEBUG) {
-        debug("|aNetwork| is not specified. Failed to save stats. Returning.");
+        debug("|aNetworkInfo| is not specified. Failed to save stats. Returning.");
       }
       return;
     }
 
     if (DEBUG) {
       debug("saveAppStats: " + aAppId + " " + aIsInBrowser + " " +
-            aNetwork.type + " " + aTimeStamp + " " +
+            aNetworkInfo.type + " " + aTimeStamp + " " +
             aRxBytes + " " + aTxBytes + " " + aIsAccumulative);
     }
 
     if (aCallback) {
       aCallback = aCallback.notify;
     }
 
-    NetworkStatsService.saveStats(aAppId, aIsInBrowser, "", aNetwork,
+    NetworkStatsService.saveStats(aAppId, aIsInBrowser, "", aNetworkInfo,
                                   aTimeStamp, aRxBytes, aTxBytes,
                                   aIsAccumulative, aCallback);
   },
 
   /*
    * Function called in the points of different system services
    * to pass the per-service stats to NetworkStatsService.
    */
-  saveServiceStats: function saveServiceStats(aServiceType, aNetwork,
+  saveServiceStats: function saveServiceStats(aServiceType, aNetworkInfo,
                                               aTimeStamp, aRxBytes, aTxBytes,
                                               aIsAccumulative, aCallback) {
-    if (!aNetwork) {
+    if (!aNetworkInfo) {
       if (DEBUG) {
-        debug("|aNetwork| is not specified. Failed to save stats. Returning.");
+        debug("|aNetworkInfo| is not specified. Failed to save stats. Returning.");
       }
       return;
     }
 
     if (DEBUG) {
-      debug("saveServiceStats: " + aServiceType + " " + aNetwork.type + " " +
+      debug("saveServiceStats: " + aServiceType + " " + aNetworkInfo.type + " " +
             aTimeStamp + " " + aRxBytes + " " + aTxBytes + " " +
             aIsAccumulative);
     }
 
     if (aCallback) {
       aCallback = aCallback.notify;
     }
 
-    NetworkStatsService.saveStats(0, false, aServiceType ,aNetwork, aTimeStamp,
+    NetworkStatsService.saveStats(0, false, aServiceType , aNetworkInfo, aTimeStamp,
                                   aRxBytes, aTxBytes, aIsAccumulative,
                                   aCallback);
   },
 
   classID : NETWORKSTATSSERVICEPROXY_CID,
   QueryInterface : XPCOMUtils.generateQI([nsINetworkStatsServiceProxy]),
 }
 
--- a/dom/network/TCPSocket.js
+++ b/dom/network/TCPSocket.js
@@ -180,17 +180,17 @@ TCPSocket.prototype = {
   _trackingNumber: 0,
 
 #ifdef MOZ_WIDGET_GONK
   // Network statistics (Gonk-specific feature)
   _txBytes: 0,
   _rxBytes: 0,
   _appId: Ci.nsIScriptSecurityManager.NO_APP_ID,
   _inBrowser: false,
-  _activeNetwork: null,
+  _activeNetworkInfo: null,
 #endif
 
   // Public accessors.
   get readyState() {
     return this._readyState;
   },
   get binaryType() {
     return this._binaryType;
@@ -369,17 +369,17 @@ TCPSocket.prototype = {
     }
 
     let nssProxy = Cc["@mozilla.org/networkstatsServiceProxy;1"]
                      .getService(Ci.nsINetworkStatsServiceProxy);
     if (!nssProxy) {
       LOG("Error: Ci.nsINetworkStatsServiceProxy service is not available.");
       return;
     }
-    nssProxy.saveAppStats(this._appId, this._inBrowser, this._activeNetwork,
+    nssProxy.saveAppStats(this._appId, this._inBrowser, this._activeNetworkInfo,
                           Date.now(), this._rxBytes, this._txBytes, false);
 
     // Reset the counters once the statistics is saved to NetworkStatsServiceProxy.
     this._txBytes = this._rxBytes = 0;
   },
   // End of helper method for network statistics.
 #endif
 
@@ -611,22 +611,22 @@ TCPSocket.prototype = {
       return that;
     }
 
     let transport = that._transport = this._createTransport(host, port, that._ssl);
     transport.setEventSink(that, Services.tm.currentThread);
     that._initStream(that._binaryType);
 
 #ifdef MOZ_WIDGET_GONK
-    // Set _activeNetwork, which is only required for network statistics.
+    // Set _activeNetworkInfo, which is only required for network statistics.
     // Note that nsINetworkManager, as well as nsINetworkStatsServiceProxy, is
     // Gonk-specific.
     let networkManager = Cc["@mozilla.org/network/manager;1"].getService(Ci.nsINetworkManager);
     if (networkManager) {
-      that._activeNetwork = networkManager.active;
+      that._activeNetworkInfo = networkManager.activeNetworkInfo;
     }
 #endif
 
     return that;
   },
 
   upgradeToSecure: function ts_upgradeToSecure() {
     if (this._readyState !== kOPEN) {
--- a/dom/network/interfaces/nsINetworkStatsServiceProxy.idl
+++ b/dom/network/interfaces/nsINetworkStatsServiceProxy.idl
@@ -1,43 +1,43 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
-interface nsINetworkInterface;
+interface nsINetworkInfo;
 
 [scriptable, function, uuid(5f821529-1d80-4ab5-a933-4e1b3585b6bc)]
 interface nsINetworkStatsServiceProxyCallback : nsISupports
 {
   /*
    * @param aResult callback result with boolean value
    * @param aMessage message
    */
   void notify(in boolean aResult, in jsval aMessage);
 };
 
-[scriptable, uuid(98fd8f69-784e-4626-aa59-56d6436a3c24)]
+[scriptable, uuid(f4f3e901-e102-499d-9d37-dc9951f52df7)]
 interface nsINetworkStatsServiceProxy : nsISupports
 {
   /*
    * An interface used to record per-app traffic data.
    * @param aAppId app id
    * @param aIsInBrowser true if the iframe element is mozbrowser
    * @param aNetworkInterface network
    * @param aTimeStamp time stamp
    * @param aRxBytes received data amount
    * @param aTxBytes transmitted data amount
    * @param aIsAccumulative is stats accumulative
    * @param aCallback an optional callback
    */
   void saveAppStats(in unsigned long aAppId,
                     in boolean aIsInBrowser,
-                    in nsINetworkInterface aNetwork,
+                    in nsINetworkInfo aNetworkInfo,
                     in unsigned long long aTimeStamp,
                     in unsigned long long aRxBytes,
                     in unsigned long long aTxBytes,
                     in boolean aIsAccumulative,
          [optional] in nsINetworkStatsServiceProxyCallback aCallback);
 
   /*
    * An interface used to record per-system service traffic data.
@@ -45,15 +45,15 @@ interface nsINetworkStatsServiceProxy : 
    * @param aNetworkInterface network
    * @param aTimeStamp time stamp
    * @param aRxBytes received data amount
    * @param aTxBytes transmitted data amount
    * @param aIsAccumulative is stats accumulative
    * @param aCallback an optional callback
    */
   void saveServiceStats(in string aServiceType,
-                        in nsINetworkInterface aNetwork,
+                        in nsINetworkInfo aNetworkInfo,
                         in unsigned long long aTimeStamp,
                         in unsigned long long aRxBytes,
                         in unsigned long long aTxBytes,
                         in boolean aIsAccumulative,
              [optional] in nsINetworkStatsServiceProxyCallback aCallback);
 };
--- a/dom/network/tests/unit_stats/test_networkstats_db.js
+++ b/dom/network/tests/unit_stats/test_networkstats_db.js
@@ -931,17 +931,17 @@ var alarms = [{ id:                null,
 var alarmsDbId = 1;
 
 add_test(function test_addAlarm() {
   // Add alarms[0] -> DB: [ alarms[0] (id: 1) ]
   // Check the insertion is OK.
   netStatsDb.addAlarm(alarms[0], function(error, result) {
     do_check_eq(error, null);
     alarmsDbId = result;
-    netStatsDb.getAlarms(Ci.nsINetworkInterface.NETWORK_TYPE_WIFI, exampleManifestURL, function(error, result) {
+    netStatsDb.getAlarms(Ci.nsINetworkInfo.NETWORK_TYPE_WIFI, exampleManifestURL, function(error, result) {
       do_check_eq(error, null);
       do_check_eq(result.length, 1);
       do_check_eq(result[0].id, alarmsDbId);
       do_check_eq(result[0].networkId, alarms[0].networkId);
       do_check_eq(result[0].absoluteThreshold, alarms[0].absoluteThreshold);
       do_check_eq(result[0].relativeThreshold, alarms[0].relativeThreshold);
       do_check_eq(result[0].data.foo, alarms[0].data.foo);
       run_next_test();
--- a/dom/network/tests/unit_stats/test_networkstats_service.js
+++ b/dom/network/tests/unit_stats/test_networkstats_service.js
@@ -255,29 +255,29 @@ add_test(function test_fireAlarm() {
                 data: null,
                 pageURL: testPageURL,
                 manifestURL: testManifestURL };
 
   // Set wifi status to standby to avoid connecting to netd when adding an alarm.
   NetworkStatsService._networks[wifiId].status = NETWORK_STATUS_STANDBY;
 
   NetworkStatsService._db.addAlarm(alarm, function addSuccessCb(error, newId) {
-    NetworkStatsService._db.getAlarms(Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
+    NetworkStatsService._db.getAlarms(Ci.nsINetworkInfo.NETWORK_TYPE_WIFI,
                                       testManifestURL, function onGet(error, result) {
       do_check_eq(error, null);
       do_check_eq(result.length, 1);
 
       // Result of getAlarms is based on expected child's data format, so
       // some changes are needed to be able to use it.
       result[0].networkId = wifiId;
       result[0].pageURL = testPageURL;
       result[0].manifestURL = testManifestURL;
 
       NetworkStatsService._fireAlarm(result[0], false);
-      NetworkStatsService._db.getAlarms(Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
+      NetworkStatsService._db.getAlarms(Ci.nsINetworkInfo.NETWORK_TYPE_WIFI,
                                         testManifestURL, function onGet(error, result) {
         do_check_eq(error, undefined);
         do_check_eq(result.length, 0);
         run_next_test();
       });
     });
   });
 });
--- a/dom/network/tests/unit_stats/test_networkstats_service_proxy.js
+++ b/dom/network/tests/unit_stats/test_networkstats_service_proxy.js
@@ -4,51 +4,50 @@
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "nssProxy",
                                    "@mozilla.org/networkstatsServiceProxy;1",
                                    "nsINetworkStatsServiceProxy");
 
-function mokConvertNetworkInterface() {
-  NetworkStatsService.convertNetworkInterface = function(aNetwork) {
-    if (aNetwork.type != Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE &&
-        aNetwork.type != Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
+function mokConvertNetworkInfo() {
+  NetworkStatsService.convertNetworkInfo = function(aNetworkInfo) {
+    if (aNetworkInfo.type != Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE &&
+        aNetworkInfo.type != Ci.nsINetworkInfo.NETWORK_TYPE_WIFI) {
       return null;
     }
 
     let id = '0';
-    if (aNetwork.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
+    if (aNetworkInfo.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE) {
       id = '1234'
     }
 
-    let netId = this.getNetworkId(id, aNetwork.type);
+    let netId = this.getNetworkId(id, aNetworkInfo.type);
 
     if (!this._networks[netId]) {
       this._networks[netId] = Object.create(null);
       this._networks[netId].network = { id: id,
-                                        type: aNetwork.type };
+                                        type: aNetworkInfo.type };
     }
 
     return netId;
   };
 }
 
 add_test(function test_saveAppStats() {
   var cachedStats = NetworkStatsService.cachedStats;
   var timestamp = NetworkStatsService.cachedStatsDate.getTime();
 
-  // Create to fake nsINetworkInterfaces. As nsINetworkInterface can not
-  // be instantiated, these two vars will emulate it by filling the properties
-  // that will be used.
-  var wifi = {type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI, id: "0"};
-  var mobile = {type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE, id: "1234"};
+  // Create to fake nsINetworkInfos. As nsINetworkInfo can not be instantiated,
+  // these two vars will emulate it by filling the properties that will be used.
+  var wifi = {type: Ci.nsINetworkInfo.NETWORK_TYPE_WIFI, id: "0"};
+  var mobile = {type: Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE, id: "1234"};
 
-  // Insert fake mobile network interface in NetworkStatsService
+  // Insert fake mobile network info in NetworkStatsService
   var mobileNetId = NetworkStatsService.getNetworkId(mobile.id, mobile.type);
 
   do_check_eq(Object.keys(cachedStats).length, 0);
 
   nssProxy.saveAppStats(1, false, wifi, timestamp, 10, 20, false,
                         function (success, message) {
     do_check_eq(success, true);
     nssProxy.saveAppStats(1, false, mobile, timestamp, 10, 20, false,
@@ -78,23 +77,22 @@ add_test(function test_saveAppStats() {
       run_next_test();
     });
   });
 });
 
 add_test(function test_saveServiceStats() {
   var timestamp = NetworkStatsService.cachedStatsDate.getTime();
 
-  // Create to fake nsINetworkInterfaces. As nsINetworkInterface can not
-  // be instantiated, these two vars will emulate it by filling the properties
-  // that will be used.
-  var wifi = {type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI, id: "0"};
-  var mobile = {type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE, id: "1234"};
+  // Create to fake nsINetworkInfos. As nsINetworkInfo can not be instantiated,
+  // these two vars will emulate it by filling the properties that will be used.
+  var wifi = {type: Ci.nsINetworkInfo.NETWORK_TYPE_WIFI, id: "0"};
+  var mobile = {type: Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE, id: "1234"};
 
-  // Insert fake mobile network interface in NetworkStatsService
+  // Insert fake mobile network info in NetworkStatsService
   var mobileNetId = NetworkStatsService.getNetworkId(mobile.id, mobile.type);
 
   NetworkStatsService.updateCachedStats(function (success, msg) {
     do_check_eq(success, true);
 
     var cachedStats = NetworkStatsService.cachedStats;
     do_check_eq(Object.keys(cachedStats).length, 0);
 
@@ -133,17 +131,17 @@ add_test(function test_saveServiceStats(
     });
   });
 });
 
 add_test(function test_saveStatsWithDifferentDates() {
   var today = NetworkStatsService.cachedStatsDate;
   var tomorrow = new Date(today.getTime() + (24 * 60 * 60 * 1000));
 
-  var mobile = {type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE, id: "1234"};
+  var mobile = {type: Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE, id: "1234"};
 
   NetworkStatsService.updateCachedStats(function (success, message) {
     do_check_eq(success, true);
 
     do_check_eq(Object.keys(NetworkStatsService.cachedStats).length, 0);
     nssProxy.saveAppStats(1, false, mobile, today.getTime(), 10, 20, false,
                           function (success, message) {
       do_check_eq(success, true);
@@ -168,17 +166,17 @@ add_test(function test_saveStatsWithDiff
       });
     });
   });
 });
 
 add_test(function test_saveStatsWithMaxCachedTraffic() {
   var timestamp = NetworkStatsService.cachedStatsDate.getTime();
   var maxtraffic = NetworkStatsService.maxCachedTraffic;
-  var wifi = {type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI, id: "0"};
+  var wifi = {type: Ci.nsINetworkInfo.NETWORK_TYPE_WIFI, id: "0"};
 
   NetworkStatsService.updateCachedStats(function (success, message) {
     do_check_eq(success, true);
 
     var cachedStats = NetworkStatsService.cachedStats;
     do_check_eq(Object.keys(cachedStats).length, 0);
     nssProxy.saveAppStats(1, false, wifi, timestamp, 10, 20, false,
                           function (success, message) {
@@ -194,21 +192,21 @@ add_test(function test_saveStatsWithMaxC
     });
   });
 });
 
 add_test(function test_saveAppStats() {
   var cachedStats = NetworkStatsService.cachedStats;
   var timestamp = NetworkStatsService.cachedStatsDate.getTime();
 
-  // Create to fake nsINetworkInterfaces. As nsINetworkInterface can not
+  // Create to fake nsINetworkInfo. As nsINetworkInfo can not
   // be instantiated, these two vars will emulate it by filling the properties
   // that will be used.
-  var wifi = {type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI, id: "0"};
-  var mobile = {type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE, id: "1234"};
+  var wifi = {type: Ci.nsINetworkInfo.NETWORK_TYPE_WIFI, id: "0"};
+  var mobile = {type: Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE, id: "1234"};
 
   // Insert fake mobile network interface in NetworkStatsService
   var mobileNetId = NetworkStatsService.getNetworkId(mobile.id, mobile.type);
 
   do_check_eq(Object.keys(cachedStats).length, 0);
 
   nssProxy.saveAppStats(1, false, wifi, timestamp, 10, 20, false, { notify:
                         function (success, message) {
@@ -227,14 +225,14 @@ add_test(function test_saveAppStats() {
   }});
 });
 
 function run_test() {
   do_get_profile();
 
   Cu.import("resource://gre/modules/NetworkStatsService.jsm");
 
-  // Function convertNetworkInterface of NetworkStatsService causes errors when dealing
+  // Function convertNetworkInfo of NetworkStatsService causes errors when dealing
   // with RIL to get the iccid, so overwrite it.
-  mokConvertNetworkInterface();
+  mokConvertNetworkInfo();
 
   run_next_test();
 }