From 4e8ee7ac441d8fbf87c1b80ebb2ed7ab3c5c8e9b Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Mon, 3 Dec 2007 22:35:08 +0000 Subject: [PATCH] Bug 405664: keyboard shortcuts to display the search engine list broken, r=enndeakin, a=schrep git-svn-id: svn://10.0.0.236/trunk@240362 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/browser/components/search/Makefile.in | 4 ++ .../components/search/content/search.xml | 2 +- .../components/search/test/Makefile.in | 51 +++++++++++++++++++ .../components/search/test/browser_405664.js | 29 +++++++++++ 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 mozilla/browser/components/search/test/Makefile.in create mode 100644 mozilla/browser/components/search/test/browser_405664.js diff --git a/mozilla/browser/components/search/Makefile.in b/mozilla/browser/components/search/Makefile.in index e7d99e4d1c2..9d14bbd85c2 100644 --- a/mozilla/browser/components/search/Makefile.in +++ b/mozilla/browser/components/search/Makefile.in @@ -43,6 +43,10 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk +ifdef MOZ_MOCHITEST +DIRS = test +endif + MODULE = browsersearch XPIDL_MODULE = browsersearch diff --git a/mozilla/browser/components/search/content/search.xml b/mozilla/browser/components/search/content/search.xml index 4e2fd1673aa..c3cfd8233f3 100644 --- a/mozilla/browser/components/search/content/search.xml +++ b/mozilla/browser/components/search/content/search.xml @@ -687,7 +687,7 @@ (Original author) +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ +relativesrcdir = browser/components/search/test + +include $(DEPTH)/config/autoconf.mk +include $(topsrcdir)/config/rules.mk + +_BROWSER_TEST_FILES = browser_405664.js \ + $(NULL) + +libs:: $(_BROWSER_TEST_FILES) + $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir) diff --git a/mozilla/browser/components/search/test/browser_405664.js b/mozilla/browser/components/search/test/browser_405664.js new file mode 100644 index 00000000000..2d3ee248f13 --- /dev/null +++ b/mozilla/browser/components/search/test/browser_405664.js @@ -0,0 +1,29 @@ +function test() { + var searchBar = BrowserSearch.searchBar; + ok(searchBar, "got search bar"); + + searchBar.focus(); + + var pbo = searchBar._popup.popupBoxObject; + ok(pbo, "popup is nsIPopupBoxObject"); + + EventUtils.synthesizeKey("VK_UP", { altKey: true }); + is(pbo.popupState, "showing", "popup is opening after Alt+Up"); + + EventUtils.synthesizeKey("VK_ESCAPE", {}); + is(pbo.popupState, "closed", "popup is closed after ESC"); + + EventUtils.synthesizeKey("VK_DOWN", { altKey: true }); + is(pbo.popupState, "showing", "popup is opening after Alt+Down"); + + EventUtils.synthesizeKey("VK_ESCAPE", {}); + is(pbo.popupState, "closed", "popup is closed after ESC 2"); + + if (!/Mac/.test(navigator.platform)) { + EventUtils.synthesizeKey("VK_F4", {}); + is(pbo.popupState, "showing", "popup is opening after F4"); + + EventUtils.synthesizeKey("VK_ESCAPE", {}); + is(pbo.popupState, "closed", "popup is closed after ESC 3"); + } +}