summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-23 16:23:40 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-01-24 08:16:35 +0000
commit72103a55b1ac514fa0acbb9131610b26ee87d083 (patch)
tree5c5fd440454a35677237b3286af29a34f27ad4f8
parentd502c6e9d09803dd268100f8c53cf7bc563e3d1d (diff)
Remove dead tests we will not be reusing
We have no plans of implement QtWebKit still plugins. Change-Id: I9f7bb94cc240e2f0eda8c85c03fa5860435d52a3 Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
-rw-r--r--tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp360
1 files changed, 0 insertions, 360 deletions
diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
index 060645733..abebec03f 100644
--- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
+++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp
@@ -104,20 +104,12 @@ private Q_SLOTS:
void modified();
void contextMenuCrash();
void updatePositionDependentActionsCrash();
- void createPluginWithPluginsEnabled();
- void createPluginWithPluginsDisabled();
void callbackSpyDeleted();
- void destroyPlugin_data();
- void destroyPlugin();
- void createViewlessPlugin_data();
- void createViewlessPlugin();
- void graphicsWidgetPlugin();
void multiplePageGroupsAndLocalStorage();
void cursorMovements();
void textSelection();
void textEditing();
void backActionUpdate();
- void protectBindingsRuntimeObjectsFromCollector();
void testOptionalJSObjects();
void testLocalStorageVisibility();
void testEnablePersistentStorage();
@@ -817,332 +809,6 @@ void tst_QWebEnginePage::contextMenuCrash()
#endif
}
-#if defined(QWEBENGINEPAGE_CREATEPLUGIN)
-class PluginPage : public QWebEnginePage
-{
-public:
- PluginPage(QObject *parent = 0)
- : QWebEnginePage(parent) {}
-
- struct CallInfo
- {
- CallInfo(const QString &c, const QUrl &u,
- const QStringList &pn, const QStringList &pv,
- QObject *r)
- : classid(c), url(u), paramNames(pn),
- paramValues(pv), returnValue(r)
- {}
- QString classid;
- QUrl url;
- QStringList paramNames;
- QStringList paramValues;
- QObject *returnValue;
- };
-
- QList<CallInfo> calls;
-
-protected:
- virtual QObject *createPlugin(const QString &classid, const QUrl &url,
- const QStringList &paramNames,
- const QStringList &paramValues)
- {
- QObject *result = 0;
- if (classid == "pushbutton")
- result = new QPushButton();
-#ifndef QT_NO_INPUTDIALOG
- else if (classid == "lineedit")
- result = new QLineEdit();
-#endif
- else if (classid == "graphicswidget")
- result = new QGraphicsWidget();
- if (result)
- result->setObjectName(classid);
- calls.append(CallInfo(classid, url, paramNames, paramValues, result));
- return result;
- }
-};
-
-static void createPlugin(QWebEngineView *view)
-{
- QSignalSpy loadSpy(view, SIGNAL(loadFinished(bool)));
-
- PluginPage* newPage = new PluginPage(view);
- view->setPage(newPage);
-
- // type has to be application/x-qt-plugin
- view->setHtml(QString("<html><body><object type='application/x-foobarbaz' classid='pushbutton' id='mybutton'/></body></html>"));
- QTRY_COMPARE(loadSpy.count(), 1);
- QCOMPARE(newPage->calls.count(), 0);
-
- view->setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></body></html>"));
- QTRY_COMPARE(loadSpy.count(), 2);
- QCOMPARE(newPage->calls.count(), 1);
- {
- PluginPage::CallInfo ci = newPage->calls.takeFirst();
- QCOMPARE(ci.classid, QString::fromLatin1("pushbutton"));
- QCOMPARE(ci.url, QUrl());
- QCOMPARE(ci.paramNames.count(), 3);
- QCOMPARE(ci.paramValues.count(), 3);
- QCOMPARE(ci.paramNames.at(0), QString::fromLatin1("type"));
- QCOMPARE(ci.paramValues.at(0), QString::fromLatin1("application/x-qt-plugin"));
- QCOMPARE(ci.paramNames.at(1), QString::fromLatin1("classid"));
- QCOMPARE(ci.paramValues.at(1), QString::fromLatin1("pushbutton"));
- QCOMPARE(ci.paramNames.at(2), QString::fromLatin1("id"));
- QCOMPARE(ci.paramValues.at(2), QString::fromLatin1("mybutton"));
- QVERIFY(ci.returnValue != 0);
- QVERIFY(ci.returnValue->inherits("QPushButton"));
- }
- // test JS bindings
- QCOMPARE(evaluateJavaScriptSync(newPage, "document.getElementById('mybutton').toString()").toString(),
- QString::fromLatin1("[object HTMLObjectElement]"));
- QCOMPARE(evaluateJavaScriptSync(newPage, "mybutton.toString()").toString(),
- QString::fromLatin1("[object HTMLObjectElement]"));
- QCOMPARE(evaluateJavaScriptSync(newPage, "typeof mybutton.objectName").toString(),
- QString::fromLatin1("string"));
- QCOMPARE(evaluateJavaScriptSync(newPage, "mybutton.objectName").toString(),
- QString::fromLatin1("pushbutton"));
- QCOMPARE(evaluateJavaScriptSync(newPage, "typeof mybutton.clicked").toString(),
- QString::fromLatin1("function"));
- QCOMPARE(evaluateJavaScriptSync(newPage, "mybutton.clicked.toString()").toString(),
- QString::fromLatin1("function clicked() {\n [native code]\n}"));
-
- view->setHtml(QString("<html><body><table>"
- "<tr><object type='application/x-qt-plugin' classid='lineedit' id='myedit'/></tr>"
- "<tr><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></tr>"
- "</table></body></html>"), QUrl("http://foo.bar.baz"));
- QTRY_COMPARE(loadSpy.count(), 3);
- QCOMPARE(newPage->calls.count(), 2);
- {
- PluginPage::CallInfo ci = newPage->calls.takeFirst();
- QCOMPARE(ci.classid, QString::fromLatin1("lineedit"));
- QCOMPARE(ci.url, QUrl());
- QCOMPARE(ci.paramNames.count(), 3);
- QCOMPARE(ci.paramValues.count(), 3);
- QCOMPARE(ci.paramNames.at(0), QString::fromLatin1("type"));
- QCOMPARE(ci.paramValues.at(0), QString::fromLatin1("application/x-qt-plugin"));
- QCOMPARE(ci.paramNames.at(1), QString::fromLatin1("classid"));
- QCOMPARE(ci.paramValues.at(1), QString::fromLatin1("lineedit"));
- QCOMPARE(ci.paramNames.at(2), QString::fromLatin1("id"));
- QCOMPARE(ci.paramValues.at(2), QString::fromLatin1("myedit"));
- QVERIFY(ci.returnValue != 0);
- QVERIFY(ci.returnValue->inherits("QLineEdit"));
- }
- {
- PluginPage::CallInfo ci = newPage->calls.takeFirst();
- QCOMPARE(ci.classid, QString::fromLatin1("pushbutton"));
- QCOMPARE(ci.url, QUrl());
- QCOMPARE(ci.paramNames.count(), 3);
- QCOMPARE(ci.paramValues.count(), 3);
- QCOMPARE(ci.paramNames.at(0), QString::fromLatin1("type"));
- QCOMPARE(ci.paramValues.at(0), QString::fromLatin1("application/x-qt-plugin"));
- QCOMPARE(ci.paramNames.at(1), QString::fromLatin1("classid"));
- QCOMPARE(ci.paramValues.at(1), QString::fromLatin1("pushbutton"));
- QCOMPARE(ci.paramNames.at(2), QString::fromLatin1("id"));
- QCOMPARE(ci.paramValues.at(2), QString::fromLatin1("mybutton"));
- QVERIFY(ci.returnValue != 0);
- QVERIFY(ci.returnValue->inherits("QPushButton"));
- }
-}
-#endif
-
-void tst_QWebEnginePage::graphicsWidgetPlugin()
-{
-#if !defined(QWEBENGINEPAGE_CREATEPLUGIN)
- QSKIP("QWEBENGINEPAGE_CREATEPLUGIN");
-#else
- m_view->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
- QGraphicsWebView webView;
-
- QSignalSpy loadSpy(&webView, SIGNAL(loadFinished(bool)));
-
- PluginPage* newPage = new PluginPage(&webView);
- webView.setPage(newPage);
-
- // type has to be application/x-qt-plugin
- webView.setHtml(QString("<html><body><object type='application/x-foobarbaz' classid='graphicswidget' id='mygraphicswidget'/></body></html>"));
- QTRY_COMPARE(loadSpy.count(), 1);
- QCOMPARE(newPage->calls.count(), 0);
-
- webView.setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='graphicswidget' id='mygraphicswidget'/></body></html>"));
- QTRY_COMPARE(loadSpy.count(), 2);
- QCOMPARE(newPage->calls.count(), 1);
- {
- PluginPage::CallInfo ci = newPage->calls.takeFirst();
- QCOMPARE(ci.classid, QString::fromLatin1("graphicswidget"));
- QCOMPARE(ci.url, QUrl());
- QCOMPARE(ci.paramNames.count(), 3);
- QCOMPARE(ci.paramValues.count(), 3);
- QCOMPARE(ci.paramNames.at(0), QString::fromLatin1("type"));
- QCOMPARE(ci.paramValues.at(0), QString::fromLatin1("application/x-qt-plugin"));
- QCOMPARE(ci.paramNames.at(1), QString::fromLatin1("classid"));
- QCOMPARE(ci.paramValues.at(1), QString::fromLatin1("graphicswidget"));
- QCOMPARE(ci.paramNames.at(2), QString::fromLatin1("id"));
- QCOMPARE(ci.paramValues.at(2), QString::fromLatin1("mygraphicswidget"));
- QVERIFY(ci.returnValue);
- QVERIFY(ci.returnValue->inherits("QGraphicsWidget"));
- }
- // test JS bindings
- QCOMPARE(evaluateJavaScriptSync(newPage, "document.getElementById('mygraphicswidget').toString()").toString(),
- QString::fromLatin1("[object HTMLObjectElement]"));
- QCOMPARE(evaluateJavaScriptSync(newPage, "mygraphicswidget.toString()").toString(),
- QString::fromLatin1("[object HTMLObjectElement]"));
- QCOMPARE(evaluateJavaScriptSync(newPage, "typeof mygraphicswidget.objectName").toString(),
- QString::fromLatin1("string"));
- QCOMPARE(evaluateJavaScriptSync(newPage, "mygraphicswidget.objectName").toString(),
- QString::fromLatin1("graphicswidget"));
- QCOMPARE(evaluateJavaScriptSync(newPage, "typeof mygraphicswidget.geometryChanged").toString(),
- QString::fromLatin1("function"));
- QCOMPARE(evaluateJavaScriptSync(newPage, "mygraphicswidget.geometryChanged.toString()").toString(),
- QString::fromLatin1("function geometryChanged() {\n [native code]\n}"));
-#endif
-}
-
-void tst_QWebEnginePage::createPluginWithPluginsEnabled()
-{
-#if !defined(QWEBENGINEPAGE_CREATEPLUGIN)
- QSKIP("QWEBENGINEPAGE_CREATEPLUGIN");
-#else
- m_view->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
- createPlugin(m_view);
-#endif
-}
-
-void tst_QWebEnginePage::createPluginWithPluginsDisabled()
-{
-#if !defined(QWEBENGINEPAGE_CREATEPLUGIN)
- QSKIP("QWEBENGINEPAGE_CREATEPLUGIN");
-#else
- // Qt Plugins should be loaded by QtWebEngine even when PluginsEnabled is
- // false. The client decides whether a Qt plugin is enabled or not when
- // it decides whether or not to instantiate it.
- m_view->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, false);
- createPlugin(m_view);
-#endif
-}
-
-#if defined(QWEBENGINEPAGE_CREATEPLUGIN)
-// Standard base class for template PluginTracerPage. In tests it is used as interface.
-class PluginCounterPage : public QWebEnginePage {
-public:
- int m_count;
- QPointer<QObject> m_widget;
- QObject* m_pluginParent;
- PluginCounterPage(QObject* parent = 0)
- : QWebEnginePage(parent)
- , m_count(0)
- , m_pluginParent(0)
- {
- settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
- }
- ~PluginCounterPage()
- {
- if (m_pluginParent)
- m_pluginParent->deleteLater();
- }
-};
-
-template<class T>
-class PluginTracerPage : public PluginCounterPage {
-public:
- PluginTracerPage(QObject* parent = 0)
- : PluginCounterPage(parent)
- {
- // this is a dummy parent object for the created plugin
- m_pluginParent = new T;
- }
- virtual QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&)
- {
- m_count++;
- m_widget = new T;
- // need a cast to the specific type, as QObject::setParent cannot be called,
- // because it is not virtual. Instead it is necessary to call QWidget::setParent,
- // which also takes a QWidget* instead of a QObject*. Therefore we need to
- // upcast to T*, which is a QWidget.
- static_cast<T*>(m_widget.data())->setParent(static_cast<T*>(m_pluginParent));
- return m_widget.data();
- }
-};
-
-class PluginFactory {
-public:
- enum FactoredType {QWidgetType, QGraphicsWidgetType};
- static PluginCounterPage* create(FactoredType type, QObject* parent = 0)
- {
- PluginCounterPage* result = 0;
- switch (type) {
- case QWidgetType:
- result = new PluginTracerPage<QWidget>(parent);
- break;
- case QGraphicsWidgetType:
- result = new PluginTracerPage<QGraphicsWidget>(parent);
- break;
- default: {/*Oops*/};
- }
- return result;
- }
-
- static void prepareTestData()
- {
- QTest::addColumn<int>("type");
- QTest::newRow("QWidget") << (int)PluginFactory::QWidgetType;
- QTest::newRow("QGraphicsWidget") << (int)PluginFactory::QGraphicsWidgetType;
- }
-};
-#endif
-
-void tst_QWebEnginePage::destroyPlugin_data()
-{
-#if defined(QWEBENGINEPAGE_CREATEPLUGIN)
- PluginFactory::prepareTestData();
-#endif
-}
-
-void tst_QWebEnginePage::destroyPlugin()
-{
-#if !defined(QWEBENGINEPAGE_CREATEPLUGIN)
- QSKIP("QWEBENGINEPAGE_CREATEPLUGIN");
-#else
- QFETCH(int, type);
- PluginCounterPage* page = PluginFactory::create((PluginFactory::FactoredType)type, m_view);
- m_view->setPage(page);
-
- // we create the plugin, so the widget should be constructed
- QString content("<html><body><object type=\"application/x-qt-plugin\" classid=\"QProgressBar\"></object></body></html>");
- m_view->setHtml(content);
- QVERIFY(page->m_widget);
- QCOMPARE(page->m_count, 1);
-
- // navigate away, the plugin widget should be destructed
- m_view->setHtml("<html><body>Hi</body></html>");
- QTestEventLoop::instance().enterLoop(1);
- QVERIFY(!page->m_widget);
-#endif
-}
-
-void tst_QWebEnginePage::createViewlessPlugin_data()
-{
-#if defined(QWEBENGINEPAGE_CREATEPLUGIN)
- PluginFactory::prepareTestData();
-#endif
-}
-
-void tst_QWebEnginePage::createViewlessPlugin()
-{
-#if !defined(QWEBENGINEPAGE_CREATEPLUGIN)
- QSKIP("QWEBENGINEPAGE_CREATEPLUGIN");
-#else
- QFETCH(int, type);
- PluginCounterPage* page = PluginFactory::create((PluginFactory::FactoredType)type);
- QString content("<html><body><object type=\"application/x-qt-plugin\" classid=\"QProgressBar\"></object></body></html>");
- page->setHtml(content);
- QCOMPARE(page->m_count, 1);
- QVERIFY(page->m_widget);
- QVERIFY(page->m_pluginParent);
- QVERIFY(page->m_widget.data()->parent() == page->m_pluginParent);
- delete page;
-#endif
-}
-
void tst_QWebEnginePage::multiplePageGroupsAndLocalStorage()
{
#if !defined(QWEBENGINESETTINGS_SETLOCALSTORAGEPATH)
@@ -1660,32 +1326,6 @@ void tst_QWebEnginePage::backActionUpdate()
QVERIFY(action->isEnabled());
}
-void tst_QWebEnginePage::protectBindingsRuntimeObjectsFromCollector()
-{
-#if !defined(QWEBENGINEPAGE_CREATEPLUGIN)
- QSKIP("QWEBENGINEPAGE_CREATEPLUGIN");
-#else
- QSignalSpy loadSpy(m_view, SIGNAL(loadFinished(bool)));
-
- PluginPage* newPage = new PluginPage(m_view);
- m_view->setPage(newPage);
-
- m_view->settings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
-
- m_view->setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='lineedit' id='mylineedit'/></body></html>"));
- QTRY_COMPARE(loadSpy.count(), 1);
-
- newPage->runJavaScript("function testme(text) { var lineedit = document.getElementById('mylineedit'); lineedit.setText(text); lineedit.selectAll(); }");
-
- evaluateJavaScriptSync(newPage, "testme('foo')");
-
- DumpRenderTreeSupportQt::garbageCollectorCollect();
-
- // don't crash!
- evaluateJavaScriptSync(newPage, "testme('bar')");
-#endif
-}
-
#if defined(QWEBENGINEPAGE_SETTINGS)
static inline bool testFlag(QWebEnginePage& webPage, QWebEngineSettings::WebAttribute settingAttribute, const QString& jsObjectName, bool settingValue)
{