diff --git a/tests/quicktestbrowser/ButtonWithMenu.qml b/tests/quicktestbrowser/ButtonWithMenu.qml
new file mode 100644
index 0000000000000000000000000000000000000000..8058b958a778833c1df80e7582db06c9e6b1505e
--- /dev/null
+++ b/tests/quicktestbrowser/ButtonWithMenu.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+**   * Redistributions of source code must retain the above copyright
+**     notice, this list of conditions and the following disclaimer.
+**   * Redistributions in binary form must reproduce the above copyright
+**     notice, this list of conditions and the following disclaimer in
+**     the documentation and/or other materials provided with the
+**     distribution.
+**   * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
+**     of its contributors may be used to endorse or promote products derived
+**     from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.3
+import QtQuick.Controls 1.2
+
+// The QtQuick controls guys are slackers, so we need to make our own stuff
+
+ToolButton {
+    id: root
+    property Menu longPressMenu
+    function showMenu() {
+        longPressMenu.__popup(0, root.height, 0)
+    }
+
+    Binding {
+        target: longPressMenu
+        property: "__visualItem"
+        value: root
+    }
+
+    MouseArea {
+        anchors.fill: parent
+        acceptedButtons: Qt.LeftButton | Qt.RightButton
+        onClicked: {
+            if (mouse.button == Qt.RightButton)
+                showMenu()
+            else
+                root.clicked()
+        }
+        onPressAndHold: showMenu()
+    }
+}
diff --git a/tests/quicktestbrowser/quicktestbrowser.pro b/tests/quicktestbrowser/quicktestbrowser.pro
index a6ee521d4a5fbf3b82d699ef4c7d09d0cccb6f3a..ac8fe74b33ab8b256db0bc3221b447670eb75151 100644
--- a/tests/quicktestbrowser/quicktestbrowser.pro
+++ b/tests/quicktestbrowser/quicktestbrowser.pro
@@ -8,7 +8,8 @@ HEADERS = quickwindow.h \
 SOURCES = quickwindow.cpp \
           main.cpp
 
-OTHER_FILES += ContextMenuExtras.qml \
+OTHER_FILES += ButtonWithMenu.qml \
+               ContextMenuExtras.qml \
                FeaturePermissionBar.qml \
                quickwindow.qml
 
diff --git a/tests/quicktestbrowser/quickwindow.qml b/tests/quicktestbrowser/quickwindow.qml
index 0fb50dd2360d43bb0eee013ac04d03bcd519140f..ca1f75c04ba4924743971bd66e3d1a4849077ca5 100644
--- a/tests/quicktestbrowser/quickwindow.qml
+++ b/tests/quicktestbrowser/quickwindow.qml
@@ -148,31 +148,21 @@ ApplicationWindow {
         id: navigationBar
             RowLayout {
                 anchors.fill: parent;
-                ToolButton {
+                ButtonWithMenu {
                     id: backButton
                     iconSource: "icons/go-previous.png"
-                    onClicked: currentWebView.goBack()
                     enabled: currentWebView && currentWebView.canGoBack
                     activeFocusOnTab: !browserWindow.platformIsMac
-
-                    MouseArea {
-                        anchors.fill: parent
-                        acceptedButtons: Qt.RightButton
-                        onClicked: backHistoryMenu.popup()
-                    }
+                    onClicked: currentWebView.goBack()
+                    longPressMenu: backHistoryMenu
                 }
-                ToolButton {
+                ButtonWithMenu {
                     id: forwardButton
                     iconSource: "icons/go-next.png"
-                    onClicked: currentWebView.goForward()
                     enabled: currentWebView && currentWebView.canGoForward
                     activeFocusOnTab: !browserWindow.platformIsMac
-
-                    MouseArea {
-                        anchors.fill: parent
-                        acceptedButtons: Qt.RightButton
-                        onClicked: forwardHistoryMenu.popup()
-                    }
+                    onClicked: currentWebView.goForward()
+                    longPressMenu: forwardHistoryMenu
                 }
                 ToolButton {
                     id: reloadButton
diff --git a/tests/quicktestbrowser/resources.qrc b/tests/quicktestbrowser/resources.qrc
index 1226be00becec77a708b409304ef00d6b6367dcf..cdc3d2304fb08fdffd3b09b7fa4ae9538a046be8 100644
--- a/tests/quicktestbrowser/resources.qrc
+++ b/tests/quicktestbrowser/resources.qrc
@@ -3,6 +3,7 @@
         <file>quickwindow.qml</file>
         <file>ContextMenuExtras.qml</file>
         <file>FeaturePermissionBar.qml</file>
+        <file>ButtonWithMenu.qml</file>
     </qresource>
     <qresource prefix="icons">
         <!-- To the risk of this breaking more often, do not duplicate the resources since this application won't be deployed -->