mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1742776: Update more tests within toolkit/components to work with https-first enabled r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D132003
This commit is contained in:
parent
72c2119804
commit
ab9c0e444e
@ -5,13 +5,13 @@
|
||||
function assertExpectedPrintPage(helper) {
|
||||
is(
|
||||
helper.sourceURI,
|
||||
PrintHelper.defaultTestPageUrl,
|
||||
PrintHelper.defaultTestPageUrlHTTPS,
|
||||
"The URL of the browser is the one we expect"
|
||||
);
|
||||
}
|
||||
|
||||
add_task(async function testModalPrintDialog() {
|
||||
await PrintHelper.withTestPage(async helper => {
|
||||
await PrintHelper.withTestPageHTTPS(async helper => {
|
||||
helper.assertDialogClosed();
|
||||
|
||||
await helper.startPrint();
|
||||
@ -31,7 +31,7 @@ add_task(async function testModalPrintDialog() {
|
||||
});
|
||||
|
||||
add_task(async function testPrintMultiple() {
|
||||
await PrintHelper.withTestPage(async helper => {
|
||||
await PrintHelper.withTestPageHTTPS(async helper => {
|
||||
helper.assertDialogClosed();
|
||||
|
||||
// First print as usual.
|
||||
@ -57,7 +57,7 @@ add_task(async function testPrintMultiple() {
|
||||
});
|
||||
|
||||
add_task(async function testCancelButton() {
|
||||
await PrintHelper.withTestPage(async helper => {
|
||||
await PrintHelper.withTestPageHTTPS(async helper => {
|
||||
helper.assertDialogClosed();
|
||||
await helper.startPrint();
|
||||
helper.assertDialogOpen();
|
||||
@ -73,7 +73,7 @@ add_task(async function testCancelButton() {
|
||||
});
|
||||
|
||||
add_task(async function testTabOrder() {
|
||||
await PrintHelper.withTestPage(async helper => {
|
||||
await PrintHelper.withTestPageHTTPS(async helper => {
|
||||
helper.assertDialogClosed();
|
||||
await helper.startPrint();
|
||||
helper.assertDialogOpen();
|
||||
@ -162,7 +162,7 @@ add_task(async function testTabOrder() {
|
||||
});
|
||||
|
||||
async function testPrintWithEnter(testFn, filename) {
|
||||
await PrintHelper.withTestPage(async helper => {
|
||||
await PrintHelper.withTestPageHTTPS(async helper => {
|
||||
await helper.startPrint();
|
||||
|
||||
let file = helper.mockFilePicker(filename);
|
||||
@ -211,7 +211,7 @@ add_task(async function testPrintOnNewWindowDoesntClose() {
|
||||
});
|
||||
let win = await BrowserTestUtils.openNewBrowserWindow();
|
||||
|
||||
await PrintHelper.withTestPage(async helper => {
|
||||
await PrintHelper.withTestPageHTTPS(async helper => {
|
||||
await helper.startPrint();
|
||||
let file = helper.mockFilePicker("print_new_window_close.pdf");
|
||||
await helper.assertPrintToFile(file, () => {
|
||||
@ -224,7 +224,7 @@ add_task(async function testPrintOnNewWindowDoesntClose() {
|
||||
});
|
||||
|
||||
add_task(async function testPrintProgressIndicator() {
|
||||
await PrintHelper.withTestPage(async helper => {
|
||||
await PrintHelper.withTestPageHTTPS(async helper => {
|
||||
await helper.startPrint();
|
||||
|
||||
helper.setupMockPrint();
|
||||
@ -251,7 +251,7 @@ add_task(async function testPageSizePortrait() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["layout.css.page-size.enabled", true]],
|
||||
});
|
||||
await PrintHelper.withTestPage(async helper => {
|
||||
await PrintHelper.withTestPageHTTPS(async helper => {
|
||||
await helper.startPrint();
|
||||
|
||||
let orientation = helper.get("orientation");
|
||||
@ -269,7 +269,7 @@ add_task(async function testPageSizeLandscape() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["layout.css.page-size.enabled", true]],
|
||||
});
|
||||
await PrintHelper.withTestPage(async helper => {
|
||||
await PrintHelper.withTestPageHTTPS(async helper => {
|
||||
await helper.startPrint();
|
||||
|
||||
let orientation = helper.get("orientation");
|
||||
|
@ -9,7 +9,7 @@ const TEST_PATH = getRootDirectory(gTestPath).replace(
|
||||
);
|
||||
|
||||
// The actual uri we open doesn't really matter.
|
||||
const OPENED_URI = PrintHelper.defaultTestPageUrl;
|
||||
const OPENED_URI = PrintHelper.defaultTestPageUrlHTTPS;
|
||||
|
||||
// Test for bug 1669554:
|
||||
//
|
||||
|
@ -5,14 +5,21 @@ const { MockFilePicker } = SpecialPowers;
|
||||
let pickerMocked = false;
|
||||
|
||||
class PrintHelper {
|
||||
static async withTestPage(testFn, pagePathname) {
|
||||
static async withTestPage(testFn, pagePathname, useHTTPS = false) {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [["print.tab_modal.enabled", true]],
|
||||
});
|
||||
|
||||
let pageUrl = pagePathname
|
||||
? this.getTestPageUrl(pagePathname)
|
||||
: this.defaultTestPageUrl;
|
||||
let pageUrl = "";
|
||||
if (pagePathname) {
|
||||
pageUrl = useHTTPS
|
||||
? this.getTestPageUrlHTTPS(pagePathname)
|
||||
: this.getTestPageUrl(pagePathname);
|
||||
} else {
|
||||
pageUrl = useHTTPS
|
||||
? this.defaultTestPageUrlHTTPS
|
||||
: this.defaultTestPageUrl;
|
||||
}
|
||||
info("withTestPage: " + pageUrl);
|
||||
let isPdf = pageUrl.endsWith(".pdf");
|
||||
|
||||
@ -52,6 +59,10 @@ class PrintHelper {
|
||||
return taskReturn;
|
||||
}
|
||||
|
||||
static async withTestPageHTTPS(testFn, pagePathname) {
|
||||
return this.withTestPage(testFn, pagePathname, /* useHttps */ true);
|
||||
}
|
||||
|
||||
static resetPrintPrefs() {
|
||||
for (let name of Services.prefs.getChildList("print.")) {
|
||||
Services.prefs.clearUserPref(name);
|
||||
@ -68,10 +79,22 @@ class PrintHelper {
|
||||
return testPath + pathName;
|
||||
}
|
||||
|
||||
static getTestPageUrlHTTPS(pathName) {
|
||||
const testPath = getRootDirectory(gTestPath).replace(
|
||||
"chrome://mochitests/content",
|
||||
"https://example.com"
|
||||
);
|
||||
return testPath + pathName;
|
||||
}
|
||||
|
||||
static get defaultTestPageUrl() {
|
||||
return this.getTestPageUrl("simplifyArticleSample.html");
|
||||
}
|
||||
|
||||
static get defaultTestPageUrlHTTPS() {
|
||||
return this.getTestPageUrlHTTPS("simplifyArticleSample.html");
|
||||
}
|
||||
|
||||
static createMockPaper(paperProperties = {}) {
|
||||
return Object.assign(
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ add_task(async function thumbnails_bg_captureIfMissing() {
|
||||
|
||||
Services.obs.addObserver(observe, "page-thumbnail:create");
|
||||
|
||||
let url = "http://example.com/";
|
||||
let url = "https://example.com/";
|
||||
let file = thumbnailFile(url);
|
||||
ok(!file.exists(), "Thumbnail file should not already exist.");
|
||||
|
||||
|
@ -6,10 +6,10 @@ add_task(async function thumbnails_bg_destroy_browser() {
|
||||
set: [["dom.ipc.processCount", 1]],
|
||||
});
|
||||
|
||||
let url1 = "http://example.com/1";
|
||||
let url1 = "https://example.com/1";
|
||||
ok(!thumbnailExists(url1), "First file should not exist yet.");
|
||||
|
||||
let url2 = "http://example.com/2";
|
||||
let url2 = "https://example.com/2";
|
||||
ok(!thumbnailExists(url2), "Second file should not exist yet.");
|
||||
|
||||
let defaultTimeout = BackgroundPageThumbs._destroyBrowserTimeout;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
add_task(async function thumbnails_bg_no_duplicates() {
|
||||
let url = "http://example.com/1";
|
||||
let url = "https://example.com/1";
|
||||
ok(!thumbnailExists(url), "Thumbnail file should not already exist.");
|
||||
|
||||
let firstCapture = bgCapture(url, {
|
||||
|
@ -3,11 +3,11 @@
|
||||
|
||||
add_task(async function thumbnails_bg_queueing() {
|
||||
let urls = [
|
||||
"http://www.example.com/0",
|
||||
"http://www.example.com/1",
|
||||
"https://www.example.com/0",
|
||||
"https://www.example.com/1",
|
||||
// an item that will timeout to ensure timeouts work and we resume.
|
||||
bgTestPageURL({ wait: 2002 }),
|
||||
"http://www.example.com/2",
|
||||
"https://www.example.com/2",
|
||||
];
|
||||
dontExpireThumbnailURLs(urls);
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
add_task(async function thumbnails_bg_redirect() {
|
||||
let finalURL = "http://example.com/redirected";
|
||||
let finalURL = "https://example.com/redirected";
|
||||
let originalURL = bgTestPageURL({ redirect: finalURL });
|
||||
|
||||
ok(
|
||||
|
Loading…
Reference in New Issue
Block a user