Backed out changeset 04144901baf6 (bug 1182338)
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 30 Jul 2015 16:09:58 +0200
changeset 287026 abd39f27c6682f1af8a3bf26858da00a1fee688b
parent 287025 89167fe9d3ba17e66010f05faf98eb82e7719095
child 287027 305ba37a62f883a1f386bcc3e002024aa1daf907
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1182338
milestone42.0a1
backs out04144901baf68f0f8e4957b15bf29ccdce286fc8
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 04144901baf6 (bug 1182338)
browser/base/content/test/general/browser_contentSearchUI.js
browser/base/content/test/general/contentSearchUI.js
--- a/browser/base/content/test/general/browser_contentSearchUI.js
+++ b/browser/base/content/test/general/browser_contentSearchUI.js
@@ -97,17 +97,17 @@ add_task(function* rightLeftKeys() {
 
   state = yield msg("key", "VK_DOWN");
   checkState(state, "xfoo", ["xfoo", "xbar"], 0);
 
   // This should make the xfoo suggestion sticky.  To make sure it sticks,
   // trigger suggestions again and cycle through them by pressing Down until
   // nothing is selected again.
   state = yield msg("key", "VK_RIGHT");
-  checkState(state, "xfoo", [], -1);
+  checkState(state, "xfoo", [], 0);
 
   state = yield msg("key", { key: "VK_DOWN", waitForSuggestions: true });
   checkState(state, "xfoo", ["xfoofoo", "xfoobar"], -1);
 
   state = yield msg("key", "VK_DOWN");
   checkState(state, "xfoofoo", ["xfoofoo", "xfoobar"], 0);
 
   state = yield msg("key", "VK_DOWN");
@@ -120,212 +120,30 @@ add_task(function* rightLeftKeys() {
   checkState(state, "xfoo", ["xfoofoo", "xfoobar"], 3);
 
   state = yield msg("key", "VK_DOWN");
   checkState(state, "xfoo", ["xfoofoo", "xfoobar"], -1);
 
   yield msg("reset");
 });
 
-add_task(function* tabKey() {
-  yield setUp();
-  yield msg("key", { key: "x", waitForSuggestions: true });
-
-  let state = yield msg("key", "VK_TAB");
-  checkState(state, "x", ["xfoo", "xbar"], 2);
-
-  state = yield msg("key", "VK_TAB");
-  checkState(state, "x", ["xfoo", "xbar"], 3);
-
-  state = yield msg("key", { key: "VK_TAB", modifiers: { shiftKey: true }});
-  checkState(state, "x", ["xfoo", "xbar"], 2);
-
-  state = yield msg("key", { key: "VK_TAB", modifiers: { shiftKey: true }});
-  checkState(state, "x", [], -1);
-
-  yield setUp();
-
-  yield msg("key", { key: "VK_DOWN", waitForSuggestions: true });
-
-  for (let i = 0; i < 3; ++i) {
-    state = yield msg("key", "VK_TAB");
-  }
-  checkState(state, "x", [], -1);
-
-  yield setUp();
-
-  yield msg("key", { key: "VK_DOWN", waitForSuggestions: true });
-  state = yield msg("key", "VK_DOWN");
-  checkState(state, "xfoo", ["xfoo", "xbar"], 0);
-
-  state = yield msg("key", "VK_TAB");
-  checkState(state, "xfoo", ["xfoo", "xbar"], 0, 0);
-
-  state = yield msg("key", "VK_TAB");
-  checkState(state, "xfoo", ["xfoo", "xbar"], 0, 1);
-
-  state = yield msg("key", "VK_DOWN");
-  checkState(state, "xbar", ["xfoo", "xbar"], 1, 1);
-
-  state = yield msg("key", "VK_DOWN");
-  checkState(state, "x", ["xfoo", "xbar"], 2);
-
-  state = yield msg("key", "VK_UP");
-  checkState(state, "xbar", ["xfoo", "xbar"], 1);
-
-  state = yield msg("key", "VK_TAB");
-  checkState(state, "xbar", ["xfoo", "xbar"], 1, 0);
-
-  state = yield msg("key", "VK_TAB");
-  checkState(state, "xbar", ["xfoo", "xbar"], 1, 1);
-
-  state = yield msg("key", "VK_TAB");
-  checkState(state, "xbar", [], -1);
-
-  yield msg("reset");
-});
-
-add_task(function* cycleSuggestions() {
-  yield setUp();
-  yield msg("key", { key: "x", waitForSuggestions: true });
-
-  let cycle = Task.async(function* (aSelectedButtonIndex) {
-    let modifiers = {
-      shiftKey: true,
-      accelKey: true,
-    };
-  
-    let state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
-    checkState(state, "xfoo", ["xfoo", "xbar"], 0, aSelectedButtonIndex);
-  
-    state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
-    checkState(state, "xbar", ["xfoo", "xbar"], 1, aSelectedButtonIndex);
-  
-    state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
-    checkState(state, "x", ["xfoo", "xbar"], -1, aSelectedButtonIndex);
-  
-    state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
-    checkState(state, "xfoo", ["xfoo", "xbar"], 0, aSelectedButtonIndex);
-  
-    state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
-    checkState(state, "x", ["xfoo", "xbar"], -1, aSelectedButtonIndex);
-  
-    state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
-    checkState(state, "xbar", ["xfoo", "xbar"], 1, aSelectedButtonIndex);
-  
-    state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
-    checkState(state, "xfoo", ["xfoo", "xbar"], 0, aSelectedButtonIndex);
-  
-    state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
-    checkState(state, "x", ["xfoo", "xbar"], -1, aSelectedButtonIndex);
-  });
-  
-  yield cycle();
-
-  // Repeat with a one-off selected.
-  let state = yield msg("key", "VK_TAB");
-  checkState(state, "x", ["xfoo", "xbar"], 2);
-  yield cycle(0);
-
-  // Repeat with the settings button selected.
-  state = yield msg("key", "VK_TAB");
-  checkState(state, "x", ["xfoo", "xbar"], 3);
-  yield cycle(1);
-
-  yield msg("reset");
-});
-
-add_task(function* cycleOneOffs() {
-  yield setUp();
-  yield msg("key", { key: "x", waitForSuggestions: true });
-
-  yield msg("addDuplicateOneOff");
-
-  let state = yield msg("key", "VK_DOWN");
-  state = yield msg("key", "VK_DOWN");
-  checkState(state, "xbar", ["xfoo", "xbar"], 1);
-
-  let modifiers = {
-    altKey: true,
-  };
-
-  state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
-  checkState(state, "xbar", ["xfoo", "xbar"], 1, 0);
-
-  state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
-  checkState(state, "xbar", ["xfoo", "xbar"], 1, 1);
-
-  state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
-  checkState(state, "xbar", ["xfoo", "xbar"], 1);
-
-  state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
-  checkState(state, "xbar", ["xfoo", "xbar"], 1, 1);
-
-  state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
-  checkState(state, "xbar", ["xfoo", "xbar"], 1, 0);
-
-  state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
-  checkState(state, "xbar", ["xfoo", "xbar"], 1);
-
-  // If the settings button is selected, pressing alt+up/down should select the
-  // last/first one-off respectively (and deselect the settings button).
-  yield msg("key", "VK_TAB");
-  yield msg("key", "VK_TAB");
-  state = yield msg("key", "VK_TAB"); // Settings button selected.
-  checkState(state, "xbar", ["xfoo", "xbar"], 1, 2);
-
-  state = yield msg("key", { key: "VK_UP", modifiers: modifiers });
-  checkState(state, "xbar", ["xfoo", "xbar"], 1, 1);
-
-  state = yield msg("key", "VK_TAB");
-  checkState(state, "xbar", ["xfoo", "xbar"], 1, 2);
-
-  state = yield msg("key", { key: "VK_DOWN", modifiers: modifiers });
-  checkState(state, "xbar", ["xfoo", "xbar"], 1, 0);
-
-  yield msg("removeLastOneOff");
-  yield msg("reset");
-});
-
 add_task(function* mouse() {
   yield setUp();
 
   let state = yield msg("key", { key: "x", waitForSuggestions: true });
   checkState(state, "x", ["xfoo", "xbar"], -1);
 
-  state = yield msg("mousemove", 0);
-  checkState(state, "x", ["xfoo", "xbar"], 0);
-
-  state = yield msg("mousemove", 1);
-  checkState(state, "x", ["xfoo", "xbar"], 1);
-
-  state = yield msg("mousemove", 2);
-  checkState(state, "x", ["xfoo", "xbar"], 1, 0);
-
-  state = yield msg("mousemove", 3);
-  checkState(state, "x", ["xfoo", "xbar"], 1, 1);
+  for (let i = 0; i < 4; ++i) {
+    state = yield msg("mousemove", i);
+    checkState(state, "x", ["xfoo", "xbar"], i);
+  }
 
   state = yield msg("mousemove", -1);
-  checkState(state, "x", ["xfoo", "xbar"], 1);
-
-  yield msg("reset");
-  yield setUp();
-
-  state = yield msg("key", { key: "x", waitForSuggestions: true });
   checkState(state, "x", ["xfoo", "xbar"], -1);
 
-  state = yield msg("mousemove", 0);
-  checkState(state, "x", ["xfoo", "xbar"], 0);
-
-  state = yield msg("mousemove", 2);
-  checkState(state, "x", ["xfoo", "xbar"], 0, 0);
-
-  state = yield msg("mousemove", -1);
-  checkState(state, "x", ["xfoo", "xbar"], 0);
-
   yield msg("reset");
 });
 
 add_task(function* formHistory() {
   yield setUp();
 
   // Type an X and add it to form history.
   let state = yield msg("key", { key: "x", waitForSuggestions: true });
@@ -374,43 +192,16 @@ add_task(function* formHistory() {
 
   // Type an X again.  The form history entry should still be gone.
   state = yield msg("key", { key: "x", waitForSuggestions: true });
   checkState(state, "x", ["xfoo", "xbar"], -1);
 
   yield msg("reset");
 });
 
-add_task(function* cycleEngines() {
-  yield setUp();
-  yield msg("key", "VK_DOWN");
-
-  function promiseEngineChange(newEngineName) {
-    let deferred = Promise.defer();
-    Services.obs.addObserver(function resolver(subj, topic, data) {
-      if (data != "engine-current") {
-        return;
-      }
-      is(subj.name, newEngineName, "Engine cycled correctly");
-      Services.obs.removeObserver(resolver, "browser-search-engine-modified");
-      deferred.resolve();
-    }, "browser-search-engine-modified", false);
-  }
-
-  let p = promiseEngineChange(TEST_ENGINE_PREFIX + " " + TEST_ENGINE_2_BASENAME);
-  yield msg("key", { key: "VK_DOWN", modifiers: { accelKey: true }});
-  yield p;
-
-  p = promiseEngineChange(TEST_ENGINE_PREFIX + " " + TEST_ENGINE_BASENAME);
-  yield msg("key", { key: "VK_UP", modifiers: { accelKey: true }});
-  yield p;
-
-  yield msg("reset");
-});
-
 add_task(function* search() {
   yield setUp();
 
   let modifiers = {};
   ["altKey", "ctrlKey", "metaKey", "shiftKey"].forEach(k => modifiers[k] = true);
 
   // Test typing a query and pressing enter.
   let p = msg("waitForSearch");
@@ -501,67 +292,29 @@ add_task(function* search() {
   eventData.searchString = "x";
   eventData.engineName = TEST_ENGINE_PREFIX + " " + TEST_ENGINE_2_BASENAME;
   delete eventData.selection;
   SimpleTest.isDeeply(eventData, mesg, "Search event data");
 
   yield promiseTab();
   yield setUp();
 
-  // Test selecting a suggestion, then clicking a one-off without deselecting the
-  // suggestion.
-  yield msg("key", { key: "x", waitForSuggestions: true });
-  p = msg("waitForSearch");
-  yield msg("mousemove", 1);
-  yield msg("mousemove", 3);
-  yield msg("click", { eltIdx: 3, modifiers: modifiers });
-  mesg = yield p;
-  eventData.searchString = "xfoo"
-  eventData.selection = {
-    index: 1,
-    kind: "mouse",
-  };
-  SimpleTest.isDeeply(eventData, mesg, "Search event data");
-
-  yield promiseTab();
-  yield setUp();
-
-  // Same as above, but with the keyboard.
-  delete modifiers.button;
-  yield msg("key", { key: "x", waitForSuggestions: true });
-  p = msg("waitForSearch");
-  yield msg("key", "VK_DOWN");
-  yield msg("key", "VK_DOWN");
-  yield msg("key", "VK_TAB");
-  yield msg("key", { key: "VK_RETURN", modifiers: modifiers });
-  mesg = yield p;
-  eventData.selection = {
-    index: 1,
-    kind: "key",
-  };
-  SimpleTest.isDeeply(eventData, mesg, "Search event data");
-
-  yield promiseTab();
-  yield setUp();
-
   // Test searching when using IME composition.
   let state = yield msg("startComposition", { data: "" });
   checkState(state, "", [], -1);
   state = yield msg("changeComposition", { data: "x", waitForSuggestions: true });
   checkState(state, "x", [{ str: "x", type: "formHistory" },
                           { str: "xfoo", type: "formHistory" }, "xbar"], -1);
   yield msg("commitComposition");
   delete modifiers.button;
   p = msg("waitForSearch");
   yield msg("key", { key: "VK_RETURN", modifiers: modifiers });
   mesg = yield p;
-  eventData.searchString = "x"
   eventData.originalEvent = modifiers;
   eventData.engineName = TEST_ENGINE_PREFIX + " " + TEST_ENGINE_BASENAME;
-  delete eventData.selection;
   SimpleTest.isDeeply(eventData, mesg, "Search event data");
 
   yield promiseTab();
   yield setUp();
 
   state = yield msg("startComposition", { data: "" });
   checkState(state, "", [], -1);
   state = yield msg("changeComposition", { data: "x", waitForSuggestions: true });
@@ -670,49 +423,36 @@ function msg(type, data=null) {
     }
     gMsgMan.removeMessageListener(TEST_MSG, onMsg);
     deferred.resolve(msg.data.data);
   });
   return deferred.promise;
 }
 
 function checkState(actualState, expectedInputVal, expectedSuggestions,
-                    expectedSelectedIdx, expectedSelectedButtonIdx) {
+                    expectedSelectedIdx) {
   expectedSuggestions = expectedSuggestions.map(sugg => {
     return typeof(sugg) == "object" ? sugg : {
       str: sugg,
       type: "remote",
     };
   });
 
-  if (expectedSelectedIdx == -1 && expectedSelectedButtonIdx != undefined) {
-    expectedSelectedIdx = expectedSuggestions.length + expectedSelectedButtonIdx;
-  }
-  
   let expectedState = {
     selectedIndex: expectedSelectedIdx,
     numSuggestions: expectedSuggestions.length,
     suggestionAtIndex: expectedSuggestions.map(s => s.str),
     isFormHistorySuggestionAtIndex:
       expectedSuggestions.map(s => s.type == "formHistory"),
 
     tableHidden: expectedSuggestions.length == 0,
 
     inputValue: expectedInputVal,
     ariaExpanded: expectedSuggestions.length == 0 ? "false" : "true",
   };
-  if (expectedSelectedButtonIdx != undefined) {
-    expectedState.selectedButtonIndex = expectedSelectedButtonIdx;
-  }
-  else if (expectedSelectedIdx < expectedSuggestions.length) {
-    expectedState.selectedButtonIndex = -1;
-  }
-  else {
-    expectedState.selectedButtonIndex = expectedSelectedIdx - expectedSuggestions.length;
-  }
 
   SimpleTest.isDeeply(actualState, expectedState, "State");
 }
 
 var gMsgMan;
 
 function promiseTab() {
   let deferred = Promise.defer();
--- a/browser/base/content/test/general/contentSearchUI.js
+++ b/browser/base/content/test/general/contentSearchUI.js
@@ -119,37 +119,21 @@ let messageHandlers = {
     ack("click");
   },
 
   addInputValueToFormHistory: function () {
     gController.addInputValueToFormHistory();
     ack("addInputValueToFormHistory");
   },
 
-  addDuplicateOneOff: function () {
-    let btn = gController._oneOffButtons[gController._oneOffButtons.length - 1];
-    let newBtn = btn.cloneNode(true);
-    btn.parentNode.appendChild(newBtn);
-    gController._oneOffButtons.push(newBtn);
-    ack("addDuplicateOneOff");
-  },
-
-  removeLastOneOff: function () {
-    gController._oneOffButtons.pop().remove();
-    ack("removeLastOneOff");
-  },
-
   reset: function () {
-    // Reset both the input and suggestions by select all + delete. If there was
-    // no text entered, this won't have any effect, so also escape to ensure the
-    // suggestions table is closed.
+    // Reset both the input and suggestions by select all + delete.
     gController.input.focus();
     content.synthesizeKey("a", { accelKey: true });
     content.synthesizeKey("VK_DELETE", {});
-    content.synthesizeKey("VK_ESCAPE", {});
     ack("reset");
   },
 };
 
 function ack(aType, aData) {
   sendAsyncMessage(TEST_MSG, { type: aType, data: aData || currentState() });
 }
 
@@ -176,17 +160,16 @@ function waitForContentSearchEvent(messa
     mm.removeMessageListener("ContentSearch", listener);
     cb(aMsg.data.data);
   });
 }
 
 function currentState() {
   let state = {
     selectedIndex: gController.selectedIndex,
-    selectedButtonIndex: gController.selectedButtonIndex,
     numSuggestions: gController._table.hidden ? 0 : gController.numSuggestions,
     suggestionAtIndex: [],
     isFormHistorySuggestionAtIndex: [],
 
     tableHidden: gController._table.hidden,
 
     inputValue: gController.input.value,
     ariaExpanded: gController.input.getAttribute("aria-expanded"),