Bug 691583 - Ensure Unix EOL in full-screen API tests. r=whitespace
authorChris Pearce <chris@pearce.org.nz>
Tue, 01 Nov 2011 18:11:47 +1300
changeset 79501 ad6054dd6e087f2f537afee1c78374999a167b48
parent 79500 e269b5ec522ab66f582525017579e2ad1ae78a9a
child 79502 a2e305e684e6039eb074f1d32d746970b81992ea
push id21408
push userkhuey@mozilla.com
push dateTue, 01 Nov 2011 14:32:20 +0000
treeherdermozilla-central@cd9add22f090 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhitespace
bugs691583
milestone10.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 691583 - Ensure Unix EOL in full-screen API tests. r=whitespace
content/html/content/test/file_fullscreen-api-keys.html
content/html/content/test/file_fullscreen-api.html
content/html/content/test/test_fullscreen-api.html
--- a/content/html/content/test/file_fullscreen-api-keys.html
+++ b/content/html/content/test/file_fullscreen-api-keys.html
@@ -1,116 +1,116 @@
- <!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=545812
-
-Test that restricted key pressed drop documents out of DOM full-screen mode.
-
--->
-<head>
-  <title>Test for Bug 545812</title>
-  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-  <style>
-  body {
-    background-color: black;
-  }
-  </style>
-</head>
-<body onload="document.body.mozRequestFullScreen();">
-
-<script type="application/javascript">
-
-/** Test for Bug 545812 **/
-
-// List of key codes which should exit full-screen mode.
-var keyList = [
-  { code: "VK_ESCAPE", suppressed: true},
-  { code: "VK_F11",    suppressed: false},
-];
-
-function ok(condition, msg) {
-  opener.ok(condition, msg);
-}
-
-function is(a, b, msg) {
-  opener.is(a, b, msg);
-}
-
-var gKeyTestIndex = 0;
-var gKeyName;
-var gKeyCode;
-var gKeySuppressed;
-var gKeyReceived = false;
-
-function keyHandler(event) {
-  gKeyReceived = true;
-}
-
-function checkKeyEffect() {
-  is(gKeySuppressed, !gKeyReceived, "Should not receive key events for " + gKeyName);
-  is(document.mozFullScreen, false, "Should exit full-screen mode for " + gKeyName + " press");
-  if (gKeyTestIndex < keyList.length) {
-    setTimeout(testNextKey, 0);
-  } else {
-    document.mozCancelFullScreen();
-    opener.nextTest();
-  }
-}
-
-function testTrustedKeyEvents() {
-  document.body.focus();
-  gKeyReceived = false;
-  synthesizeKey(gKeyName, {});
-  setTimeout(checkKeyEffect, 0);
-}
-
-function testScriptInitiatedKeyEvents() {
-  // Script initiated untrusted key events should not cause full-screen exit.
-  document.body.focus();
-  gKeyReceived = false;
-  var evt = document.createEvent("KeyEvents");
-  evt.initKeyEvent("keydown", true, true, window,
-                   false, false, false, false,
-                   gKeyCode, 0);
-  document.body.dispatchEvent(evt);
-
-  evt = document.createEvent("KeyEvents");
-  evt.initKeyEvent("keypress", true, true, window,
-                   false, false, false, false,
-                   gKeyCode, 0);
-  document.body.dispatchEvent(evt);
-
-  evt = document.createEvent("KeyEvents");
-  evt.initKeyEvent("keyup", true, true, window,
-                   false, false, false, false,
-                   gKeyCode, 0);
-  document.body.dispatchEvent(evt);
-  
-  ok(gKeyReceived, "dispatchEvent should dispatch events synchronously");
-  ok(document.mozFullScreen,
-     "Should remain in full-screen mode for script initiated key events for " + gKeyName);
-}
-
-function testNextKey() {
-  if (!document.mozFullScreen) {
-    document.body.mozRequestFullScreen();
-  }
-  ok(document.mozFullScreen, "Must be in full-screen mode");
-
-  gKeyName = keyList[gKeyTestIndex].code;
-  gKeyCode = KeyEvent["DOM_" + gKeyName];
-  gKeySuppressed = keyList[gKeyTestIndex].suppressed;
-  gKeyTestIndex++;
-
-  testScriptInitiatedKeyEvents();
-  testTrustedKeyEvents();
-}
-
-window.addEventListener("keydown", keyHandler, true);
-window.addEventListener("keyup", keyHandler, true);
-window.addEventListener("keypress", keyHandler, true);
-setTimeout(testNextKey, 0);
-
-</script>
-</pre>
-</body>
-</html>
+ <!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=545812
+
+Test that restricted key pressed drop documents out of DOM full-screen mode.
+
+-->
+<head>
+  <title>Test for Bug 545812</title>
+  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  <style>
+  body {
+    background-color: black;
+  }
+  </style>
+</head>
+<body onload="document.body.mozRequestFullScreen();">
+
+<script type="application/javascript">
+
+/** Test for Bug 545812 **/
+
+// List of key codes which should exit full-screen mode.
+var keyList = [
+  { code: "VK_ESCAPE", suppressed: true},
+  { code: "VK_F11",    suppressed: false},
+];
+
+function ok(condition, msg) {
+  opener.ok(condition, msg);
+}
+
+function is(a, b, msg) {
+  opener.is(a, b, msg);
+}
+
+var gKeyTestIndex = 0;
+var gKeyName;
+var gKeyCode;
+var gKeySuppressed;
+var gKeyReceived = false;
+
+function keyHandler(event) {
+  gKeyReceived = true;
+}
+
+function checkKeyEffect() {
+  is(gKeySuppressed, !gKeyReceived, "Should not receive key events for " + gKeyName);
+  is(document.mozFullScreen, false, "Should exit full-screen mode for " + gKeyName + " press");
+  if (gKeyTestIndex < keyList.length) {
+    setTimeout(testNextKey, 0);
+  } else {
+    document.mozCancelFullScreen();
+    opener.nextTest();
+  }
+}
+
+function testTrustedKeyEvents() {
+  document.body.focus();
+  gKeyReceived = false;
+  synthesizeKey(gKeyName, {});
+  setTimeout(checkKeyEffect, 0);
+}
+
+function testScriptInitiatedKeyEvents() {
+  // Script initiated untrusted key events should not cause full-screen exit.
+  document.body.focus();
+  gKeyReceived = false;
+  var evt = document.createEvent("KeyEvents");
+  evt.initKeyEvent("keydown", true, true, window,
+                   false, false, false, false,
+                   gKeyCode, 0);
+  document.body.dispatchEvent(evt);
+
+  evt = document.createEvent("KeyEvents");
+  evt.initKeyEvent("keypress", true, true, window,
+                   false, false, false, false,
+                   gKeyCode, 0);
+  document.body.dispatchEvent(evt);
+
+  evt = document.createEvent("KeyEvents");
+  evt.initKeyEvent("keyup", true, true, window,
+                   false, false, false, false,
+                   gKeyCode, 0);
+  document.body.dispatchEvent(evt);
+  
+  ok(gKeyReceived, "dispatchEvent should dispatch events synchronously");
+  ok(document.mozFullScreen,
+     "Should remain in full-screen mode for script initiated key events for " + gKeyName);
+}
+
+function testNextKey() {
+  if (!document.mozFullScreen) {
+    document.body.mozRequestFullScreen();
+  }
+  ok(document.mozFullScreen, "Must be in full-screen mode");
+
+  gKeyName = keyList[gKeyTestIndex].code;
+  gKeyCode = KeyEvent["DOM_" + gKeyName];
+  gKeySuppressed = keyList[gKeyTestIndex].suppressed;
+  gKeyTestIndex++;
+
+  testScriptInitiatedKeyEvents();
+  testTrustedKeyEvents();
+}
+
+window.addEventListener("keydown", keyHandler, true);
+window.addEventListener("keyup", keyHandler, true);
+window.addEventListener("keypress", keyHandler, true);
+setTimeout(testNextKey, 0);
+
+</script>
+</pre>
+</body>
+</html>
--- a/content/html/content/test/file_fullscreen-api.html
+++ b/content/html/content/test/file_fullscreen-api.html
@@ -169,30 +169,30 @@ function fullScreenChange(event) {
       setRequireTrustedContext(false);
       document.mozCancelFullScreen();
       ok(!document.mozFullScreen, "Should have left full-screen mode.");
       break;
     }
     case 7: {
       ok(!document.mozFullScreen, "Should have left full-screen mode (last time).");
 
-      SpecialPowers.setBoolPref("full-screen-api.enabled", false);
-      is(document.mozFullScreenEnabled, false, "document.mozFullScreenEnabled should be false if full-screen-api.enabled is false");
+      SpecialPowers.setBoolPref("full-screen-api.enabled", false);
+      is(document.mozFullScreenEnabled, false, "document.mozFullScreenEnabled should be false if full-screen-api.enabled is false");
       fullScreenElement().mozRequestFullScreen();
       ok(!document.mozFullScreen, "Should still be in normal mode, because pref is not enabled.");
-
-      SpecialPowers.setBoolPref("full-screen-api.enabled", true);
-      is(document.mozFullScreenEnabled, true, "document.mozFullScreenEnabled should be true if full-screen-api.enabled is true");
-
+
+      SpecialPowers.setBoolPref("full-screen-api.enabled", true);
+      is(document.mozFullScreenEnabled, true, "document.mozFullScreenEnabled should be true if full-screen-api.enabled is true");
+
       iframe = document.createElement("iframe");
       fullScreenElement().appendChild(iframe);
       iframe.src = iframeContents;
       ok(!document.mozFullScreen, "Should still be in normal mode, because iframe did not have mozallowfullscreen attribute.");
-      fullScreenElement().removeChild(iframe);
-      iframe = null;
+      fullScreenElement().removeChild(iframe);
+      iframe = null;
 
       // Set timeout for calling finish(), so that any pending "mozfullscreenchange" events
       // would have a chance to fire.
       setTimeout(function(){opener.nextTest();}, 0);
       break;
     }
     default: {
       ok(false, "Should not receive any more fullscreenchange events!");
--- a/content/html/content/test/test_fullscreen-api.html
+++ b/content/html/content/test/test_fullscreen-api.html
@@ -1,68 +1,68 @@
- <!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test for Bug 545812</title>
-  <script type="application/javascript" src="/MochiKit/packed.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-  <style>
-  body {
-    background-color: black;
-  }
-  </style>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=545812">Mozilla Bug 545812</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-/** Tests for Bug 545812 **/
-
-// Ensure the full-screen api is enabled, and will be disabled on test exit.
-var prevEnabled = SpecialPowers.getBoolPref("full-screen-api.enabled");
-SpecialPowers.setBoolPref("full-screen-api.enabled", true);
-
-// Disable the requirement for trusted contexts only, so the tests are easier
-// to write.
-var prevTrusted = SpecialPowers.getBoolPref("full-screen-api.allow-trusted-requests-only");
-SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
-
-// Run the tests which go full-screen in new windows, as mochitests normally
-// run in an iframe, which by default will not have the mozallowfullscreen
-// attribute set, so full-screen won't work.
-var gTestWindows = [
-  "file_fullscreen-denied.html",
-  "file_fullscreen-api.html",
-  "file_fullscreen-api-keys.html",
-  "file_fullscreen-plugins.html"
-];
-
-var testWindow = null;
-var gTestIndex = 0;
-
-function nextTest() {
-  if (testWindow) {
-    testWindow.close();
-  }
-  if (gTestIndex < gTestWindows.length) {
-    testWindow = window.open(gTestWindows[gTestIndex], "", "width=500,height=500");
-    gTestIndex++;
-  } else {
-    SpecialPowers.setBoolPref("full-screen-api.enabled", prevEnabled);
-    SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", prevTrusted);	
-    SimpleTest.finish();
-  }
-}
-
-addLoadEvent(nextTest);
-SimpleTest.waitForExplicitFinish();
-
-</script>
-</pre>
-</body>
-</html>
+ <!DOCTYPE HTML>
+<html>
+<head>
+  <title>Test for Bug 545812</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+  <style>
+  body {
+    background-color: black;
+  }
+  </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=545812">Mozilla Bug 545812</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Tests for Bug 545812 **/
+
+// Ensure the full-screen api is enabled, and will be disabled on test exit.
+var prevEnabled = SpecialPowers.getBoolPref("full-screen-api.enabled");
+SpecialPowers.setBoolPref("full-screen-api.enabled", true);
+
+// Disable the requirement for trusted contexts only, so the tests are easier
+// to write.
+var prevTrusted = SpecialPowers.getBoolPref("full-screen-api.allow-trusted-requests-only");
+SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
+
+// Run the tests which go full-screen in new windows, as mochitests normally
+// run in an iframe, which by default will not have the mozallowfullscreen
+// attribute set, so full-screen won't work.
+var gTestWindows = [
+  "file_fullscreen-denied.html",
+  "file_fullscreen-api.html",
+  "file_fullscreen-api-keys.html",
+  "file_fullscreen-plugins.html"
+];
+
+var testWindow = null;
+var gTestIndex = 0;
+
+function nextTest() {
+  if (testWindow) {
+    testWindow.close();
+  }
+  if (gTestIndex < gTestWindows.length) {
+    testWindow = window.open(gTestWindows[gTestIndex], "", "width=500,height=500");
+    gTestIndex++;
+  } else {
+    SpecialPowers.setBoolPref("full-screen-api.enabled", prevEnabled);
+    SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", prevTrusted);	
+    SimpleTest.finish();
+  }
+}
+
+addLoadEvent(nextTest);
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</pre>
+</body>
+</html>