static std::unique_ptr<Dali::WebEngineConsoleMessage> gConsoleMessageInstance = nullptr;
static int gResponsePolicyDecidedCallbackCalled = 0;
static int gNavigationPolicyDecidedCallbackCalled = 0;
+static int gNewWindowCreatedCallbackCalled = 0;
static std::unique_ptr<Dali::WebEnginePolicyDecision> gResponsePolicyDecisionInstance = nullptr;
static int gCertificateConfirmCallbackCalled = 0;
static std::unique_ptr<Dali::WebEngineCertificate> gCertificateConfirmInstance = nullptr;
gNavigationPolicyDecidedCallbackCalled++;
}
+static void OnNewWindowCreated(Dali::WebEnginePlugin*& outPlugin)
+{
+ gNewWindowCreatedCallbackCalled++;
+ WebView newView = WebView::New();
+ outPlugin = newView.GetPlugin();
+}
+
static void OnUrlChanged(const std::string& url)
{
gUrlChangedCallbackCalled++;
ToolkitTestApplication application;
Dali::WebEngineContext* context = WebView::GetContext();
- DALI_TEST_CHECK(context != 0);
+ DALI_TEST_CHECK(context != nullptr);
END_TEST;
}
END_TEST;
}
+int UtcDaliWebViewNewWindowCreated(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ // load url.
+ view.RegisterNewWindowCreatedCallback(&OnNewWindowCreated);
+ DALI_TEST_EQUALS(gNewWindowCreatedCallbackCalled, 0, TEST_LOCATION);
+
+ view.LoadUrl(TEST_URL1);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gNewWindowCreatedCallbackCalled, 1, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliWebViewHitTest(void)
{
ToolkitTestApplication application;
Dali::WebEngineContext* context = WebView::GetContext();
DALI_TEST_CHECK(context != 0)
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ // Check if web view is found or not when plugin is null.
+ DALI_TEST_CHECK(!WebView::FindWebView(nullptr));
+
// load url.
context->RegisterRequestInterceptedCallback(&OnRequestIntercepted);
DALI_TEST_EQUALS(gRequestInterceptedCallbackCalled, 0, TEST_LOCATION);
DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseBody((const int8_t*)"test", 4));
DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponse("key:value", (const int8_t*)"test", 4));
DALI_TEST_CHECK(gRequestInterceptorInstance->WriteResponseChunk((const int8_t*)"test", 4));
+
+ DALI_TEST_CHECK(gRequestInterceptorInstance->GetWebEngine());
+ // Check if web view is found or not when plugin is not null.
+ DALI_TEST_CHECK(WebView::FindWebView(gRequestInterceptorInstance->GetWebEngine()));
+
std::string testUrl("http://test.html");
DALI_TEST_EQUALS(gRequestInterceptorInstance->GetUrl(), testUrl, TEST_LOCATION);
std::string testMethod("GET");
Dali::Property::Map resultHeaders = gRequestInterceptorInstance->GetHeaders();
DALI_TEST_EQUALS(resultHeaders.Count(), 2, TEST_LOCATION);
+ // Destroy web view.
+ view.Reset();
gRequestInterceptorInstance = nullptr;
END_TEST;