4f7d8fac6482362d9c7768915c141eeaefaa4421
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / utc-Dali-WebView.cpp
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <iostream>
19 #include <stdlib.h>
20
21 #include <dali-toolkit-test-suite-utils.h>
22 #include "dali-toolkit-test-utils/toolkit-timer.h"
23
24 #include <dali.h>
25 #include <dali/devel-api/adaptor-framework/web-engine-certificate.h>
26 #include <dali/devel-api/adaptor-framework/web-engine-console-message.h>
27 #include <dali/devel-api/adaptor-framework/web-engine-context-menu.h>
28 #include <dali/devel-api/adaptor-framework/web-engine-context-menu-item.h>
29 #include <dali/devel-api/adaptor-framework/web-engine-form-repost-decision.h>
30 #include <dali/devel-api/adaptor-framework/web-engine-frame.h>
31 #include <dali/devel-api/adaptor-framework/web-engine-hit-test.h>
32 #include <dali/devel-api/adaptor-framework/web-engine-http-auth-handler.h>
33 #include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
34 #include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
35 #include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
36 #include <dali/devel-api/adaptor-framework/web-engine-context.h>
37 #include <dali/devel-api/adaptor-framework/web-engine-security-origin.h>
38 #include <dali/integration-api/events/hover-event-integ.h>
39 #include <dali/integration-api/events/key-event-integ.h>
40 #include <dali/integration-api/events/touch-event-integ.h>
41 #include <dali/integration-api/events/wheel-event-integ.h>
42 #include <dali/public-api/images/pixel-data.h>
43 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
44 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
45 #include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
46 #include <dali-toolkit/devel-api/controls/web-view/web-context.h>
47 #include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
48 #include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
49 #include <dali-toolkit/devel-api/controls/web-view/web-view.h>
50
51 using namespace Dali;
52 using namespace Toolkit;
53
54 namespace
55 {
56
57 const char* const TEST_URL1( "http://www.somewhere.valid1.com" );
58 const char* const TEST_URL2( "http://www.somewhere.valid2.com" );
59
60 static int gPageLoadStartedCallbackCalled = 0;
61 static int gPageLoadInProgressCallbackCalled = 0;
62 static int gPageLoadFinishedCallbackCalled = 0;
63 static int gPageLoadErrorCallbackCalled = 0;
64 static std::unique_ptr<Dali::WebEngineLoadError> gPageLoadErrorInstance = nullptr;
65 static int gScrollEdgeReachedCallbackCalled = 0;
66 static int gUrlChangedCallbackCalled = 0;
67 static int gEvaluateJavaScriptCallbackCalled = 0;
68 static int gJavaScriptAlertCallbackCalled = 0;
69 static int gJavaScriptConfirmCallbackCalled = 0;
70 static int gJavaScriptPromptCallbackCalled = 0;
71 static int gScreenshotCapturedCallbackCalled = 0;
72 static int gVideoPlayingCallbackCalled = 0;
73 static int gGeolocationPermissionCallbackCalled = 0;
74 static bool gTouched = false;
75 static bool gHovered = false;
76 static bool gWheelEventHandled = false;
77 static int gFormRepostDecidedCallbackCalled = 0;
78 static std::unique_ptr<Dali::WebEngineFormRepostDecision> gFormRepostDecidedInstance = nullptr;
79 static int gFrameRenderedCallbackCalled = 0;
80 static int gRequestInterceptorCallbackCalled = 0;
81 static std::unique_ptr<Dali::WebEngineRequestInterceptor> gRequestInterceptorInstance = nullptr;
82 static int gConsoleMessageCallbackCalled = 0;
83 static std::unique_ptr<Dali::WebEngineConsoleMessage> gConsoleMessageInstance = nullptr;
84 static int gResponsePolicyDecidedCallbackCalled = 0;
85 static std::unique_ptr<Dali::WebEnginePolicyDecision> gResponsePolicyDecisionInstance = nullptr;
86 static int gCertificateConfirmCallbackCalled = 0;
87 static std::unique_ptr<Dali::WebEngineCertificate> gCertificateConfirmInstance = nullptr;
88 static int gSslCertificateChangedCallbackCalled = 0;
89 static std::unique_ptr<Dali::WebEngineCertificate> gSslCertificateInstance = nullptr;
90 static int gHttpAuthHandlerCallbackCalled = 0;
91 static std::unique_ptr<Dali::WebEngineHttpAuthHandler> gHttpAuthInstance = nullptr;
92 static int gSecurityOriginsAcquiredCallbackCalled = 0;
93 static int gStorageUsageAcquiredCallbackCalled = 0;
94 static int gFormPasswordsAcquiredCallbackCalled = 0;
95 static int gDownloadStartedCallbackCalled = 0;
96 static int gMimeOverriddenCallbackCalled = 0;
97 static std::vector<std::unique_ptr<Dali::WebEngineSecurityOrigin>> gSecurityOriginList;
98 static std::vector<std::unique_ptr<Dali::WebEngineContext::PasswordData>> gPasswordDataList;
99 static int gContextMenuShownCallbackCalled = 0;
100 static std::unique_ptr<Dali::WebEngineContextMenu> gContextMenuShownInstance = nullptr;
101 static int gContextMenuHiddenCallbackCalled = 0;
102 static std::unique_ptr<Dali::WebEngineContextMenu> gContextMenuHiddenInstance = nullptr;
103 static int gHitTestCreatedCallbackCalled = 0;
104 static int gCookieManagerChangsWatchCallbackCalled = 0;
105
106 struct CallbackFunctor
107 {
108   CallbackFunctor(bool* callbackFlag)
109   : mCallbackFlag( callbackFlag )
110   {
111   }
112
113   void operator()()
114   {
115     *mCallbackFlag = true;
116   }
117   bool* mCallbackFlag;
118 };
119
120 static void OnPageLoadStarted(const std::string& url)
121 {
122   gPageLoadStartedCallbackCalled++;
123 }
124
125 static void OnPageLoadInProgress(const std::string& url)
126 {
127   gPageLoadInProgressCallbackCalled++;
128 }
129
130 static void OnPageLoadFinished(const std::string& url)
131 {
132   gPageLoadFinishedCallbackCalled++;
133 }
134
135 static void OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge)
136 {
137   gScrollEdgeReachedCallbackCalled++;
138 }
139
140 static void OnResponsePolicyDecided(std::unique_ptr<Dali::WebEnginePolicyDecision> decision)
141 {
142   gResponsePolicyDecidedCallbackCalled++;
143   gResponsePolicyDecisionInstance = std::move(decision);
144 }
145
146 static void OnUrlChanged(const std::string& url)
147 {
148   gUrlChangedCallbackCalled++;
149 }
150
151 static bool OnHitTestCreated(std::unique_ptr<Dali::WebEngineHitTest> test)
152 {
153   gHitTestCreatedCallbackCalled++;
154   return true;
155 }
156
157 static void OnPageLoadError(std::unique_ptr<Dali::WebEngineLoadError> error)
158 {
159   gPageLoadErrorCallbackCalled++;
160   gPageLoadErrorInstance = std::move(error);
161 }
162
163 static void OnEvaluateJavaScript(const std::string& result)
164 {
165   gEvaluateJavaScriptCallbackCalled++;
166 }
167
168 static bool OnJavaScriptAlert(const std::string& result)
169 {
170   gJavaScriptAlertCallbackCalled++;
171   return true;
172 }
173
174 static bool OnJavaScriptConfirm(const std::string& result)
175 {
176   gJavaScriptConfirmCallbackCalled++;
177   return true;
178 }
179
180 static bool OnJavaScriptPrompt(const std::string& meesage1, const std::string& message2)
181 {
182   gJavaScriptPromptCallbackCalled++;
183   return true;
184 }
185
186 static void OnScreenshotCaptured(Dali::Toolkit::ImageView)
187 {
188   gScreenshotCapturedCallbackCalled++;
189 }
190
191 static void OnVideoPlaying(bool isPlaying)
192 {
193   gVideoPlayingCallbackCalled++;
194 }
195
196 static bool OnGeolocationPermission(const std::string&, const std::string&)
197 {
198   gGeolocationPermissionCallbackCalled++;
199   return true;
200 }
201
202 static bool OnTouched( Actor actor, const Dali::TouchEvent& touch )
203 {
204   gTouched = true;
205   return true;
206 }
207
208 static void OnChangesWatch()
209 {
210   gCookieManagerChangsWatchCallbackCalled++;
211 }
212
213 static bool OnHovered(Actor actor, const Dali::HoverEvent& hover)
214 {
215   gHovered = true;
216   return true;
217 }
218
219 static bool OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel)
220 {
221   gWheelEventHandled = true;
222   return true;
223 }
224
225 static void OnFormRepostDecided(std::unique_ptr<Dali::WebEngineFormRepostDecision> decision)
226 {
227   gFormRepostDecidedCallbackCalled++;
228   gFormRepostDecidedInstance = std::move(decision);
229 }
230
231 static void OnFrameRendered()
232 {
233   gFrameRenderedCallbackCalled++;
234 }
235
236 static void OnRequestInterceptor(std::unique_ptr<Dali::WebEngineRequestInterceptor> interceptor)
237 {
238   gRequestInterceptorCallbackCalled++;
239   gRequestInterceptorInstance = std::move(interceptor);
240 }
241
242 static void OnConsoleMessage(std::unique_ptr<Dali::WebEngineConsoleMessage> message)
243 {
244   gConsoleMessageCallbackCalled++;
245   gConsoleMessageInstance = std::move(message);
246 }
247
248 static void OnCertificateConfirm(std::unique_ptr<Dali::WebEngineCertificate> certificate)
249 {
250   gCertificateConfirmCallbackCalled++;
251   gCertificateConfirmInstance = std::move(certificate);
252 }
253
254 static void OnSslCertificateChanged(std::unique_ptr<Dali::WebEngineCertificate> certificate)
255 {
256   gSslCertificateChangedCallbackCalled++;
257   gSslCertificateInstance = std::move(certificate);
258 }
259
260 static void OnHttpAuthHandler(std::unique_ptr<Dali::WebEngineHttpAuthHandler> hander)
261 {
262   gHttpAuthHandlerCallbackCalled++;
263   gHttpAuthInstance = std::move(hander);
264 }
265
266 static void OnSecurityOriginsAcquired(std::vector<std::unique_ptr<Dali::WebEngineSecurityOrigin>>& origins)
267 {
268   gSecurityOriginsAcquiredCallbackCalled++;
269   gSecurityOriginList.clear();
270   gSecurityOriginList.swap(origins);
271 }
272
273 static void OnStorageUsageAcquired(uint64_t usage)
274 {
275   gStorageUsageAcquiredCallbackCalled++;
276 }
277
278 static void OnFormPasswordsAcquired(std::vector<std::unique_ptr<Dali::WebEngineContext::PasswordData>>& passwords)
279 {
280   gFormPasswordsAcquiredCallbackCalled++;
281   gPasswordDataList.clear();
282   gPasswordDataList.swap(passwords);
283 }
284
285 static void OnDownloadStarted(const std::string& url)
286 {
287   gDownloadStartedCallbackCalled++;
288 }
289
290 static bool OnMimeOverridden(const std::string&, const std::string&, std::string&)
291 {
292   gMimeOverriddenCallbackCalled++;
293   return false;
294 }
295
296 static void OnContextMenuShown(std::unique_ptr<Dali::WebEngineContextMenu> menu)
297 {
298   gContextMenuShownCallbackCalled++;
299   gContextMenuShownInstance = std::move(menu);
300 }
301
302 static void OnContextMenuHidden(std::unique_ptr<Dali::WebEngineContextMenu> menu)
303 {
304   gContextMenuHiddenCallbackCalled++;
305   gContextMenuHiddenInstance = std::move(menu);
306 }
307
308 } // namespace
309
310 void web_view_startup(void)
311 {
312   test_return_value = TET_UNDEF;
313 }
314
315 void web_view_cleanup(void)
316 {
317   test_return_value = TET_PASS;
318 }
319
320 int UtcDaliWebViewBasics(void)
321 {
322   ToolkitTestApplication application;
323
324   // Copy and Assignment Test
325   tet_infoline( "UtcDaliWebViewBasic Copy and Assignment Test" );
326   WebView view = WebView::New();
327   DALI_TEST_CHECK( view );
328
329   WebView copy( view );
330   DALI_TEST_CHECK( view == copy );
331
332   WebView assign;
333   DALI_TEST_CHECK( !assign );
334
335   assign = copy;
336   DALI_TEST_CHECK( assign == view );
337
338   // DownCast Test
339   tet_infoline( "UtcDaliWebViewBasic DownCast Test" );
340   BaseHandle handle(view);
341
342   WebView view2 = WebView::DownCast( handle );
343   DALI_TEST_CHECK( view );
344   DALI_TEST_CHECK( view2 );
345   DALI_TEST_CHECK( view == view2 );
346
347   // TypeRegistry Test
348   tet_infoline( "UtcDaliWebViewBasic TypeRegistry Test" );
349   TypeRegistry typeRegistry = TypeRegistry::Get();
350   DALI_TEST_CHECK( typeRegistry );
351
352   TypeInfo typeInfo = typeRegistry.GetTypeInfo( "WebView" );
353   DALI_TEST_CHECK( typeInfo );
354
355   BaseHandle handle2 = typeInfo.CreateInstance();
356   DALI_TEST_CHECK( handle2 );
357
358   WebView view3 = WebView::DownCast( handle2 );
359   DALI_TEST_CHECK( view3 );
360
361   END_TEST;
362 }
363
364 int UtcDaliWebViewPageNavigation(void)
365 {
366   ToolkitTestApplication application;
367
368   WebView view = WebView::New();
369   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
370   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
371   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
372   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
373   application.GetScene().Add( view );
374   application.SendNotification();
375   application.Render();
376   DALI_TEST_CHECK( view );
377
378   view.RegisterPageLoadStartedCallback( &OnPageLoadStarted );
379   view.RegisterPageLoadInProgressCallback( &OnPageLoadInProgress );
380   view.RegisterPageLoadFinishedCallback( &OnPageLoadFinished );
381   view.RegisterUrlChangedCallback( &OnUrlChanged );
382   DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 0, TEST_LOCATION );
383   DALI_TEST_EQUALS( gPageLoadInProgressCallbackCalled, 0, TEST_LOCATION );
384   DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 0, TEST_LOCATION );
385   DALI_TEST_EQUALS( gUrlChangedCallbackCalled, 0, TEST_LOCATION );
386
387   view.LoadUrl( TEST_URL1 );
388   view.GetNaturalSize();
389   Test::EmitGlobalTimerSignal();
390   DALI_TEST_EQUALS( view.CanGoBack(), false, TEST_LOCATION );
391   DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 1, TEST_LOCATION );
392   DALI_TEST_EQUALS( gPageLoadInProgressCallbackCalled, 1, TEST_LOCATION );
393   DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 1, TEST_LOCATION );
394   DALI_TEST_EQUALS( gUrlChangedCallbackCalled, 1, TEST_LOCATION );
395
396   view.LoadUrl( TEST_URL2 );
397   view.Suspend();
398   view.SetProperty( Actor::Property::SIZE, Vector2( 400, 300 ) );
399   application.SendNotification();
400   application.Render();
401   Test::EmitGlobalTimerSignal();
402   view.Resume();
403   DALI_TEST_EQUALS( view.CanGoBack(), true, TEST_LOCATION );
404   DALI_TEST_EQUALS( view.CanGoForward(), false, TEST_LOCATION );
405   DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 2, TEST_LOCATION );
406   DALI_TEST_EQUALS( gPageLoadInProgressCallbackCalled, 2, TEST_LOCATION );
407   DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 2, TEST_LOCATION );
408   DALI_TEST_EQUALS( gUrlChangedCallbackCalled, 2, TEST_LOCATION );
409
410   view.GoBack();
411   Test::EmitGlobalTimerSignal();
412   DALI_TEST_CHECK( !view.CanGoBack() );
413   DALI_TEST_CHECK( view.CanGoForward() );
414
415   view.GoForward();
416   Test::EmitGlobalTimerSignal();
417   DALI_TEST_CHECK( view.CanGoBack() );
418   DALI_TEST_CHECK( !view.CanGoForward() );
419
420   view.Reload();
421   view.StopLoading();
422   view.ClearHistory();
423   Test::EmitGlobalTimerSignal();
424   DALI_TEST_CHECK( !view.CanGoBack() );
425   DALI_TEST_CHECK( !view.CanGoForward() );
426
427   END_TEST;
428 }
429
430 int UtcDaliWebViewPageLoadErrorConsoleMessage(void)
431 {
432   ToolkitTestApplication application;
433
434   WebView view = WebView::New();
435   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
436   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
437   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
438   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
439   application.GetScene().Add( view );
440   application.SendNotification();
441   application.Render();
442   DALI_TEST_CHECK( view );
443
444   view.RegisterPageLoadErrorCallback( &OnPageLoadError );
445   view.RegisterConsoleMessageReceivedCallback( &OnConsoleMessage );
446   DALI_TEST_EQUALS( gPageLoadErrorCallbackCalled, 0, TEST_LOCATION );
447   DALI_TEST_EQUALS( gConsoleMessageCallbackCalled, 0, TEST_LOCATION );
448
449   view.LoadUrl( TEST_URL1 );
450   Test::EmitGlobalTimerSignal();
451   DALI_TEST_EQUALS( gPageLoadErrorCallbackCalled, 1, TEST_LOCATION );
452   DALI_TEST_EQUALS( gConsoleMessageCallbackCalled, 1, TEST_LOCATION );
453
454   // error code.
455   DALI_TEST_CHECK(gPageLoadErrorInstance);
456   DALI_TEST_EQUALS(gPageLoadErrorInstance->GetUrl(), TEST_URL1, TEST_LOCATION);
457   DALI_TEST_EQUALS(gPageLoadErrorInstance->GetCode(), Dali::WebEngineLoadError::ErrorCode::UNKNOWN, TEST_LOCATION);
458   std::string testErrorDescription("This is an error.");
459   DALI_TEST_EQUALS(gPageLoadErrorInstance->GetDescription(), testErrorDescription, TEST_LOCATION);
460   DALI_TEST_EQUALS(gPageLoadErrorInstance->GetType(), Dali::WebEngineLoadError::ErrorType::NONE, TEST_LOCATION);
461
462   // console message.
463   DALI_TEST_CHECK(gConsoleMessageInstance);
464   std::string testConsoleSource("source");
465   DALI_TEST_EQUALS(gConsoleMessageInstance->GetSource(), testConsoleSource, TEST_LOCATION);
466   DALI_TEST_EQUALS(gConsoleMessageInstance->GetLine(), 10, TEST_LOCATION);
467   DALI_TEST_EQUALS(gConsoleMessageInstance->GetSeverityLevel(), Dali::WebEngineConsoleMessage::SeverityLevel::EMPTY, TEST_LOCATION);
468   std::string testConsoleText("This is a text.");
469   DALI_TEST_EQUALS(gConsoleMessageInstance->GetText(), testConsoleText, TEST_LOCATION);
470
471   // reset
472   gPageLoadErrorInstance = nullptr;
473   gConsoleMessageInstance = nullptr;
474
475   END_TEST;
476 }
477
478 int UtcDaliWebViewTouchAndKeys(void)
479 {
480   ToolkitTestApplication application;
481
482   WebView view = WebView::New();
483   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
484   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
485   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
486   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
487
488   application.GetScene().Add( view );
489   application.SendNotification();
490   application.Render();
491
492   view.GetNaturalSize();
493   view.TouchedSignal().Connect( &OnTouched );
494
495   // Touch event
496   Dali::Integration::TouchEvent event;
497   Dali::Integration::Point pointDown, pointUp;
498
499   event = Dali::Integration::TouchEvent();
500   pointDown.SetState( PointState::DOWN );
501   pointDown.SetScreenPosition( Vector2( 10, 10 ) );
502   event.AddPoint( pointDown );
503   application.ProcessEvent( event );
504
505   event = Dali::Integration::TouchEvent();
506   pointUp.SetState( PointState::UP );
507   pointUp.SetScreenPosition( Vector2( 10, 10 ) );
508   event.AddPoint( pointUp );
509   application.ProcessEvent( event );
510
511   // Key event
512   Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor( view );
513   application.ProcessEvent( Integration::KeyEvent( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE ) );
514   application.SendNotification();
515
516   DALI_TEST_CHECK( gTouched );
517   DALI_TEST_CHECK( view );
518
519   END_TEST;
520 }
521
522 int UtcDaliWebViewFocusGainedAndLost(void)
523 {
524   ToolkitTestApplication application;
525
526   WebView view = WebView::New();
527   DALI_TEST_CHECK( view );
528
529   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
530   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
531   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
532   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
533
534   application.GetScene().Add( view );
535   application.SendNotification();
536   application.Render();
537
538   view.SetKeyInputFocus();
539   DALI_TEST_CHECK( view.HasKeyInputFocus() );
540
541   // reset
542   view.ClearKeyInputFocus();
543   DALI_TEST_CHECK( !view.HasKeyInputFocus() );
544
545   END_TEST;
546 }
547
548 int UtcDaliWebViewPropertyPageZoomFactor(void)
549 {
550   ToolkitTestApplication application;
551
552   WebView view = WebView::New();
553   DALI_TEST_CHECK( view );
554
555   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
556   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
557   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
558   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
559
560   application.GetScene().Add( view );
561   application.SendNotification();
562   application.Render();
563
564   view.SetProperty( WebView::Property::PAGE_ZOOM_FACTOR, 1.5f);
565   float zoomFactor = view.GetProperty<float>( WebView::Property::PAGE_ZOOM_FACTOR );
566   DALI_TEST_EQUALS( zoomFactor, 1.5f, TEST_LOCATION );
567
568   view.SetProperty( WebView::Property::PAGE_ZOOM_FACTOR, 1.0f);
569   zoomFactor = view.GetProperty<float>( WebView::Property::PAGE_ZOOM_FACTOR );
570   DALI_TEST_EQUALS( zoomFactor, 1.0f, TEST_LOCATION );
571
572   END_TEST;
573 }
574
575 int UtcDaliWebViewPropertyTextZoomFactor(void)
576 {
577   ToolkitTestApplication application;
578
579   WebView view = WebView::New();
580   DALI_TEST_CHECK( view );
581
582   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
583   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
584   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
585   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
586
587   application.GetScene().Add( view );
588   application.SendNotification();
589   application.Render();
590
591   view.SetProperty( WebView::Property::TEXT_ZOOM_FACTOR, 1.5f);
592   float zoomFactor = view.GetProperty<float>( WebView::Property::TEXT_ZOOM_FACTOR );
593   DALI_TEST_EQUALS( zoomFactor, 1.5f, TEST_LOCATION );
594
595   view.SetProperty( WebView::Property::TEXT_ZOOM_FACTOR, 1.0f);
596   zoomFactor = view.GetProperty<float>( WebView::Property::TEXT_ZOOM_FACTOR );
597   DALI_TEST_EQUALS( zoomFactor, 1.0f, TEST_LOCATION );
598
599   END_TEST;
600 }
601
602 int UtcDaliWebViewPropertyLoadProgressPercentage(void)
603 {
604   ToolkitTestApplication application;
605
606   WebView view = WebView::New();
607   DALI_TEST_CHECK( view );
608
609   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
610   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
611   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
612   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
613
614   application.GetScene().Add( view );
615   application.SendNotification();
616   application.Render();
617
618   float percentage = view.GetProperty<float>( WebView::Property::LOAD_PROGRESS_PERCENTAGE );
619   DALI_TEST_EQUALS( percentage, 0.5f, TEST_LOCATION );
620
621   END_TEST;
622 }
623
624 int UtcDaliWebViewMove(void)
625 {
626   ToolkitTestApplication application;
627
628   WebView view = WebView::New();
629   DALI_TEST_CHECK( view );
630
631   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
632   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
633   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
634   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
635
636   application.GetScene().Add( view );
637   application.SendNotification();
638   application.Render();
639
640   view.SetProperty( Actor::Property::POSITION, Vector2( 100, 100 ));
641   Vector3 viewPos = view.GetProperty<Vector3>( Actor::Property::POSITION );
642   DALI_TEST_EQUALS( viewPos, Vector3( 100, 100, 0 ), TEST_LOCATION );
643
644   END_TEST;
645 }
646
647 int UtcDaliWebViewPropertyVideoHoleEnabled(void)
648 {
649   ToolkitTestApplication application;
650
651   WebView view = WebView::New();
652   DALI_TEST_CHECK( view );
653
654   const bool kDefaultValue = false;
655   const bool kTestValue = true;
656
657   // Check default value
658   bool output;
659   Property::Value value = view.GetProperty( WebView::Property::VIDEO_HOLE_ENABLED );
660   DALI_TEST_CHECK( value.Get( output ) );
661   DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
662
663   // Check Set/GetProperty
664   view.SetProperty( WebView::Property::VIDEO_HOLE_ENABLED, kTestValue );
665   value = view.GetProperty( WebView::Property::VIDEO_HOLE_ENABLED );
666   DALI_TEST_CHECK( value.Get( output ) );
667   DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
668
669   END_TEST;
670 }
671
672 int UtcDaliWebViewPropertyMouseEventsEnabled(void)
673 {
674   ToolkitTestApplication application;
675
676   WebView view = WebView::New();
677   DALI_TEST_CHECK( view );
678
679   const bool kDefaultValue = true;
680   const bool kTestValue = false;
681
682   // Check default value
683   bool output;
684   Property::Value value = view.GetProperty( WebView::Property::MOUSE_EVENTS_ENABLED );
685   DALI_TEST_CHECK( value.Get( output ) );
686   DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
687
688   // Check Set/GetProperty
689   view.SetProperty( WebView::Property::MOUSE_EVENTS_ENABLED, kTestValue );
690   value = view.GetProperty( WebView::Property::MOUSE_EVENTS_ENABLED );
691   DALI_TEST_CHECK( value.Get( output ) );
692   DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
693
694   END_TEST;
695 }
696
697 int UtcDaliWebViewPropertyKeyEventsEnabled(void)
698 {
699   ToolkitTestApplication application;
700
701   WebView view = WebView::New();
702   DALI_TEST_CHECK( view );
703
704   const bool kDefaultValue = true;
705   const bool kTestValue = false;
706
707   // Check default value
708   bool output;
709   Property::Value value = view.GetProperty( WebView::Property::KEY_EVENTS_ENABLED );
710   DALI_TEST_CHECK( value.Get( output ) );
711   DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
712
713   // Check Set/GetProperty
714   view.SetProperty( WebView::Property::KEY_EVENTS_ENABLED, kTestValue );
715   value = view.GetProperty( WebView::Property::KEY_EVENTS_ENABLED );
716   DALI_TEST_CHECK( value.Get( output ) );
717   DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
718
719   END_TEST;
720 }
721
722 int UtcDaliWebViewHoverAndWheel(void)
723 {
724   ToolkitTestApplication application;
725
726   WebView view = WebView::New();
727   DALI_TEST_CHECK( view );
728   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
729   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
730   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
731   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
732
733   application.GetScene().Add( view );
734   application.SendNotification();
735   application.Render();
736
737   view.GetNaturalSize();
738   view.HoveredSignal().Connect( &OnHovered );
739   view.WheelEventSignal().Connect( &OnWheelEvent );
740
741   // Hover event
742   Dali::Integration::HoverEvent event = Dali::Integration::HoverEvent();
743   Dali::Integration::Point pointDown;
744   pointDown.SetState( PointState::DOWN );
745   pointDown.SetScreenPosition( Vector2( 10, 10 ) );
746   event.AddPoint( pointDown );
747   application.ProcessEvent( event );
748
749   event = Dali::Integration::HoverEvent();
750   Dali::Integration::Point pointUp;
751   pointUp.SetState( PointState::UP );
752   pointUp.SetScreenPosition( Vector2( 10, 10 ) );
753   event.AddPoint( pointUp );
754   application.ProcessEvent( event );
755
756   event = Dali::Integration::HoverEvent();
757   Dali::Integration::Point pointMotion;
758   pointUp.SetState( PointState::MOTION );
759   pointUp.SetScreenPosition( Vector2( 10, 10 ) );
760   event.AddPoint( pointMotion );
761   application.ProcessEvent( event );
762
763   // Wheel event
764   Dali::Integration::WheelEvent wheelEvent;
765   wheelEvent.type = Dali::Integration::WheelEvent::Type::MOUSE_WHEEL;
766   wheelEvent.direction = 0;
767   wheelEvent.point = Vector2( 20, 20 );
768   wheelEvent.delta = 10;
769   application.ProcessEvent( wheelEvent );
770   application.SendNotification();
771
772   DALI_TEST_CHECK( gHovered );
773   DALI_TEST_CHECK( gWheelEventHandled );
774
775   END_TEST;
776 }
777
778 int UtcDaliWebViewFormRepostDecidedFrameRendering(void)
779 {
780   ToolkitTestApplication application;
781
782   WebView view = WebView::New();
783   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
784   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
785   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
786   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
787   application.GetScene().Add( view );
788   application.SendNotification();
789   application.Render();
790   DALI_TEST_CHECK( view );
791
792   view.RegisterFormRepostDecidedCallback(&OnFormRepostDecided);
793   view.RegisterFrameRenderedCallback(&OnFrameRendered);
794   DALI_TEST_EQUALS( gFormRepostDecidedCallbackCalled, 0, TEST_LOCATION );
795   DALI_TEST_EQUALS( gFrameRenderedCallbackCalled, 0, TEST_LOCATION );
796
797   view.LoadUrl( TEST_URL1 );
798   Test::EmitGlobalTimerSignal();
799   DALI_TEST_EQUALS( gFormRepostDecidedCallbackCalled, 1, TEST_LOCATION );
800   DALI_TEST_EQUALS( gFrameRenderedCallbackCalled, 1, TEST_LOCATION );
801
802   // form repost decision.
803   DALI_TEST_CHECK(gFormRepostDecidedInstance);
804   gFormRepostDecidedInstance->Reply(true);
805
806   // reset
807   gFormRepostDecidedInstance = nullptr;
808
809   END_TEST;
810 }
811
812 int UtcDaliWebViewSslCertificateHttpAuthentication(void)
813 {
814   ToolkitTestApplication application;
815
816   WebView view = WebView::New();
817   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
818   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
819   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
820   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
821   application.GetScene().Add( view );
822   application.SendNotification();
823   application.Render();
824   DALI_TEST_CHECK( view );
825
826   view.RegisterCertificateConfirmedCallback(&OnCertificateConfirm);
827   view.RegisterSslCertificateChangedCallback(&OnSslCertificateChanged);
828   view.RegisterHttpAuthHandlerCallback(&OnHttpAuthHandler);
829   DALI_TEST_EQUALS( gCertificateConfirmCallbackCalled, 0, TEST_LOCATION );
830   DALI_TEST_EQUALS( gSslCertificateChangedCallbackCalled, 0, TEST_LOCATION );
831   DALI_TEST_EQUALS( gHttpAuthHandlerCallbackCalled, 0, TEST_LOCATION );
832
833   view.LoadUrl( TEST_URL1 );
834   Test::EmitGlobalTimerSignal();
835   DALI_TEST_EQUALS( gCertificateConfirmCallbackCalled, 1, TEST_LOCATION );
836   DALI_TEST_EQUALS( gSslCertificateChangedCallbackCalled, 1, TEST_LOCATION );
837   DALI_TEST_EQUALS( gHttpAuthHandlerCallbackCalled, 1, TEST_LOCATION );
838
839   // certificate.
840   DALI_TEST_CHECK(gCertificateConfirmInstance);
841   gCertificateConfirmInstance->Allow(true);
842   DALI_TEST_CHECK(gCertificateConfirmInstance->IsFromMainFrame());
843
844   DALI_TEST_CHECK(gSslCertificateInstance);
845   DALI_TEST_EQUALS(gSslCertificateInstance->GetPem(), "abc", TEST_LOCATION);
846   DALI_TEST_CHECK(gSslCertificateInstance->IsContextSecure());
847
848   // http authentication.
849   DALI_TEST_CHECK(gHttpAuthInstance);
850   gHttpAuthInstance->Suspend();
851   gHttpAuthInstance->UseCredential("", "");
852   gHttpAuthInstance->CancelCredential();
853   DALI_TEST_EQUALS(gHttpAuthInstance->GetRealm(), "test", TEST_LOCATION);
854
855   // reset
856   gCertificateConfirmInstance = nullptr;
857   gSslCertificateInstance = nullptr;
858   gHttpAuthInstance = nullptr;
859
860   END_TEST;
861 }
862
863 int UtcDaliWebViewGetWebBackForwardList(void)
864 {
865   ToolkitTestApplication application;
866
867   WebView view = WebView::New();
868   DALI_TEST_CHECK( view );
869
870   Dali::Toolkit::WebBackForwardList* bfList = view.GetBackForwardList();
871   DALI_TEST_CHECK( bfList != 0 );
872
873   END_TEST;
874 }
875
876 int UtcDaliWebViewGetWebContext(void)
877 {
878   ToolkitTestApplication application;
879
880   WebView view = WebView::New();
881   DALI_TEST_CHECK( view );
882
883   Dali::Toolkit::WebContext* context = view.GetContext();
884   DALI_TEST_CHECK( context != 0 );
885
886   END_TEST;
887 }
888
889 int UtcDaliWebViewGetWebCookieManager(void)
890 {
891   ToolkitTestApplication application;
892
893   WebView view = WebView::New();
894   DALI_TEST_CHECK( view );
895
896   Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
897   DALI_TEST_CHECK( cookieManager != 0 );
898
899   END_TEST;
900 }
901
902 int UtcDaliWebViewGetWebSettings(void)
903 {
904   ToolkitTestApplication application;
905
906   WebView view = WebView::New();
907   DALI_TEST_CHECK( view );
908
909   Dali::Toolkit::WebSettings* settings = view.GetSettings();
910   DALI_TEST_CHECK( settings != 0 );
911
912   END_TEST;
913 }
914
915 int UtcDaliWebViewProperty1(void)
916 {
917   // URL
918   ToolkitTestApplication application;
919
920   WebView view = WebView::New();
921   DALI_TEST_CHECK( view );
922
923   std::string local;
924   view.SetProperty( WebView::Property::URL, TEST_URL1 );
925   Property::Value val = view.GetProperty( WebView::Property::URL );
926   DALI_TEST_CHECK( val.Get( local ) );
927   DALI_TEST_EQUALS( local, TEST_URL1, TEST_LOCATION );
928
929   END_TEST;
930 }
931
932 int UtcDaliWebViewProperty4(void)
933 {
934   // USER_AGENT
935   ToolkitTestApplication application;
936
937   WebView view = WebView::New();
938   DALI_TEST_CHECK( view );
939
940   const std::string kDefaultValue;
941   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";
942
943   // Check default value
944   std::string output;
945   Property::Value value = view.GetProperty( WebView::Property::USER_AGENT );
946   DALI_TEST_CHECK( value.Get( output ) );
947   DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
948
949   // Check Set/GetProperty
950   view.SetProperty( WebView::Property::USER_AGENT, kTestValue );
951   value = view.GetProperty( WebView::Property::USER_AGENT );
952   DALI_TEST_CHECK( value.Get( output ) );
953   DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
954
955   END_TEST;
956 }
957
958 int UtcDaliWebViewProperty9(void)
959 {
960   // SCROLL_POSITION
961   ToolkitTestApplication application;
962
963   WebView view = WebView::New();
964   DALI_TEST_CHECK( view );
965
966   // Check default value
967   Dali::Vector2 output = Dali::Vector2::ONE;
968   view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
969   DALI_TEST_CHECK( output.x == 0 && output.y == 0 );
970
971   // Check Set/GetProperty
972   Dali::Vector2 testValue = Dali::Vector2( 100, 100 );
973   view.SetProperty( WebView::Property::SCROLL_POSITION, testValue );
974   view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
975   DALI_TEST_EQUALS( output, testValue, TEST_LOCATION );
976
977   // Check default value of scroll size
978   output = Dali::Vector2::ONE;
979   view.GetProperty( WebView::Property::SCROLL_SIZE ).Get( output );
980   DALI_TEST_CHECK( output.x == 500 && output.y == 500 );
981
982   // Check default value of content size
983   output = Dali::Vector2::ONE;
984   view.GetProperty( WebView::Property::CONTENT_SIZE ).Get( output );
985   DALI_TEST_CHECK( output.x == 500 && output.y == 500 );
986
987   END_TEST;
988 }
989
990 int UtcDaliWebViewPropertyBackgroundColorSelectedTextEtc(void)
991 {
992   ToolkitTestApplication application;
993
994   WebView view = WebView::New();
995   DALI_TEST_CHECK( view );
996
997   Dali::Vector4 testValue = Dali::Vector4(0.0f, 0.0f, 0.0f, 0.0f);
998   view.SetProperty(WebView::Property::DOCUMENT_BACKGROUND_COLOR, testValue);
999   view.SetProperty(WebView::Property::TILES_CLEARED_WHEN_HIDDEN, true);
1000   view.SetProperty(WebView::Property::TILE_COVER_AREA_MULTIPLIER, 1.0f);
1001   view.SetProperty(WebView::Property::CURSOR_ENABLED_BY_CLIENT, true);
1002
1003   // Check default value
1004   std::string testText("test");
1005   std::string output;
1006   view.GetProperty(WebView::Property::SELECTED_TEXT).Get(output);
1007   DALI_TEST_EQUALS(output, testText, TEST_LOCATION);
1008
1009   END_TEST;
1010 }
1011
1012 int UtcDaliWebViewPropertyTitleFavicon(void)
1013 {
1014   ToolkitTestApplication application;
1015
1016   char argv[] = "--test";
1017   WebView view = WebView::New( 1, (char**)&argv );
1018   DALI_TEST_CHECK( view );
1019
1020   // reset something
1021   view.ClearAllTilesResources();
1022
1023   // Check default value of title
1024   std::string testValue("title");
1025   std::string output;
1026   view.GetProperty( WebView::Property::TITLE ).Get( output );
1027   DALI_TEST_EQUALS( output, testValue, TEST_LOCATION );
1028
1029   // Check the case that favicon is not null.
1030   Dali::Toolkit::ImageView favicon = view.GetFavicon();
1031   DALI_TEST_CHECK( favicon );
1032   Dali::Vector3 iconsize = favicon.GetProperty< Vector3 >( Dali::Actor::Property::SIZE );
1033   DALI_TEST_CHECK( ( int )iconsize.width == 2 && ( int )iconsize.height == 2 );
1034
1035   // Check the case that favicon is null.
1036   favicon = view.GetFavicon();
1037   DALI_TEST_CHECK( !favicon );
1038
1039   END_TEST;
1040 }
1041
1042 int UtcDaliWebViewContextMenuShownAndHidden(void)
1043 {
1044   ToolkitTestApplication application;
1045
1046   WebView view = WebView::New();
1047   DALI_TEST_CHECK( view );
1048
1049   // load url.
1050   view.RegisterContextMenuShownCallback( &OnContextMenuShown );
1051   view.RegisterContextMenuHiddenCallback( &OnContextMenuHidden );
1052   DALI_TEST_EQUALS( gContextMenuShownCallbackCalled, 0, TEST_LOCATION );
1053   DALI_TEST_EQUALS( gContextMenuHiddenCallbackCalled, 0, TEST_LOCATION );
1054   DALI_TEST_CHECK(gContextMenuShownInstance == 0);
1055   DALI_TEST_CHECK(gContextMenuHiddenInstance == 0);
1056
1057   view.LoadUrl( TEST_URL1 );
1058   Test::EmitGlobalTimerSignal();
1059   DALI_TEST_EQUALS( gContextMenuShownCallbackCalled, 1, TEST_LOCATION );
1060   DALI_TEST_EQUALS( gContextMenuHiddenCallbackCalled, 1, TEST_LOCATION );
1061
1062   // check context meun & its items.
1063   DALI_TEST_CHECK(gContextMenuShownInstance != 0);
1064   std::unique_ptr<Dali::WebEngineContextMenuItem> item = gContextMenuShownInstance->GetItemAt(0);
1065   DALI_TEST_CHECK(item.get() != 0);
1066   std::vector<std::unique_ptr<Dali::WebEngineContextMenuItem>> itemList = gContextMenuShownInstance->GetItemList();
1067   DALI_TEST_CHECK(itemList.size() == 1);
1068   DALI_TEST_CHECK(gContextMenuShownInstance->RemoveItem(*(item.get())));
1069   DALI_TEST_CHECK(gContextMenuShownInstance->AppendItemAsAction(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", false));
1070   DALI_TEST_CHECK(gContextMenuShownInstance->AppendItem(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", "", false));
1071   DALI_TEST_CHECK(gContextMenuShownInstance->SelectItem(*(item.get())));
1072   DALI_TEST_CHECK(gContextMenuShownInstance->Hide());
1073
1074   Dali::WebEngineContextMenuItem::ItemTag testItemTag = Dali::WebEngineContextMenuItem::ItemTag::NO_ACTION;
1075   DALI_TEST_EQUALS(item->GetTag(), testItemTag, TEST_LOCATION);
1076   Dali::WebEngineContextMenuItem::ItemType testItemType = Dali::WebEngineContextMenuItem::ItemType::ACTION;
1077   DALI_TEST_EQUALS(item->GetType(), testItemType, TEST_LOCATION);
1078   DALI_TEST_CHECK(item->IsEnabled());
1079   std::string testLinkUrl("http://test.html");
1080   DALI_TEST_EQUALS(item->GetLinkUrl(), testLinkUrl, TEST_LOCATION);
1081   std::string testImageUrl("http://test.jpg");
1082   DALI_TEST_EQUALS(item->GetImageUrl(), testImageUrl, TEST_LOCATION);
1083   std::string testTitle("title");
1084   DALI_TEST_EQUALS(item->GetTitle(), testTitle, TEST_LOCATION);
1085   DALI_TEST_CHECK(item->GetParentMenu().get() == 0);
1086
1087   DALI_TEST_CHECK(gContextMenuHiddenInstance != 0);
1088
1089   gContextMenuShownInstance = nullptr;
1090   gContextMenuHiddenInstance = nullptr;
1091
1092   END_TEST;
1093 }
1094
1095 int UtcDaliWebViewScrollBy(void)
1096 {
1097   ToolkitTestApplication application;
1098
1099   WebView view = WebView::New();
1100   DALI_TEST_CHECK( view );
1101
1102   // load url.
1103   view.RegisterScrollEdgeReachedCallback( &OnScrollEdgeReached );
1104   DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 0, TEST_LOCATION );
1105
1106   view.LoadUrl( TEST_URL1 );
1107   Test::EmitGlobalTimerSignal();
1108
1109   // set scroll position.
1110   Dali::Vector2 output = Dali::Vector2::ONE;
1111   Dali::Vector2 testValue = Dali::Vector2( 100, 100 );
1112   view.SetProperty( WebView::Property::SCROLL_POSITION, testValue );
1113   view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
1114   DALI_TEST_EQUALS( output, testValue, TEST_LOCATION );
1115
1116   // scroll by and trigger scrollEdgeReached event.
1117   view.ScrollBy( 50, 50 );
1118   Test::EmitGlobalTimerSignal();
1119
1120   view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
1121   DALI_TEST_CHECK( output.x == 150 && output.y == 150 );
1122   DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 1, TEST_LOCATION );
1123
1124   // scroll by and trigger scrollEdgeReached event.
1125   bool result = view.ScrollEdgeBy( 50, 50 );
1126   DALI_TEST_CHECK( result );
1127   Test::EmitGlobalTimerSignal();
1128
1129   view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
1130   DALI_TEST_CHECK( output.x == 200 && output.y == 200 );
1131   DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 2, TEST_LOCATION );
1132
1133   END_TEST;
1134 }
1135
1136 int UtcDaliWebViewSetGetScaleFactorActivateAccessibility(void)
1137 {
1138   ToolkitTestApplication application;
1139
1140   WebView view = WebView::New();
1141   DALI_TEST_CHECK( view );
1142
1143   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
1144   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
1145   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
1146   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
1147
1148   application.GetScene().Add( view );
1149   application.SendNotification();
1150   application.Render();
1151
1152   view.ActivateAccessibility(true);
1153   view.AddDynamicCertificatePath("host", "test/to/path");
1154   bool found = view.HighlightText("test", Dali::WebEnginePlugin::FindOption::CASE_INSENSITIVE, 2);
1155   DALI_TEST_CHECK( found );
1156
1157   view.SetScaleFactor(1.5f, Dali::Vector2(0.0f, 0.0f));
1158   float result = view.GetScaleFactor();
1159   DALI_TEST_EQUALS( result, 1.5f, TEST_LOCATION );
1160
1161   view.SetScaleFactor(1.0f, Dali::Vector2(0.0f, 0.0f));
1162   result = view.GetScaleFactor();
1163   DALI_TEST_EQUALS( result, 1.0f, TEST_LOCATION );
1164
1165   END_TEST;
1166 }
1167
1168 int UtcDaliWebViewGetScreenshotSyncAndAsync(void)
1169 {
1170   // SCROLL_POSITION
1171   ToolkitTestApplication application;
1172
1173   char argv[] = "--test";
1174   WebView view = WebView::New( 1, (char**)&argv );
1175   DALI_TEST_CHECK( view );
1176
1177   // Check GetScreenshot
1178   Dali::Rect<int> viewArea;
1179   viewArea.x = 100;
1180   viewArea.y = 100;
1181   viewArea.width = 10;
1182   viewArea.height = 10;
1183   Dali::Toolkit::ImageView screenshot = view.GetScreenshot(viewArea, 1.0f);
1184   DALI_TEST_CHECK( screenshot );
1185   Dali::Vector3 shotsize = screenshot.GetProperty< Vector3 >( Dali::Actor::Property::SIZE );
1186   DALI_TEST_CHECK( ( int )shotsize.width == viewArea.width && ( int )shotsize.height == viewArea.height );
1187
1188   // Check GetScreenshotAsynchronously
1189   viewArea.x = 100;
1190   viewArea.y = 100;
1191   viewArea.width = 100;
1192   viewArea.height = 100;
1193   bool result = view.GetScreenshotAsynchronously(viewArea, 1.0f, &OnScreenshotCaptured);
1194   DALI_TEST_CHECK( result );
1195
1196   Test::EmitGlobalTimerSignal();
1197
1198   Test::EmitGlobalTimerSignal();
1199   DALI_TEST_EQUALS( gScreenshotCapturedCallbackCalled, 1, TEST_LOCATION );
1200
1201   END_TEST;
1202 }
1203
1204 int UtcDaliWebViewVideoPlayingGeolocationPermission(void)
1205 {
1206   // SCROLL_POSITION
1207   ToolkitTestApplication application;
1208
1209   char argv[] = "--test";
1210   WebView view = WebView::New( 1, (char**)&argv );
1211   DALI_TEST_CHECK( view );
1212
1213   // Check CheckVideoPlayingAsynchronously
1214   bool result = view.CheckVideoPlayingAsynchronously(&OnVideoPlaying);
1215   DALI_TEST_CHECK( result );
1216   Test::EmitGlobalTimerSignal();
1217   DALI_TEST_EQUALS( gVideoPlayingCallbackCalled, 1, TEST_LOCATION );
1218
1219   // Check RegisterGeolocationPermissionCallback
1220   view.RegisterGeolocationPermissionCallback(&OnGeolocationPermission);
1221   Test::EmitGlobalTimerSignal();
1222   DALI_TEST_EQUALS( gGeolocationPermissionCallbackCalled, 1, TEST_LOCATION );
1223
1224   END_TEST;
1225 }
1226
1227 int UtcDaliWebViewHttpRequestInterceptor(void)
1228 {
1229   ToolkitTestApplication application;
1230
1231   WebView view = WebView::New();
1232   DALI_TEST_CHECK( view );
1233
1234   // load url.
1235   view.RegisterRequestInterceptorCallback( &OnRequestInterceptor );
1236   DALI_TEST_EQUALS( gRequestInterceptorCallbackCalled, 0, TEST_LOCATION );
1237   DALI_TEST_CHECK(gRequestInterceptorInstance == 0);
1238
1239   view.LoadUrl( TEST_URL1 );
1240   Test::EmitGlobalTimerSignal();
1241   DALI_TEST_EQUALS( gRequestInterceptorCallbackCalled, 1, TEST_LOCATION );
1242
1243   // check request interceptor.
1244   DALI_TEST_CHECK(gRequestInterceptorInstance != 0);
1245   DALI_TEST_CHECK(gRequestInterceptorInstance->Ignore());
1246   DALI_TEST_CHECK(gRequestInterceptorInstance->SetResponseStatus(400, "error"));
1247   DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseHeader("key", "value"));
1248   DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseBody("test", 4));
1249   std::string testUrl("http://test.html");
1250   DALI_TEST_EQUALS(gRequestInterceptorInstance->GetUrl(), testUrl, TEST_LOCATION);
1251
1252   gRequestInterceptorInstance = nullptr;
1253
1254   END_TEST;
1255 }
1256
1257 int UtcDaliWebViewResponsePolicyDecisionRequest(void)
1258 {
1259   ToolkitTestApplication application;
1260
1261   WebView view = WebView::New();
1262   DALI_TEST_CHECK( view );
1263
1264   // load url.
1265   view.RegisterResponsePolicyDecidedCallback( &OnResponsePolicyDecided );
1266   DALI_TEST_EQUALS( gResponsePolicyDecidedCallbackCalled, 0, TEST_LOCATION );
1267   DALI_TEST_CHECK(gResponsePolicyDecisionInstance == 0);
1268
1269   view.LoadUrl( TEST_URL1 );
1270   Test::EmitGlobalTimerSignal();
1271   DALI_TEST_EQUALS( gResponsePolicyDecidedCallbackCalled, 1, TEST_LOCATION );
1272
1273   // check response policy decision & its frame.
1274   DALI_TEST_CHECK(gResponsePolicyDecisionInstance != 0);
1275   std::string testUrl("http://test.html");
1276   DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetUrl(), testUrl, TEST_LOCATION);
1277   std::string testCookie("test:abc");
1278   DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetCookie(), testCookie, TEST_LOCATION);
1279   Dali::WebEnginePolicyDecision::DecisionType testDecisionType = Dali::WebEnginePolicyDecision::DecisionType::USE;
1280   DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetDecisionType(), testDecisionType, TEST_LOCATION);
1281   std::string testResponseMime("txt/xml");
1282   DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetResponseMime(), testResponseMime, TEST_LOCATION);
1283   int32_t ResponseStatusCode = 500;
1284   DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetResponseStatusCode(), ResponseStatusCode, TEST_LOCATION);
1285   Dali::WebEnginePolicyDecision::NavigationType testNavigationType = Dali::WebEnginePolicyDecision::NavigationType::LINK_CLICKED;
1286   DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetNavigationType(), testNavigationType, TEST_LOCATION);
1287   std::string testScheme("test");
1288   DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetScheme(), testScheme, TEST_LOCATION);
1289   DALI_TEST_CHECK(gResponsePolicyDecisionInstance->Use());
1290   DALI_TEST_CHECK(gResponsePolicyDecisionInstance->Ignore());
1291   DALI_TEST_CHECK(gResponsePolicyDecisionInstance->Suspend());
1292
1293   Dali::WebEngineFrame* webFrame = &(gResponsePolicyDecisionInstance->GetFrame());
1294   DALI_TEST_CHECK(webFrame);
1295   DALI_TEST_CHECK(webFrame->IsMainFrame());
1296
1297   gResponsePolicyDecisionInstance = nullptr;
1298
1299   END_TEST;
1300 }
1301
1302 int UtcDaliWebViewHitTest(void)
1303 {
1304   ToolkitTestApplication application;
1305
1306   WebView view = WebView::New();
1307   DALI_TEST_CHECK( view );
1308
1309   // load url.
1310   view.LoadUrl( TEST_URL1 );
1311
1312   // sync hit test.
1313   std::unique_ptr<Dali::WebEngineHitTest> hitTest = view.CreateHitTest(100, 100, Dali::WebEngineHitTest::HitTestMode::DEFAULT);
1314   DALI_TEST_CHECK(hitTest != 0);
1315   DALI_TEST_EQUALS(hitTest->GetResultContext(), Dali::WebEngineHitTest::ResultContext::DOCUMENT, TEST_LOCATION);
1316   std::string testLinkUri("http://test.html");
1317   DALI_TEST_EQUALS(hitTest->GetLinkUri(), testLinkUri, TEST_LOCATION);
1318   std::string testLinkTitle("test");
1319   DALI_TEST_EQUALS(hitTest->GetLinkTitle(), testLinkTitle, TEST_LOCATION);
1320   std::string testLinkLabel("label");
1321   DALI_TEST_EQUALS(hitTest->GetLinkLabel(), testLinkLabel, TEST_LOCATION);
1322   std::string testImageUri("http://test.jpg");
1323   DALI_TEST_EQUALS(hitTest->GetImageUri(), testImageUri, TEST_LOCATION);
1324   std::string testMediaUri("http://test.mp4");
1325   DALI_TEST_EQUALS(hitTest->GetMediaUri(), testMediaUri, TEST_LOCATION);
1326   std::string testTagName("img");
1327   DALI_TEST_EQUALS(hitTest->GetTagName(), testTagName, TEST_LOCATION);
1328   std::string testNodeValue("test");
1329   DALI_TEST_EQUALS(hitTest->GetNodeValue(), testNodeValue, TEST_LOCATION);
1330   Dali::Property::Map* testMap = &hitTest->GetAttributes();
1331   DALI_TEST_CHECK(testMap);
1332   std::string testImageFileNameExtension("jpg");
1333   DALI_TEST_EQUALS(hitTest->GetImageFileNameExtension(), testImageFileNameExtension, TEST_LOCATION);
1334   Dali::PixelData testImageBuffer = hitTest->GetImageBuffer();
1335   DALI_TEST_CHECK((int)testImageBuffer.GetWidth() == 2 && (int)testImageBuffer.GetHeight() == 2);
1336
1337   // async...
1338   bool result = view.CreateHitTestAsynchronously(100, 100, Dali::WebEngineHitTest::HitTestMode::DEFAULT, &OnHitTestCreated);
1339   DALI_TEST_CHECK(result);
1340   Test::EmitGlobalTimerSignal();
1341   DALI_TEST_EQUALS( gHitTestCreatedCallbackCalled, 1, TEST_LOCATION );
1342
1343   END_TEST;
1344 }
1345
1346 int UtcDaliWebViewEvaluteJavaScript(void)
1347 {
1348   ToolkitTestApplication application;
1349
1350   WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
1351
1352   view.LoadHtmlString( "<body>Hello World!</body>" );
1353   view.EvaluateJavaScript( "jsObject.postMessage('Hello')" );
1354   view.EvaluateJavaScript( "jsObject.postMessage('World')", OnEvaluateJavaScript );
1355   Test::EmitGlobalTimerSignal();
1356
1357   DALI_TEST_EQUALS( gEvaluateJavaScriptCallbackCalled, 1, TEST_LOCATION );
1358
1359   END_TEST;
1360 }
1361
1362 int UtcDaliWebViewJavaScriptAlertConfirmPrompt(void)
1363 {
1364   ToolkitTestApplication application;
1365
1366   WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
1367
1368   view.RegisterJavaScriptAlertCallback( &OnJavaScriptAlert );
1369   view.LoadHtmlString( "<head><script type='text/javascript'>alert('this is an alert popup.');</script></head><body>Hello World!</body>" );
1370   view.JavaScriptAlertReply();
1371   Test::EmitGlobalTimerSignal();
1372   DALI_TEST_EQUALS( gJavaScriptAlertCallbackCalled, 1, TEST_LOCATION );
1373
1374   view.RegisterJavaScriptConfirmCallback( &OnJavaScriptConfirm );
1375   view.LoadHtmlString( "<head><script type='text/javascript'>confirm('this is a confirm popup.');</script></head><body>Hello World!</body>" );
1376   view.JavaScriptConfirmReply( true );
1377   Test::EmitGlobalTimerSignal();
1378   DALI_TEST_EQUALS( gJavaScriptConfirmCallbackCalled, 1, TEST_LOCATION );
1379
1380   view.RegisterJavaScriptPromptCallback( &OnJavaScriptPrompt );
1381   view.LoadHtmlString( "<head><script type='text/javascript'>prompt('this is a prompt popup.');</script></head><body>Hello World!</body>" );
1382   view.JavaScriptPromptReply( "it is a prompt." );
1383   Test::EmitGlobalTimerSignal();
1384   DALI_TEST_EQUALS( gJavaScriptPromptCallbackCalled, 1, TEST_LOCATION );
1385
1386   END_TEST;
1387 }
1388
1389 int UtcDaliWebViewLoadHtmlStringOverrideCurrentEntryAndContents(void)
1390 {
1391   ToolkitTestApplication application;
1392
1393   WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
1394   DALI_TEST_CHECK( view );
1395
1396   std::string html("<body>Hello World!</body>");
1397   std::string basicUri("http://basicurl");
1398   std::string unreachableUrl("http://unreachableurl");
1399   bool result = view.LoadHtmlStringOverrideCurrentEntry( html, basicUri, unreachableUrl );
1400   DALI_TEST_CHECK( result );
1401
1402   application.SendNotification();
1403   application.Render();
1404   Test::EmitGlobalTimerSignal();
1405
1406   result = view.LoadContents( html, html.length(), "html/text", "utf-8", basicUri );
1407   DALI_TEST_CHECK( result );
1408
1409   END_TEST;
1410 }
1411
1412 int UtcDaliWebViewReloadSuspendResumeNetworkLoadingCustomHeader(void)
1413 {
1414   ToolkitTestApplication application;
1415
1416   WebView view = WebView::New();
1417   view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
1418   view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
1419   view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
1420   view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
1421
1422   application.GetScene().Add( view );
1423   application.SendNotification();
1424   application.Render();
1425   DALI_TEST_CHECK( view );
1426
1427   view.LoadUrl( "http://test.html" );
1428   bool result = view.AddCustomHeader("key", "value");
1429   DALI_TEST_CHECK( result );
1430
1431   result = view.ReloadWithoutCache();
1432   DALI_TEST_CHECK( result );
1433
1434   uint32_t portNumber = view.StartInspectorServer(5000);
1435   DALI_TEST_EQUALS( portNumber, 5000, TEST_LOCATION );
1436
1437   application.SendNotification();
1438   application.Render();
1439   Test::EmitGlobalTimerSignal();
1440
1441   result = view.StopInspectorServer();
1442   DALI_TEST_CHECK( result );
1443
1444   view.SuspendNetworkLoading();
1445
1446   result = view.RemoveCustomHeader("key");
1447   DALI_TEST_CHECK( result );
1448
1449   view.ResumeNetworkLoading();
1450
1451   END_TEST;
1452 }
1453
1454 int UtcDaliWebViewMethodsForCoverage(void)
1455 {
1456   ToolkitTestApplication application;
1457
1458   WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
1459
1460   view.LoadHtmlString( "<body>Hello World!</body>" );
1461   view.AddJavaScriptMessageHandler( "jsObject",
1462     []( const std::string& arg ) {
1463     }
1464   );
1465   view.SetTtsFocus(true);
1466
1467   DALI_TEST_CHECK( view );
1468
1469   END_TEST;
1470 }
1471
1472 // test cases for web backforward list.
1473
1474 int UtcDaliWebBackForwardListCheckItem(void)
1475 {
1476   ToolkitTestApplication application;
1477
1478   WebView view = WebView::New();
1479   DALI_TEST_CHECK( view );
1480
1481   Dali::Toolkit::WebBackForwardList* bfList = view.GetBackForwardList();
1482   DALI_TEST_CHECK( bfList != 0 )
1483
1484   unsigned int itemCount = bfList->GetItemCount();
1485   DALI_TEST_CHECK( itemCount == 1 )
1486
1487   std::unique_ptr<Dali::WebEngineBackForwardListItem> citem = bfList->GetCurrentItem();
1488   DALI_TEST_CHECK( citem != 0 );
1489
1490   std::unique_ptr<Dali::WebEngineBackForwardListItem> citemP = bfList->GetPreviousItem();
1491   DALI_TEST_CHECK( citemP != 0 );
1492
1493   std::unique_ptr<Dali::WebEngineBackForwardListItem> citemN = bfList->GetNextItem();
1494   DALI_TEST_CHECK( citemN != 0 );
1495
1496   const std::string kDefaultUrl( "http://url" );
1497   std::string testValue = citem->GetUrl();
1498   DALI_TEST_EQUALS( testValue, kDefaultUrl, TEST_LOCATION );
1499
1500   const std::string kDefaultTitle( "title" );
1501   testValue = citem->GetTitle();
1502   DALI_TEST_EQUALS( testValue, kDefaultTitle, TEST_LOCATION );
1503
1504   const std::string kDefaultOriginalUrl( "http://originalurl" );
1505   testValue = citem->GetOriginalUrl();
1506   DALI_TEST_EQUALS( testValue, kDefaultOriginalUrl, TEST_LOCATION );
1507
1508   std::unique_ptr<Dali::WebEngineBackForwardListItem> item = bfList->GetItemAtIndex( 0 );
1509   DALI_TEST_CHECK( item != 0 );
1510
1511   std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> vecBack = bfList->GetBackwardItems(-1);
1512   DALI_TEST_CHECK( vecBack.size() == 1 );
1513
1514   std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> vecForward = bfList->GetForwardItems(-1);
1515   DALI_TEST_CHECK( vecForward.size() == 1 );
1516
1517   END_TEST;
1518 }
1519
1520 // test cases for web context.
1521
1522 int UtcDaliWebContextGetSetCacheModel(void)
1523 {
1524   ToolkitTestApplication application;
1525
1526   WebView view = WebView::New();
1527   DALI_TEST_CHECK( view );
1528
1529   Dali::Toolkit::WebContext* context = view.GetContext();
1530   DALI_TEST_CHECK( context != 0 )
1531
1532   std::string kDefaultValue;
1533
1534   // Reset something
1535   context->SetAppId( "id" );
1536   context->SetApplicationType( Dali::WebEngineContext::ApplicationType::OTHER );
1537   context->SetTimeOffset( 0 );
1538   context->SetTimeZoneOffset( 0, 0 );
1539   context->SetDefaultProxyAuth( kDefaultValue, kDefaultValue );
1540   context->DeleteAllWebDatabase();
1541   context->DeleteAllWebStorage();
1542   context->DeleteLocalFileSystem();
1543   context->ClearCache();
1544   context->DeleteAllFormPasswordData();
1545   context->DeleteAllFormCandidateData();
1546
1547   // Check default value
1548   Dali::WebEngineContext::CacheModel value = context->GetCacheModel();
1549   DALI_TEST_CHECK( value == Dali::WebEngineContext::CacheModel::DOCUMENT_VIEWER );
1550
1551   // Check Set/GetProperty
1552   context->SetCacheModel( Dali::WebEngineContext::CacheModel::DOCUMENT_BROWSER );
1553   value = context->GetCacheModel();
1554   DALI_TEST_CHECK( value == Dali::WebEngineContext::CacheModel::DOCUMENT_BROWSER );
1555
1556   // Get cache enabled
1557   context->EnableCache( true );
1558   DALI_TEST_CHECK( context->IsCacheEnabled() );
1559
1560   // Get certificate
1561   context->SetCertificateFilePath( "test" );
1562   std::string str = context->GetCertificateFilePath();
1563   DALI_TEST_EQUALS( str, "test", TEST_LOCATION );
1564
1565   // Set version
1566   DALI_TEST_CHECK( context->SetAppVersion( "test" ) );
1567
1568   // Register
1569   std::vector<std::string> temp;
1570   context->RegisterUrlSchemesAsCorsEnabled( temp );
1571   context->RegisterJsPluginMimeTypes( temp );
1572   context->DeleteFormPasswordDataList( temp );
1573
1574   // Get zoom factor
1575   context->SetDefaultZoomFactor( 1.0f );
1576   DALI_TEST_EQUALS( context->GetDefaultZoomFactor(), float( 1.0f ), TEST_LOCATION );
1577
1578   // Delete cache and database
1579   DALI_TEST_CHECK( context->DeleteAllApplicationCache() );
1580   DALI_TEST_CHECK( context->DeleteAllWebIndexedDatabase() );
1581
1582   // Get contextProxy
1583   context->SetProxyUri( "test" );
1584   DALI_TEST_EQUALS( context->GetProxyUri(), "test", TEST_LOCATION );
1585   context->SetProxyBypassRule("", "test");
1586   DALI_TEST_EQUALS( context->GetProxyBypassRule(), "test", TEST_LOCATION );
1587
1588   //Notify low memory
1589   DALI_TEST_CHECK( context->FreeUnusedMemory() );
1590
1591   END_TEST;
1592 }
1593
1594 int UtcDaliWebContextGetWebDatabaseStorageOrigins(void)
1595 {
1596   ToolkitTestApplication application;
1597
1598   WebView view = WebView::New();
1599   DALI_TEST_CHECK( view );
1600
1601   Dali::Toolkit::WebContext* context = view.GetContext();
1602   DALI_TEST_CHECK( context != 0 )
1603
1604   std::string kDefaultValue;
1605
1606   // get origins of web database
1607   bool result = context->GetWebDatabaseOrigins(&OnSecurityOriginsAcquired);
1608   DALI_TEST_CHECK( result );
1609
1610   Test::EmitGlobalTimerSignal();
1611   DALI_TEST_EQUALS( gSecurityOriginsAcquiredCallbackCalled, 1, TEST_LOCATION );
1612   DALI_TEST_CHECK(gSecurityOriginList.size() == 1);
1613
1614   Dali::WebEngineSecurityOrigin* origin = gSecurityOriginList[0].get();
1615   DALI_TEST_CHECK( origin );
1616
1617   result = context->DeleteWebDatabase(*origin);
1618   DALI_TEST_CHECK( result );
1619
1620   // get origins of web storage
1621   result = context->GetWebStorageOrigins(&OnSecurityOriginsAcquired);
1622   DALI_TEST_CHECK( result );
1623
1624   Test::EmitGlobalTimerSignal();
1625   DALI_TEST_EQUALS( gSecurityOriginsAcquiredCallbackCalled, 2, TEST_LOCATION );
1626   DALI_TEST_CHECK(gSecurityOriginList.size() == 1);
1627
1628   origin = gSecurityOriginList[0].get();
1629   DALI_TEST_CHECK( origin );
1630
1631   result = context->GetWebStorageUsageForOrigin(*origin, &OnStorageUsageAcquired);
1632   DALI_TEST_CHECK( result );
1633   Test::EmitGlobalTimerSignal();
1634   DALI_TEST_EQUALS( gStorageUsageAcquiredCallbackCalled, 1, TEST_LOCATION );
1635
1636   result = context->DeleteWebStorage(*origin);
1637   DALI_TEST_CHECK( result );
1638
1639   result = context->DeleteApplicationCache(*origin);
1640   DALI_TEST_CHECK( result );
1641
1642   // form passwords, download state, mime type.
1643   context->GetFormPasswordList(&OnFormPasswordsAcquired);
1644   Test::EmitGlobalTimerSignal();
1645   DALI_TEST_EQUALS(gFormPasswordsAcquiredCallbackCalled, 1, TEST_LOCATION);
1646   DALI_TEST_CHECK(gPasswordDataList.size() == 1);
1647   DALI_TEST_EQUALS(gPasswordDataList[0]->url, "http://test.html", TEST_LOCATION);
1648   DALI_TEST_CHECK(gPasswordDataList[0]->useFingerprint == false);
1649
1650   context->RegisterDownloadStartedCallback(&OnDownloadStarted);
1651   Test::EmitGlobalTimerSignal();
1652   DALI_TEST_EQUALS(gDownloadStartedCallbackCalled, 1, TEST_LOCATION);
1653
1654   context->RegisterMimeOverriddenCallback(&OnMimeOverridden);
1655   Test::EmitGlobalTimerSignal();
1656   DALI_TEST_EQUALS(gMimeOverriddenCallbackCalled, 1, TEST_LOCATION);
1657
1658   gSecurityOriginList.clear();
1659   gPasswordDataList.clear();
1660
1661   END_TEST;
1662 }
1663
1664 // test cases for web cookie manager.
1665
1666 int UtcDaliWebCookieManagerGetSetCookieAcceptPolicy(void)
1667 {
1668   ToolkitTestApplication application;
1669
1670   WebView view = WebView::New();
1671   DALI_TEST_CHECK( view );
1672
1673   Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
1674   DALI_TEST_CHECK( cookieManager != 0 )
1675
1676   const std::string kDefaultValue;
1677
1678   // Reset something
1679   cookieManager->SetPersistentStorage( kDefaultValue, Dali::WebEngineCookieManager::CookiePersistentStorage::SQLITE );
1680   cookieManager->ClearCookies();
1681
1682   // Check default value
1683   Dali::WebEngineCookieManager::CookieAcceptPolicy value = cookieManager->GetCookieAcceptPolicy();
1684   DALI_TEST_CHECK( value == Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY );
1685
1686   // Check Set/GetProperty
1687   cookieManager->SetCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy::ALWAYS );
1688   value = cookieManager->GetCookieAcceptPolicy();
1689   DALI_TEST_CHECK( value == Dali::WebEngineCookieManager::CookieAcceptPolicy::ALWAYS );
1690
1691   END_TEST;
1692 }
1693
1694 int UtcDaliWebCookieManagerChangesWatch(void)
1695 {
1696   ToolkitTestApplication application;
1697
1698   WebView view = WebView::New();
1699   DALI_TEST_CHECK( view );
1700
1701   Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
1702   DALI_TEST_CHECK( cookieManager != 0 )
1703
1704   cookieManager->ChangesWatch(&OnChangesWatch);
1705   Test::EmitGlobalTimerSignal();
1706   DALI_TEST_EQUALS( gCookieManagerChangsWatchCallbackCalled, 1, TEST_LOCATION );
1707
1708   END_TEST;
1709 }
1710
1711 // test cases for web settings.
1712
1713 int UtcDaliWebSettingsGetSetDefaultFontSize(void)
1714 {
1715   ToolkitTestApplication application;
1716
1717   WebView view = WebView::New();
1718   DALI_TEST_CHECK( view );
1719
1720   Dali::Toolkit::WebSettings* settings = view.GetSettings();
1721   DALI_TEST_CHECK( settings != 0 )
1722
1723   // Reset something
1724   settings->AllowMixedContents( false );
1725   settings->EnableSpatialNavigation( false );
1726   settings->EnableWebSecurity( false );
1727   settings->EnableCacheBuilder( false );
1728   settings->EnableDoNotTrack( false );
1729   settings->UseScrollbarThumbFocusNotifications( false );
1730   settings->AllowFileAccessFromExternalUrl( false );
1731   settings->AllowScriptsOpenWindows( false );
1732
1733   // Check default value
1734   int value = settings->GetDefaultFontSize();
1735   DALI_TEST_CHECK( value == 16 );
1736
1737   // Check Set/GetProperty
1738   settings->SetDefaultFontSize( 20 );
1739   value = settings->GetDefaultFontSize();
1740   DALI_TEST_CHECK( value == 20 );
1741
1742   END_TEST;
1743 }
1744
1745 int UtcDaliWebSettingsCheckEnableJavaScript(void)
1746 {
1747   ToolkitTestApplication application;
1748
1749   WebView view = WebView::New();
1750   DALI_TEST_CHECK( view );
1751
1752   Dali::Toolkit::WebSettings* settings = view.GetSettings();
1753   DALI_TEST_CHECK( settings != 0 )
1754
1755   // Reset something
1756   settings->AllowMixedContents( false );
1757   settings->EnableSpatialNavigation( false );
1758   settings->EnableWebSecurity( false );
1759   settings->EnableCacheBuilder( false );
1760   settings->EnableDoNotTrack( false );
1761   settings->UseScrollbarThumbFocusNotifications( false );
1762   settings->AllowFileAccessFromExternalUrl( false );
1763   settings->AllowScriptsOpenWindows( false );
1764
1765   // Check default value is true or not
1766   bool value = settings->IsJavaScriptEnabled();
1767   DALI_TEST_CHECK( value );
1768
1769   // Check Set/GetProperty
1770   settings->EnableJavaScript( false );
1771   value = settings->IsJavaScriptEnabled();
1772   DALI_TEST_CHECK( !value );
1773
1774   END_TEST;
1775 }
1776
1777 int UtcDaliWebSettingsCheckEnableAutoFitting(void)
1778 {
1779   ToolkitTestApplication application;
1780
1781   WebView view = WebView::New();
1782   DALI_TEST_CHECK( view );
1783
1784   Dali::Toolkit::WebSettings* settings = view.GetSettings();
1785   DALI_TEST_CHECK( settings != 0 )
1786
1787   // Reset something
1788   settings->AllowMixedContents( false );
1789   settings->EnableSpatialNavigation( false );
1790   settings->EnableWebSecurity( false );
1791   settings->EnableCacheBuilder( false );
1792   settings->EnableDoNotTrack( false );
1793   settings->UseScrollbarThumbFocusNotifications( false );
1794   settings->AllowFileAccessFromExternalUrl( false );
1795   settings->AllowScriptsOpenWindows( false );
1796
1797   // Check default value is true or not
1798   bool value = settings->IsAutoFittingEnabled();
1799   DALI_TEST_CHECK( value );
1800
1801   // Check Set/GetProperty
1802   settings->EnableAutoFitting( false );
1803   value = settings->IsAutoFittingEnabled();
1804   DALI_TEST_CHECK( !value );
1805
1806   END_TEST;
1807 }
1808
1809 int UtcDaliWebSettingsCheckEnablePlugins(void)
1810 {
1811   ToolkitTestApplication application;
1812
1813   WebView view = WebView::New();
1814   DALI_TEST_CHECK( view );
1815
1816   Dali::Toolkit::WebSettings* settings = view.GetSettings();
1817   DALI_TEST_CHECK( settings != 0 )
1818
1819   // Reset something
1820   settings->AllowMixedContents( false );
1821   settings->EnableSpatialNavigation( false );
1822   settings->EnableWebSecurity( false );
1823   settings->EnableCacheBuilder( false );
1824   settings->EnableDoNotTrack( false );
1825   settings->UseScrollbarThumbFocusNotifications( false );
1826   settings->AllowFileAccessFromExternalUrl( false );
1827   settings->AllowScriptsOpenWindows( false );
1828
1829   // Check default value is true or not
1830   bool value = settings->ArePluginsEnabled();
1831   DALI_TEST_CHECK( value );
1832
1833   // Check Set/GetProperty
1834   settings->EnablePlugins( false );
1835   value = settings->ArePluginsEnabled();
1836   DALI_TEST_CHECK( !value );
1837
1838   END_TEST;
1839 }
1840
1841 int UtcDaliWebSettingsCheckEnablePrivateBrowsing(void)
1842 {
1843   ToolkitTestApplication application;
1844
1845   WebView view = WebView::New();
1846   DALI_TEST_CHECK( view );
1847
1848   Dali::Toolkit::WebSettings* settings = view.GetSettings();
1849   DALI_TEST_CHECK( settings != 0 )
1850
1851   // Reset something
1852   settings->AllowMixedContents( false );
1853   settings->EnableSpatialNavigation( false );
1854   settings->EnableWebSecurity( false );
1855   settings->EnableCacheBuilder( false );
1856   settings->EnableDoNotTrack( false );
1857   settings->UseScrollbarThumbFocusNotifications( false );
1858   settings->AllowFileAccessFromExternalUrl( false );
1859   settings->AllowScriptsOpenWindows( false );
1860
1861   // Check default value is true or not
1862   bool value = settings->IsPrivateBrowsingEnabled();
1863   DALI_TEST_CHECK( value );
1864
1865   // Check Set/GetProperty
1866   settings->EnablePrivateBrowsing( false );
1867   value = settings->IsPrivateBrowsingEnabled();
1868   DALI_TEST_CHECK( !value );
1869
1870   END_TEST;
1871 }
1872
1873 int UtcDaliWebSettingsCheckEnableLinkMagnifier(void)
1874 {
1875   ToolkitTestApplication application;
1876
1877   WebView view = WebView::New();
1878   DALI_TEST_CHECK( view );
1879
1880   Dali::Toolkit::WebSettings* settings = view.GetSettings();
1881   DALI_TEST_CHECK( settings != 0 )
1882
1883   // Reset something
1884   settings->AllowMixedContents( false );
1885   settings->EnableSpatialNavigation( false );
1886   settings->EnableWebSecurity( false );
1887   settings->EnableCacheBuilder( false );
1888   settings->EnableDoNotTrack( false );
1889   settings->UseScrollbarThumbFocusNotifications( false );
1890   settings->AllowFileAccessFromExternalUrl( false );
1891   settings->AllowScriptsOpenWindows( false );
1892
1893   // Check default value is true or not
1894   bool value = settings->IsLinkMagnifierEnabled();
1895   DALI_TEST_CHECK( value );
1896
1897   // Check Set/GetProperty
1898   settings->EnableLinkMagnifier( false );
1899   value = settings->IsLinkMagnifierEnabled();
1900   DALI_TEST_CHECK( !value );
1901
1902   END_TEST;
1903 }
1904
1905 int UtcDaliWebSettingsCheckUseKeypadWithoutUserAction(void)
1906 {
1907   ToolkitTestApplication application;
1908
1909   WebView view = WebView::New();
1910   DALI_TEST_CHECK( view );
1911
1912   Dali::Toolkit::WebSettings* settings = view.GetSettings();
1913   DALI_TEST_CHECK( settings != 0 )
1914
1915   // Reset something
1916   settings->AllowMixedContents( false );
1917   settings->EnableSpatialNavigation( false );
1918   settings->EnableWebSecurity( false );
1919   settings->EnableCacheBuilder( false );
1920   settings->EnableDoNotTrack( false );
1921   settings->UseScrollbarThumbFocusNotifications( false );
1922   settings->AllowFileAccessFromExternalUrl( false );
1923   settings->AllowScriptsOpenWindows( false );
1924
1925   // Check default value is true or not
1926   bool value = settings->IsKeypadWithoutUserActionUsed();
1927   DALI_TEST_CHECK( value );
1928
1929   // Check Set/GetProperty
1930   settings->UseKeypadWithoutUserAction( false );
1931   value = settings->IsKeypadWithoutUserActionUsed();
1932   DALI_TEST_CHECK( !value );
1933
1934   END_TEST;
1935 }
1936
1937 int UtcDaliWebSettingsCheckEnableAutofillPasswordForm(void)
1938 {
1939   ToolkitTestApplication application;
1940
1941   WebView view = WebView::New();
1942   DALI_TEST_CHECK( view );
1943
1944   Dali::Toolkit::WebSettings* settings = view.GetSettings();
1945   DALI_TEST_CHECK( settings != 0 )
1946
1947   // Reset something
1948   settings->AllowMixedContents( false );
1949   settings->EnableSpatialNavigation( false );
1950   settings->EnableWebSecurity( false );
1951   settings->EnableCacheBuilder( false );
1952   settings->EnableDoNotTrack( false );
1953   settings->UseScrollbarThumbFocusNotifications( false );
1954   settings->AllowFileAccessFromExternalUrl( false );
1955   settings->AllowScriptsOpenWindows( false );
1956
1957   // Check default value is true or not
1958   bool value = settings->IsAutofillPasswordFormEnabled();
1959   DALI_TEST_CHECK( value );
1960   settings->EnableAutofillPasswordForm( false );
1961   value = settings->IsAutofillPasswordFormEnabled();
1962   DALI_TEST_CHECK( !value );
1963   END_TEST;
1964 }
1965
1966 int UtcDaliWebSettingsCheckEnableFormCandidateData(void)
1967 {
1968   ToolkitTestApplication application;
1969
1970   WebView view = WebView::New();
1971   DALI_TEST_CHECK( view );
1972
1973   Dali::Toolkit::WebSettings* settings = view.GetSettings();
1974   DALI_TEST_CHECK( settings != 0 );
1975
1976   // Reset something
1977   settings->AllowMixedContents( false );
1978   settings->EnableSpatialNavigation( false );
1979   settings->EnableWebSecurity( false );
1980   settings->EnableCacheBuilder( false );
1981   settings->EnableDoNotTrack( false );
1982   settings->UseScrollbarThumbFocusNotifications( false );
1983   settings->AllowFileAccessFromExternalUrl( false );
1984   settings->AllowScriptsOpenWindows( false );
1985
1986   // Check default value is true or not
1987   bool value = settings->IsFormCandidateDataEnabled();
1988   DALI_TEST_CHECK( value );
1989
1990   // Check Set/GetProperty
1991   settings->EnableFormCandidateData( false );
1992   value = settings->IsFormCandidateDataEnabled();
1993   DALI_TEST_CHECK( !value );
1994
1995   END_TEST;
1996 }
1997
1998 int UtcDaliWebSettingsCheckEnableTextSelection(void)
1999 {
2000   ToolkitTestApplication application;
2001
2002   WebView view = WebView::New();
2003   DALI_TEST_CHECK( view );
2004
2005   Dali::Toolkit::WebSettings* settings = view.GetSettings();
2006   DALI_TEST_CHECK( settings != 0 );
2007
2008   // Reset something
2009   settings->AllowMixedContents( false );
2010   settings->EnableSpatialNavigation( false );
2011   settings->EnableWebSecurity( false );
2012   settings->EnableCacheBuilder( false );
2013   settings->EnableDoNotTrack( false );
2014   settings->UseScrollbarThumbFocusNotifications( false );
2015   settings->AllowFileAccessFromExternalUrl( false );
2016   settings->AllowScriptsOpenWindows( false );
2017
2018   // Check default value is true or not
2019   bool value = settings->IsTextSelectionEnabled();
2020   DALI_TEST_CHECK( value );
2021
2022   //Check Set/GetProperty
2023   settings->EnableTextSelection(false);
2024   value = settings->IsTextSelectionEnabled();
2025   DALI_TEST_CHECK( !value );
2026
2027   END_TEST;
2028 }
2029
2030 int UtcDaliWebSettingsCheckEnableTextAutosizing(void)
2031 {
2032   ToolkitTestApplication application;
2033
2034   WebView view = WebView::New();
2035   DALI_TEST_CHECK( view );
2036
2037   Dali::Toolkit::WebSettings* settings = view.GetSettings();
2038   DALI_TEST_CHECK( settings != 0 );
2039
2040   // Reset something
2041   settings->AllowMixedContents( false );
2042   settings->EnableSpatialNavigation( false );
2043   settings->EnableWebSecurity( false );
2044   settings->EnableCacheBuilder( false );
2045   settings->EnableDoNotTrack( false );
2046   settings->UseScrollbarThumbFocusNotifications( false );
2047   settings->AllowFileAccessFromExternalUrl( false );
2048   settings->AllowScriptsOpenWindows( false );
2049
2050   // Check default value is true or not
2051   bool value = settings->IsTextAutosizingEnabled();
2052   DALI_TEST_CHECK( value );
2053
2054   // Check Set/GetProperty
2055   settings->EnableTextAutosizing(false);
2056   value = settings->IsTextAutosizingEnabled();
2057   DALI_TEST_CHECK( !value );
2058
2059   END_TEST;
2060 }
2061
2062 int UtcDaliWebSettingsCheckEnableArrowScroll(void)
2063 {
2064   ToolkitTestApplication application;
2065
2066   WebView view = WebView::New();
2067   DALI_TEST_CHECK( view );
2068
2069   Dali::Toolkit::WebSettings* settings = view.GetSettings();
2070   DALI_TEST_CHECK( settings != 0 );
2071
2072   // Reset something
2073   settings->AllowMixedContents( false );
2074   settings->EnableSpatialNavigation( false );
2075   settings->EnableWebSecurity( false );
2076   settings->EnableCacheBuilder( false );
2077   settings->EnableDoNotTrack( false );
2078   settings->UseScrollbarThumbFocusNotifications( false );
2079   settings->AllowFileAccessFromExternalUrl( false );
2080   settings->AllowScriptsOpenWindows( false );
2081
2082   // Check default value is true or not
2083   bool value = settings->IsArrowScrollEnabled();
2084   DALI_TEST_CHECK( value );
2085
2086   // Check Set/GetProperty
2087   settings->EnableArrowScroll(false);
2088   value = settings->IsArrowScrollEnabled();
2089   DALI_TEST_CHECK( !value );
2090
2091   END_TEST;
2092 }
2093
2094 int UtcDaliWebSettingsCheckEnableClipboard(void)
2095 {
2096   ToolkitTestApplication application;
2097
2098   WebView view = WebView::New();
2099   DALI_TEST_CHECK( view );
2100
2101   Dali::Toolkit::WebSettings* settings = view.GetSettings();
2102   DALI_TEST_CHECK( settings != 0 );
2103
2104   // Reset something
2105   settings->AllowMixedContents( false );
2106   settings->EnableSpatialNavigation( false );
2107   settings->EnableWebSecurity( false );
2108   settings->EnableCacheBuilder( false );
2109   settings->EnableDoNotTrack( false );
2110   settings->UseScrollbarThumbFocusNotifications( false );
2111   settings->AllowFileAccessFromExternalUrl( false );
2112   settings->AllowScriptsOpenWindows( false );
2113
2114   // Check default value is true or not
2115   bool value = settings->IsClipboardEnabled();
2116   DALI_TEST_CHECK( value );
2117   settings->EnableClipboard(false);
2118   value = settings->IsClipboardEnabled();
2119   DALI_TEST_CHECK( !value );
2120   END_TEST;
2121 }
2122
2123 int UtcDaliWebSettingsCheckEnableImePanel(void)
2124 {
2125   ToolkitTestApplication application;
2126
2127   WebView view = WebView::New();
2128   DALI_TEST_CHECK( view );
2129
2130   Dali::Toolkit::WebSettings* settings = view.GetSettings();
2131   DALI_TEST_CHECK( settings != 0 );
2132
2133   // Reset something
2134   settings->AllowMixedContents( false );
2135   settings->EnableSpatialNavigation( false );
2136   settings->EnableWebSecurity( false );
2137   settings->EnableCacheBuilder( false );
2138   settings->EnableDoNotTrack( false );
2139   settings->UseScrollbarThumbFocusNotifications( false );
2140   settings->AllowFileAccessFromExternalUrl( false );
2141   settings->AllowScriptsOpenWindows( false );
2142
2143   // Check default value is true or not
2144   bool value = settings->IsImePanelEnabled();
2145   DALI_TEST_CHECK( value );
2146
2147   // Check Set/GetProperty
2148   settings->EnableImePanel(false);
2149   value = settings->IsImePanelEnabled();
2150   DALI_TEST_CHECK( !value );
2151
2152   END_TEST;
2153 }
2154
2155 int UtcDaliWebSettingsCheckAllowImagesLoadAutomatically(void)
2156 {
2157   ToolkitTestApplication application;
2158
2159   WebView view = WebView::New();
2160   DALI_TEST_CHECK( view );
2161
2162   Dali::Toolkit::WebSettings* settings = view.GetSettings();
2163   DALI_TEST_CHECK( settings != 0 )
2164
2165   // Reset something
2166   settings->AllowMixedContents( false );
2167   settings->EnableSpatialNavigation( false );
2168   settings->EnableWebSecurity( false );
2169   settings->EnableCacheBuilder( false );
2170   settings->EnableDoNotTrack( false );
2171   settings->UseScrollbarThumbFocusNotifications( false );
2172   settings->AllowFileAccessFromExternalUrl( false );
2173   settings->AllowScriptsOpenWindows( false );
2174
2175   // Check default value is true or not
2176   bool value = settings->AreImagesLoadedAutomatically();
2177   DALI_TEST_CHECK( value );
2178
2179   // Check Set/GetProperty
2180   settings->AllowImagesLoadAutomatically( false );
2181   value = settings->AreImagesLoadedAutomatically();
2182   DALI_TEST_CHECK( !value );
2183
2184   END_TEST;
2185 }
2186
2187 int UtcDaliWebSettingsGetSetDefaultTextEncodingName(void)
2188 {
2189   ToolkitTestApplication application;
2190
2191   WebView view = WebView::New();
2192   DALI_TEST_CHECK( view );
2193
2194   Dali::Toolkit::WebSettings* settings = view.GetSettings();
2195   DALI_TEST_CHECK( settings != 0 )
2196
2197   const std::string kDefaultValue;
2198   const std::string kTestValue = "UTF-8";
2199
2200   // Reset something
2201   settings->AllowMixedContents( false );
2202   settings->EnableSpatialNavigation( false );
2203   settings->EnableWebSecurity( false );
2204   settings->EnableCacheBuilder( false );
2205   settings->EnableDoNotTrack( false );
2206   settings->UseScrollbarThumbFocusNotifications( false );
2207   settings->AllowFileAccessFromExternalUrl( false );
2208   settings->AllowScriptsOpenWindows( false );
2209
2210   // Check default value
2211   std::string value = settings->GetDefaultTextEncodingName();
2212   DALI_TEST_EQUALS( value, kDefaultValue, TEST_LOCATION );
2213
2214   // Check Set/GetProperty
2215   settings->SetDefaultTextEncodingName( kTestValue );
2216   value = settings->GetDefaultTextEncodingName();
2217   DALI_TEST_EQUALS( value, kTestValue, TEST_LOCATION );
2218
2219   END_TEST;
2220 }
2221
2222 int UtcDaliWebSettingsSetViewportMetaTag(void)
2223 {
2224   ToolkitTestApplication application;
2225
2226   WebView view = WebView::New();
2227   DALI_TEST_CHECK( view );
2228
2229   Dali::Toolkit::WebSettings* settings = view.GetSettings();
2230   DALI_TEST_CHECK( settings != 0 )
2231
2232   // Check the value is true or not
2233   bool value = settings->SetViewportMetaTag(true);
2234   DALI_TEST_CHECK( value );
2235
2236   END_TEST;
2237 }
2238
2239 int UtcDaliWebSettingsSetForceZoom(void)
2240 {
2241   ToolkitTestApplication application;
2242
2243   WebView view = WebView::New();
2244   DALI_TEST_CHECK( view );
2245
2246   Dali::Toolkit::WebSettings* settings = view.GetSettings();
2247   DALI_TEST_CHECK( settings != 0 )
2248
2249   // Check the value is true or not
2250   bool value = settings->SetForceZoom(true);
2251   DALI_TEST_CHECK( value );
2252
2253   value = settings->IsZoomForced();
2254   DALI_TEST_CHECK( value );
2255
2256   END_TEST;
2257 }
2258
2259 int UtcDaliWebSettingsSetTextZoomEnabled(void)
2260 {
2261   ToolkitTestApplication application;
2262
2263   WebView view = WebView::New();
2264   DALI_TEST_CHECK( view );
2265
2266   Dali::Toolkit::WebSettings* settings = view.GetSettings();
2267   DALI_TEST_CHECK( settings != 0 )
2268
2269   // Check the value is true or not
2270   bool value = settings->SetTextZoomEnabled(true);
2271   DALI_TEST_CHECK( value );
2272
2273   value = settings->IsTextZoomEnabled();
2274   DALI_TEST_CHECK( value );
2275
2276   END_TEST;
2277 }
2278
2279 int UtcDaliWebSettingsSetExtraFeature(void)
2280 {
2281   ToolkitTestApplication application;
2282
2283   WebView view = WebView::New();
2284   DALI_TEST_CHECK( view );
2285
2286   Dali::Toolkit::WebSettings* settings = view.GetSettings();
2287   DALI_TEST_CHECK( settings != 0 )
2288
2289   // Check the value is true or not
2290   settings->SetExtraFeature("test", true);
2291   bool value = settings->IsExtraFeatureEnabled("test");
2292   DALI_TEST_CHECK( value );
2293
2294   END_TEST;
2295 }
2296