Bug 1369815 - Add mochitest for additional display modes r=heycam

MozReview-Commit-ID: 3ADmC1op4Sj
This commit is contained in:
James Willcox 2017-08-10 14:32:34 -05:00
parent b3df8d8daa
commit 2b6d28deca

View File

@ -47,6 +47,12 @@ add_task(async function() {
ok(!queryApplies(q), q + " should not apply");
}
function setDisplayMode(mode) {
win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDocShell)
.displayMode = mode;
}
shouldApply("all and (display-mode: browser)");
shouldNotApply("all and (display-mode: fullscreen)");
shouldNotApply("all and (display-mode: standalone)");
@ -77,6 +83,18 @@ add_task(async function() {
ok(!document.mozFullScreenElement, "window exited fullscreen");
shouldNotApply("all and (display-mode: fullscreen)");
shouldApply("all and (display-mode: browser)");
// Test entering display mode mode through docshell
setDisplayMode(Components.interfaces.nsIDocShell.DISPLAY_MODE_STANDALONE);
shouldApply("all and (display-mode: standalone)");
shouldNotApply("all and (display-mode: fullscreen)");
shouldNotApply("all and (display-mode: browser)");
shouldNotApply("all and (display-mode: minimal-ui)");
// Test that changes in the display mode are reflected
setDisplayMode(Components.interfaces.nsIDocShell.DISPLAY_MODE_MINIMAL_UI);
shouldApply("all and (display-mode: minimal-ui)");
shouldNotApply("all and (display-mode: standalone)");
});
</script>
</head>