+ // Check default value
+ Dali::Vector2 output = Dali::Vector2::ONE;
+ view.GetProperty(WebView::Property::SCROLL_POSITION).Get(output);
+ DALI_TEST_CHECK(output.x == 0 && output.y == 0);
+
+ // Check Set/GetProperty
+ Dali::Vector2 testValue = Dali::Vector2(100, 100);
+ view.SetProperty(WebView::Property::SCROLL_POSITION, testValue);
+ view.GetProperty(WebView::Property::SCROLL_POSITION).Get(output);
+ DALI_TEST_EQUALS(output, testValue, TEST_LOCATION);
+
+ // Check default value of scroll size
+ output = Dali::Vector2::ONE;
+ view.GetProperty(WebView::Property::SCROLL_SIZE).Get(output);
+ DALI_TEST_CHECK(output.x == 500 && output.y == 500);
+
+ // Check default value of content size
+ output = Dali::Vector2::ONE;
+ view.GetProperty(WebView::Property::CONTENT_SIZE).Get(output);
+ DALI_TEST_CHECK(output.x == 500 && output.y == 500);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewPropertyBackgroundColorSelectedTextEtc(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Vector4 testValue = Dali::Vector4(0.0f, 0.0f, 0.0f, 0.0f);
+ view.SetProperty(WebView::Property::DOCUMENT_BACKGROUND_COLOR, testValue);
+ view.SetProperty(WebView::Property::TILES_CLEARED_WHEN_HIDDEN, true);
+ view.SetProperty(WebView::Property::TILE_COVER_AREA_MULTIPLIER, 1.0f);
+ view.SetProperty(WebView::Property::CURSOR_ENABLED_BY_CLIENT, true);
+
+ // Check default value
+ std::string testText("test");
+ std::string output;
+ view.GetProperty(WebView::Property::SELECTED_TEXT).Get(output);
+ DALI_TEST_EQUALS(output, testText, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewPropertyTitleFavicon(void)
+{
+ ToolkitTestApplication application;
+
+ char argv[] = "--test";
+ WebView view = WebView::New(1, (char**)&argv);
+ DALI_TEST_CHECK(view);
+
+ // reset something
+ view.ClearAllTilesResources();
+
+ // Check default value of title
+ std::string testValue("title");
+ std::string output;
+ view.GetProperty(WebView::Property::TITLE).Get(output);
+ DALI_TEST_EQUALS(output, testValue, TEST_LOCATION);
+
+ // Check the case that favicon is not null.
+ Dali::Toolkit::ImageView favicon = view.GetFavicon();
+ DALI_TEST_CHECK(favicon);
+ Dali::Vector3 iconsize = favicon.GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ DALI_TEST_CHECK((int)iconsize.width == 2 && (int)iconsize.height == 2);
+
+ // Check the case that favicon is null.
+ favicon = view.GetFavicon();
+ DALI_TEST_CHECK(!favicon);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewContextMenuShownAndHidden(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ // load url.
+ view.RegisterContextMenuShownCallback(&OnContextMenuShown);
+ view.RegisterContextMenuHiddenCallback(&OnContextMenuHidden);
+ DALI_TEST_EQUALS(gContextMenuShownCallbackCalled, 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(gContextMenuHiddenCallbackCalled, 0, TEST_LOCATION);
+ DALI_TEST_CHECK(gContextMenuShownInstance == 0);
+ DALI_TEST_CHECK(gContextMenuHiddenInstance == 0);
+
+ view.LoadUrl(TEST_URL1);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gContextMenuShownCallbackCalled, 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(gContextMenuHiddenCallbackCalled, 1, TEST_LOCATION);
+
+ // check context meun & its items.
+ DALI_TEST_CHECK(gContextMenuShownInstance != 0);
+ std::unique_ptr<Dali::WebEngineContextMenuItem> item = gContextMenuShownInstance->GetItemAt(0);
+ DALI_TEST_CHECK(item.get() != 0);
+ std::vector<std::unique_ptr<Dali::WebEngineContextMenuItem>> itemList = gContextMenuShownInstance->GetItemList();
+ DALI_TEST_CHECK(itemList.size() == 1);
+ DALI_TEST_CHECK(gContextMenuShownInstance->RemoveItem(*(item.get())));
+ DALI_TEST_CHECK(gContextMenuShownInstance->AppendItemAsAction(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", false));
+ DALI_TEST_CHECK(gContextMenuShownInstance->AppendItem(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", "", false));
+ DALI_TEST_CHECK(gContextMenuShownInstance->SelectItem(*(item.get())));
+ DALI_TEST_CHECK(gContextMenuShownInstance->Hide());
+
+ Dali::WebEngineContextMenuItem::ItemTag testItemTag = Dali::WebEngineContextMenuItem::ItemTag::NO_ACTION;
+ DALI_TEST_EQUALS(item->GetTag(), testItemTag, TEST_LOCATION);
+ Dali::WebEngineContextMenuItem::ItemType testItemType = Dali::WebEngineContextMenuItem::ItemType::ACTION;
+ DALI_TEST_EQUALS(item->GetType(), testItemType, TEST_LOCATION);
+ DALI_TEST_CHECK(item->IsEnabled());
+ std::string testLinkUrl("http://test.html");
+ DALI_TEST_EQUALS(item->GetLinkUrl(), testLinkUrl, TEST_LOCATION);
+ std::string testImageUrl("http://test.jpg");
+ DALI_TEST_EQUALS(item->GetImageUrl(), testImageUrl, TEST_LOCATION);
+ std::string testTitle("title");
+ DALI_TEST_EQUALS(item->GetTitle(), testTitle, TEST_LOCATION);
+ DALI_TEST_CHECK(item->GetParentMenu().get() == 0);
+
+ DALI_TEST_CHECK(gContextMenuHiddenInstance != 0);
+
+ gContextMenuShownInstance = nullptr;
+ gContextMenuHiddenInstance = nullptr;
+
+ END_TEST;
+}
+
+int UtcDaliWebViewScrollBy(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ // load url.
+ view.RegisterScrollEdgeReachedCallback(&OnScrollEdgeReached);
+ DALI_TEST_EQUALS(gScrollEdgeReachedCallbackCalled, 0, TEST_LOCATION);
+
+ view.LoadUrl(TEST_URL1);
+ Test::EmitGlobalTimerSignal();
+
+ // set scroll position.
+ Dali::Vector2 output = Dali::Vector2::ONE;
+ Dali::Vector2 testValue = Dali::Vector2(100, 100);
+ view.SetProperty(WebView::Property::SCROLL_POSITION, testValue);
+ view.GetProperty(WebView::Property::SCROLL_POSITION).Get(output);
+ DALI_TEST_EQUALS(output, testValue, TEST_LOCATION);
+
+ // scroll by and trigger scrollEdgeReached event.
+ view.ScrollBy(50, 50);
+ Test::EmitGlobalTimerSignal();
+
+ view.GetProperty(WebView::Property::SCROLL_POSITION).Get(output);
+ DALI_TEST_CHECK(output.x == 150 && output.y == 150);
+ DALI_TEST_EQUALS(gScrollEdgeReachedCallbackCalled, 1, TEST_LOCATION);
+
+ // scroll by and trigger scrollEdgeReached event.
+ bool result = view.ScrollEdgeBy(50, 50);
+ DALI_TEST_CHECK(result);
+ Test::EmitGlobalTimerSignal();
+
+ view.GetProperty(WebView::Property::SCROLL_POSITION).Get(output);
+ DALI_TEST_CHECK(output.x == 200 && output.y == 200);
+ DALI_TEST_EQUALS(gScrollEdgeReachedCallbackCalled, 2, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewSetGetScaleFactorActivateAccessibility(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
+ view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
+
+ application.GetScene().Add(view);
+ application.SendNotification();
+ application.Render();
+
+ view.ActivateAccessibility(true);
+ view.AddDynamicCertificatePath("host", "test/to/path");
+ bool found = view.HighlightText("test", Dali::WebEnginePlugin::FindOption::CASE_INSENSITIVE, 2);
+ DALI_TEST_CHECK(found);
+
+ view.SetScaleFactor(1.5f, Dali::Vector2(0.0f, 0.0f));
+ float result = view.GetScaleFactor();
+ DALI_TEST_EQUALS(result, 1.5f, TEST_LOCATION);
+
+ view.SetScaleFactor(1.0f, Dali::Vector2(0.0f, 0.0f));
+ result = view.GetScaleFactor();
+ DALI_TEST_EQUALS(result, 1.0f, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewGetScreenshotSyncAndAsync(void)
+{
+ // SCROLL_POSITION
+ ToolkitTestApplication application;
+
+ char argv[] = "--test";
+ WebView view = WebView::New(1, (char**)&argv);
+ DALI_TEST_CHECK(view);
+
+ // Check GetScreenshot
+ Dali::Rect<int> viewArea;
+ viewArea.x = 100;
+ viewArea.y = 100;
+ viewArea.width = 10;
+ viewArea.height = 10;
+ Dali::Toolkit::ImageView screenshot = view.GetScreenshot(viewArea, 1.0f);
+ DALI_TEST_CHECK(screenshot);
+ Dali::Vector3 shotsize = screenshot.GetProperty<Vector3>(Dali::Actor::Property::SIZE);
+ DALI_TEST_CHECK((int)shotsize.width == viewArea.width && (int)shotsize.height == viewArea.height);
+
+ // Check GetScreenshotAsynchronously
+ viewArea.x = 100;
+ viewArea.y = 100;
+ viewArea.width = 100;
+ viewArea.height = 100;
+ bool result = view.GetScreenshotAsynchronously(viewArea, 1.0f, &OnScreenshotCaptured);
+ DALI_TEST_CHECK(result);
+
+ Test::EmitGlobalTimerSignal();
+
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gScreenshotCapturedCallbackCalled, 1, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewVideoPlayingGeolocationPermission(void)
+{
+ // SCROLL_POSITION
+ ToolkitTestApplication application;
+
+ char argv[] = "--test";
+ WebView view = WebView::New(1, (char**)&argv);
+ DALI_TEST_CHECK(view);
+
+ // Check CheckVideoPlayingAsynchronously
+ bool result = view.CheckVideoPlayingAsynchronously(&OnVideoPlaying);
+ DALI_TEST_CHECK(result);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gVideoPlayingCallbackCalled, 1, TEST_LOCATION);
+
+ // Check RegisterGeolocationPermissionCallback
+ view.RegisterGeolocationPermissionCallback(&OnGeolocationPermission);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gGeolocationPermissionCallbackCalled, 1, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewResponsePolicyDecisionRequest(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ // load url.
+ view.RegisterResponsePolicyDecidedCallback(&OnResponsePolicyDecided);
+ DALI_TEST_EQUALS(gResponsePolicyDecidedCallbackCalled, 0, TEST_LOCATION);
+ DALI_TEST_CHECK(gResponsePolicyDecisionInstance == 0);
+
+ view.LoadUrl(TEST_URL1);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gResponsePolicyDecidedCallbackCalled, 1, TEST_LOCATION);
+
+ // check response policy decision & its frame.
+ DALI_TEST_CHECK(gResponsePolicyDecisionInstance != 0);
+ std::string testUrl("http://test.html");
+ DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetUrl(), testUrl, TEST_LOCATION);
+ std::string testCookie("test:abc");
+ DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetCookie(), testCookie, TEST_LOCATION);
+ Dali::WebEnginePolicyDecision::DecisionType testDecisionType = Dali::WebEnginePolicyDecision::DecisionType::USE;
+ DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetDecisionType(), testDecisionType, TEST_LOCATION);
+ std::string testResponseMime("txt/xml");
+ DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetResponseMime(), testResponseMime, TEST_LOCATION);
+ int32_t ResponseStatusCode = 500;
+ DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetResponseStatusCode(), ResponseStatusCode, TEST_LOCATION);
+ Dali::WebEnginePolicyDecision::NavigationType testNavigationType = Dali::WebEnginePolicyDecision::NavigationType::LINK_CLICKED;
+ DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetNavigationType(), testNavigationType, TEST_LOCATION);
+ std::string testScheme("test");
+ DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetScheme(), testScheme, TEST_LOCATION);
+ DALI_TEST_CHECK(gResponsePolicyDecisionInstance->Use());
+ DALI_TEST_CHECK(gResponsePolicyDecisionInstance->Ignore());
+ DALI_TEST_CHECK(gResponsePolicyDecisionInstance->Suspend());
+
+ Dali::WebEngineFrame* webFrame = &(gResponsePolicyDecisionInstance->GetFrame());
+ DALI_TEST_CHECK(webFrame);
+ DALI_TEST_CHECK(webFrame->IsMainFrame());
+
+ gResponsePolicyDecisionInstance = nullptr;
+
+ END_TEST;
+}
+
+int UtcDaliWebViewNavigationPolicyDecisionRequest(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ // load url.
+ view.RegisterNavigationPolicyDecidedCallback(&OnNavigationPolicyDecided);
+ DALI_TEST_EQUALS(gNavigationPolicyDecidedCallbackCalled, 0, TEST_LOCATION);
+
+ view.LoadUrl(TEST_URL1);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gNavigationPolicyDecidedCallbackCalled, 1, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewHitTest(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ // load url.
+ view.LoadUrl(TEST_URL1);
+
+ // sync hit test.
+ std::unique_ptr<Dali::WebEngineHitTest> hitTest = view.CreateHitTest(100, 100, Dali::WebEngineHitTest::HitTestMode::DEFAULT);
+ DALI_TEST_CHECK(hitTest != 0);
+ DALI_TEST_EQUALS(hitTest->GetResultContext(), Dali::WebEngineHitTest::ResultContext::DOCUMENT, TEST_LOCATION);
+ std::string testLinkUri("http://test.html");
+ DALI_TEST_EQUALS(hitTest->GetLinkUri(), testLinkUri, TEST_LOCATION);
+ std::string testLinkTitle("test");
+ DALI_TEST_EQUALS(hitTest->GetLinkTitle(), testLinkTitle, TEST_LOCATION);
+ std::string testLinkLabel("label");
+ DALI_TEST_EQUALS(hitTest->GetLinkLabel(), testLinkLabel, TEST_LOCATION);
+ std::string testImageUri("http://test.jpg");
+ DALI_TEST_EQUALS(hitTest->GetImageUri(), testImageUri, TEST_LOCATION);
+ std::string testMediaUri("http://test.mp4");
+ DALI_TEST_EQUALS(hitTest->GetMediaUri(), testMediaUri, TEST_LOCATION);
+ std::string testTagName("img");
+ DALI_TEST_EQUALS(hitTest->GetTagName(), testTagName, TEST_LOCATION);
+ std::string testNodeValue("test");
+ DALI_TEST_EQUALS(hitTest->GetNodeValue(), testNodeValue, TEST_LOCATION);
+ Dali::Property::Map testMap = hitTest->GetAttributes();
+ DALI_TEST_EQUALS(testMap.Count(), 0, TEST_LOCATION);
+ std::string testImageFileNameExtension("jpg");
+ DALI_TEST_EQUALS(hitTest->GetImageFileNameExtension(), testImageFileNameExtension, TEST_LOCATION);
+ Dali::PixelData testImageBuffer = hitTest->GetImageBuffer();
+ DALI_TEST_CHECK((int)testImageBuffer.GetWidth() == 2 && (int)testImageBuffer.GetHeight() == 2);
+
+ // async...
+ bool result = view.CreateHitTestAsynchronously(100, 100, Dali::WebEngineHitTest::HitTestMode::DEFAULT, &OnHitTestCreated);
+ DALI_TEST_CHECK(result);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gHitTestCreatedCallbackCalled, 1, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewEvaluteJavaScript(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New("ko-KR", "Asia/Seoul");
+
+ view.LoadHtmlString("<body>Hello World!</body>");
+ view.EvaluateJavaScript("jsObject.postMessage('Hello')");
+ view.EvaluateJavaScript("jsObject.postMessage('World')", OnEvaluateJavaScript);
+ Test::EmitGlobalTimerSignal();
+
+ DALI_TEST_EQUALS(gEvaluateJavaScriptCallbackCalled, 1, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewJavaScriptAlertConfirmPrompt(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New("ko-KR", "Asia/Seoul");
+
+ view.RegisterJavaScriptAlertCallback(&OnJavaScriptAlert);
+ view.LoadHtmlString("<head><script type='text/javascript'>alert('this is an alert popup.');</script></head><body>Hello World!</body>");
+ view.JavaScriptAlertReply();
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gJavaScriptAlertCallbackCalled, 1, TEST_LOCATION);
+
+ view.RegisterJavaScriptConfirmCallback(&OnJavaScriptConfirm);
+ view.LoadHtmlString("<head><script type='text/javascript'>confirm('this is a confirm popup.');</script></head><body>Hello World!</body>");
+ view.JavaScriptConfirmReply(true);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gJavaScriptConfirmCallbackCalled, 1, TEST_LOCATION);
+
+ view.RegisterJavaScriptPromptCallback(&OnJavaScriptPrompt);
+ view.LoadHtmlString("<head><script type='text/javascript'>prompt('this is a prompt popup.');</script></head><body>Hello World!</body>");
+ view.JavaScriptPromptReply("it is a prompt.");
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gJavaScriptPromptCallbackCalled, 1, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewLoadHtmlStringOverrideCurrentEntryAndContents(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New("ko-KR", "Asia/Seoul");
+ DALI_TEST_CHECK(view);
+
+ std::string html("<body>Hello World!</body>");
+ std::string basicUri("http://basicurl");
+ std::string unreachableUrl("http://unreachableurl");
+ bool result = view.LoadHtmlStringOverrideCurrentEntry(html, basicUri, unreachableUrl);
+ DALI_TEST_CHECK(result);
+
+ application.SendNotification();
+ application.Render();
+ Test::EmitGlobalTimerSignal();
+
+ result = view.LoadContents(html, html.length(), "html/text", "utf-8", basicUri);
+ DALI_TEST_CHECK(result);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewReloadSuspendResumeNetworkLoadingCustomHeader(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+ view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
+ view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
+
+ application.GetScene().Add(view);
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_CHECK(view);
+
+ view.LoadUrl("http://test.html");
+ bool result = view.AddCustomHeader("key", "value");
+ DALI_TEST_CHECK(result);
+
+ result = view.ReloadWithoutCache();
+ DALI_TEST_CHECK(result);
+
+ uint32_t portNumber = view.StartInspectorServer(5000);
+ DALI_TEST_EQUALS(portNumber, 5000, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render();
+ Test::EmitGlobalTimerSignal();
+
+ result = view.StopInspectorServer();
+ DALI_TEST_CHECK(result);
+
+ view.SuspendNetworkLoading();
+
+ result = view.RemoveCustomHeader("key");
+ DALI_TEST_CHECK(result);
+
+ view.ResumeNetworkLoading();
+
+ END_TEST;
+}
+
+int UtcDaliWebViewMethodsForCoverage(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New("ko-KR", "Asia/Seoul");
+
+ view.LoadHtmlString("<body>Hello World!</body>");
+ view.AddJavaScriptMessageHandler("jsObject",
+ [](const std::string& arg) {
+ });
+ view.SetTtsFocus(true);
+
+ DALI_TEST_CHECK(view);
+
+ END_TEST;
+}
+
+// test cases for web backforward list.
+
+int UtcDaliWebBackForwardListCheckItem(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebBackForwardList* bfList = view.GetBackForwardList();
+ DALI_TEST_CHECK(bfList != 0)
+
+ unsigned int itemCount = bfList->GetItemCount();
+ DALI_TEST_CHECK(itemCount == 1)
+
+ std::unique_ptr<Dali::WebEngineBackForwardListItem> citem = bfList->GetCurrentItem();
+ DALI_TEST_CHECK(citem != 0);
+
+ std::unique_ptr<Dali::WebEngineBackForwardListItem> citemP = bfList->GetPreviousItem();
+ DALI_TEST_CHECK(citemP != 0);
+
+ std::unique_ptr<Dali::WebEngineBackForwardListItem> citemN = bfList->GetNextItem();
+ DALI_TEST_CHECK(citemN != 0);
+
+ const std::string kDefaultUrl("http://url");
+ std::string testValue = citem->GetUrl();
+ DALI_TEST_EQUALS(testValue, kDefaultUrl, TEST_LOCATION);
+
+ const std::string kDefaultTitle("title");
+ testValue = citem->GetTitle();
+ DALI_TEST_EQUALS(testValue, kDefaultTitle, TEST_LOCATION);
+
+ const std::string kDefaultOriginalUrl("http://originalurl");
+ testValue = citem->GetOriginalUrl();
+ DALI_TEST_EQUALS(testValue, kDefaultOriginalUrl, TEST_LOCATION);
+
+ std::unique_ptr<Dali::WebEngineBackForwardListItem> item = bfList->GetItemAtIndex(0);
+ DALI_TEST_CHECK(item != 0);
+
+ std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> vecBack = bfList->GetBackwardItems(-1);
+ DALI_TEST_CHECK(vecBack.size() == 1);
+
+ std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> vecForward = bfList->GetForwardItems(-1);
+ DALI_TEST_CHECK(vecForward.size() == 1);
+
+ END_TEST;
+}
+
+// test cases for web context.
+
+int UtcDaliWebContextGetSetCacheModel(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebContext* context = view.GetContext();
+ DALI_TEST_CHECK(context != 0)
+
+ std::string kDefaultValue;
+
+ // Reset something
+ context->SetAppId("id");
+ context->SetApplicationType(Dali::WebEngineContext::ApplicationType::OTHER);
+ context->SetTimeOffset(0);
+ context->SetTimeZoneOffset(0, 0);
+ context->SetDefaultProxyAuth(kDefaultValue, kDefaultValue);
+ context->DeleteAllWebDatabase();
+ context->DeleteAllWebStorage();
+ context->DeleteLocalFileSystem();
+ context->ClearCache();
+ context->DeleteAllFormPasswordData();
+ context->DeleteAllFormCandidateData();
+
+ // Check default value
+ Dali::WebEngineContext::CacheModel value = context->GetCacheModel();
+ DALI_TEST_CHECK(value == Dali::WebEngineContext::CacheModel::DOCUMENT_VIEWER);
+
+ // Check Set/GetProperty
+ context->SetCacheModel(Dali::WebEngineContext::CacheModel::DOCUMENT_BROWSER);
+ value = context->GetCacheModel();
+ DALI_TEST_CHECK(value == Dali::WebEngineContext::CacheModel::DOCUMENT_BROWSER);
+
+ // Get cache enabled
+ context->EnableCache(true);
+ DALI_TEST_CHECK(context->IsCacheEnabled());
+
+ // Get certificate
+ context->SetCertificateFilePath("test");
+ std::string str = context->GetCertificateFilePath();
+ DALI_TEST_EQUALS(str, "test", TEST_LOCATION);
+
+ // Set version
+ DALI_TEST_CHECK(context->SetAppVersion("test"));
+
+ // Register
+ std::vector<std::string> temp;
+ context->RegisterUrlSchemesAsCorsEnabled(temp);
+ context->RegisterJsPluginMimeTypes(temp);
+ context->DeleteFormPasswordDataList(temp);
+
+ // Get zoom factor
+ context->SetDefaultZoomFactor(1.0f);
+ DALI_TEST_EQUALS(context->GetDefaultZoomFactor(), float(1.0f), TEST_LOCATION);
+
+ // Delete cache and database
+ DALI_TEST_CHECK(context->DeleteAllApplicationCache());
+ DALI_TEST_CHECK(context->DeleteAllWebIndexedDatabase());
+
+ // Get contextProxy
+ context->SetProxyUri("test");
+ DALI_TEST_EQUALS(context->GetProxyUri(), "test", TEST_LOCATION);
+ context->SetProxyBypassRule("", "test");
+ DALI_TEST_EQUALS(context->GetProxyBypassRule(), "test", TEST_LOCATION);
+
+ //Notify low memory
+ DALI_TEST_CHECK(context->FreeUnusedMemory());
+
+ END_TEST;
+}
+
+int UtcDaliWebContextGetWebDatabaseStorageOrigins(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebContext* context = view.GetContext();
+ DALI_TEST_CHECK(context != 0)
+
+ std::string kDefaultValue;
+
+ // get origins of web database
+ bool result = context->GetWebDatabaseOrigins(&OnSecurityOriginsAcquired);
+ DALI_TEST_CHECK(result);
+
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gSecurityOriginsAcquiredCallbackCalled, 1, TEST_LOCATION);
+ DALI_TEST_CHECK(gSecurityOriginList.size() == 1);
+
+ Dali::WebEngineSecurityOrigin* origin = gSecurityOriginList[0].get();
+ DALI_TEST_CHECK(origin);
+
+ result = context->DeleteWebDatabase(*origin);
+ DALI_TEST_CHECK(result);
+
+ // get origins of web storage
+ result = context->GetWebStorageOrigins(&OnSecurityOriginsAcquired);
+ DALI_TEST_CHECK(result);
+
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gSecurityOriginsAcquiredCallbackCalled, 2, TEST_LOCATION);
+ DALI_TEST_CHECK(gSecurityOriginList.size() == 1);
+
+ origin = gSecurityOriginList[0].get();
+ DALI_TEST_CHECK(origin);
+
+ result = context->GetWebStorageUsageForOrigin(*origin, &OnStorageUsageAcquired);
+ DALI_TEST_CHECK(result);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gStorageUsageAcquiredCallbackCalled, 1, TEST_LOCATION);
+
+ result = context->DeleteWebStorage(*origin);
+ DALI_TEST_CHECK(result);
+
+ result = context->DeleteApplicationCache(*origin);
+ DALI_TEST_CHECK(result);
+
+ // form passwords, download state, mime type.
+ context->GetFormPasswordList(&OnFormPasswordsAcquired);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gFormPasswordsAcquiredCallbackCalled, 1, TEST_LOCATION);
+ DALI_TEST_CHECK(gPasswordDataList.size() == 1);
+ DALI_TEST_EQUALS(gPasswordDataList[0]->url, "http://test.html", TEST_LOCATION);
+ DALI_TEST_CHECK(gPasswordDataList[0]->useFingerprint == false);
+
+ context->RegisterDownloadStartedCallback(&OnDownloadStarted);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gDownloadStartedCallbackCalled, 1, TEST_LOCATION);
+
+ context->RegisterMimeOverriddenCallback(&OnMimeOverridden);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gMimeOverriddenCallbackCalled, 1, TEST_LOCATION);
+
+ gSecurityOriginList.clear();
+ gPasswordDataList.clear();
+
+ END_TEST;
+}
+
+int UtcDaliWebContextHttpRequestInterceptor(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebContext* context = view.GetContext();
+ DALI_TEST_CHECK(context != 0)
+
+ // load url.
+ context->RegisterRequestInterceptedCallback(&OnRequestIntercepted);
+ DALI_TEST_EQUALS(gRequestInterceptedCallbackCalled, 0, TEST_LOCATION);
+ DALI_TEST_CHECK(!gRequestInterceptorInstance);
+
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gRequestInterceptedCallbackCalled, 1, TEST_LOCATION);
+
+ // check request interceptor.
+ DALI_TEST_CHECK(gRequestInterceptorInstance);
+ DALI_TEST_CHECK(gRequestInterceptorInstance->Ignore());
+ DALI_TEST_CHECK(gRequestInterceptorInstance->SetResponseStatus(400, "error"));
+ DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseHeader("key1", "value1"));
+ Dali::Property::Map testHeaders;
+ testHeaders.Insert("key2", "value2");
+ DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseHeaders(testHeaders));
+ 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));
+ std::string testUrl("http://test.html");
+ DALI_TEST_EQUALS(gRequestInterceptorInstance->GetUrl(), testUrl, TEST_LOCATION);
+ std::string testMethod("GET");
+ DALI_TEST_EQUALS(gRequestInterceptorInstance->GetMethod(), testMethod, TEST_LOCATION);
+ Dali::Property::Map resultHeaders = gRequestInterceptorInstance->GetHeaders();
+ DALI_TEST_EQUALS(resultHeaders.Count(), 2, TEST_LOCATION);
+
+ gRequestInterceptorInstance = nullptr;
+
+ END_TEST;
+}
+
+// test cases for web cookie manager.
+
+int UtcDaliWebCookieManagerGetSetCookieAcceptPolicy(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ DALI_TEST_CHECK(cookieManager != 0)
+
+ const std::string kDefaultValue;
+
+ // Reset something
+ cookieManager->SetPersistentStorage(kDefaultValue, Dali::WebEngineCookieManager::CookiePersistentStorage::SQLITE);
+ cookieManager->ClearCookies();
+
+ // Check default value
+ Dali::WebEngineCookieManager::CookieAcceptPolicy value = cookieManager->GetCookieAcceptPolicy();
+ DALI_TEST_CHECK(value == Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY);
+
+ // Check Set/GetProperty
+ cookieManager->SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy::ALWAYS);
+ value = cookieManager->GetCookieAcceptPolicy();
+ DALI_TEST_CHECK(value == Dali::WebEngineCookieManager::CookieAcceptPolicy::ALWAYS);
+
+ END_TEST;
+}
+
+int UtcDaliWebCookieManagerChangesWatch(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
+ DALI_TEST_CHECK(cookieManager != 0)
+
+ cookieManager->ChangesWatch(&OnChangesWatch);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gCookieManagerChangsWatchCallbackCalled, 1, TEST_LOCATION);
+
+ END_TEST;
+}
+
+// test cases for web settings.
+
+int UtcDaliWebSettingsGetSetDefaultFontSize(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value
+ int value = settings->GetDefaultFontSize();
+ DALI_TEST_CHECK(value == 16);
+
+ // Check Set/GetProperty
+ settings->SetDefaultFontSize(20);
+ value = settings->GetDefaultFontSize();
+ DALI_TEST_CHECK(value == 20);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableJavaScript(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsJavaScriptEnabled();
+ DALI_TEST_CHECK(value);
+
+ // Check Set/GetProperty
+ settings->EnableJavaScript(false);
+ value = settings->IsJavaScriptEnabled();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableAutoFitting(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsAutoFittingEnabled();
+ DALI_TEST_CHECK(value);
+
+ // Check Set/GetProperty
+ settings->EnableAutoFitting(false);
+ value = settings->IsAutoFittingEnabled();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnablePlugins(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->ArePluginsEnabled();
+ DALI_TEST_CHECK(value);
+
+ // Check Set/GetProperty
+ settings->EnablePlugins(false);
+ value = settings->ArePluginsEnabled();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnablePrivateBrowsing(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsPrivateBrowsingEnabled();
+ DALI_TEST_CHECK(value);
+
+ // Check Set/GetProperty
+ settings->EnablePrivateBrowsing(false);
+ value = settings->IsPrivateBrowsingEnabled();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableLinkMagnifier(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsLinkMagnifierEnabled();
+ DALI_TEST_CHECK(value);
+
+ // Check Set/GetProperty
+ settings->EnableLinkMagnifier(false);
+ value = settings->IsLinkMagnifierEnabled();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckUseKeypadWithoutUserAction(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsKeypadWithoutUserActionUsed();
+ DALI_TEST_CHECK(value);
+
+ // Check Set/GetProperty
+ settings->UseKeypadWithoutUserAction(false);
+ value = settings->IsKeypadWithoutUserActionUsed();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableAutofillPasswordForm(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsAutofillPasswordFormEnabled();
+ DALI_TEST_CHECK(value);
+ settings->EnableAutofillPasswordForm(false);
+ value = settings->IsAutofillPasswordFormEnabled();
+ DALI_TEST_CHECK(!value);
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableFormCandidateData(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0);
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsFormCandidateDataEnabled();
+ DALI_TEST_CHECK(value);
+
+ // Check Set/GetProperty
+ settings->EnableFormCandidateData(false);
+ value = settings->IsFormCandidateDataEnabled();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableTextSelection(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0);
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsTextSelectionEnabled();
+ DALI_TEST_CHECK(value);
+
+ //Check Set/GetProperty
+ settings->EnableTextSelection(false);
+ value = settings->IsTextSelectionEnabled();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableTextAutosizing(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0);
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsTextAutosizingEnabled();
+ DALI_TEST_CHECK(value);
+
+ // Check Set/GetProperty
+ settings->EnableTextAutosizing(false);
+ value = settings->IsTextAutosizingEnabled();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableArrowScroll(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0);
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsArrowScrollEnabled();
+ DALI_TEST_CHECK(value);
+
+ // Check Set/GetProperty
+ settings->EnableArrowScroll(false);
+ value = settings->IsArrowScrollEnabled();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableClipboard(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0);
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsClipboardEnabled();
+ DALI_TEST_CHECK(value);
+ settings->EnableClipboard(false);
+ value = settings->IsClipboardEnabled();
+ DALI_TEST_CHECK(!value);
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckEnableImePanel(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0);
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->IsImePanelEnabled();
+ DALI_TEST_CHECK(value);
+
+ // Check Set/GetProperty
+ settings->EnableImePanel(false);
+ value = settings->IsImePanelEnabled();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsCheckAllowImagesLoadAutomatically(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value is true or not
+ bool value = settings->AreImagesLoadedAutomatically();
+ DALI_TEST_CHECK(value);
+
+ // Check Set/GetProperty
+ settings->AllowImagesLoadAutomatically(false);
+ value = settings->AreImagesLoadedAutomatically();
+ DALI_TEST_CHECK(!value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsGetSetDefaultTextEncodingName(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ const std::string kDefaultValue;
+ const std::string kTestValue = "UTF-8";
+
+ // Reset something
+ settings->AllowMixedContents(false);
+ settings->EnableSpatialNavigation(false);
+ settings->EnableWebSecurity(false);
+ settings->EnableCacheBuilder(false);
+ settings->EnableDoNotTrack(false);
+ settings->UseScrollbarThumbFocusNotifications(false);
+ settings->AllowFileAccessFromExternalUrl(false);
+ settings->AllowScriptsOpenWindows(false);
+
+ // Check default value
+ std::string value = settings->GetDefaultTextEncodingName();
+ DALI_TEST_EQUALS(value, kDefaultValue, TEST_LOCATION);
+
+ // Check Set/GetProperty
+ settings->SetDefaultTextEncodingName(kTestValue);
+ value = settings->GetDefaultTextEncodingName();
+ DALI_TEST_EQUALS(value, kTestValue, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsSetViewportMetaTag(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Check the value is true or not
+ bool value = settings->SetViewportMetaTag(true);
+ DALI_TEST_CHECK(value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsSetForceZoom(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Check the value is true or not
+ bool value = settings->SetForceZoom(true);
+ DALI_TEST_CHECK(value);
+
+ value = settings->IsZoomForced();
+ DALI_TEST_CHECK(value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsSetTextZoomEnabled(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Check the value is true or not
+ bool value = settings->SetTextZoomEnabled(true);
+ DALI_TEST_CHECK(value);
+
+ value = settings->IsTextZoomEnabled();
+ DALI_TEST_CHECK(value);
+
+ END_TEST;
+}
+
+int UtcDaliWebSettingsSetExtraFeature(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ Dali::Toolkit::WebSettings* settings = view.GetSettings();
+ DALI_TEST_CHECK(settings != 0)
+
+ // Check the value is true or not
+ settings->SetExtraFeature("test", true);
+ bool value = settings->IsExtraFeatureEnabled("test");
+ DALI_TEST_CHECK(value);
+
+ END_TEST;
+}
+
+int UtcDaliWebViewGetPlainText(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK(view);
+
+ view.LoadUrl(TEST_URL1);
+
+ view.GetPlainTextAsynchronously(&OnPlainTextReceived);
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS(gPlainTextReceivedCallbackCalled, 1, TEST_LOCATION);