Add APIs of webview context
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-web-engine.cpp
index 0b0c203..88be84c 100755 (executable)
@@ -83,6 +83,7 @@ bool OnStorageUsageAcquired();
 bool OnFormPasswordAcquired();
 bool OnDownloadStarted();
 bool OnMimeOverridden();
+bool OnChangesWatch();
 
 static void ConnectToGlobalSignal( bool ( *func )() )
 {
@@ -170,7 +171,7 @@ public:
   {
   }
 
-  bool DeleteWebStorageOrigin(Dali::WebEngineSecurityOrigin& origin)
+  bool DeleteWebStorage(Dali::WebEngineSecurityOrigin& origin)
   {
     return true;
   }
@@ -179,10 +180,6 @@ public:
   {
   }
 
-  void DisableCache( bool cacheDisabled ) override
-  {
-  }
-
   void ClearCache() override
   {
   }
@@ -219,6 +216,99 @@ public:
     }
   }
 
+  void EnableCache( bool cacheEnabled ) override
+  {
+  }
+
+  bool IsCacheEnabled() const override
+  {
+    return true;
+  }
+
+  std::string GetContextCertificateFile() const override
+  {
+    return "test";
+  }
+
+  void SetContextAppId(const std::string& appID) override
+  {
+  }
+
+  bool SetContextAppVersion(const std::string& appVersion) override
+  {
+    return true;
+  }
+
+  void SetContextApplicationType(const Dali::WebEngineContext::ApplicationType applicationType) override
+  {
+  }
+
+  void SetContextTimeOffset(float timeOffset) override
+  {
+  }
+
+  void SetContextTimeZoneOffset(float timeZoneOffset, float daylightSavingTime) override
+  {
+  }
+
+  void RegisterUrlSchemesAsCorsEnabled(const std::vector<std::string>& schemes) override
+  {
+  }
+
+  void RegisterJsPluginMimeTypes(const std::vector<std::string>& mimeTypes) override
+  {
+  }
+
+  void SetDefaultZoomFactor(float zoomFactor) override
+  {
+  }
+
+  float GetContextDefaultZoomFactor() const override
+  {
+    return 0;
+  }
+
+  bool DeleteAllApplicationCache() override
+  {
+    return true;
+  }
+
+  bool DeleteAllWebIndexedDatabase() override
+  {
+    return true;
+  }
+
+  void DeleteFormPasswordDataList(const std::vector<std::string>& list) override
+  {
+  }
+
+  void DeleteAllFormPasswordData() override
+  {
+  }
+
+  void DeleteAllFormCandidateData() override
+  {
+  }
+
+  std::string GetContextProxy() const override
+  {
+    return "test";
+  }
+
+  void SetContextProxy(const std::string& proxy, const std::string& bypass) override
+  {
+  }
+
+  std::string GetProxyBypassRule() const override
+  {
+    return "test";
+  }
+
+  bool FreeUnusedMemory() override
+  {
+    return true;
+  }
+
 public:
   Dali::WebEngineContext::WebEngineSecurityOriginAcquiredCallback mSecurityOriginAcquiredCallback;
   Dali::WebEngineContext::WebEngineStorageUsageAcquiredCallback mStorageUsageAcquiredCallback;
@@ -256,6 +346,18 @@ public:
   {
   }
 
+  void ChangesWatch( Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback callback ) override
+  {
+    if ( callback )
+    {
+      ConnectToGlobalSignal( &OnChangesWatch );
+      mChangesWatchCallback = callback;
+    }
+  }
+
+public:
+  Dali::WebEngineCookieManager::WebEngineCookieManagerChangesWatchCallback mChangesWatchCallback;
+
 private:
   Dali::WebEngineCookieManager::CookieAcceptPolicy mockCookieAcceptPolicy;
 };
@@ -989,6 +1091,40 @@ public:
   {
   }
 
+  bool SetViewportMetaTag(bool enable) override
+  {
+    return true;
+  }
+
+  bool SetForceZoom(bool enable) override
+  {
+    return true;
+  }
+
+  bool IsZoomForced() const override
+  {
+    return true;
+  }
+
+  bool SetTextZoomEnabled(bool enable) override
+  {
+    return true;
+  }
+
+  bool IsTextZoomEnabled() const override
+  {
+    return true;
+  }
+
+  void SetExtraFeature(const std::string& feature, bool enable) override
+  {
+  }
+
+  bool IsExtraFeatureEnabled(const std::string& feature) const override
+  {
+    return  true;
+  }
+
 private:
   int mockDefaultFontSize;
   bool mockJavaScriptEnabled;
@@ -1693,6 +1829,22 @@ bool OnMimeOverridden()
   return false;
 }
 
+bool OnChangesWatch()
+{
+  DisconnectFromGlobalSignal( &OnChangesWatch );
+
+  if ( gInstance )
+  {
+    MockWebEngineCookieManager* temp = (MockWebEngineCookieManager *)(&(gInstance->GetCookieManager()));
+    if ( temp )
+    {
+      temp->mChangesWatchCallback();
+    }
+  }
+
+  return false;
+}
+
 } // namespace
 
 inline WebEngine& GetImplementation( Dali::WebEngine& webEngine )