+
+// 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 )
+
+ Dali::Toolkit::WebBackForwardListItem* citem = bfList->GetCurrentItem();
+ DALI_TEST_CHECK( citem != 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 );
+
+ Dali::Toolkit::WebBackForwardListItem* item = bfList->GetItemAtIndex( 0 );
+ DALI_TEST_CHECK( item != 0 );
+
+ 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->SetProxyUri( kDefaultValue );
+ context->SetCertificateFilePath( kDefaultValue );
+ context->DisableCache( false );
+ context->SetDefaultProxyAuth( kDefaultValue, kDefaultValue );
+ context->DeleteWebDatabase();
+ context->DeleteWebStorage();
+ context->DeleteLocalFileSystem();
+ context->ClearCache();
+
+ // 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 );
+
+ 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;
+}
+
+// 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->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->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 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->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->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;
+}
+