Bug 1369287 - shipping compact new tab page view by default;r=gijs draft
authorgasolin <gasolin@gmail.com>
Tue, 27 Jun 2017 11:13:15 -0700
changeset 600660 9b274138a8ff7ceaa2f29a368ea83b30020d89e4
parent 600616 f4e52135d9bdc6ce98bb37b450021445aed894ce
child 635053 d6c43db3d17a845a527cd8d96c860820e76ce9b9
push id65826
push userbmo:gasolin@mozilla.com
push dateTue, 27 Jun 2017 18:13:37 +0000
reviewersgijs
bugs1369287
milestone56.0a1
Bug 1369287 - shipping compact new tab page view by default;r=gijs MozReview-Commit-ID: FTEicOcGqtv
browser/app/profile/firefox.js
browser/base/content/test/newtab/browser_newtab_bug752841.js
browser/base/content/test/newtab/browser_newtab_drag_drop_ext.js
browser/base/content/test/newtab/head.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1261,26 +1261,26 @@ pref("browser.newtabpage.introShown", fa
 
 // Toggles the content of 'about:newtab'. Shows the grid when enabled.
 pref("browser.newtabpage.enabled", true);
 
 // Toggles the directory tiles content of 'about:newtab'.
 sticky_pref("browser.newtabpage.enhanced", true);
 
 // enables Activity Stream inspired layout
-pref("browser.newtabpage.compact", false);
+pref("browser.newtabpage.compact", true);
 
 // enables showing basic placeholders for missing thumbnails
 pref("browser.newtabpage.thumbnailPlaceholder", false);
 
 // number of rows of newtab grid
-pref("browser.newtabpage.rows", 3);
+pref("browser.newtabpage.rows", 2);
 
 // number of columns of newtab grid
-pref("browser.newtabpage.columns", 5);
+pref("browser.newtabpage.columns", 6);
 
 // directory tiles download URL
 pref("browser.newtabpage.directory.source", "https://tiles.services.mozilla.com/v3/links/fetch/%LOCALE%/%CHANNEL%");
 
 // activates Activity Stream
 pref("browser.newtabpage.activity-stream.enabled", false);
 
 // Enable the DOM fullscreen API.
--- a/browser/base/content/test/newtab/browser_newtab_bug752841.js
+++ b/browser/base/content/test/newtab/browser_newtab_bug752841.js
@@ -18,18 +18,18 @@ add_task(async function() {
     {row: 0, column: -1},
     {row: 2, column: 4},
     {row: 2, column: 5},
   ];
 
   // Expected length of grid
   let expectedValues = [1, 1, 1, 1, 8, 10];
 
-   // Values before setting new pref values (15 is the default value -> 5 x 3)
-  let previousValues = [15, 1, 1, 1, 1, 8];
+   // Values before setting new pref values (12 is the default value -> 6 x 2)
+  let previousValues = [12, 1, 1, 1, 1, 8];
 
   await addNewTabPageTab();
   let existingTab = gBrowser.selectedTab;
 
   for (let i = 0; i < expectedValues.length; i++) {
     let existingTabGridLength = await getCellsCount();
     is(existingTabGridLength, previousValues[i],
       "Grid length of existing page before update is correctly.");
--- a/browser/base/content/test/newtab/browser_newtab_drag_drop_ext.js
+++ b/browser/base/content/test/newtab/browser_newtab_drag_drop_ext.js
@@ -1,14 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 requestLongerTimeout(2);
 
 const PREF_NEWTAB_COLUMNS = "browser.newtabpage.columns";
+const PREF_NEWTAB_ROWS = "browser.newtabpage.rows";
 
 /*
  * These tests make sure that dragging and dropping sites works as expected.
  * Sites contained in the grid need to shift around to indicate the result
  * of the drag-and-drop operation. If the grid is full and we're dragging
  * a new site into it another one gets pushed out.
  * This is a continuation of browser_newtab_drag_drop.js
  * to decrease test run time, focusing on external sites.
@@ -31,16 +32,17 @@ const PREF_NEWTAB_COLUMNS = "browser.new
   await setLinks("0,1,2,3,4,5,6,7,8");
   setPinnedLinks(",,,,,,,7,8");
 
   await addNewTabPageTab();
   await checkGrid("0,1,2,3,4,5,6,7p,8p");
 
   // force the grid to be small enough that a pinned cell could be pushed out
   await pushPrefs([PREF_NEWTAB_COLUMNS, 3]);
+  await pushPrefs([PREF_NEWTAB_ROWS, 3]);
   await simulateExternalDrop(5);
   await checkGrid("0,1,2,3,4,99p,5,7p,8p");
 
   // drag a new site beneath a pinned cell and make sure the pinned cell is
   // not moved
   await setLinks("0,1,2,3,4,5,6,7,8");
   setPinnedLinks(",,,,,,,,8");
 
@@ -55,9 +57,19 @@ const PREF_NEWTAB_COLUMNS = "browser.new
   await setLinks("0,1,2,3,4,5,6,7,8");
   setPinnedLinks("0,1,2,,,,,,");
 
   await addNewTabPageTab();
   await checkGrid("0p,1p,2p");
 
   await simulateExternalDrop(1);
   await checkGrid("0p,99p,1p,2p,3,4,5,6,7");
+
+  // force the grid to be small enough that a pinned cell could be pushed out
+  // and the full list is truncated
+  await setLinks("0,1,2,3,4,5,6,7,8");
+  setPinnedLinks(",,,,,,,7,8");
+
+  await addNewTabPageTab();
+  await pushPrefs([PREF_NEWTAB_ROWS, 2]);
+  await simulateExternalDrop(5);
+  await checkGrid("0,1,2,3,4,99p");
 });
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -323,17 +323,17 @@ async function addNewTabPageTab() {
 
   return tab;
 }
 
 /**
  * Compares the current grid arrangement with the given pattern.
  * @param the pattern (see below)
  *
- * Example: checkGrid("3p,2,,1p")
+ * Example: checkGrid("3p,2,,4p")
  * Result: We expect the first cell to contain the pinned site 'http://example3.com/'.
  *         The second cell contains 'http://example2.com/'. The third cell is empty.
  *         The fourth cell contains the pinned site 'http://example4.com/'.
  */
 async function checkGrid(pattern) {
   let length = pattern.split(",").length;
 
   await ContentTask.spawn(gWindow.gBrowser.selectedBrowser,