Bug 952800 - Intermittent TEST-UNEXPECTED-FAIL | browser_form_auto_complete.js | autofill item list length mismatch, some items were not found. - Got 5, expected 6 r=jimm a=test-only
authorRodrigo Silveira <rsilveira@mozilla.com>
Wed, 29 Jan 2014 12:24:05 -0800
changeset 225597 1ada2104ea5b61eee69c15789f974b27eddee098
parent 225596 1783cd636fe99138d4bbbfc279d5ce735482087f
child 225598 4476fa860f4aff8e31110b75b40b4ffb95b7d52e
push id6
push userryanvm@gmail.com
push dateMon, 12 Jan 2015 22:04:06 +0000
treeherdermozilla-b2g37_v2_2@895c8fc7b734 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, test-only
bugs952800
milestone28.0a2
Bug 952800 - Intermittent TEST-UNEXPECTED-FAIL | browser_form_auto_complete.js | autofill item list length mismatch, some items were not found. - Got 5, expected 6 r=jimm a=test-only
browser/metro/base/tests/mochitest/browser_form_auto_complete.html
browser/metro/base/tests/mochitest/browser_form_auto_complete.js
browser/metro/base/tests/mochitest/head.js
--- a/browser/metro/base/tests/mochitest/browser_form_auto_complete.html
+++ b/browser/metro/base/tests/mochitest/browser_form_auto_complete.html
@@ -1,16 +1,16 @@
 <!DOCTYPE html>
 <html>
 <head>
 <style>
 </style>
 </head>
 <body style="margin: 20px 20px 20px 20px;">
-<form id="form1" method="get" action="" autocomplete="on">
+<form id="form1" method="get" autocomplete="on">
 <datalist id="testdatalist">
    <option value="one">
    <option value="two">
    <option value="three">
    <option value="four">
    <option value="five">
 </datalist> 
 <input autocomplete="on" list="testdatalist" id="textedit1" style="width:200px;" type="text" />
--- a/browser/metro/base/tests/mochitest/browser_form_auto_complete.js
+++ b/browser/metro/base/tests/mochitest/browser_form_auto_complete.js
@@ -55,19 +55,18 @@ gTests.push({
       return !Browser.selectedTab.isLoading();
     });
 
     let tabDocument = Browser.selectedTab.browser.contentWindow.document;
     let form = tabDocument.getElementById("form1");
     let input = tabDocument.getElementById("textedit1");
 
     input.value = "hellothere";
-    form.action = chromeRoot + "browser_form_auto_complete.html";
 
-    loadedPromise = waitForEvent(Browser.selectedTab.browser, "DOMContentLoaded");
+    loadedPromise = waitForObserver("satchel-storage-changed", null, "formhistory-add");
     form.submit();
     yield loadedPromise;
 
     // XXX Solves a problem with events not getting delivered to Content.js
     // immediately after submitting the form.
     yield waitForMs(500);
 
     tabDocument = Browser.selectedTab.browser.contentWindow.document;
--- a/browser/metro/base/tests/mochitest/head.js
+++ b/browser/metro/base/tests/mochitest/head.js
@@ -514,17 +514,17 @@ function waitForImageLoad(aWindow, aImag
 
 /**
  * Waits a specified number of miliseconds for an observer event.
  *
  * @param aObsEvent the observer event to wait for
  * @param aTimeoutMs the number of miliseconds to wait before giving up
  * @returns a Promise that resolves to true, or to an Error
  */
-function waitForObserver(aObsEvent, aTimeoutMs) {
+function waitForObserver(aObsEvent, aTimeoutMs, aObsData) {
   try {
 
   let deferred = Promise.defer();
   let timeoutMs = aTimeoutMs || kDefaultWait;
   let timerID = 0;
 
   var observeWatcher = {
     onEvent: function () {
@@ -535,17 +535,18 @@ function waitForObserver(aObsEvent, aTim
 
     onError: function () {
       clearTimeout(timerID);
       Services.obs.removeObserver(this, aObsEvent);
       deferred.reject(new Error(aObsEvent + " event timeout"));
     },
 
     observe: function (aSubject, aTopic, aData) {
-      if (aTopic == aObsEvent) {
+      if (aTopic == aObsEvent &&
+        (!aObsData || (aObsData == aData))) {
         this.onEvent();
       }
     },
 
     QueryInterface: function (aIID) {
       if (!aIID.equals(Ci.nsIObserver) &&
           !aIID.equals(Ci.nsISupportsWeakReference) &&
           !aIID.equals(Ci.nsISupports)) {