Backed out changeset 9ad67a907cae (bug 1261306) for test failures like test_autocomplete_change_after_focus.html
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 21 Apr 2016 15:33:02 +0200
changeset 331978 4ac3b4265ce2205bab28de9f09da31379e23b785
parent 331977 a4dc7ffd8a5fe88f29080999a5b1cbef6c3bb70e
child 331979 252417bdd33d5224a90a37043469592632e5cbc7
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1261306
milestone48.0a1
backs out9ad67a907cae9644493ecbabae4529602ca3fa72
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
Backed out changeset 9ad67a907cae (bug 1261306) for test failures like test_autocomplete_change_after_focus.html
toolkit/content/tests/chrome/chrome.ini
toolkit/content/tests/chrome/test_autocomplete_change_after_focus.html
toolkit/content/tests/mochitest/mochitest.ini
toolkit/content/tests/mochitest/test_autocomplete_change_after_focus.html
--- a/toolkit/content/tests/chrome/chrome.ini
+++ b/toolkit/content/tests/chrome/chrome.ini
@@ -49,16 +49,17 @@ support-files =
   rtltest/content/dirtest.xul
 
 [test_about_networking.html]
 [test_arrowpanel.xul]
 [test_autocomplete2.xul]
 [test_autocomplete3.xul]
 [test_autocomplete4.xul]
 [test_autocomplete5.xul]
+[test_autocomplete_change_after_focus.html]
 [test_autocomplete_delayOnPaste.xul]
 [test_autocomplete_emphasis.xul]
 [test_autocomplete_with_composition_on_input.html]
 [test_autocomplete_with_composition_on_textbox.xul]
 [test_autocomplete_placehold_last_complete.xul]
 [test_browser_drop.xul]
 skip-if = buildapp == 'mulet'
 [test_bug253481.xul]
rename from toolkit/content/tests/mochitest/test_autocomplete_change_after_focus.html
rename to toolkit/content/tests/chrome/test_autocomplete_change_after_focus.html
--- a/toolkit/content/tests/mochitest/test_autocomplete_change_after_focus.html
+++ b/toolkit/content/tests/chrome/test_autocomplete_change_after_focus.html
@@ -1,103 +1,67 @@
 <!DOCTYPE html>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=998893
 -->
 <head>
   <meta charset="utf-8">
   <title>Test for Bug 998893 - Ensure that input.value changes affect autocomplete</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-  <script type="text/javascript">
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript">
   /** Test for Bug 998893 **/
-  add_task(function* waitForFocus() {
-    yield new Promise(resolve => SimpleTest.waitForFocus(resolve));
-  });
+  SimpleTest.waitForExplicitFinish();
+  SimpleTest.waitForFocus(setup);
 
-  add_task(function* setup() {
-    yield new Promise(resolve => {
-      let chromeScript = SpecialPowers.loadChromeScript(function() {
-        const {FormHistory} = Components.utils.import("resource://gre/modules/FormHistory.jsm", null);
-        FormHistory.update([
-          { op : "bump", fieldname: "field1", value: "Default text option" },
-          { op : "bump", fieldname: "field1", value: "New value option" },
-        ], {
-          handleCompletion: function() {
-            sendAsyncMessage("Test:Resume");
-          },
-        });
-      });
+  function setup() {
+    SpecialPowers.formHistory.update([
+      { op : "bump", fieldname: "field1", value: "Default text option" },
+      { op : "bump", fieldname: "field1", value: "New value option" },
+    ], {
+      handleCompletion: function() {
+        runTest();
+      },
+    });
+  }
 
-      chromeScript.addMessageListener("Test:Resume", function resumeListener() {
-        chromeScript.removeMessageListener("Test:Resume", resumeListener);
-        chromeScript.destroy();
-        resolve();
-      });
-    });
-  });
+  function handleEnter(evt) {
+    if (evt.keyCode != KeyEvent.DOM_VK_RETURN) {
+      return;
+    }
+    info("RETURN received for phase: " + evt.eventPhase);
+    is(evt.target.value, "New value option", "Check that the correct autocomplete entry was used");
+    SimpleTest.finish();
+  }
 
-  add_task(function* runTest() {
-    let promisePopupShown = new Promise(resolve => {
-      let chromeScript = SpecialPowers.loadChromeScript(function() {
-        Components.utils.import("resource://gre/modules/Services.jsm");
-        let window = Services.wm.getMostRecentWindow("navigator:browser");
-        let popup = window.document.getElementById("PopupAutoComplete");
-        popup.addEventListener("popupshown", function popupShown() {
-          popup.removeEventListener("popupshown", popupShown);
-          sendAsyncMessage("Test:Resume");
-        });
-      });
+  function popupShownListener(evt) {
+    info("popupshown");
+    sendKey("DOWN");
+    sendKey("RETURN"); // select the first entry in the popup
+    sendKey("RETURN"); // try to submit the form with the filled value
+  }
 
-      chromeScript.addMessageListener("Test:Resume", function resumeListener() {
-        chromeScript.removeMessageListener("Test:Resume", resumeListener);
-        chromeScript.destroy();
-        resolve();
-      });
+  SpecialPowers.addAutoCompletePopupEventListener(window, "popupshown", popupShownListener);
+
+  function runTest() {
+    var field = document.getElementById("field1");
+    field.addEventListener("focus", function onFocus() {
+      info("field focused");
+      field.value = "New value";
+      sendKey("DOWN");
     });
 
-    let field = document.getElementById("field1");
-
-    let promiseFieldFocus = new Promise(resolve => {
-      field.addEventListener("focus", function onFocus() {
-        info("field focused");
-        field.value = "New value";
-        sendKey("DOWN");
-        resolve();
-      });
-    });
-
-    let handleEnterPromise = new Promise(resolve => {
-      function handleEnter(evt) {
-        if (evt.keyCode != KeyEvent.DOM_VK_RETURN) {
-          return;
-        }
-        info("RETURN received for phase: " + evt.eventPhase);
-        is(evt.target.value, "New value option", "Check that the correct autocomplete entry was used");
-        resolve();
-      }
-
-      field.addEventListener("keypress", handleEnter, true);
-    });
+    field.addEventListener("keypress", handleEnter, true);
 
     field.focus();
-
-    yield promiseFieldFocus;
-
-    yield promisePopupShown;
+  }
 
-    sendKey("DOWN");
-    sendKey("RETURN");
-    sendKey("RETURN");
-
-    yield handleEnterPromise;
-  });
   </script>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=998893">Mozilla Bug 998893</a>
 <p id="display"><input id="field1" value="Default text"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 </pre>
--- a/toolkit/content/tests/mochitest/mochitest.ini
+++ b/toolkit/content/tests/mochitest/mochitest.ini
@@ -1,4 +1,3 @@
-[test_autocomplete_change_after_focus.html]
 [test_mousecapture.xhtml]
 skip-if = toolkit == "android"