Bug 1136208 - Change all references of 'related' to 'suggested' r=adw, a=sylvestre
authorMarina Samuel <msamuel@mozilla.com>
Thu, 26 Mar 2015 17:23:21 -0400
changeset 258196 60f350a6b8b8
parent 258195 745269d59b33
child 258197 4afccec73fb9
push id4619
push useredilee@gmail.com
push date2015-04-02 05:50 +0000
treeherdermozilla-beta@daf8a9291a9b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw, sylvestre
bugs1136208
milestone38.0
Bug 1136208 - Change all references of 'related' to 'suggested' r=adw, a=sylvestre
browser/modules/DirectoryLinksProvider.jsm
browser/modules/test/xpcshell/test_DirectoryLinksProvider.js
--- a/browser/modules/DirectoryLinksProvider.jsm
+++ b/browser/modules/DirectoryLinksProvider.jsm
@@ -52,18 +52,18 @@ const PREF_NEWTAB_ENHANCED = "browser.ne
 const ALLOWED_LINK_SCHEMES = new Set(["http", "https"]);
 
 // Only allow link image urls that are https or data
 const ALLOWED_IMAGE_SCHEMES = new Set(["https", "data"]);
 
 // The frecency of a directory link
 const DIRECTORY_FRECENCY = 1000;
 
-// The frecency of a related link
-const RELATED_FRECENCY = Infinity;
+// The frecency of a suggested link
+const SUGGESTED_FRECENCY = Infinity;
 
 // Divide frecency by this amount for pings
 const PING_SCORE_DIVISOR = 10000;
 
 // Allowed ping actions remotely stored as columns: case-insensitive [a-z0-9_]
 const PING_ACTIONS = ["block", "click", "pin", "sponsored", "sponsored_link", "unpin", "view"];
 
 /**
@@ -84,24 +84,24 @@ let DirectoryLinksProvider = {
   _downloadIntervalMS: 86400000,
 
   /**
    * A mapping from eTLD+1 to an enhanced link objects
    */
   _enhancedLinks: new Map(),
 
   /**
-   * A mapping from site to a list of related link objects
+   * A mapping from site to a list of suggested link objects
    */
-  _relatedLinks: new Map(),
+  _suggestedLinks: new Map(),
 
   /**
-   * A set of top sites that we can provide related links for
+   * A set of top sites that we can provide suggested links for
    */
-  _topSitesWithRelatedLinks: new Set(),
+  _topSitesWithSuggestedLinks: new Set(),
 
   get _observedPrefs() Object.freeze({
     enhanced: PREF_NEWTAB_ENHANCED,
     linksURL: PREF_DIRECTORY_SOURCE,
     matchOSLocale: PREF_MATCH_OS_LOCALE,
     prefSelectedLocale: PREF_SELECTED_LOCALE,
   }),
 
@@ -196,21 +196,21 @@ let DirectoryLinksProvider = {
 
   _removePrefsObserver: function DirectoryLinksProvider_removeObserver() {
     for (let pref in this._observedPrefs) {
       let prefName = this._observedPrefs[pref];
       Services.prefs.removeObserver(prefName, this);
     }
   },
 
-  _cacheRelatedLinks: function(link) {
-    for (let relatedSite of link.frecent_sites) {
-      let relatedMap = this._relatedLinks.get(relatedSite) || new Map();
-      relatedMap.set(link.url, link);
-      this._relatedLinks.set(relatedSite, relatedMap);
+  _cacheSuggestedLinks: function(link) {
+    for (let suggestedSite of link.frecent_sites) {
+      let suggestedMap = this._suggestedLinks.get(suggestedSite) || new Map();
+      suggestedMap.set(link.url, link);
+      this._suggestedLinks.set(suggestedSite, suggestedMap);
     }
   },
 
   _fetchAndCacheLinks: function DirectoryLinksProvider_fetchAndCacheLinks(uri) {
     // Replace with the same display locale used for selecting links data
     uri = uri.replace("%LOCALE%", this.locale);
 
     let deferred = Promise.defer();
@@ -408,19 +408,19 @@ let DirectoryLinksProvider = {
   },
 
   /**
    * Gets the current set of directory links.
    * @param aCallback The function that the array of links is passed to.
    */
   getLinks: function DirectoryLinksProvider_getLinks(aCallback) {
     this._readDirectoryLinksFile().then(rawLinks => {
-      // Reset the cache of related tiles and enhanced images for this new set of links
+      // Reset the cache of suggested tiles and enhanced images for this new set of links
       this._enhancedLinks.clear();
-      this._relatedLinks.clear();
+      this._suggestedLinks.clear();
 
       let validityFilter = function(link) {
         // Make sure the link url is allowed and images too if they exist
         return this.isURLAllowed(link.url, ALLOWED_LINK_SCHEMES) &&
                this.isURLAllowed(link.imageURI, ALLOWED_IMAGE_SCHEMES) &&
                this.isURLAllowed(link.enhancedImageURI, ALLOWED_IMAGE_SCHEMES);
       }.bind(this);
 
@@ -430,19 +430,19 @@ let DirectoryLinksProvider = {
           this._enhancedLinks.set(NewTabUtils.extractSite(link.url), link);
         }
         link.lastVisitDate = length - position;
       }.bind(this);
 
       rawLinks.suggested.filter(validityFilter).forEach((link, position) => {
         setCommonProperties(link, rawLinks.suggested.length, position);
 
-        // We cache related tiles here but do not push any of them in the links list yet.
-        // The decision for which related tile to include will be made separately.
-        this._cacheRelatedLinks(link);
+        // We cache suggested tiles here but do not push any of them in the links list yet.
+        // The decision for which suggested tile to include will be made separately.
+        this._cacheSuggestedLinks(link);
       });
 
       return rawLinks.directory.filter(validityFilter).map((link, position) => {
         setCommonProperties(link, rawLinks.directory.length, position);
         link.frecency = DIRECTORY_FRECENCY;
         return link;
       });
     }).catch(ex => {
@@ -471,145 +471,145 @@ let DirectoryLinksProvider = {
         this._lastDownloadMS = Date.parse(fileInfo.lastModificationDate);
       }
       // fetch directory on startup without force
       yield this._fetchAndCacheLinksIfNecessary();
     }.bind(this));
   },
 
   _handleManyLinksChanged: function() {
-    this._topSitesWithRelatedLinks.clear();
-    this._relatedLinks.forEach((relatedLinks, site) => {
+    this._topSitesWithSuggestedLinks.clear();
+    this._suggestedLinks.forEach((suggestedLinks, site) => {
       if (NewTabUtils.isTopPlacesSite(site)) {
-        this._topSitesWithRelatedLinks.add(site);
+        this._topSitesWithSuggestedLinks.add(site);
       }
     });
-    this._updateRelatedTile();
+    this._updateSuggestedTile();
   },
 
   /**
-   * Updates _topSitesWithRelatedLinks based on the link that was changed.
+   * Updates _topSitesWithSuggestedLinks based on the link that was changed.
    *
-   * @return true if _topSitesWithRelatedLinks was modified, false otherwise.
+   * @return true if _topSitesWithSuggestedLinks was modified, false otherwise.
    */
   _handleLinkChanged: function(aLink) {
     let changedLinkSite = NewTabUtils.extractSite(aLink.url);
-    let linkStored = this._topSitesWithRelatedLinks.has(changedLinkSite);
+    let linkStored = this._topSitesWithSuggestedLinks.has(changedLinkSite);
 
     if (!NewTabUtils.isTopPlacesSite(changedLinkSite) && linkStored) {
-      this._topSitesWithRelatedLinks.delete(changedLinkSite);
+      this._topSitesWithSuggestedLinks.delete(changedLinkSite);
       return true;
     }
 
-    if (this._relatedLinks.has(changedLinkSite) &&
+    if (this._suggestedLinks.has(changedLinkSite) &&
         NewTabUtils.isTopPlacesSite(changedLinkSite) && !linkStored) {
-      this._topSitesWithRelatedLinks.add(changedLinkSite);
+      this._topSitesWithSuggestedLinks.add(changedLinkSite);
       return true;
     }
     return false;
   },
 
   _populatePlacesLinks: function () {
     NewTabUtils.links.populateProviderCache(NewTabUtils.placesProvider, () => {
       this._handleManyLinksChanged();
     });
   },
 
   onLinkChanged: function (aProvider, aLink) {
     // Make sure NewTabUtils.links handles the notification first.
     setTimeout(() => {
       if (this._handleLinkChanged(aLink)) {
-        this._updateRelatedTile();
+        this._updateSuggestedTile();
       }
     }, 0);
   },
 
   onManyLinksChanged: function () {
     // Make sure NewTabUtils.links handles the notification first.
     setTimeout(() => {
       this._handleManyLinksChanged();
     }, 0);
   },
 
   /**
-   * Chooses and returns a related tile based on a user's top sites
-   * that we have an available related tile for.
+   * Chooses and returns a suggested tile based on a user's top sites
+   * that we have an available suggested tile for.
    *
-   * @return the chosen related tile, or undefined if there isn't one
+   * @return the chosen suggested tile, or undefined if there isn't one
    */
-  _updateRelatedTile: function() {
+  _updateSuggestedTile: function() {
     let sortedLinks = NewTabUtils.getProviderLinks(this);
 
     if (!sortedLinks) {
       // If NewTabUtils.links.resetCache() is called before getting here,
       // sortedLinks may be undefined.
       return;
     }
 
-    // Delete the current related tile, if one exists.
+    // Delete the current suggested tile, if one exists.
     let initialLength = sortedLinks.length;
     this.maxNumLinks = initialLength;
     if (initialLength) {
       let mostFrecentLink = sortedLinks[0];
       if (mostFrecentLink.targetedSite) {
         this._callObservers("onLinkChanged", {
           url: mostFrecentLink.url,
           frecency: 0,
           lastVisitDate: mostFrecentLink.lastVisitDate,
           type: mostFrecentLink.type,
         }, 0, true);
       }
     }
 
-    if (this._topSitesWithRelatedLinks.size == 0) {
-      // There are no potential related links we can show.
+    if (this._topSitesWithSuggestedLinks.size == 0) {
+      // There are no potential suggested links we can show.
       return;
     }
 
-    // Create a flat list of all possible links we can show as related.
-    // Note that many top sites may map to the same related links, but we only
-    // want to count each related link once (based on url), thus possibleLinks is a map
-    // from url to relatedLink. Thus, each link has an equal chance of being chosen at
+    // Create a flat list of all possible links we can show as suggested.
+    // Note that many top sites may map to the same suggested links, but we only
+    // want to count each suggested link once (based on url), thus possibleLinks is a map
+    // from url to suggestedLink. Thus, each link has an equal chance of being chosen at
     // random from flattenedLinks if it appears only once.
     let possibleLinks = new Map();
     let targetedSites = new Map();
-    this._topSitesWithRelatedLinks.forEach(topSiteWithRelatedLink => {
-      let relatedLinksMap = this._relatedLinks.get(topSiteWithRelatedLink);
-      relatedLinksMap.forEach((relatedLink, url) => {
-        possibleLinks.set(url, relatedLink);
+    this._topSitesWithSuggestedLinks.forEach(topSiteWithSuggestedLink => {
+      let suggestedLinksMap = this._suggestedLinks.get(topSiteWithSuggestedLink);
+      suggestedLinksMap.forEach((suggestedLink, url) => {
+        possibleLinks.set(url, suggestedLink);
 
         // Keep a map of URL to targeted sites. We later use this to show the user
         // what site they visited to trigger this suggestion.
         if (!targetedSites.get(url)) {
           targetedSites.set(url, []);
         }
-        targetedSites.get(url).push(topSiteWithRelatedLink);
+        targetedSites.get(url).push(topSiteWithSuggestedLink);
       })
     });
     let flattenedLinks = [...possibleLinks.values()];
 
-    // Choose our related link at random
-    let relatedIndex = Math.floor(Math.random() * flattenedLinks.length);
-    let chosenRelatedLink = flattenedLinks[relatedIndex];
+    // Choose our suggested link at random
+    let suggestedIndex = Math.floor(Math.random() * flattenedLinks.length);
+    let chosenSuggestedLink = flattenedLinks[suggestedIndex];
 
     // Show the new directory tile.
     this._callObservers("onLinkChanged", {
-      url: chosenRelatedLink.url,
-      title: chosenRelatedLink.title,
-      frecency: RELATED_FRECENCY,
-      lastVisitDate: chosenRelatedLink.lastVisitDate,
-      type: chosenRelatedLink.type,
+      url: chosenSuggestedLink.url,
+      title: chosenSuggestedLink.title,
+      frecency: SUGGESTED_FRECENCY,
+      lastVisitDate: chosenSuggestedLink.lastVisitDate,
+      type: chosenSuggestedLink.type,
 
       // Choose the first site a user has visited as the target. In the future,
       // this should be the site with the highest frecency. However, we currently
       // store frecency by URL not by site.
-      targetedSite: targetedSites.get(chosenRelatedLink.url).length ?
-        targetedSites.get(chosenRelatedLink.url)[0] : null
+      targetedSite: targetedSites.get(chosenSuggestedLink.url).length ?
+        targetedSites.get(chosenSuggestedLink.url)[0] : null
     });
-    return chosenRelatedLink;
+    return chosenSuggestedLink;
    },
 
   /**
    * Return the object to its pre-init state
    */
   reset: function DirectoryLinksProvider_reset() {
     delete this.__linksURL;
     this._removePrefsObserver();
--- a/browser/modules/test/xpcshell/test_DirectoryLinksProvider.js
+++ b/browser/modules/test/xpcshell/test_DirectoryLinksProvider.js
@@ -56,50 +56,50 @@ const kHttpHandlerData = {};
 kHttpHandlerData[kExamplePath] = {"directory": [{"url":"http://example.com","title":"RemoteSource"}]};
 
 const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
                               "nsIBinaryInputStream",
                               "setInputStream");
 
 let gLastRequestPath;
 
-let relatedTile1 = {
+let suggestedTile1 = {
   url: "http://turbotax.com",
   type: "affiliate",
   lastVisitDate: 3,
   frecent_sites: [
     "taxact.com",
     "hrblock.com",
     "1040.com",
     "taxslayer.com"
   ]
 };
-let relatedTile2 = {
+let suggestedTile2 = {
   url: "http://irs.gov",
   type: "affiliate",
   lastVisitDate: 2,
   frecent_sites: [
     "taxact.com",
     "hrblock.com",
     "freetaxusa.com",
     "taxslayer.com"
   ]
 };
-let relatedTile3 = {
+let suggestedTile3 = {
   url: "http://hrblock.com",
   type: "affiliate",
   lastVisitDate: 1,
   frecent_sites: [
     "taxact.com",
     "freetaxusa.com",
     "1040.com",
     "taxslayer.com"
   ]
 };
-let someOtherSite = {url: "http://someothersite.com", title: "Not_A_Related_Site"};
+let someOtherSite = {url: "http://someothersite.com", title: "Not_A_Suggested_Site"};
 
 function getHttpHandler(path) {
   let code = 200;
   let body = JSON.stringify(kHttpHandlerData[path]);
   if (path == kFailPath) {
     code = 204;
   }
   return function(aRequest, aResponse) {
@@ -209,21 +209,21 @@ function run_test() {
     DirectoryLinksProvider.reset();
     Services.prefs.clearUserPref(kLocalePref);
     Services.prefs.clearUserPref(kSourceUrlPref);
     Services.prefs.clearUserPref(kPingUrlPref);
     Services.prefs.clearUserPref(kNewtabEnhancedPref);
   });
 }
 
-add_task(function test_updateRelatedTile() {
+add_task(function test_updateSuggestedTile() {
   let topSites = ["site0.com", "1040.com", "site2.com", "hrblock.com", "site4.com", "freetaxusa.com", "site6.com"];
 
   // Initial setup
-  let data = {"suggested": [relatedTile1, relatedTile2, relatedTile3], "directory": [someOtherSite]};
+  let data = {"suggested": [suggestedTile1, suggestedTile2, suggestedTile3], "directory": [someOtherSite]};
   let dataURI = 'data:application/json,' + JSON.stringify(data);
 
   let testObserver = new TestFirstRun();
   DirectoryLinksProvider.addObserver(testObserver);
 
   yield promiseSetupDirectoryLinksProvider({linksURL: dataURI});
   let links = yield fetchData();
 
@@ -232,195 +232,195 @@ add_task(function test_updateRelatedTile
     return topSites.indexOf(site) >= 0;
   }
 
   let origGetProviderLinks = NewTabUtils.getProviderLinks;
   NewTabUtils.getProviderLinks = function(provider) {
     return links;
   }
 
-  do_check_eq(DirectoryLinksProvider._updateRelatedTile(), undefined);
+  do_check_eq(DirectoryLinksProvider._updateSuggestedTile(), undefined);
 
   function TestFirstRun() {
     this.promise = new Promise(resolve => {
       this.onLinkChanged = (directoryLinksProvider, link) => {
         links.unshift(link);
-        let possibleLinks = [relatedTile1.url, relatedTile2.url, relatedTile3.url];
+        let possibleLinks = [suggestedTile1.url, suggestedTile2.url, suggestedTile3.url];
 
-        isIdentical([...DirectoryLinksProvider._topSitesWithRelatedLinks], ["hrblock.com", "1040.com", "freetaxusa.com"]);
+        isIdentical([...DirectoryLinksProvider._topSitesWithSuggestedLinks], ["hrblock.com", "1040.com", "freetaxusa.com"]);
         do_check_true(possibleLinks.indexOf(link.url) > -1);
         do_check_eq(link.frecency, Infinity);
         do_check_eq(link.type, "affiliate");
         resolve();
       };
     });
   }
 
-  function TestChangingRelatedTile() {
+  function TestChangingSuggestedTile() {
     this.count = 0;
     this.promise = new Promise(resolve => {
       this.onLinkChanged = (directoryLinksProvider, link) => {
         this.count++;
-        let possibleLinks = [relatedTile1.url, relatedTile2.url, relatedTile3.url];
+        let possibleLinks = [suggestedTile1.url, suggestedTile2.url, suggestedTile3.url];
 
         do_check_true(possibleLinks.indexOf(link.url) > -1);
         do_check_eq(link.type, "affiliate");
         do_check_true(this.count <= 2);
 
         if (this.count == 1) {
-          // The removed related link is the one we added initially.
+          // The removed suggested link is the one we added initially.
           do_check_eq(link.url, links.shift().url);
           do_check_eq(link.frecency, 0);
         } else {
           links.unshift(link);
           do_check_eq(link.frecency, Infinity);
         }
-        isIdentical([...DirectoryLinksProvider._topSitesWithRelatedLinks], ["hrblock.com", "freetaxusa.com"]);
+        isIdentical([...DirectoryLinksProvider._topSitesWithSuggestedLinks], ["hrblock.com", "freetaxusa.com"]);
         resolve();
       }
     });
   }
 
-  function TestRemovingRelatedTile() {
+  function TestRemovingSuggestedTile() {
     this.count = 0;
     this.promise = new Promise(resolve => {
       this.onLinkChanged = (directoryLinksProvider, link) => {
         this.count++;
 
         do_check_eq(link.type, "affiliate");
         do_check_eq(this.count, 1);
         do_check_eq(link.frecency, 0);
         do_check_eq(link.url, links.shift().url);
-        isIdentical([...DirectoryLinksProvider._topSitesWithRelatedLinks], []);
+        isIdentical([...DirectoryLinksProvider._topSitesWithSuggestedLinks], []);
         resolve();
       }
     });
   }
 
-  // Test first call to '_updateRelatedTile()', called when fetching directory links.
+  // Test first call to '_updateSuggestedTile()', called when fetching directory links.
   yield testObserver.promise;
   DirectoryLinksProvider.removeObserver(testObserver);
 
-  // Removing a top site that doesn't have a related link should
-  // not change the current related tile.
+  // Removing a top site that doesn't have a suggested link should
+  // not change the current suggested tile.
   let removedTopsite = topSites.shift();
   do_check_eq(removedTopsite, "site0.com");
   do_check_false(NewTabUtils.isTopPlacesSite(removedTopsite));
-  let updateRelatedTile = DirectoryLinksProvider._handleLinkChanged({
+  let updateSuggestedTile = DirectoryLinksProvider._handleLinkChanged({
     url: "http://" + removedTopsite,
     type: "history",
   });
-  do_check_false(updateRelatedTile);
+  do_check_false(updateSuggestedTile);
 
-  // Removing a top site that has a related link should
-  // remove any current related tile and add a new one.
-  testObserver = new TestChangingRelatedTile();
+  // Removing a top site that has a suggested link should
+  // remove any current suggested tile and add a new one.
+  testObserver = new TestChangingSuggestedTile();
   DirectoryLinksProvider.addObserver(testObserver);
   removedTopsite = topSites.shift();
   do_check_eq(removedTopsite, "1040.com");
   do_check_false(NewTabUtils.isTopPlacesSite(removedTopsite));
   DirectoryLinksProvider.onLinkChanged(DirectoryLinksProvider, {
     url: "http://" + removedTopsite,
     type: "history",
   });
   yield testObserver.promise;
   do_check_eq(testObserver.count, 2);
   DirectoryLinksProvider.removeObserver(testObserver);
 
-  // Removing all top sites with related links should remove
-  // the current related link and not replace it.
+  // Removing all top sites with suggested links should remove
+  // the current suggested link and not replace it.
   topSites = [];
-  testObserver = new TestRemovingRelatedTile();
+  testObserver = new TestRemovingSuggestedTile();
   DirectoryLinksProvider.addObserver(testObserver);
   DirectoryLinksProvider.onManyLinksChanged();
   yield testObserver.promise;
 
   // Cleanup
   yield promiseCleanDirectoryLinksProvider();
   NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
   NewTabUtils.getProviderLinks = origGetProviderLinks;
 });
 
-add_task(function test_relatedLinksMap() {
-  let data = {"suggested": [relatedTile1, relatedTile2, relatedTile3], "directory": [someOtherSite]};
+add_task(function test_suggestedLinksMap() {
+  let data = {"suggested": [suggestedTile1, suggestedTile2, suggestedTile3], "directory": [someOtherSite]};
   let dataURI = 'data:application/json,' + JSON.stringify(data);
 
   yield promiseSetupDirectoryLinksProvider({linksURL: dataURI});
   let links = yield fetchData();
 
-  // Ensure the related tiles were not considered directory tiles.
+  // Ensure the suggested tiles were not considered directory tiles.
   do_check_eq(links.length, 1);
-  let expected_data = [{url: "http://someothersite.com", title: "Not_A_Related_Site", frecency: DIRECTORY_FRECENCY, lastVisitDate: 1}];
+  let expected_data = [{url: "http://someothersite.com", title: "Not_A_Suggested_Site", frecency: DIRECTORY_FRECENCY, lastVisitDate: 1}];
   isIdentical(links, expected_data);
 
-  // Check for correctly saved related tiles data.
+  // Check for correctly saved suggested tiles data.
   expected_data = {
-    "taxact.com": [relatedTile1, relatedTile2, relatedTile3],
-    "hrblock.com": [relatedTile1, relatedTile2],
-    "1040.com": [relatedTile1, relatedTile3],
-    "taxslayer.com": [relatedTile1, relatedTile2, relatedTile3],
-    "freetaxusa.com": [relatedTile2, relatedTile3],
+    "taxact.com": [suggestedTile1, suggestedTile2, suggestedTile3],
+    "hrblock.com": [suggestedTile1, suggestedTile2],
+    "1040.com": [suggestedTile1, suggestedTile3],
+    "taxslayer.com": [suggestedTile1, suggestedTile2, suggestedTile3],
+    "freetaxusa.com": [suggestedTile2, suggestedTile3],
   };
 
-  DirectoryLinksProvider._relatedLinks.forEach((relatedLinks, site) => {
-    let relatedLinksItr = relatedLinks.values();
+  DirectoryLinksProvider._suggestedLinks.forEach((suggestedLinks, site) => {
+    let suggestedLinksItr = suggestedLinks.values();
     for (let link of expected_data[site]) {
-      isIdentical(relatedLinksItr.next().value, link);
+      isIdentical(suggestedLinksItr.next().value, link);
     }
   })
 
   yield promiseCleanDirectoryLinksProvider();
 });
 
-add_task(function test_topSitesWithRelatedLinks() {
+add_task(function test_topSitesWithSuggestedLinks() {
   let topSites = ["site0.com", "1040.com", "site2.com", "hrblock.com", "site4.com", "freetaxusa.com", "site6.com"];
   let origIsTopPlacesSite = NewTabUtils.isTopPlacesSite;
   NewTabUtils.isTopPlacesSite = function(site) {
     return topSites.indexOf(site) >= 0;
   }
 
   // Mock out getProviderLinks() so we don't have to populate cache in NewTabUtils
   let origGetProviderLinks = NewTabUtils.getProviderLinks;
   NewTabUtils.getProviderLinks = function(provider) {
     return [];
   }
 
-  // We start off with no top sites with related links.
-  do_check_eq(DirectoryLinksProvider._topSitesWithRelatedLinks.size, 0);
+  // We start off with no top sites with suggested links.
+  do_check_eq(DirectoryLinksProvider._topSitesWithSuggestedLinks.size, 0);
 
-  let data = {"suggested": [relatedTile1, relatedTile2, relatedTile3], "directory": [someOtherSite]};
+  let data = {"suggested": [suggestedTile1, suggestedTile2, suggestedTile3], "directory": [someOtherSite]};
   let dataURI = 'data:application/json,' + JSON.stringify(data);
 
   yield promiseSetupDirectoryLinksProvider({linksURL: dataURI});
   let links = yield fetchData();
 
-  // Check we've populated related links as expected.
-  do_check_eq(DirectoryLinksProvider._relatedLinks.size, 5);
+  // Check we've populated suggested links as expected.
+  do_check_eq(DirectoryLinksProvider._suggestedLinks.size, 5);
 
-  // When many sites change, we update _topSitesWithRelatedLinks as expected.
-  let expectedTopSitesWithRelatedLinks = ["hrblock.com", "1040.com", "freetaxusa.com"];
+  // When many sites change, we update _topSitesWithSuggestedLinks as expected.
+  let expectedTopSitesWithSuggestedLinks = ["hrblock.com", "1040.com", "freetaxusa.com"];
   DirectoryLinksProvider._handleManyLinksChanged();
-  isIdentical([...DirectoryLinksProvider._topSitesWithRelatedLinks], expectedTopSitesWithRelatedLinks);
+  isIdentical([...DirectoryLinksProvider._topSitesWithSuggestedLinks], expectedTopSitesWithSuggestedLinks);
 
-  // Removing site6.com as a topsite has no impact on _topSitesWithRelatedLinks.
+  // Removing site6.com as a topsite has no impact on _topSitesWithSuggestedLinks.
   let popped = topSites.pop();
   DirectoryLinksProvider._handleLinkChanged({url: "http://" + popped});
-  isIdentical([...DirectoryLinksProvider._topSitesWithRelatedLinks], expectedTopSitesWithRelatedLinks);
+  isIdentical([...DirectoryLinksProvider._topSitesWithSuggestedLinks], expectedTopSitesWithSuggestedLinks);
 
-  // Removing freetaxusa.com as a topsite will remove it from _topSitesWithRelatedLinks.
+  // Removing freetaxusa.com as a topsite will remove it from _topSitesWithSuggestedLinks.
   popped = topSites.pop();
-  expectedTopSitesWithRelatedLinks.pop();
+  expectedTopSitesWithSuggestedLinks.pop();
   DirectoryLinksProvider._handleLinkChanged({url: "http://" + popped});
-  isIdentical([...DirectoryLinksProvider._topSitesWithRelatedLinks], expectedTopSitesWithRelatedLinks);
+  isIdentical([...DirectoryLinksProvider._topSitesWithSuggestedLinks], expectedTopSitesWithSuggestedLinks);
 
-  // Re-adding freetaxusa.com as a topsite will add it to _topSitesWithRelatedLinks.
+  // Re-adding freetaxusa.com as a topsite will add it to _topSitesWithSuggestedLinks.
   topSites.push(popped);
-  expectedTopSitesWithRelatedLinks.push(popped);
+  expectedTopSitesWithSuggestedLinks.push(popped);
   DirectoryLinksProvider._handleLinkChanged({url: "http://" + popped});
-  isIdentical([...DirectoryLinksProvider._topSitesWithRelatedLinks], expectedTopSitesWithRelatedLinks);
+  isIdentical([...DirectoryLinksProvider._topSitesWithSuggestedLinks], expectedTopSitesWithSuggestedLinks);
 
   // Cleanup.
   NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
   NewTabUtils.getProviderLinks = origGetProviderLinks;
 });
 
 add_task(function test_reportSitesAction() {
   yield DirectoryLinksProvider.init();