Bug 1522440 - Finish porting browser_test_focus_urlbar.js to quantumbar. r=adw
authorDão Gottwald <dao@mozilla.com>
Wed, 08 May 2019 22:04:54 +0000
changeset 535023 bd51101014c06c2c7751bd075ea0eca5975d900c
parent 535022 0f82265a6ae5eb2906d16bd61b4494c8b36f55f4
child 535024 d9cf7d539c45e2895193e507840bf1bdec6cb21b
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1522440
milestone68.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 1522440 - Finish porting browser_test_focus_urlbar.js to quantumbar. r=adw Differential Revision: https://phabricator.services.mozilla.com/D30346
accessible/tests/browser/events/browser.ini
accessible/tests/browser/events/browser_test_focus_urlbar.js
browser/components/urlbar/UrlbarController.jsm
--- a/accessible/tests/browser/events/browser.ini
+++ b/accessible/tests/browser/events/browser.ini
@@ -7,9 +7,8 @@ support-files =
 
 [browser_test_docload.js]
 skip-if = e10s
 [browser_test_scrolling.js]
 [browser_test_textcaret.js]
 [browser_test_focus_browserui.js]
 [browser_test_focus_dialog.js]
 [browser_test_focus_urlbar.js]
-skip-if = true # Skipping temporarily, tracked in bug 1522440.
--- a/accessible/tests/browser/events/browser_test_focus_urlbar.js
+++ b/accessible/tests/browser/events/browser_test_focus_urlbar.js
@@ -147,19 +147,23 @@ async function runTests() {
   testStates(event.accessible, STATE_FOCUSED);
 
   info("Ensuring text box focus on backspace");
   focused = waitForEvent(EVENT_FOCUS, textBox);
   EventUtils.synthesizeKey("KEY_Backspace");
   await focused;
   testStates(textBox, STATE_FOCUSED);
 
-  info("Ensuring autocomplete focus on down arrow (4)");
+  info("Ensuring autocomplete focus on arrow down & up");
   focused = waitForEvent(EVENT_FOCUS, isEventForAutocompleteItem);
   EventUtils.synthesizeKey("KEY_ArrowDown");
+  // With the quantumbar enabled, we only get one result here, and arrow down
+  // selects a one-off search button. We arrow back up to re-select the
+  // autocomplete result.
+  EventUtils.synthesizeKey("KEY_ArrowUp");
   event = await focused;
   testStates(event.accessible, STATE_FOCUSED);
 
   info("Ensuring text box focus on text selection");
   focused = waitForEvent(EVENT_FOCUS, textBox);
   EventUtils.synthesizeKey("KEY_ArrowLeft", {shiftKey: true});
   await focused;
   testStates(textBox, STATE_FOCUSED);
--- a/browser/components/urlbar/UrlbarController.jsm
+++ b/browser/components/urlbar/UrlbarController.jsm
@@ -292,18 +292,18 @@ class UrlbarController {
         }
         if (executeAction) {
           this.input.handleCommand(event);
         }
         break;
       case KeyEvent.DOM_VK_TAB:
         if (this.view.isOpen) {
           if (executeAction) {
+            this.userSelectionBehavior = "tab";
             this.view.selectBy(1, { reverse: event.shiftKey });
-            this.userSelectionBehavior = "tab";
           }
           event.preventDefault();
         }
         break;
       case KeyEvent.DOM_VK_DOWN:
       case KeyEvent.DOM_VK_UP:
       case KeyEvent.DOM_VK_PAGE_DOWN:
       case KeyEvent.DOM_VK_PAGE_UP:
@@ -342,17 +342,17 @@ class UrlbarController {
         if (!this.view.isOpen) {
           break;
         }
         if (event.shiftKey) {
           if (!executeAction || this._handleDeleteEntry()) {
             event.preventDefault();
           }
         } else if (executeAction) {
-          this.view.removeAccessibleFocus();
+          this.userSelectionBehavior = "none";
         }
         break;
     }
   }
 
   /**
    * Tries to initialize a speculative connection on a result.
    * Speculative connections are only supported for a subset of all the results.