Commit 6c931ce4 authored by Carsten "Tomcat" Book's avatar Carsten "Tomcat" Book
Browse files

merge fx-team to mozilla-central a=merge

parents 66231ca0 9b168d2c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1440,6 +1440,7 @@ pref("devtools.performance.ui.show-platform-data", false);
pref("devtools.performance.ui.show-idle-blocks", true);
pref("devtools.performance.ui.enable-memory", false);
pref("devtools.performance.ui.enable-framerate", true);
pref("devtools.performance.ui.show-jit-optimizations", false);

// The default cache UI setting
pref("devtools.cache.disabled", false);
+68 −7
Original line number Diff line number Diff line
@@ -4,11 +4,24 @@
const PRELOAD_PREF = "browser.newtab.preload";

gDirectorySource = "data:application/json," + JSON.stringify({
  "directory": [{
  "enhanced": [{
    url: "http://example.com/",
    enhancedImageURI: "data:image/png;base64,helloWORLD",
    title: "title",
    type: "organic",
  }],
  "directory": [{
    url: "http://example1.com/",
    enhancedImageURI: "data:image/png;base64,helloWORLD2",
    title: "title1",
    type: "organic"
  }],
  "suggested": [{
    url: "http://example1.com/2",
    imageURI: "data:image/png;base64,helloWORLD3",
    title: "title2",
    type: "affiliate",
    frecent_sites: ["test.com"]
  }]
});

@@ -33,7 +46,7 @@ function runTests() {
    };
  }

  // Make the page have a directory link followed by a history link
  // Make the page have a directory link, enhanced link, and history link
  yield setLinks("-1");

  // Test with enhanced = false
@@ -52,19 +65,29 @@ function runTests() {
  ({type, enhanced, title} = getData(0));
  is(type, "organic", "directory link is organic");
  isnot(enhanced, "", "directory link has enhanced image");
  is(title, "title1");

  ({type, enhanced, title} = getData(1));
  is(type, "enhanced", "history link is enhanced");
  isnot(enhanced, "", "history link has enhanced image");
  is(title, "title");

  is(getData(1), null, "history link pushed out by directory link");
  is(getData(2), null, "there are only 2 links, directory and enhanced history");

  // Test with a pinned link
  setPinnedLinks("-1");
  yield addNewTabPageTab();
  ({type, enhanced, title} = getData(0));
  is(type, "history", "pinned history link is not enhanced");
  is(enhanced, "", "pinned history link doesn't have enhanced image");
  is(title, "site#-1");
  is(type, "enhanced", "pinned history link is enhanced");
  isnot(enhanced, "", "pinned history link has enhanced image");
  is(title, "title");

  is(getData(1), null, "directory link pushed out by pinned history link");
  ({type, enhanced, title} = getData(1));
  is(type, "organic", "directory link is organic");
  isnot(enhanced, "", "directory link has enhanced image");
  is(title, "title1");

  is(getData(2), null, "directory link pushed out by pinned history link");

  // Test pinned link with enhanced = false
  yield addNewTabPageTab();
@@ -78,4 +101,42 @@ function runTests() {

  ok(getContentDocument().getElementById("newtab-intro-what"),
     "'What is this page?' link exists");

  yield unpinCell(0);



  // Test that a suggested tile is not enhanced by a directory tile
  let origIsTopPlacesSite = NewTabUtils.isTopPlacesSite;
  NewTabUtils.isTopPlacesSite = () => true;
  yield setLinks("-1");

  // Test with enhanced = false
  yield addNewTabPageTab();
  yield customizeNewTabPage("classic");
  ({type, enhanced, title} = getData(0));
  isnot(type, "enhanced", "history link is not enhanced");
  is(enhanced, "", "history link has no enhanced image");
  is(title, "site#-1");

  is(getData(1), null, "there is only one link and it's a history link");


  // Test with enhanced = true
  yield addNewTabPageTab();
  yield customizeNewTabPage("enhanced");

  // Suggested link was not enhanced by directory link with same domain
  ({type, enhanced, title} = getData(0));
  is(type, "affiliate", "suggested link is affiliate");
  is(enhanced, "", "suggested link has no enhanced image");
  is(title, "title2");

  // Enhanced history link shows up second
  ({type, enhanced, title} = getData(1));
  is(type, "enhanced", "pinned history link is enhanced");
  isnot(enhanced, "", "pinned history link has enhanced image");
  is(title, "title");

  is(getData(2), null, "there is only a suggested link followed by an enhanced history link");
}
+15 −0
Original line number Diff line number Diff line
@@ -40,6 +40,21 @@ Please be sure to execute

from the top level before requesting review on a patch.

Linting
=======
run-all-loop-tests.sh will take care of this for you automatically, after
you've installed the dependencies by typing:

  ( cd standalone ; make install )

If you install eslint and the react plugin globally:

  npm install -g eslint
  npm install -g eslint-plugin-react

You can also run it by hand in the browser/components/loop directory:

  eslint .

Front-End Unit Tests
====================
+6 −6
Original line number Diff line number Diff line
@@ -12,12 +12,12 @@ set -e
# Main tests

LOOPDIR=browser/components/loop
#ESLINT=standalone/node_modules/.bin/eslint
#if [ -x "${LOOPDIR}/${ESLINT}" ]; then
#  echo 'running eslint; see http://eslint.org/docs/rules/ for error info'
#  (cd ${LOOPDIR} && ./${ESLINT} .)
#  echo 'eslint run finished.'
#fi
ESLINT=standalone/node_modules/.bin/eslint
if [ -x "${LOOPDIR}/${ESLINT}" ]; then
  echo 'running eslint; see http://eslint.org/docs/rules/ for error info'
  (cd ${LOOPDIR} && ./${ESLINT} .)
  echo 'eslint run finished.'
fi

./mach xpcshell-test ${LOOPDIR}/
./mach marionette-test ${LOOPDIR}/manifest.ini
+0 −5
Original line number Diff line number Diff line
@@ -48,11 +48,6 @@ Then point your browser at:
**Note:** the provided static file server for web contents is **not** intended
for production use.

Code linting
------------

    $ make lint

License
-------

Loading