Bug 997996 - Make ToolbarComponent.dismissEditingMode use the cancel editing mode button. r=mcomella
authorvivek <vivekb.balakrishnan@gmail.com>
Mon, 21 Apr 2014 13:27:00 +0200
changeset 179601 162b121760e1dfba54bc7c30f91929ad461b7e73
parent 179600 f2bfa7425575e8d769f8b705667b184e5b75138d
child 179602 fd8dd096ffe4239ac033854b2a467ab21bcc73bd
push id26631
push userryanvm@gmail.com
push dateTue, 22 Apr 2014 20:05:15 +0000
treeherdermozilla-central@1ab07aa4d004 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella
bugs997996
milestone31.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 997996 - Make ToolbarComponent.dismissEditingMode use the cancel editing mode button. r=mcomella
mobile/android/base/tests/components/ToolbarComponent.java
--- a/mobile/android/base/tests/components/ToolbarComponent.java
+++ b/mobile/android/base/tests/components/ToolbarComponent.java
@@ -81,16 +81,23 @@ public class ToolbarComponent extends Ba
         return (ImageButton) getToolbarView().findViewById(R.id.back);
     }
 
     private ImageButton getForwardButton() {
         DeviceHelper.assertIsTablet();
         return (ImageButton) getToolbarView().findViewById(R.id.forward);
     }
 
+    /**
+     * Returns the View for the edit cancel button in the browser toolbar.
+     */
+    private ImageButton getEditCancelButton() {
+        return (ImageButton) getToolbarView().findViewById(R.id.edit_cancel);
+    }
+
     private CharSequence getTitle() {
         return getTitleHelper(true);
     }
 
     /**
      * Returns the title of the page. Note that this makes no assertions to Toolbar state and
      * may return a value that may never be visible to the user. Callers likely want to use
      * {@link assertTitle} instead.
@@ -140,25 +147,30 @@ public class ToolbarComponent extends Ba
         waitForNotEditing();
 
         return this;
     }
 
     public ToolbarComponent dismissEditingMode() {
         assertIsEditing();
 
-        if (getUrlEditText().isInputMethodTarget()) {
-            // Drop the soft keyboard.
-            // TODO: Solo.hideSoftKeyboard() does not clear focus, causing unexpected
-            // behavior, but we may want to use it over goBack().
+        // Cancel Button not implemeneted in tablet.
+        if (DeviceHelper.isTablet()) {
+            if (getUrlEditText().isInputMethodTarget()) {
+                // Drop the soft keyboard.
+                // TODO: Solo.hideSoftKeyboard() does not clear focus, causing unexpected
+                // behavior, but we may want to use it over goBack().
+                mSolo.goBack();
+            }
+
             mSolo.goBack();
+        } else {
+            mSolo.clickOnView(getEditCancelButton());
         }
 
-        mSolo.goBack();
-
         waitForNotEditing();
 
         return this;
     }
 
     public ToolbarComponent enterUrl(final String url) {
         fAssertNotNull("url is not null", url);