+int UtcDaliWebViewProperty4(void)
+{
+ // USER_AGENT
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ const std::string kDefaultValue;
+ const std::string kTestValue = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36";
+
+ // Check default value
+ std::string output;
+ Property::Value value = view.GetProperty( WebView::Property::USER_AGENT );
+ DALI_TEST_CHECK( value.Get( output ) );
+ DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
+
+ // Check Set/GetProperty
+ view.SetProperty( WebView::Property::USER_AGENT, kTestValue );
+ value = view.GetProperty( WebView::Property::USER_AGENT );
+ DALI_TEST_CHECK( value.Get( output ) );
+ DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliWebViewProperty9(void)
+{
+ // SCROLL_POSITION
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ // 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 UtcDaliWebViewContextMenuCustomizedAndItemSelected(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ // load url.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ view.ContextMenuCustomizedSignal().Connect( &OnContextMenuCustomized );
+ view.ContextMenuItemSelectedSignal().Connect( &OnContextMenuItemSelected );
+ bool signal1 = false;
+ bool signal2 = false;
+ view.ConnectSignal( testTracker, "contextMenuCustomized", CallbackFunctor(&signal1) );
+ view.ConnectSignal( testTracker, "contextMenuItemSelected", CallbackFunctor(&signal2) );
+ DALI_TEST_EQUALS( gContextMenuCustomizedCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( gContextMenuItemSelectedCallbackCalled, 0, TEST_LOCATION );
+ DALI_TEST_CHECK(gContextMenuInstance == 0);
+ DALI_TEST_CHECK(gContextMenuItemInstance == 0);
+
+ view.LoadUrl( TEST_URL1 );
+ Test::EmitGlobalTimerSignal();
+ DALI_TEST_EQUALS( gContextMenuCustomizedCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( gContextMenuItemSelectedCallbackCalled, 1, TEST_LOCATION );
+ DALI_TEST_CHECK( signal1 );
+ DALI_TEST_CHECK( signal2 );
+
+ // check context meun & its items.
+ DALI_TEST_CHECK(gContextMenuInstance != 0);
+ std::unique_ptr<Dali::WebEngineContextMenuItem> item = gContextMenuInstance->GetItemAt(0);
+ DALI_TEST_CHECK(item.get() != 0);
+ std::vector<std::unique_ptr<Dali::WebEngineContextMenuItem>> itemList = gContextMenuInstance->GetItemList();
+ DALI_TEST_CHECK(itemList.size() == 1);
+ Dali::Vector2 testPosition = Dali::Vector2(100, 100);
+ DALI_TEST_EQUALS(gContextMenuInstance->GetPosition(), testPosition, TEST_LOCATION);
+ DALI_TEST_CHECK(gContextMenuInstance->RemoveItem(*(item.get())));
+ DALI_TEST_CHECK(gContextMenuInstance->AppendItemAsAction(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", false));
+ DALI_TEST_CHECK(gContextMenuInstance->AppendItem(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", "", false));
+ DALI_TEST_CHECK(gContextMenuInstance->SelectItem(*(item.get())));
+ DALI_TEST_CHECK(gContextMenuInstance->Hide());
+
+ DALI_TEST_CHECK(gContextMenuItemInstance != 0);
+ Dali::WebEngineContextMenuItem::ItemTag testItemTag = Dali::WebEngineContextMenuItem::ItemTag::NO_ACTION;
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetTag(), testItemTag, TEST_LOCATION);
+ Dali::WebEngineContextMenuItem::ItemType testItemType = Dali::WebEngineContextMenuItem::ItemType::ACTION;
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetType(), testItemType, TEST_LOCATION);
+ DALI_TEST_CHECK(gContextMenuItemInstance->IsEnabled());
+ std::string testLinkUrl("http://test.html");
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetLinkUrl(), testLinkUrl, TEST_LOCATION);
+ std::string testImageUrl("http://test.jpg");
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetImageUrl(), testImageUrl, TEST_LOCATION);
+ std::string testTitle("title");
+ DALI_TEST_EQUALS(gContextMenuItemInstance->GetTitle(), testTitle, TEST_LOCATION);
+ DALI_TEST_CHECK(gContextMenuItemInstance->GetParentMenu().get() == 0);
+
+ gContextMenuInstance = nullptr;
+ gContextMenuItemInstance = nullptr;
+
+ END_TEST;
+}
+
+int UtcDaliWebViewScrollBy(void)
+{
+ ToolkitTestApplication application;
+
+ WebView view = WebView::New();
+ DALI_TEST_CHECK( view );
+
+ // load url.
+ ConnectionTracker* testTracker = new ConnectionTracker();
+ view.ScrollEdgeReachedSignal().Connect( &OnScrollEdgeReached );
+ bool signal1 = false;
+ view.ConnectSignal( testTracker, "scrollEdgeReached", CallbackFunctor(&signal1) );
+ 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 );
+ DALI_TEST_CHECK( signal1 );
+
+ // 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 );
+ DALI_TEST_CHECK( signal1 );
+
+ 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)