Bug 1369815 - Add mochitest for additional display modes r=heycam
☠☠ backed out by 2bbb1bd8335d ☠ ☠
authorJames Willcox <snorp@snorp.net>
Thu, 10 Aug 2017 14:32:34 -0500
changeset 374794 e018aed689755170416b0bda839cc5c7f01c6764
parent 374793 a758c86dd864ccabbdb4225075bf932d4c146683
child 374795 094e6802c2f440f74076374030268de13a806b22
push id93765
push userjwillcox@mozilla.com
push dateTue, 15 Aug 2017 14:30:19 +0000
treeherdermozilla-inbound@4fb119706335 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1369815
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1369815 - Add mochitest for additional display modes r=heycam MozReview-Commit-ID: 3ADmC1op4Sj
layout/style/test/chrome/test_display_mode.html
--- a/layout/style/test/chrome/test_display_mode.html
+++ b/layout/style/test/chrome/test_display_mode.html
@@ -42,16 +42,22 @@ add_task(async function() {
   function shouldApply(q) {
     ok(queryApplies(q), q + " should apply");
   }
 
   function shouldNotApply(q) {
     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)");
   shouldNotApply("all and (display-mode: minimal-ui)");
 
   // Test entering the OS's fullscreen mode.
   var fullScreenEntered = waitOneEvent(win, "sizemodechange");
   synthesizeKey("VK_F11", {});
@@ -72,16 +78,28 @@ add_task(async function() {
   shouldApply("all and (display-mode: fullscreen)");
   shouldNotApply("all and (display-mode: browser)");
   fullScreenExited = waitOneEvent(document, "mozfullscreenchange");
   document.mozCancelFullScreen();
   await fullScreenExited;
   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>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1104916">Mozilla Bug 1104916</a>
 <iframe id="subdoc" src="http://mochi.test:8888/tests/layout/style/test/media_queries_iframe.html"></iframe>
 <p id="display"></p>
 <div id="content" style="display: none">