Implement WebView::GetPlainTextAsynchronously
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-WebView.cpp
index d4f9f00..16518da 100755 (executable)
@@ -102,6 +102,7 @@ static int gContextMenuHiddenCallbackCalled = 0;
 static std::unique_ptr<Dali::WebEngineContextMenu> gContextMenuHiddenInstance = nullptr;
 static int gHitTestCreatedCallbackCalled = 0;
 static int gCookieManagerChangsWatchCallbackCalled = 0;
+static int gPlainTextReceivedCallbackCalled = 0;
 
 struct CallbackFunctor
 {
@@ -154,6 +155,12 @@ static bool OnHitTestCreated(std::unique_ptr<Dali::WebEngineHitTest> test)
   return true;
 }
 
+static bool OnPlainTextReceived(const std::string& plainText)
+{
+  gPlainTextReceivedCallbackCalled++;
+  return true;
+}
+
 static void OnPageLoadError(std::unique_ptr<Dali::WebEngineLoadError> error)
 {
   gPageLoadErrorCallbackCalled++;
@@ -651,8 +658,8 @@ int UtcDaliWebViewPropertyVideoHoleEnabled(void)
   WebView view = WebView::New();
   DALI_TEST_CHECK( view );
 
-  const bool kDefaultValue = true;
-  const bool kTestValue = false;
+  const bool kDefaultValue = false;
+  const bool kTestValue = true;
 
   // Check default value
   bool output;
@@ -2294,3 +2301,19 @@ int UtcDaliWebSettingsSetExtraFeature(void)
   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);
+
+  END_TEST;
+}
+