summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-07-27 14:55:25 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-07-27 16:10:24 +0000
commit83d01d328e2fcd8c0d1632a85704336c2411ce9b (patch)
tree92eee55bea50b796c1760c941a0e9f4a39ce11e1
parenta5519edccb7b5d1aac7f2f3c735ea227bf4e6e7b (diff)
Speculative fix for crash on RHEL
Based on what appears to be the only difference in initialization we have compared to other tests. Change-Id: I6f8737e5de31e8a74872bfee05fecbff3b8dd096 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r--tests/auto/widgets/origins/tst_origins.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/tests/auto/widgets/origins/tst_origins.cpp b/tests/auto/widgets/origins/tst_origins.cpp
index 26329c5b5..044595214 100644
--- a/tests/auto/widgets/origins/tst_origins.cpp
+++ b/tests/auto/widgets/origins/tst_origins.cpp
@@ -67,6 +67,9 @@ class tst_Origins final : public QObject {
Q_OBJECT
private Q_SLOTS:
+ void initTestCase();
+ void cleanupTestCase();
+
void jsUrlCanon();
void jsUrlOrigin();
void subdirWithAccess();
@@ -80,22 +83,34 @@ private Q_SLOTS:
private:
bool load(const QUrl &url)
{
- QSignalSpy spy(&m_page, &QWebEnginePage::loadFinished);
- m_page.load(url);
+ QSignalSpy spy(m_page, &QWebEnginePage::loadFinished);
+ m_page->load(url);
return (!spy.empty() || spy.wait())
&& spy.front().value(0).toBool();
}
QVariant eval(const QString &code)
{
- return evaluateJavaScriptSync(&m_page, code);
+ return evaluateJavaScriptSync(m_page, code);
}
QWebEngineProfile m_profile;
- QWebEnginePage m_page{&m_profile};
- TstUrlSchemeHandler m_handler{&m_profile};
+ QWebEnginePage *m_page = nullptr;
+ TstUrlSchemeHandler *m_handler = nullptr;
};
+void tst_Origins::initTestCase()
+{
+ m_page = new QWebEnginePage(&m_profile, nullptr);
+ m_handler = new TstUrlSchemeHandler(&m_profile);
+}
+
+void tst_Origins::cleanupTestCase()
+{
+ delete m_handler;
+ delete m_page;
+}
+
// Test URL parsing and canonicalization in Blink. The implementation of this
// part is mostly shared between Blink and Chromium proper.
void tst_Origins::jsUrlCanon()
@@ -185,7 +200,7 @@ private:
// demonstrate the difference with Firefox where such access is not allowed.
void tst_Origins::subdirWithAccess()
{
- ScopedAttribute sa(m_page.settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, true);
+ ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, true);
QVERIFY(load(QSL("file:" THIS_DIR "resources/subdir/index.html")));
QCOMPARE(eval(QSL("msg[0]")), QVariant(QSL("hello")));
@@ -211,7 +226,7 @@ void tst_Origins::subdirWithAccess()
// - the blink::SecurityOrigin::BlockLocalAccessFromLocalOrigin() method.
void tst_Origins::subdirWithoutAccess()
{
- ScopedAttribute sa(m_page.settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, false);
+ ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, false);
QVERIFY(load(QSL("file:" THIS_DIR "resources/subdir/index.html")));
QCOMPARE(eval(QSL("msg[0]")), QVariant());
@@ -304,7 +319,7 @@ void tst_Origins::dedicatedWorker()
void tst_Origins::sharedWorker()
{
{
- ScopedAttribute sa(m_page.settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, false);
+ ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, false);
QVERIFY(load(QSL("file:" THIS_DIR "resources/sharedWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QVERIFY(eval(QSL("error")).toString()
@@ -312,7 +327,7 @@ void tst_Origins::sharedWorker()
}
{
- ScopedAttribute sa(m_page.settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, true);
+ ScopedAttribute sa(m_page->settings(), QWebEngineSettings::LocalContentCanAccessFileUrls, true);
QVERIFY(load(QSL("file:" THIS_DIR "resources/sharedWorker.html")));
QTRY_VERIFY(eval(QSL("done")).toBool());
QCOMPARE(eval(QSL("result")), QVariant(42));