Bug 1195699 - Port tests fixes from 1180387 uplift [r=emtwo]

This commit is contained in:
Maxim Zhilyaev 2015-08-19 04:29:26 -07:00
Родитель e91e642b81
Коммит 5dce3adde9
4 изменённых файлов: 21 добавлений и 3 удалений

Просмотреть файл

@ -1,9 +1,15 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const PREF_NEWTAB_ROWS = "browser.newtabpage.rows";
function runTests() {
// set max rows to 1, to avoid scroll events by clicking middle button
Services.prefs.setIntPref(PREF_NEWTAB_ROWS, 1);
yield setLinks("-1");
yield addNewTabPageTab();
// we need a second newtab to honor max rows
yield addNewTabPageTab();
// Remember if the click handler was triggered
let cell = getCell(0);
@ -16,4 +22,5 @@ function runTests() {
// Send a middle-click and make sure it happened
yield EventUtils.synthesizeMouseAtCenter(cell.node, {button: 1}, getContentWindow());
ok(clicked, "middle click triggered click listener");
Services.prefs.clearUserPref(PREF_NEWTAB_ROWS);
}

Просмотреть файл

@ -1,9 +1,15 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const PREF_NEWTAB_ROWS = "browser.newtabpage.rows";
function runTests() {
// set max rows to 1, to avoid scroll events by clicking middle button
Services.prefs.setIntPref(PREF_NEWTAB_ROWS, 1);
yield setLinks("0");
yield addNewTabPageTab();
// we need a second newtab to honor max rows
yield addNewTabPageTab();
// Remember if the click handler was triggered
let {site} = getCell(0);
@ -22,4 +28,5 @@ function runTests() {
// Make sure the cell didn't actually get blocked
checkGrid("0");
Services.prefs.clearUserPref(PREF_NEWTAB_ROWS);
}

Просмотреть файл

@ -10,7 +10,8 @@ function runTests() {
// Focus count in new tab page.
// 30 = 9 * 3 + 3 = 9 sites, each with link, pin and remove buttons; search
// bar; search button; and toggle button.
// bar; search button; and toggle button. Additionaly there may or may not be
// a scroll bar caused by fix to 1180387, which will eat an extra focus
let FOCUS_COUNT = 30;
// Create a new tab page.
@ -42,7 +43,9 @@ function countFocus(aExpectedCount) {
let focusedElement = document.commandDispatcher.focusedElement;
if (focusedElement && focusedElement.classList.contains("urlbar-input")) {
window.removeEventListener("focus", onFocus, true);
is(focusCount, aExpectedCount, "Validate focus count in the new tab page.");
// account for a potential presence of a scroll bar
ok(focusCount == aExpectedCount || focusCount == (aExpectedCount + 1),
"Validate focus count in the new tab page.");
executeSoon(TestRunner.next);
} else {
if (focusedElement && focusedElement.ownerDocument == contentDoc &&

Просмотреть файл

@ -587,7 +587,8 @@ function createExternalDropIframe() {
iframe.style.position = "absolute";
iframe.style.zIndex = 50;
let margin = doc.getElementById("newtab-margin-top");
// the frame has to be attached to a visible element
let margin = doc.getElementById("newtab-search-container");
margin.appendChild(iframe);
iframe.addEventListener("load", function onLoad() {