summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/qwebenginescript
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-07 09:56:13 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-08 23:51:38 +0000
commite07e18a8a6219c69d75589f6d3d1fe9b84821f31 (patch)
treee24208d42387a56de288ec9431d4fa576cf4b8a4 /tests/auto/widgets/qwebenginescript
parent741ac0f756bc124656e5c137bd9b885b327f1f13 (diff)
Add methods for running javascript in isolated worlds
We exposed javascript worlds for user-scripts, this adds variants of runJavaScript that can access those worlds. Change-Id: I5a0b40b863b543cd364c902d0a84ae2c35e2a0b8 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'tests/auto/widgets/qwebenginescript')
-rw-r--r--tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
index 53762f54c..3231293bf 100644
--- a/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
+++ b/tests/auto/widgets/qwebenginescript/tst_qwebenginescript.cpp
@@ -115,12 +115,14 @@ void tst_QWebEngineScript::scriptWorld()
page.load(QUrl("about:blank"));
waitForSignal(&page, SIGNAL(loadFinished(bool)));
QCOMPARE(evaluateJavaScriptSync(&page, "typeof(userScriptTest) != \"undefined\" && userScriptTest == 1;"), QVariant::fromValue(true));
+ QCOMPARE(evaluateJavaScriptSyncInWorld(&page, "typeof(userScriptTest) == \"undefined\"", QWebEngineScript::ApplicationWorld), QVariant::fromValue(true));
script.setWorldId(QWebEngineScript::ApplicationWorld);
page.scripts().clear();
page.scripts().insert(script);
page.load(QUrl("about:blank"));
waitForSignal(&page, SIGNAL(loadFinished(bool)));
QCOMPARE(evaluateJavaScriptSync(&page, "typeof(userScriptTest) == \"undefined\""), QVariant::fromValue(true));
+ QCOMPARE(evaluateJavaScriptSyncInWorld(&page, "typeof(userScriptTest) != \"undefined\" && userScriptTest == 1;", QWebEngineScript::ApplicationWorld), QVariant::fromValue(true));
}
void tst_QWebEngineScript::scriptModifications()