Bug 883390 - Part 1.2 - Ensure and test that pastes from touch cause autocomplete to show (fixes 887120). r=jimm
authorJonathan Wilde <jwilde@jwilde.me>
Mon, 15 Jul 2013 11:25:45 -0700
changeset 138552 9434d96e85b5a08852a809f79c0044b776f622d4
parent 138551 47a9f741253c252a24061ff8c9a69f1c33579c6b
child 138553 c112dc25fa8c639a4de4692e20c7978cb397ecad
push id24961
push useremorley@mozilla.com
push dateTue, 16 Jul 2013 08:58:21 +0000
treeherdermozilla-central@41ed26826acb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs883390, 887120
milestone25.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 883390 - Part 1.2 - Ensure and test that pastes from touch cause autocomplete to show (fixes 887120). r=jimm
browser/metro/base/content/bindings/urlbar.xml
browser/metro/base/tests/mochitest/browser_selection_urlbar.js
browser/metro/base/tests/mochitest/head.js
--- a/browser/metro/base/content/bindings/urlbar.xml
+++ b/browser/metro/base/content/bindings/urlbar.xml
@@ -430,18 +430,20 @@
       </method>
     </implementation>
 
     <handlers>
       <!-- Entering editing mode -->
 
       <handler event="input" phase="capturing">
         <![CDATA[
-          // Ensures that paste-and-go actually brings the URL bar into editing mode.
+          // Ensures that paste-and-go actually brings the URL bar into editing mode
+          // and displays the half-height autocomplete popup.
           this.beginEditing();
+          this.openPopup();
         ]]>
       </handler>
 
       <handler event="click" phase="capturing">
         <![CDATA[
           this.beginEditing(true);
         ]]>
       </handler>
--- a/browser/metro/base/tests/mochitest/browser_selection_urlbar.js
+++ b/browser/metro/base/tests/mochitest/browser_selection_urlbar.js
@@ -51,28 +51,51 @@ gTests.push({
     ok(SelectionHelperUI.isCaretUIVisible, "caret ui active");
 
     // to the right
     let xpos = SelectionHelperUI.caretMark.xPos;
     let ypos = SelectionHelperUI.caretMark.yPos + 10;
     var touchdrag = new TouchDragAndHold();
     yield touchdrag.start(gWindow, xpos, ypos, 900, ypos);
     yield waitForCondition(function () {
-      return getTrimmedSelection(edit).toString() == 
+      return getTrimmedSelection(edit).toString() ==
         "mochitests/content/metro/browser/metro/base/tests/mochitest/res/textblock01.html";
     }, kCommonWaitMs, kCommonPollMs);
     touchdrag.end();
     yield waitForMs(100);
 
     ok(SelectionHelperUI.isSelectionUIVisible, "selection ui active");
 
     // taps on the urlbar-edit leak a ClientRect property on the window
     delete window.r;
   },
 });
 
+gTests.push({
+  desc: "bug 887120 - tap & hold to paste into urlbar",
+  run: function bug887120_test() {
+    gWindow = window;
+
+    yield showNavBar();
+    let edit = document.getElementById("urlbar-edit");
+
+    SpecialPowers.clipboardCopyString("mozilla");
+    sendContextMenuClickToElement(window, edit);
+    yield waitForEvent(document, "popupshown");
+
+    ok(ContextMenuUI._menuPopup._visible, "is visible");
+    let paste = document.getElementById("context-paste");
+    ok(!paste.hidden, "paste item is visible");
+
+    sendElementTap(window, paste);
+    ok(edit.popup.popupOpen, "bug: popup should be showing");
+
+    delete window.r;
+  }
+});
+
 function test() {
   if (!isLandscapeMode()) {
     todo(false, "browser_selection_tests need landscape mode to run.");
     return;
   }
   runTests();
 }
--- a/browser/metro/base/tests/mochitest/head.js
+++ b/browser/metro/base/tests/mochitest/head.js
@@ -703,18 +703,18 @@ TouchDragAndHold.prototype = {
     this._win = null;
   },
 };
 
 /*=============================================================================
   System utilities
 =============================================================================*/
 
- /*
- * emptyClipboard - clear the windows clipbaord.
+/*
+ * emptyClipboard - clear the windows clipboard.
  */
 function emptyClipboard() {
   Cc["@mozilla.org/widget/clipboard;1"].getService(Ci.nsIClipboard)
                                        .emptyClipboard(Ci.nsIClipboard.kGlobalClipboard);
 }
 
 /*
  * purgeEventQueue - purges the event queue on the calling thread.