/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
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++;
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;
application.Render();
Test::EmitGlobalTimerSignal();
- result = view.LoadContents(html, html.length(), "html/text", "utf-8", basicUri);
+ result = view.LoadContents((const int8_t*)html.c_str(), html.length(), "html/text", "utf-8", basicUri);
DALI_TEST_CHECK(result);
END_TEST;