Bug 1322726 - add UITour API to support opening about:newtab in the current tab, r=MattN

When running the tests by dir, I noticed the tracking protection test requires extra
files to work, but don't list those, so I fixed that.

MozReview-Commit-ID: FUi8XQImvbI

--HG--
extra : rebase_source : 22cda58541764b624b9d75fbe0fd76275203aa18
This commit is contained in:
Gijs Kruitbosch 2016-12-15 14:30:36 +00:00
parent 36952d2ae0
commit e022c25cf8
4 changed files with 34 additions and 0 deletions

View File

@ -220,6 +220,10 @@ if (typeof Mozilla == 'undefined') {
});
};
Mozilla.UITour.showNewTab = function() {
_sendEvent('showNewTab');
};
Mozilla.UITour.getConfiguration = function(configName, callback) {
_sendEvent('getConfiguration', {
callbackID: _waitForCallback(callback),

View File

@ -527,6 +527,11 @@ this.UITour = {
break;
}
case "showNewTab": {
this.showNewTab(window, browser);
break;
}
case "getConfiguration": {
if (typeof data.configuration != "string") {
log.warn("getConfiguration: No configuration option specified");
@ -1744,6 +1749,10 @@ this.UITour = {
}
},
showNewTab: function(aWindow, aBrowser) {
aWindow.openLinkIn("about:newtab", "current", {targetBrowser: aBrowser});
},
hideAnnotationsForPanel: function(aEvent, aTargetPositionCallback) {
let win = aEvent.target.ownerGlobal;
let annotationElements = new Map([

View File

@ -16,6 +16,9 @@ skip-if = true # Bug 1113038 - Intermittent "Popup was opened"
[browser_trackingProtection.js]
skip-if = os == "linux" # Intermittent NS_ERROR_NOT_AVAILABLE [nsIUrlClassifierDBService.beginUpdate]
tag = trackingprotection
support-files =
!/browser/base/content/test/general/benignPage.html
!/browser/base/content/test/general/trackingPage.html
[browser_trackingProtection_tour.js]
tag = trackingprotection
[browser_showMenu_controlCenter.js]
@ -41,5 +44,6 @@ skip-if = true # Disabled due to frequent failures, bugs 1026310 and 1032137
skip-if = true # Disabled pending removal of pocket UI Tour
[browser_UITour_registerPageID.js]
[browser_UITour_resetProfile.js]
[browser_UITour_showNewTab.js]
[browser_UITour_sync.js]
[browser_UITour_toggleReaderMode.js]

View File

@ -0,0 +1,17 @@
"use strict";
var gTestTab;
var gContentAPI;
var gContentWindow;
add_task(setup_UITourTest);
// Test that we can switch to about:newtab
add_UITour_task(function* test_aboutNewTab() {
let newTabLoaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, "about:newtab");
info("Showing about:newtab");
yield gContentAPI.showNewTab();
info("Waiting for about:newtab to load");
yield newTabLoaded;
is(gBrowser.selectedBrowser.currentURI.spec, "about:newtab", "Loaded about:newtab");
});