summaryrefslogtreecommitdiffstats
path: root/browser/components/sessionstore/test/browser_pageStyle.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
commit8148615da179fdd60f19018e13b4e94b95609cc6 (patch)
tree771fccdd99fa3adf35fdd2c81d8197b415a89b91 /browser/components/sessionstore/test/browser_pageStyle.js
parent494802c1be7888025b95260d23db187467d2b9dd (diff)
downloadUXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.gz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.lz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.xz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.zip
Remove browser tests - Part 1: The Tests (except for experiments)
Diffstat (limited to 'browser/components/sessionstore/test/browser_pageStyle.js')
-rw-r--r--browser/components/sessionstore/test/browser_pageStyle.js89
1 files changed, 0 insertions, 89 deletions
diff --git a/browser/components/sessionstore/test/browser_pageStyle.js b/browser/components/sessionstore/test/browser_pageStyle.js
deleted file mode 100644
index 7abee5d9d..000000000
--- a/browser/components/sessionstore/test/browser_pageStyle.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-const URL = getRootDirectory(gTestPath) + "browser_pageStyle_sample.html";
-const URL_NESTED = getRootDirectory(gTestPath) + "browser_pageStyle_sample_nested.html";
-
-/**
- * This test ensures that page style information is correctly persisted.
- */
-add_task(function page_style() {
- let tab = gBrowser.addTab(URL);
- let browser = tab.linkedBrowser;
- yield promiseBrowserLoaded(browser);
- let sheets = yield getStyleSheets(browser);
-
- // Enable all style sheets one by one.
- for (let [title, disabled] of sheets) {
- yield enableStyleSheetsForSet(browser, title);
-
- let tab2 = gBrowser.duplicateTab(tab);
- yield promiseTabRestored(tab2);
-
- let sheets = yield getStyleSheets(tab2.linkedBrowser);
- let enabled = sheets.filter(([title, disabled]) => !disabled);
-
- if (title.startsWith("fail_")) {
- ok(!enabled.length, "didn't restore " + title);
- } else {
- is(enabled.length, 1, "restored one style sheet");
- is(enabled[0][0], title, "restored correct sheet");
- }
-
- gBrowser.removeTab(tab2);
- }
-
- // Disable all styles and verify that this is correctly persisted.
- yield setAuthorStyleDisabled(browser, true);
-
- let tab2 = gBrowser.duplicateTab(tab);
- yield promiseTabRestored(tab2);
-
- let authorStyleDisabled = yield getAuthorStyleDisabled(tab2.linkedBrowser);
- ok(authorStyleDisabled, "disabled all stylesheets");
-
- // Clean up.
- gBrowser.removeTab(tab);
- gBrowser.removeTab(tab2);
-});
-
-/**
- * This test ensures that page style notification from nested documents are
- * received and the page style is persisted correctly.
- */
-add_task(function nested_page_style() {
- let tab = gBrowser.addTab(URL_NESTED);
- let browser = tab.linkedBrowser;
- yield promiseBrowserLoaded(browser);
-
- yield enableSubDocumentStyleSheetsForSet(browser, "alternate");
- yield promiseRemoveTab(tab);
-
- let [{state: {pageStyle}}] = JSON.parse(ss.getClosedTabData(window));
- let expected = JSON.stringify({children: [{pageStyle: "alternate"}]});
- is(JSON.stringify(pageStyle), expected, "correct pageStyle persisted");
-});
-
-function getStyleSheets(browser) {
- return sendMessage(browser, "ss-test:getStyleSheets");
-}
-
-function enableStyleSheetsForSet(browser, name) {
- return sendMessage(browser, "ss-test:enableStyleSheetsForSet", name);
-}
-
-function enableSubDocumentStyleSheetsForSet(browser, name) {
- return sendMessage(browser, "ss-test:enableSubDocumentStyleSheetsForSet", {
- id: "iframe", set: name
- });
-}
-
-function getAuthorStyleDisabled(browser) {
- return sendMessage(browser, "ss-test:getAuthorStyleDisabled");
-}
-
-function setAuthorStyleDisabled(browser, val) {
- return sendMessage(browser, "ss-test:setAuthorStyleDisabled", val)
-}