2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
21 #include <dali-toolkit-test-suite-utils.h>
22 #include "dali-toolkit-test-utils/toolkit-timer.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-frame.h>
28 #include <dali/devel-api/adaptor-framework/web-engine-http-auth-handler.h>
29 #include <dali/devel-api/adaptor-framework/web-engine-load-error.h>
30 #include <dali/devel-api/adaptor-framework/web-engine-policy-decision.h>
31 #include <dali/devel-api/adaptor-framework/web-engine-request-interceptor.h>
32 #include <dali/integration-api/events/hover-event-integ.h>
33 #include <dali/integration-api/events/key-event-integ.h>
34 #include <dali/integration-api/events/touch-event-integ.h>
35 #include <dali/integration-api/events/wheel-event-integ.h>
36 #include <dali/public-api/images/pixel-data.h>
37 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
38 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
39 #include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
40 #include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list-item.h>
41 #include <dali-toolkit/devel-api/controls/web-view/web-context.h>
42 #include <dali-toolkit/devel-api/controls/web-view/web-cookie-manager.h>
43 #include <dali-toolkit/devel-api/controls/web-view/web-form-repost-decision.h>
44 #include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
45 #include <dali-toolkit/devel-api/controls/web-view/web-view.h>
48 using namespace Toolkit;
53 const char* const TEST_URL1( "http://www.somewhere.valid1.com" );
54 const char* const TEST_URL2( "http://www.somewhere.valid2.com" );
56 static int gPageLoadStartedCallbackCalled = 0;
57 static int gPageLoadInProgressCallbackCalled = 0;
58 static int gPageLoadFinishedCallbackCalled = 0;
59 static int gPageLoadErrorCallbackCalled = 0;
60 static std::shared_ptr<Dali::WebEngineLoadError> gPageLoadErrorInstance = nullptr;
61 static int gScrollEdgeReachedCallbackCalled = 0;
62 static int gUrlChangedCallbackCalled = 0;
63 static int gEvaluateJavaScriptCallbackCalled = 0;
64 static int gJavaScriptAlertCallbackCalled = 0;
65 static int gJavaScriptConfirmCallbackCalled = 0;
66 static int gJavaScriptPromptCallbackCalled = 0;
67 static int gScreenshotCapturedCallbackCalled = 0;
68 static int gVideoPlayingCallbackCalled = 0;
69 static int gGeolocationPermissionCallbackCalled = 0;
70 static bool gTouched = false;
71 static bool gHovered = false;
72 static bool gWheelEventHandled = false;
73 static int gFormRepostDecisionCallbackCalled = 0;
74 static std::shared_ptr<Dali::Toolkit::WebFormRepostDecision> gFormRepostDecisionInstance = nullptr;
75 static int gFrameRenderedCallbackCalled = 0;
76 static int gRequestInterceptorCallbackCalled = 0;
77 static std::shared_ptr<Dali::WebEngineRequestInterceptor> gRequestInterceptorInstance = nullptr;
78 static int gConsoleMessageCallbackCalled = 0;
79 static std::shared_ptr<Dali::WebEngineConsoleMessage> gConsoleMessageInstance = nullptr;
80 static int gPolicyDecisionCallbackCalled = 0;
81 static std::shared_ptr<Dali::WebEnginePolicyDecision> gPolicyDecisionInstance = nullptr;
82 static int gCertificateConfirmCallbackCalled = 0;
83 static std::shared_ptr<Dali::WebEngineCertificate> gCertificateConfirmInstance = nullptr;
84 static int gSslCertificateChangedCallbackCalled = 0;
85 static std::shared_ptr<Dali::WebEngineCertificate> gSslCertificateInstance = nullptr;
86 static int gHttpAuthHandlerCallbackCalled = 0;
87 static std::shared_ptr<Dali::WebEngineHttpAuthHandler> gHttpAuthInstance = nullptr;
89 struct CallbackFunctor
91 CallbackFunctor(bool* callbackFlag)
92 : mCallbackFlag( callbackFlag )
98 *mCallbackFlag = true;
103 static void OnPageLoadStarted( WebView view, const std::string& url )
105 gPageLoadStartedCallbackCalled++;
108 static void OnPageLoadInProgress( WebView view, const std::string& url )
110 gPageLoadInProgressCallbackCalled++;
113 static void OnPageLoadFinished( WebView view, const std::string& url )
115 gPageLoadFinishedCallbackCalled++;
118 static void OnScrollEdgeReached( WebView view, Dali::WebEnginePlugin::ScrollEdge edge )
120 gScrollEdgeReachedCallbackCalled++;
123 static void OnPolicyDecisionRequest(WebView view, std::shared_ptr<Dali::WebEnginePolicyDecision> decision)
125 gPolicyDecisionCallbackCalled++;
126 gPolicyDecisionInstance = std::move(decision);
129 static void OnUrlChanged( WebView view, const std::string& url )
131 gUrlChangedCallbackCalled++;
134 static void OnPageLoadError(WebView view, std::shared_ptr<Dali::WebEngineLoadError> error)
136 gPageLoadErrorCallbackCalled++;
137 gPageLoadErrorInstance = std::move(error);
140 static void OnEvaluateJavaScript( const std::string& result )
142 gEvaluateJavaScriptCallbackCalled++;
145 static bool OnJavaScriptAlert( const std::string& result )
147 gJavaScriptAlertCallbackCalled++;
151 static bool OnJavaScriptConfirm( const std::string& result )
153 gJavaScriptConfirmCallbackCalled++;
157 static bool OnJavaScriptPrompt( const std::string& meesage1, const std::string& message2 )
159 gJavaScriptPromptCallbackCalled++;
163 static void OnScreenshotCaptured(Dali::Toolkit::ImageView)
165 gScreenshotCapturedCallbackCalled++;
\r
168 static void OnVideoPlaying(bool isPlaying)
170 gVideoPlayingCallbackCalled++;
173 static bool OnGeolocationPermission(const std::string&, const std::string&)
175 gGeolocationPermissionCallbackCalled++;
179 static bool OnTouched( Actor actor, const Dali::TouchEvent& touch )
185 static bool OnHovered( Actor actor, const Dali::HoverEvent& hover )
191 static bool OnWheelEvent( Actor actor, const Dali::WheelEvent& wheel )
193 gWheelEventHandled = true;
197 static void OnFormRepostDecision(WebView, std::shared_ptr<Dali::Toolkit::WebFormRepostDecision> decision)
199 gFormRepostDecisionCallbackCalled++;
200 gFormRepostDecisionInstance = std::move(decision);
203 static void OnFrameRendered(WebView)
205 gFrameRenderedCallbackCalled++;
208 static void OnRequestInterceptor(WebView view, std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor)
210 gRequestInterceptorCallbackCalled++;
211 gRequestInterceptorInstance = std::move(interceptor);
214 static void OnConsoleMessage(WebView view, std::shared_ptr<Dali::WebEngineConsoleMessage> message)
216 gConsoleMessageCallbackCalled++;
217 gConsoleMessageInstance = std::move(message);
220 static void OnCertificateConfirm(WebView view, std::shared_ptr<Dali::WebEngineCertificate> certificate )
222 gCertificateConfirmCallbackCalled++;
223 gCertificateConfirmInstance = std::move(certificate);
226 static void OnSslCertificateChanged(WebView view, std::shared_ptr<Dali::WebEngineCertificate> certificate )
228 gSslCertificateChangedCallbackCalled++;
229 gSslCertificateInstance = std::move(certificate);
232 static void OnHttpAuthHandler( WebView view, std::shared_ptr<Dali::WebEngineHttpAuthHandler> hander )
234 gHttpAuthHandlerCallbackCalled++;
235 gHttpAuthInstance = std::move(hander);
240 void web_view_startup(void)
242 test_return_value = TET_UNDEF;
245 void web_view_cleanup(void)
247 test_return_value = TET_PASS;
250 int UtcDaliWebViewBasics(void)
252 ToolkitTestApplication application;
254 // Copy and Assignment Test
255 tet_infoline( "UtcDaliWebViewBasic Copy and Assignment Test" );
256 WebView view = WebView::New();
257 DALI_TEST_CHECK( view );
259 WebView copy( view );
260 DALI_TEST_CHECK( view == copy );
263 DALI_TEST_CHECK( !assign );
266 DALI_TEST_CHECK( assign == view );
269 tet_infoline( "UtcDaliWebViewBasic DownCast Test" );
270 BaseHandle handle(view);
272 WebView view2 = WebView::DownCast( handle );
273 DALI_TEST_CHECK( view );
274 DALI_TEST_CHECK( view2 );
275 DALI_TEST_CHECK( view == view2 );
278 tet_infoline( "UtcDaliWebViewBasic TypeRegistry Test" );
279 TypeRegistry typeRegistry = TypeRegistry::Get();
280 DALI_TEST_CHECK( typeRegistry );
282 TypeInfo typeInfo = typeRegistry.GetTypeInfo( "WebView" );
283 DALI_TEST_CHECK( typeInfo );
285 BaseHandle handle2 = typeInfo.CreateInstance();
286 DALI_TEST_CHECK( handle2 );
288 WebView view3 = WebView::DownCast( handle2 );
289 DALI_TEST_CHECK( view3 );
294 int UtcDaliWebViewPageNavigation(void)
296 ToolkitTestApplication application;
298 WebView view = WebView::New();
299 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
300 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
301 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
302 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
303 application.GetScene().Add( view );
304 application.SendNotification();
305 application.Render();
306 DALI_TEST_CHECK( view );
308 ConnectionTracker* testTracker = new ConnectionTracker();
309 view.PageLoadStartedSignal().Connect( &OnPageLoadStarted );
310 view.PageLoadInProgressSignal().Connect( &OnPageLoadInProgress );
311 view.PageLoadFinishedSignal().Connect( &OnPageLoadFinished );
312 view.UrlChangedSignal().Connect( &OnUrlChanged );
313 bool signal1 = false;
314 bool signal2 = false;
315 bool signal3 = false;
316 bool signal4 = false;
317 bool signal5 = false;
318 view.ConnectSignal( testTracker, "pageLoadStarted", CallbackFunctor(&signal1) );
319 view.ConnectSignal( testTracker, "pageLoadInProgress", CallbackFunctor(&signal2) );
320 view.ConnectSignal( testTracker, "pageLoadFinished", CallbackFunctor(&signal3) );
321 view.ConnectSignal( testTracker, "urlChanged", CallbackFunctor(&signal4) );
322 view.ConnectSignal( testTracker, "invalidname", CallbackFunctor(&signal5) );
323 DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 0, TEST_LOCATION );
324 DALI_TEST_EQUALS( gPageLoadInProgressCallbackCalled, 0, TEST_LOCATION );
325 DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 0, TEST_LOCATION );
326 DALI_TEST_EQUALS( gUrlChangedCallbackCalled, 0, TEST_LOCATION );
328 view.LoadUrl( TEST_URL1 );
329 view.GetNaturalSize();
330 Test::EmitGlobalTimerSignal();
331 DALI_TEST_EQUALS( view.CanGoBack(), false, TEST_LOCATION );
332 DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 1, TEST_LOCATION );
333 DALI_TEST_EQUALS( gPageLoadInProgressCallbackCalled, 1, TEST_LOCATION );
334 DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 1, TEST_LOCATION );
335 DALI_TEST_EQUALS( gUrlChangedCallbackCalled, 1, TEST_LOCATION );
336 DALI_TEST_CHECK( signal1 & signal2 & signal3 & signal4 );
337 DALI_TEST_CHECK( !signal5 );
339 view.LoadUrl( TEST_URL2 );
341 view.SetProperty( Actor::Property::SIZE, Vector2( 400, 300 ) );
342 application.SendNotification();
343 application.Render();
344 Test::EmitGlobalTimerSignal();
346 DALI_TEST_EQUALS( view.CanGoBack(), true, TEST_LOCATION );
347 DALI_TEST_EQUALS( view.CanGoForward(), false, TEST_LOCATION );
348 DALI_TEST_EQUALS( gPageLoadStartedCallbackCalled, 2, TEST_LOCATION );
349 DALI_TEST_EQUALS( gPageLoadInProgressCallbackCalled, 2, TEST_LOCATION );
350 DALI_TEST_EQUALS( gPageLoadFinishedCallbackCalled, 2, TEST_LOCATION );
351 DALI_TEST_EQUALS( gUrlChangedCallbackCalled, 2, TEST_LOCATION );
354 Test::EmitGlobalTimerSignal();
355 DALI_TEST_CHECK( !view.CanGoBack() );
356 DALI_TEST_CHECK( view.CanGoForward() );
359 Test::EmitGlobalTimerSignal();
360 DALI_TEST_CHECK( view.CanGoBack() );
361 DALI_TEST_CHECK( !view.CanGoForward() );
366 Test::EmitGlobalTimerSignal();
367 DALI_TEST_CHECK( !view.CanGoBack() );
368 DALI_TEST_CHECK( !view.CanGoForward() );
373 int UtcDaliWebViewPageLoadErrorConsoleMessage(void)
375 ToolkitTestApplication application;
377 WebView view = WebView::New();
378 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
379 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
380 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
381 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
382 application.GetScene().Add( view );
383 application.SendNotification();
384 application.Render();
385 DALI_TEST_CHECK( view );
387 ConnectionTracker* testTracker = new ConnectionTracker();
388 view.PageLoadErrorSignal().Connect( &OnPageLoadError );
389 view.ConsoleMessageSignal().Connect( &OnConsoleMessage );
390 bool signal1 = false;
391 bool signal2 = false;
392 view.ConnectSignal( testTracker, "pageLoadError", CallbackFunctor(&signal1) );
393 view.ConnectSignal( testTracker, "consoleMessage", CallbackFunctor(&signal2) );
394 DALI_TEST_EQUALS( gPageLoadErrorCallbackCalled, 0, TEST_LOCATION );
395 DALI_TEST_EQUALS( gConsoleMessageCallbackCalled, 0, TEST_LOCATION );
397 view.LoadUrl( TEST_URL1 );
398 Test::EmitGlobalTimerSignal();
399 DALI_TEST_EQUALS( gPageLoadErrorCallbackCalled, 1, TEST_LOCATION );
400 DALI_TEST_EQUALS( gConsoleMessageCallbackCalled, 1, TEST_LOCATION );
401 DALI_TEST_CHECK( signal1 & signal2);
404 DALI_TEST_CHECK(gPageLoadErrorInstance);
405 DALI_TEST_EQUALS(gPageLoadErrorInstance->GetUrl(), TEST_URL1, TEST_LOCATION);
406 DALI_TEST_EQUALS(gPageLoadErrorInstance->GetCode(), Dali::WebEngineLoadError::ErrorCode::UNKNOWN, TEST_LOCATION);
407 std::string testErrorDescription("This is an error.");
408 DALI_TEST_EQUALS(gPageLoadErrorInstance->GetDescription(), testErrorDescription, TEST_LOCATION);
409 DALI_TEST_EQUALS(gPageLoadErrorInstance->GetType(), Dali::WebEngineLoadError::ErrorType::NONE, TEST_LOCATION);
412 DALI_TEST_CHECK(gConsoleMessageInstance);
413 std::string testConsoleSource("source");
414 DALI_TEST_EQUALS(gConsoleMessageInstance->GetSource(), testConsoleSource, TEST_LOCATION);
415 DALI_TEST_EQUALS(gConsoleMessageInstance->GetLine(), 10, TEST_LOCATION);
416 DALI_TEST_EQUALS(gConsoleMessageInstance->GetSeverityLevel(), Dali::WebEngineConsoleMessage::SeverityLevel::EMPTY, TEST_LOCATION);
417 std::string testConsoleText("This is a text.");
418 DALI_TEST_EQUALS(gConsoleMessageInstance->GetText(), testConsoleText, TEST_LOCATION);
421 gPageLoadErrorInstance = nullptr;
422 gConsoleMessageInstance = nullptr;
427 int UtcDaliWebViewTouchAndKeys(void)
429 ToolkitTestApplication application;
431 WebView view = WebView::New();
432 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
433 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
434 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
435 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
437 application.GetScene().Add( view );
438 application.SendNotification();
439 application.Render();
441 view.GetNaturalSize();
442 view.TouchedSignal().Connect( &OnTouched );
445 Dali::Integration::TouchEvent event;
446 Dali::Integration::Point pointDown, pointUp;
448 event = Dali::Integration::TouchEvent();
449 pointDown.SetState( PointState::DOWN );
450 pointDown.SetScreenPosition( Vector2( 10, 10 ) );
451 event.AddPoint( pointDown );
452 application.ProcessEvent( event );
454 event = Dali::Integration::TouchEvent();
455 pointUp.SetState( PointState::UP );
456 pointUp.SetScreenPosition( Vector2( 10, 10 ) );
457 event.AddPoint( pointUp );
458 application.ProcessEvent( event );
461 Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor( view );
462 application.ProcessEvent( Integration::KeyEvent( "", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE ) );
463 application.SendNotification();
465 DALI_TEST_CHECK( gTouched );
466 DALI_TEST_CHECK( view );
471 int UtcDaliWebViewFocusGainedAndLost(void)
473 ToolkitTestApplication application;
475 WebView view = WebView::New();
476 DALI_TEST_CHECK( view );
478 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
479 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
480 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
481 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
483 application.GetScene().Add( view );
484 application.SendNotification();
485 application.Render();
487 view.SetKeyInputFocus();
488 DALI_TEST_CHECK( view.HasKeyInputFocus() );
491 view.ClearKeyInputFocus();
492 DALI_TEST_CHECK( !view.HasKeyInputFocus() );
497 int UtcDaliWebViewPropertyPageZoomFactor(void)
499 ToolkitTestApplication application;
501 WebView view = WebView::New();
502 DALI_TEST_CHECK( view );
504 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
505 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
506 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
507 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
509 application.GetScene().Add( view );
510 application.SendNotification();
511 application.Render();
513 view.SetProperty( WebView::Property::PAGE_ZOOM_FACTOR, 1.5f);
514 float zoomFactor = view.GetProperty<float>( WebView::Property::PAGE_ZOOM_FACTOR );
515 DALI_TEST_EQUALS( zoomFactor, 1.5f, TEST_LOCATION );
517 view.SetProperty( WebView::Property::PAGE_ZOOM_FACTOR, 1.0f);
518 zoomFactor = view.GetProperty<float>( WebView::Property::PAGE_ZOOM_FACTOR );
519 DALI_TEST_EQUALS( zoomFactor, 1.0f, TEST_LOCATION );
524 int UtcDaliWebViewPropertyTextZoomFactor(void)
526 ToolkitTestApplication application;
528 WebView view = WebView::New();
529 DALI_TEST_CHECK( view );
531 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
532 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
533 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
534 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
536 application.GetScene().Add( view );
537 application.SendNotification();
538 application.Render();
540 view.SetProperty( WebView::Property::TEXT_ZOOM_FACTOR, 1.5f);
541 float zoomFactor = view.GetProperty<float>( WebView::Property::TEXT_ZOOM_FACTOR );
542 DALI_TEST_EQUALS( zoomFactor, 1.5f, TEST_LOCATION );
544 view.SetProperty( WebView::Property::TEXT_ZOOM_FACTOR, 1.0f);
545 zoomFactor = view.GetProperty<float>( WebView::Property::TEXT_ZOOM_FACTOR );
546 DALI_TEST_EQUALS( zoomFactor, 1.0f, TEST_LOCATION );
551 int UtcDaliWebViewPropertyLoadProgressPercentage(void)
553 ToolkitTestApplication application;
555 WebView view = WebView::New();
556 DALI_TEST_CHECK( view );
558 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
559 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
560 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
561 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
563 application.GetScene().Add( view );
564 application.SendNotification();
565 application.Render();
567 float percentage = view.GetProperty<float>( WebView::Property::LOAD_PROGRESS_PERCENTAGE );
568 DALI_TEST_EQUALS( percentage, 0.5f, TEST_LOCATION );
573 int UtcDaliWebViewMove(void)
575 ToolkitTestApplication application;
577 WebView view = WebView::New();
578 DALI_TEST_CHECK( view );
580 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
581 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
582 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
583 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
585 application.GetScene().Add( view );
586 application.SendNotification();
587 application.Render();
589 view.SetProperty( Actor::Property::POSITION, Vector2( 100, 100 ));
590 Vector3 viewPos = view.GetProperty<Vector3>( Actor::Property::POSITION );
591 DALI_TEST_EQUALS( viewPos, Vector3( 100, 100, 0 ), TEST_LOCATION );
596 int UtcDaliWebViewPropertyVideoHoleEnabled(void)
598 ToolkitTestApplication application;
600 WebView view = WebView::New();
601 DALI_TEST_CHECK( view );
603 const bool kDefaultValue = true;
604 const bool kTestValue = false;
606 // Check default value
608 Property::Value value = view.GetProperty( WebView::Property::VIDEO_HOLE_ENABLED );
609 DALI_TEST_CHECK( value.Get( output ) );
610 DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
612 // Check Set/GetProperty
613 view.SetProperty( WebView::Property::VIDEO_HOLE_ENABLED, kTestValue );
614 value = view.GetProperty( WebView::Property::VIDEO_HOLE_ENABLED );
615 DALI_TEST_CHECK( value.Get( output ) );
616 DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
621 int UtcDaliWebViewPropertyMouseEventsEnabled(void)
623 ToolkitTestApplication application;
625 WebView view = WebView::New();
626 DALI_TEST_CHECK( view );
628 const bool kDefaultValue = true;
629 const bool kTestValue = false;
631 // Check default value
633 Property::Value value = view.GetProperty( WebView::Property::MOUSE_EVENTS_ENABLED );
634 DALI_TEST_CHECK( value.Get( output ) );
635 DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
637 // Check Set/GetProperty
638 view.SetProperty( WebView::Property::MOUSE_EVENTS_ENABLED, kTestValue );
639 value = view.GetProperty( WebView::Property::MOUSE_EVENTS_ENABLED );
640 DALI_TEST_CHECK( value.Get( output ) );
641 DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
646 int UtcDaliWebViewPropertyKeyEventsEnabled(void)
648 ToolkitTestApplication application;
650 WebView view = WebView::New();
651 DALI_TEST_CHECK( view );
653 const bool kDefaultValue = true;
654 const bool kTestValue = false;
656 // Check default value
658 Property::Value value = view.GetProperty( WebView::Property::KEY_EVENTS_ENABLED );
659 DALI_TEST_CHECK( value.Get( output ) );
660 DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
662 // Check Set/GetProperty
663 view.SetProperty( WebView::Property::KEY_EVENTS_ENABLED, kTestValue );
664 value = view.GetProperty( WebView::Property::KEY_EVENTS_ENABLED );
665 DALI_TEST_CHECK( value.Get( output ) );
666 DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
671 int UtcDaliWebViewHoverAndWheel(void)
673 ToolkitTestApplication application;
675 WebView view = WebView::New();
676 DALI_TEST_CHECK( view );
677 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
678 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
679 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
680 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
682 application.GetScene().Add( view );
683 application.SendNotification();
684 application.Render();
686 view.GetNaturalSize();
687 view.HoveredSignal().Connect( &OnHovered );
688 view.WheelEventSignal().Connect( &OnWheelEvent );
691 Dali::Integration::HoverEvent event = Dali::Integration::HoverEvent();
692 Dali::Integration::Point pointDown;
693 pointDown.SetState( PointState::DOWN );
694 pointDown.SetScreenPosition( Vector2( 10, 10 ) );
695 event.AddPoint( pointDown );
696 application.ProcessEvent( event );
698 event = Dali::Integration::HoverEvent();
699 Dali::Integration::Point pointUp;
700 pointUp.SetState( PointState::UP );
701 pointUp.SetScreenPosition( Vector2( 10, 10 ) );
702 event.AddPoint( pointUp );
703 application.ProcessEvent( event );
705 event = Dali::Integration::HoverEvent();
706 Dali::Integration::Point pointMotion;
707 pointUp.SetState( PointState::MOTION );
708 pointUp.SetScreenPosition( Vector2( 10, 10 ) );
709 event.AddPoint( pointMotion );
710 application.ProcessEvent( event );
713 Dali::Integration::WheelEvent wheelEvent;
714 wheelEvent.type = Dali::Integration::WheelEvent::Type::MOUSE_WHEEL;
715 wheelEvent.direction = 0;
716 wheelEvent.point = Vector2( 20, 20 );
717 wheelEvent.delta = 10;
718 application.ProcessEvent( wheelEvent );
719 application.SendNotification();
721 DALI_TEST_CHECK( gHovered );
722 DALI_TEST_CHECK( gWheelEventHandled );
727 int UtcDaliWebViewFormRepostDecisionFrameRendering(void)
729 ToolkitTestApplication application;
731 WebView view = WebView::New();
732 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
733 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
734 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
735 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
736 application.GetScene().Add( view );
737 application.SendNotification();
738 application.Render();
739 DALI_TEST_CHECK( view );
741 ConnectionTracker* testTracker = new ConnectionTracker();
742 view.FormRepostDecisionSignal().Connect(&OnFormRepostDecision);
743 view.FrameRenderedSignal().Connect(&OnFrameRendered);
744 bool signal1 = false;
745 bool signal2 = false;
746 view.ConnectSignal( testTracker, "formRepostDecision", CallbackFunctor(&signal1) );
747 view.ConnectSignal( testTracker, "frameRendered", CallbackFunctor(&signal2) );
748 DALI_TEST_EQUALS( gFormRepostDecisionCallbackCalled, 0, TEST_LOCATION );
749 DALI_TEST_EQUALS( gFrameRenderedCallbackCalled, 0, TEST_LOCATION );
751 view.LoadUrl( TEST_URL1 );
752 Test::EmitGlobalTimerSignal();
753 DALI_TEST_EQUALS( gFormRepostDecisionCallbackCalled, 1, TEST_LOCATION );
754 DALI_TEST_EQUALS( gFrameRenderedCallbackCalled, 1, TEST_LOCATION );
755 DALI_TEST_CHECK( signal1 & signal2);
757 // form repost decision.
758 DALI_TEST_CHECK(gFormRepostDecisionInstance);
759 gFormRepostDecisionInstance->Reply(true);
762 gFormRepostDecisionInstance = nullptr;
767 int UtcDaliWebViewSslCertificateHttpAuthentication(void)
769 ToolkitTestApplication application;
771 WebView view = WebView::New();
772 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
773 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
774 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
775 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
776 application.GetScene().Add( view );
777 application.SendNotification();
778 application.Render();
779 DALI_TEST_CHECK( view );
781 ConnectionTracker* testTracker = new ConnectionTracker();
782 view.CertificateConfirmSignal().Connect(&OnCertificateConfirm);
783 view.SslCertificateChangedSignal().Connect(&OnSslCertificateChanged);
784 view.HttpAuthHandlerSignal().Connect(&OnHttpAuthHandler);
785 bool signal1 = false;
786 bool signal2 = false;
787 bool signal3 = false;
788 view.ConnectSignal( testTracker, "certificateConfirm", CallbackFunctor(&signal1) );
789 view.ConnectSignal( testTracker, "sslCertificateChanged", CallbackFunctor(&signal2) );
790 view.ConnectSignal( testTracker, "httpAuthRequest", CallbackFunctor(&signal3) );
791 DALI_TEST_EQUALS( gCertificateConfirmCallbackCalled, 0, TEST_LOCATION );
792 DALI_TEST_EQUALS( gSslCertificateChangedCallbackCalled, 0, TEST_LOCATION );
793 DALI_TEST_EQUALS( gHttpAuthHandlerCallbackCalled, 0, TEST_LOCATION );
795 view.LoadUrl( TEST_URL1 );
796 Test::EmitGlobalTimerSignal();
797 DALI_TEST_EQUALS( gCertificateConfirmCallbackCalled, 1, TEST_LOCATION );
798 DALI_TEST_EQUALS( gSslCertificateChangedCallbackCalled, 1, TEST_LOCATION );
799 DALI_TEST_EQUALS( gHttpAuthHandlerCallbackCalled, 1, TEST_LOCATION );
800 DALI_TEST_CHECK( signal1 & signal2 & signal3);
803 DALI_TEST_CHECK(gCertificateConfirmInstance);
804 gCertificateConfirmInstance->Allow(true);
805 DALI_TEST_CHECK(gCertificateConfirmInstance->IsFromMainFrame());
807 DALI_TEST_CHECK(gSslCertificateInstance);
808 DALI_TEST_EQUALS(gSslCertificateInstance->GetPem(), "abc", TEST_LOCATION);
809 DALI_TEST_CHECK(gSslCertificateInstance->IsContextSecure());
811 // http authentication.
812 DALI_TEST_CHECK(gHttpAuthInstance);
813 gHttpAuthInstance->Suspend();
814 gHttpAuthInstance->UseCredential("", "");
815 gHttpAuthInstance->CancelCredential();
816 DALI_TEST_EQUALS(gHttpAuthInstance->GetRealm(), "test", TEST_LOCATION);
819 gCertificateConfirmInstance = nullptr;
820 gSslCertificateInstance = nullptr;
821 gHttpAuthInstance = nullptr;
826 int UtcDaliWebViewGetWebBackForwardList(void)
828 ToolkitTestApplication application;
830 WebView view = WebView::New();
831 DALI_TEST_CHECK( view );
833 Dali::Toolkit::WebBackForwardList* bfList = view.GetBackForwardList();
834 DALI_TEST_CHECK( bfList != 0 );
839 int UtcDaliWebViewGetWebContext(void)
841 ToolkitTestApplication application;
843 WebView view = WebView::New();
844 DALI_TEST_CHECK( view );
846 Dali::Toolkit::WebContext* context = view.GetContext();
847 DALI_TEST_CHECK( context != 0 );
852 int UtcDaliWebViewGetWebCookieManager(void)
854 ToolkitTestApplication application;
856 WebView view = WebView::New();
857 DALI_TEST_CHECK( view );
859 Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
860 DALI_TEST_CHECK( cookieManager != 0 );
865 int UtcDaliWebViewGetWebSettings(void)
867 ToolkitTestApplication application;
869 WebView view = WebView::New();
870 DALI_TEST_CHECK( view );
872 Dali::Toolkit::WebSettings* settings = view.GetSettings();
873 DALI_TEST_CHECK( settings != 0 );
878 int UtcDaliWebViewProperty1(void)
881 ToolkitTestApplication application;
883 WebView view = WebView::New();
884 DALI_TEST_CHECK( view );
887 view.SetProperty( WebView::Property::URL, TEST_URL1 );
888 Property::Value val = view.GetProperty( WebView::Property::URL );
889 DALI_TEST_CHECK( val.Get( local ) );
890 DALI_TEST_EQUALS( local, TEST_URL1, TEST_LOCATION );
895 int UtcDaliWebViewProperty4(void)
898 ToolkitTestApplication application;
900 WebView view = WebView::New();
901 DALI_TEST_CHECK( view );
903 const std::string kDefaultValue;
904 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";
906 // Check default value
908 Property::Value value = view.GetProperty( WebView::Property::USER_AGENT );
909 DALI_TEST_CHECK( value.Get( output ) );
910 DALI_TEST_EQUALS( output, kDefaultValue, TEST_LOCATION );
912 // Check Set/GetProperty
913 view.SetProperty( WebView::Property::USER_AGENT, kTestValue );
914 value = view.GetProperty( WebView::Property::USER_AGENT );
915 DALI_TEST_CHECK( value.Get( output ) );
916 DALI_TEST_EQUALS( output, kTestValue, TEST_LOCATION );
921 int UtcDaliWebViewProperty9(void)
924 ToolkitTestApplication application;
926 WebView view = WebView::New();
927 DALI_TEST_CHECK( view );
929 // Check default value
930 Dali::Vector2 output = Dali::Vector2::ONE;
931 view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
932 DALI_TEST_CHECK( output.x == 0 && output.y == 0 );
934 // Check Set/GetProperty
935 Dali::Vector2 testValue = Dali::Vector2( 100, 100 );
936 view.SetProperty( WebView::Property::SCROLL_POSITION, testValue );
937 view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
938 DALI_TEST_EQUALS( output, testValue, TEST_LOCATION );
940 // Check default value of scroll size
941 output = Dali::Vector2::ONE;
942 view.GetProperty( WebView::Property::SCROLL_SIZE ).Get( output );
943 DALI_TEST_CHECK( output.x == 500 && output.y == 500 );
945 // Check default value of content size
946 output = Dali::Vector2::ONE;
947 view.GetProperty( WebView::Property::CONTENT_SIZE ).Get( output );
948 DALI_TEST_CHECK( output.x == 500 && output.y == 500 );
953 int UtcDaliWebViewPropertyBackgroundColorSelectedTextEtc(void)
955 ToolkitTestApplication application;
957 WebView view = WebView::New();
958 DALI_TEST_CHECK( view );
960 Dali::Vector4 testValue = Dali::Vector4(0.0f, 0.0f, 0.0f, 0.0f);
961 view.SetProperty(WebView::Property::DOCUMENT_BACKGROUND_COLOR, testValue);
962 view.SetProperty(WebView::Property::TILES_CLEARED_WHEN_HIDDEN, true);
963 view.SetProperty(WebView::Property::TILE_COVER_AREA_MULTIPLIER, 1.0f);
964 view.SetProperty(WebView::Property::CURSOR_ENABLED_BY_CLIENT, true);
966 // Check default value
967 std::string testText("test");
969 view.GetProperty(WebView::Property::SELECTED_TEXT).Get(output);
970 DALI_TEST_EQUALS(output, testText, TEST_LOCATION);
975 int UtcDaliWebViewPropertyTitleFavicon(void)
977 ToolkitTestApplication application;
979 char argv[] = "--test";
980 WebView view = WebView::New( 1, (char**)&argv );
981 DALI_TEST_CHECK( view );
984 view.ClearAllTilesResources();
986 // Check default value of title
987 std::string testValue("title");
989 view.GetProperty( WebView::Property::TITLE ).Get( output );
990 DALI_TEST_EQUALS( output, testValue, TEST_LOCATION );
992 // Check default value of favicon
993 Dali::Toolkit::ImageView* favicon = &view.GetFavicon();
994 DALI_TEST_CHECK( favicon );
995 Dali::Vector3 iconsize = favicon->GetProperty< Vector3 >( Dali::Actor::Property::SIZE );
996 DALI_TEST_CHECK( ( int )iconsize.width == 2 && ( int )iconsize.height == 2 );
1001 int UtcDaliWebViewScrollBy(void)
1003 ToolkitTestApplication application;
1005 WebView view = WebView::New();
1006 DALI_TEST_CHECK( view );
1009 ConnectionTracker* testTracker = new ConnectionTracker();
1010 view.ScrollEdgeReachedSignal().Connect( &OnScrollEdgeReached );
1011 bool signal1 = false;
1012 view.ConnectSignal( testTracker, "scrollEdgeReached", CallbackFunctor(&signal1) );
1013 DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 0, TEST_LOCATION );
1015 view.LoadUrl( TEST_URL1 );
1016 Test::EmitGlobalTimerSignal();
1018 // set scroll position.
1019 Dali::Vector2 output = Dali::Vector2::ONE;
1020 Dali::Vector2 testValue = Dali::Vector2( 100, 100 );
1021 view.SetProperty( WebView::Property::SCROLL_POSITION, testValue );
1022 view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
1023 DALI_TEST_EQUALS( output, testValue, TEST_LOCATION );
1025 // scroll by and trigger scrollEdgeReached event.
1026 view.ScrollBy( 50, 50 );
1027 Test::EmitGlobalTimerSignal();
1029 view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
1030 DALI_TEST_CHECK( output.x == 150 && output.y == 150 );
1031 DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 1, TEST_LOCATION );
1032 DALI_TEST_CHECK( signal1 );
1034 // scroll by and trigger scrollEdgeReached event.
1035 bool result = view.ScrollEdgeBy( 50, 50 );
1036 DALI_TEST_CHECK( result );
1037 Test::EmitGlobalTimerSignal();
1039 view.GetProperty( WebView::Property::SCROLL_POSITION ).Get( output );
1040 DALI_TEST_CHECK( output.x == 200 && output.y == 200 );
1041 DALI_TEST_EQUALS( gScrollEdgeReachedCallbackCalled, 2, TEST_LOCATION );
1042 DALI_TEST_CHECK( signal1 );
1047 int UtcDaliWebViewSetGetScaleFactorActivateAccessibility(void)
1049 ToolkitTestApplication application;
1051 WebView view = WebView::New();
1052 DALI_TEST_CHECK( view );
1054 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
1055 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
1056 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
1057 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
1059 application.GetScene().Add( view );
1060 application.SendNotification();
1061 application.Render();
1063 view.ActivateAccessibility(true);
1064 view.AddDynamicCertificatePath("host", "test/to/path");
1065 bool found = view.HighlightText("test", Dali::WebEnginePlugin::FindOption::CASE_INSENSITIVE, 2);
1066 DALI_TEST_CHECK( found );
1068 view.SetScaleFactor(1.5f, Dali::Vector2(0.0f, 0.0f));
1069 float result = view.GetScaleFactor();
1070 DALI_TEST_EQUALS( result, 1.5f, TEST_LOCATION );
1072 view.SetScaleFactor(1.0f, Dali::Vector2(0.0f, 0.0f));
1073 result = view.GetScaleFactor();
1074 DALI_TEST_EQUALS( result, 1.0f, TEST_LOCATION );
1079 int UtcDaliWebViewGetScreenshotSyncAndAsync(void)
1082 ToolkitTestApplication application;
1084 char argv[] = "--test";
1085 WebView view = WebView::New( 1, (char**)&argv );
1086 DALI_TEST_CHECK( view );
1088 // Check GetScreenshot
1089 Dali::Rect<int> viewArea;
1092 viewArea.width = 10;
1093 viewArea.height = 10;
1094 Dali::Toolkit::ImageView screenshot = view.GetScreenshot(viewArea, 1.0f);
1095 DALI_TEST_CHECK( screenshot );
1096 Dali::Vector3 shotsize = screenshot.GetProperty< Vector3 >( Dali::Actor::Property::SIZE );
1097 DALI_TEST_CHECK( ( int )shotsize.width == viewArea.width && ( int )shotsize.height == viewArea.height );
1099 // Check GetScreenshotAsynchronously
1102 viewArea.width = 100;
1103 viewArea.height = 100;
1104 bool result = view.GetScreenshotAsynchronously(viewArea, 1.0f, &OnScreenshotCaptured);
1105 DALI_TEST_CHECK( result );
1107 Test::EmitGlobalTimerSignal();
1109 Test::EmitGlobalTimerSignal();
1110 DALI_TEST_EQUALS( gScreenshotCapturedCallbackCalled, 1, TEST_LOCATION );
1115 int UtcDaliWebViewVideoPlayingGeolocationPermission(void)
1118 ToolkitTestApplication application;
1120 char argv[] = "--test";
1121 WebView view = WebView::New( 1, (char**)&argv );
1122 DALI_TEST_CHECK( view );
1124 // Check CheckVideoPlayingAsynchronously
1125 bool result = view.CheckVideoPlayingAsynchronously(&OnVideoPlaying);
1126 DALI_TEST_CHECK( result );
1127 Test::EmitGlobalTimerSignal();
1128 DALI_TEST_EQUALS( gVideoPlayingCallbackCalled, 1, TEST_LOCATION );
1130 // Check RegisterGeolocationPermissionCallback
1131 view.RegisterGeolocationPermissionCallback(&OnGeolocationPermission);
1132 Test::EmitGlobalTimerSignal();
1133 DALI_TEST_EQUALS( gGeolocationPermissionCallbackCalled, 1, TEST_LOCATION );
1138 int UtcDaliWebViewHttpRequestInterceptor(void)
1140 ToolkitTestApplication application;
1142 WebView view = WebView::New();
1143 DALI_TEST_CHECK( view );
1146 ConnectionTracker* testTracker = new ConnectionTracker();
1147 view.RequestInterceptorSignal().Connect( &OnRequestInterceptor );
1148 bool signal1 = false;
1149 view.ConnectSignal( testTracker, "requestInterceptor", CallbackFunctor(&signal1) );
1150 DALI_TEST_EQUALS( gRequestInterceptorCallbackCalled, 0, TEST_LOCATION );
1151 DALI_TEST_CHECK(gRequestInterceptorInstance == 0);
1153 view.LoadUrl( TEST_URL1 );
1154 Test::EmitGlobalTimerSignal();
1155 DALI_TEST_EQUALS( gRequestInterceptorCallbackCalled, 1, TEST_LOCATION );
1156 DALI_TEST_CHECK( signal1 );
1158 // check request interceptor.
1159 DALI_TEST_CHECK(gRequestInterceptorInstance != 0);
1160 DALI_TEST_CHECK(gRequestInterceptorInstance->Ignore());
1161 DALI_TEST_CHECK(gRequestInterceptorInstance->SetResponseStatus(400, "error"));
1162 DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseHeader("key", "value"));
1163 DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseBody("test", 4));
1164 std::string testUrl("http://test.html");
1165 DALI_TEST_EQUALS(gRequestInterceptorInstance->GetUrl(), testUrl, TEST_LOCATION);
1167 gRequestInterceptorInstance = nullptr;
1172 int UtcDaliWebViewPolicyDecisionRequest(void)
1174 ToolkitTestApplication application;
1176 WebView view = WebView::New();
1177 DALI_TEST_CHECK( view );
1180 ConnectionTracker* testTracker = new ConnectionTracker();
1181 view.PolicyDecisionSignal().Connect( &OnPolicyDecisionRequest );
1182 bool signal1 = false;
1183 view.ConnectSignal( testTracker, "policyDecision", CallbackFunctor(&signal1) );
1184 DALI_TEST_EQUALS( gPolicyDecisionCallbackCalled, 0, TEST_LOCATION );
1185 DALI_TEST_CHECK(gPolicyDecisionInstance == 0);
1187 view.LoadUrl( TEST_URL1 );
1188 Test::EmitGlobalTimerSignal();
1189 DALI_TEST_EQUALS( gPolicyDecisionCallbackCalled, 1, TEST_LOCATION );
1190 DALI_TEST_CHECK( signal1 );
1192 // check policy decision & its frame.
1193 DALI_TEST_CHECK(gPolicyDecisionInstance != 0);
1194 std::string testUrl("http://test.html");
1195 DALI_TEST_EQUALS(gPolicyDecisionInstance->GetUrl(), testUrl, TEST_LOCATION);
1196 std::string testCookie("test:abc");
1197 DALI_TEST_EQUALS(gPolicyDecisionInstance->GetCookie(), testCookie, TEST_LOCATION);
1198 Dali::WebEnginePolicyDecision::DecisionType testDecisionType = Dali::WebEnginePolicyDecision::DecisionType::USE;
1199 DALI_TEST_EQUALS(gPolicyDecisionInstance->GetDecisionType(), testDecisionType, TEST_LOCATION);
1200 std::string testResponseMime("txt/xml");
1201 DALI_TEST_EQUALS(gPolicyDecisionInstance->GetResponseMime(), testResponseMime, TEST_LOCATION);
1202 int32_t ResponseStatusCode = 500;
1203 DALI_TEST_EQUALS(gPolicyDecisionInstance->GetResponseStatusCode(), ResponseStatusCode, TEST_LOCATION);
1204 Dali::WebEnginePolicyDecision::NavigationType testNavigationType = Dali::WebEnginePolicyDecision::NavigationType::LINK_CLICKED;
1205 DALI_TEST_EQUALS(gPolicyDecisionInstance->GetNavigationType(), testNavigationType, TEST_LOCATION);
1206 std::string testScheme("test");
1207 DALI_TEST_EQUALS(gPolicyDecisionInstance->GetScheme(), testScheme, TEST_LOCATION);
1208 DALI_TEST_CHECK(gPolicyDecisionInstance->Use());
1209 DALI_TEST_CHECK(gPolicyDecisionInstance->Ignore());
1210 DALI_TEST_CHECK(gPolicyDecisionInstance->Suspend());
1212 Dali::WebEngineFrame* webFrame = &(gPolicyDecisionInstance->GetFrame());
1213 DALI_TEST_CHECK(webFrame);
1214 DALI_TEST_CHECK(webFrame->IsMainFrame());
1216 gPolicyDecisionInstance = nullptr;
1221 int UtcDaliWebViewEvaluteJavaScript(void)
1223 ToolkitTestApplication application;
1225 WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
1227 view.LoadHtmlString( "<body>Hello World!</body>" );
1228 view.EvaluateJavaScript( "jsObject.postMessage('Hello')" );
1229 view.EvaluateJavaScript( "jsObject.postMessage('World')", OnEvaluateJavaScript );
1230 Test::EmitGlobalTimerSignal();
1232 DALI_TEST_EQUALS( gEvaluateJavaScriptCallbackCalled, 1, TEST_LOCATION );
1237 int UtcDaliWebViewJavaScriptAlertConfirmPrompt(void)
1239 ToolkitTestApplication application;
1241 WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
1243 view.RegisterJavaScriptAlertCallback( &OnJavaScriptAlert );
1244 view.LoadHtmlString( "<head><script type='text/javascript'>alert('this is an alert popup.');</script></head><body>Hello World!</body>" );
1245 view.JavaScriptAlertReply();
1246 Test::EmitGlobalTimerSignal();
1247 DALI_TEST_EQUALS( gJavaScriptAlertCallbackCalled, 1, TEST_LOCATION );
1249 view.RegisterJavaScriptConfirmCallback( &OnJavaScriptConfirm );
1250 view.LoadHtmlString( "<head><script type='text/javascript'>confirm('this is a confirm popup.');</script></head><body>Hello World!</body>" );
1251 view.JavaScriptConfirmReply( true );
1252 Test::EmitGlobalTimerSignal();
1253 DALI_TEST_EQUALS( gJavaScriptConfirmCallbackCalled, 1, TEST_LOCATION );
1255 view.RegisterJavaScriptPromptCallback( &OnJavaScriptPrompt );
1256 view.LoadHtmlString( "<head><script type='text/javascript'>prompt('this is a prompt popup.');</script></head><body>Hello World!</body>" );
1257 view.JavaScriptPromptReply( "it is a prompt." );
1258 Test::EmitGlobalTimerSignal();
1259 DALI_TEST_EQUALS( gJavaScriptPromptCallbackCalled, 1, TEST_LOCATION );
1264 int UtcDaliWebViewLoadHtmlStringOverrideCurrentEntryAndContents(void)
1266 ToolkitTestApplication application;
1268 WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
1269 DALI_TEST_CHECK( view );
1271 std::string html("<body>Hello World!</body>");
1272 std::string basicUri("http://basicurl");
1273 std::string unreachableUrl("http://unreachableurl");
1274 bool result = view.LoadHtmlStringOverrideCurrentEntry( html, basicUri, unreachableUrl );
1275 DALI_TEST_CHECK( result );
1277 application.SendNotification();
1278 application.Render();
1279 Test::EmitGlobalTimerSignal();
1281 result = view.LoadContents( html, html.length(), "html/text", "utf-8", basicUri );
1282 DALI_TEST_CHECK( result );
1287 int UtcDaliWebViewReloadSuspendResumeNetworkLoadingCustomHeader(void)
1289 ToolkitTestApplication application;
1291 WebView view = WebView::New();
1292 view.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
1293 view.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
1294 view.SetProperty( Actor::Property::POSITION, Vector2( 0, 0 ));
1295 view.SetProperty( Actor::Property::SIZE, Vector2( 800, 600 ) );
1297 application.GetScene().Add( view );
1298 application.SendNotification();
1299 application.Render();
1300 DALI_TEST_CHECK( view );
1302 view.LoadUrl( "http://test.html" );
1303 bool result = view.AddCustomHeader("key", "value");
1304 DALI_TEST_CHECK( result );
1306 result = view.ReloadWithoutCache();
1307 DALI_TEST_CHECK( result );
1309 uint32_t portNumber = view.StartInspectorServer(5000);
1310 DALI_TEST_EQUALS( portNumber, 5000, TEST_LOCATION );
1312 application.SendNotification();
1313 application.Render();
1314 Test::EmitGlobalTimerSignal();
1316 result = view.StopInspectorServer();
1317 DALI_TEST_CHECK( result );
1319 view.SuspendNetworkLoading();
1321 result = view.RemoveCustomHeader("key");
1322 DALI_TEST_CHECK( result );
1324 view.ResumeNetworkLoading();
1329 int UtcDaliWebViewMethodsForCoverage(void)
1331 ToolkitTestApplication application;
1333 WebView view = WebView::New( "ko-KR", "Asia/Seoul" );
1335 view.LoadHtmlString( "<body>Hello World!</body>" );
1336 view.AddJavaScriptMessageHandler( "jsObject",
1337 []( const std::string& arg ) {
1341 DALI_TEST_CHECK( view );
1346 // test cases for web backforward list.
1348 int UtcDaliWebBackForwardListCheckItem(void)
1350 ToolkitTestApplication application;
1352 WebView view = WebView::New();
1353 DALI_TEST_CHECK( view );
1355 Dali::Toolkit::WebBackForwardList* bfList = view.GetBackForwardList();
1356 DALI_TEST_CHECK( bfList != 0 )
1358 unsigned int itemCount = bfList->GetItemCount();
1359 DALI_TEST_CHECK( itemCount == 1 )
1361 Dali::Toolkit::WebBackForwardListItem* citem = bfList->GetCurrentItem();
1362 DALI_TEST_CHECK( citem != 0 );
1364 const std::string kDefaultUrl( "http://url" );
1365 std::string testValue = citem->GetUrl();
1366 DALI_TEST_EQUALS( testValue, kDefaultUrl, TEST_LOCATION );
1368 const std::string kDefaultTitle( "title" );
1369 testValue = citem->GetTitle();
1370 DALI_TEST_EQUALS( testValue, kDefaultTitle, TEST_LOCATION );
1372 const std::string kDefaultOriginalUrl( "http://originalurl" );
1373 testValue = citem->GetOriginalUrl();
1374 DALI_TEST_EQUALS( testValue, kDefaultOriginalUrl, TEST_LOCATION );
1376 Dali::Toolkit::WebBackForwardListItem* item = bfList->GetItemAtIndex( 0 );
1377 DALI_TEST_CHECK( item != 0 );
1382 // test cases for web context.
1384 int UtcDaliWebContextGetSetCacheModel(void)
1386 ToolkitTestApplication application;
1388 WebView view = WebView::New();
1389 DALI_TEST_CHECK( view );
1391 Dali::Toolkit::WebContext* context = view.GetContext();
1392 DALI_TEST_CHECK( context != 0 )
1394 std::string kDefaultValue;
1397 context->SetProxyUri( kDefaultValue );
1398 context->SetCertificateFilePath( kDefaultValue );
1399 context->DisableCache( false );
1400 context->SetDefaultProxyAuth( kDefaultValue, kDefaultValue );
1401 context->DeleteWebDatabase();
1402 context->DeleteWebStorage();
1403 context->DeleteLocalFileSystem();
1404 context->ClearCache();
1406 // Check default value
1407 Dali::WebEngineContext::CacheModel value = context->GetCacheModel();
1408 DALI_TEST_CHECK( value == Dali::WebEngineContext::CacheModel::DOCUMENT_VIEWER );
1410 // Check Set/GetProperty
1411 context->SetCacheModel( Dali::WebEngineContext::CacheModel::DOCUMENT_BROWSER );
1412 value = context->GetCacheModel();
1413 DALI_TEST_CHECK( value == Dali::WebEngineContext::CacheModel::DOCUMENT_BROWSER );
1418 // test cases for web cookie manager.
1420 int UtcDaliWebCookieManagerGetSetCookieAcceptPolicy(void)
1422 ToolkitTestApplication application;
1424 WebView view = WebView::New();
1425 DALI_TEST_CHECK( view );
1427 Dali::Toolkit::WebCookieManager* cookieManager = view.GetCookieManager();
1428 DALI_TEST_CHECK( cookieManager != 0 )
1430 const std::string kDefaultValue;
1433 cookieManager->SetPersistentStorage( kDefaultValue, Dali::WebEngineCookieManager::CookiePersistentStorage::SQLITE );
1434 cookieManager->ClearCookies();
1436 // Check default value
1437 Dali::WebEngineCookieManager::CookieAcceptPolicy value = cookieManager->GetCookieAcceptPolicy();
1438 DALI_TEST_CHECK( value == Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY );
1440 // Check Set/GetProperty
1441 cookieManager->SetCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy::ALWAYS );
1442 value = cookieManager->GetCookieAcceptPolicy();
1443 DALI_TEST_CHECK( value == Dali::WebEngineCookieManager::CookieAcceptPolicy::ALWAYS );
1448 // test cases for web settings.
1450 int UtcDaliWebSettingsGetSetDefaultFontSize(void)
1452 ToolkitTestApplication application;
1454 WebView view = WebView::New();
1455 DALI_TEST_CHECK( view );
1457 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1458 DALI_TEST_CHECK( settings != 0 )
1461 settings->AllowMixedContents( false );
1462 settings->EnableSpatialNavigation( false );
1463 settings->EnableWebSecurity( false );
1464 settings->EnableCacheBuilder( false );
1465 settings->EnableDoNotTrack( false );
1466 settings->UseScrollbarThumbFocusNotifications( false );
1467 settings->AllowFileAccessFromExternalUrl( false );
1468 settings->AllowScriptsOpenWindows( false );
1470 // Check default value
1471 int value = settings->GetDefaultFontSize();
1472 DALI_TEST_CHECK( value == 16 );
1474 // Check Set/GetProperty
1475 settings->SetDefaultFontSize( 20 );
1476 value = settings->GetDefaultFontSize();
1477 DALI_TEST_CHECK( value == 20 );
1482 int UtcDaliWebSettingsCheckEnableJavaScript(void)
1484 ToolkitTestApplication application;
1486 WebView view = WebView::New();
1487 DALI_TEST_CHECK( view );
1489 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1490 DALI_TEST_CHECK( settings != 0 )
1493 settings->AllowMixedContents( false );
1494 settings->EnableSpatialNavigation( false );
1495 settings->EnableWebSecurity( false );
1496 settings->EnableCacheBuilder( false );
1497 settings->EnableDoNotTrack( false );
1498 settings->UseScrollbarThumbFocusNotifications( false );
1499 settings->AllowFileAccessFromExternalUrl( false );
1500 settings->AllowScriptsOpenWindows( false );
1502 // Check default value is true or not
1503 bool value = settings->IsJavaScriptEnabled();
1504 DALI_TEST_CHECK( value );
1506 // Check Set/GetProperty
1507 settings->EnableJavaScript( false );
1508 value = settings->IsJavaScriptEnabled();
1509 DALI_TEST_CHECK( !value );
1514 int UtcDaliWebSettingsCheckEnableAutoFitting(void)
1516 ToolkitTestApplication application;
1518 WebView view = WebView::New();
1519 DALI_TEST_CHECK( view );
1521 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1522 DALI_TEST_CHECK( settings != 0 )
1525 settings->AllowMixedContents( false );
1526 settings->EnableSpatialNavigation( false );
1527 settings->EnableWebSecurity( false );
1528 settings->EnableCacheBuilder( false );
1529 settings->EnableDoNotTrack( false );
1530 settings->UseScrollbarThumbFocusNotifications( false );
1531 settings->AllowFileAccessFromExternalUrl( false );
1532 settings->AllowScriptsOpenWindows( false );
1534 // Check default value is true or not
1535 bool value = settings->IsAutoFittingEnabled();
1536 DALI_TEST_CHECK( value );
1538 // Check Set/GetProperty
1539 settings->EnableAutoFitting( false );
1540 value = settings->IsAutoFittingEnabled();
1541 DALI_TEST_CHECK( !value );
1546 int UtcDaliWebSettingsCheckEnablePlugins(void)
1548 ToolkitTestApplication application;
1550 WebView view = WebView::New();
1551 DALI_TEST_CHECK( view );
1553 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1554 DALI_TEST_CHECK( settings != 0 )
1557 settings->AllowMixedContents( false );
1558 settings->EnableSpatialNavigation( false );
1559 settings->EnableWebSecurity( false );
1560 settings->EnableCacheBuilder( false );
1561 settings->EnableDoNotTrack( false );
1562 settings->UseScrollbarThumbFocusNotifications( false );
1563 settings->AllowFileAccessFromExternalUrl( false );
1564 settings->AllowScriptsOpenWindows( false );
1566 // Check default value is true or not
1567 bool value = settings->ArePluginsEnabled();
1568 DALI_TEST_CHECK( value );
1570 // Check Set/GetProperty
1571 settings->EnablePlugins( false );
1572 value = settings->ArePluginsEnabled();
1573 DALI_TEST_CHECK( !value );
1578 int UtcDaliWebSettingsCheckEnablePrivateBrowsing(void)
1580 ToolkitTestApplication application;
1582 WebView view = WebView::New();
1583 DALI_TEST_CHECK( view );
1585 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1586 DALI_TEST_CHECK( settings != 0 )
1589 settings->AllowMixedContents( false );
1590 settings->EnableSpatialNavigation( false );
1591 settings->EnableWebSecurity( false );
1592 settings->EnableCacheBuilder( false );
1593 settings->EnableDoNotTrack( false );
1594 settings->UseScrollbarThumbFocusNotifications( false );
1595 settings->AllowFileAccessFromExternalUrl( false );
1596 settings->AllowScriptsOpenWindows( false );
1598 // Check default value is true or not
1599 bool value = settings->IsPrivateBrowsingEnabled();
1600 DALI_TEST_CHECK( value );
1602 // Check Set/GetProperty
1603 settings->EnablePrivateBrowsing( false );
1604 value = settings->IsPrivateBrowsingEnabled();
1605 DALI_TEST_CHECK( !value );
1610 int UtcDaliWebSettingsCheckEnableLinkMagnifier(void)
1612 ToolkitTestApplication application;
1614 WebView view = WebView::New();
1615 DALI_TEST_CHECK( view );
1617 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1618 DALI_TEST_CHECK( settings != 0 )
1621 settings->AllowMixedContents( false );
1622 settings->EnableSpatialNavigation( false );
1623 settings->EnableWebSecurity( false );
1624 settings->EnableCacheBuilder( false );
1625 settings->EnableDoNotTrack( false );
1626 settings->UseScrollbarThumbFocusNotifications( false );
1627 settings->AllowFileAccessFromExternalUrl( false );
1628 settings->AllowScriptsOpenWindows( false );
1630 // Check default value is true or not
1631 bool value = settings->IsLinkMagnifierEnabled();
1632 DALI_TEST_CHECK( value );
1634 // Check Set/GetProperty
1635 settings->EnableLinkMagnifier( false );
1636 value = settings->IsLinkMagnifierEnabled();
1637 DALI_TEST_CHECK( !value );
1642 int UtcDaliWebSettingsCheckUseKeypadWithoutUserAction(void)
1644 ToolkitTestApplication application;
1646 WebView view = WebView::New();
1647 DALI_TEST_CHECK( view );
1649 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1650 DALI_TEST_CHECK( settings != 0 )
1653 settings->AllowMixedContents( false );
1654 settings->EnableSpatialNavigation( false );
1655 settings->EnableWebSecurity( false );
1656 settings->EnableCacheBuilder( false );
1657 settings->EnableDoNotTrack( false );
1658 settings->UseScrollbarThumbFocusNotifications( false );
1659 settings->AllowFileAccessFromExternalUrl( false );
1660 settings->AllowScriptsOpenWindows( false );
1662 // Check default value is true or not
1663 bool value = settings->IsKeypadWithoutUserActionUsed();
1664 DALI_TEST_CHECK( value );
1666 // Check Set/GetProperty
1667 settings->UseKeypadWithoutUserAction( false );
1668 value = settings->IsKeypadWithoutUserActionUsed();
1669 DALI_TEST_CHECK( !value );
1674 int UtcDaliWebSettingsCheckEnableAutofillPasswordForm(void)
1676 ToolkitTestApplication application;
1678 WebView view = WebView::New();
1679 DALI_TEST_CHECK( view );
1681 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1682 DALI_TEST_CHECK( settings != 0 )
1685 settings->AllowMixedContents( false );
1686 settings->EnableSpatialNavigation( false );
1687 settings->EnableWebSecurity( false );
1688 settings->EnableCacheBuilder( false );
1689 settings->EnableDoNotTrack( false );
1690 settings->UseScrollbarThumbFocusNotifications( false );
1691 settings->AllowFileAccessFromExternalUrl( false );
1692 settings->AllowScriptsOpenWindows( false );
1694 // Check default value is true or not
1695 bool value = settings->IsAutofillPasswordFormEnabled();
1696 DALI_TEST_CHECK( value );
1697 settings->EnableAutofillPasswordForm( false );
1698 value = settings->IsAutofillPasswordFormEnabled();
1699 DALI_TEST_CHECK( !value );
1703 int UtcDaliWebSettingsCheckEnableFormCandidateData(void)
1705 ToolkitTestApplication application;
1707 WebView view = WebView::New();
1708 DALI_TEST_CHECK( view );
1710 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1711 DALI_TEST_CHECK( settings != 0 );
1714 settings->AllowMixedContents( false );
1715 settings->EnableSpatialNavigation( false );
1716 settings->EnableWebSecurity( false );
1717 settings->EnableCacheBuilder( false );
1718 settings->EnableDoNotTrack( false );
1719 settings->UseScrollbarThumbFocusNotifications( false );
1720 settings->AllowFileAccessFromExternalUrl( false );
1721 settings->AllowScriptsOpenWindows( false );
1723 // Check default value is true or not
1724 bool value = settings->IsFormCandidateDataEnabled();
1725 DALI_TEST_CHECK( value );
1727 // Check Set/GetProperty
1728 settings->EnableFormCandidateData( false );
1729 value = settings->IsFormCandidateDataEnabled();
1730 DALI_TEST_CHECK( !value );
1735 int UtcDaliWebSettingsCheckEnableTextSelection(void)
1737 ToolkitTestApplication application;
1739 WebView view = WebView::New();
1740 DALI_TEST_CHECK( view );
1742 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1743 DALI_TEST_CHECK( settings != 0 );
1746 settings->AllowMixedContents( false );
1747 settings->EnableSpatialNavigation( false );
1748 settings->EnableWebSecurity( false );
1749 settings->EnableCacheBuilder( false );
1750 settings->EnableDoNotTrack( false );
1751 settings->UseScrollbarThumbFocusNotifications( false );
1752 settings->AllowFileAccessFromExternalUrl( false );
1753 settings->AllowScriptsOpenWindows( false );
1755 // Check default value is true or not
1756 bool value = settings->IsTextSelectionEnabled();
1757 DALI_TEST_CHECK( value );
1759 //Check Set/GetProperty
1760 settings->EnableTextSelection(false);
1761 value = settings->IsTextSelectionEnabled();
1762 DALI_TEST_CHECK( !value );
1767 int UtcDaliWebSettingsCheckEnableTextAutosizing(void)
1769 ToolkitTestApplication application;
1771 WebView view = WebView::New();
1772 DALI_TEST_CHECK( view );
1774 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1775 DALI_TEST_CHECK( settings != 0 );
1778 settings->AllowMixedContents( false );
1779 settings->EnableSpatialNavigation( false );
1780 settings->EnableWebSecurity( false );
1781 settings->EnableCacheBuilder( false );
1782 settings->EnableDoNotTrack( false );
1783 settings->UseScrollbarThumbFocusNotifications( false );
1784 settings->AllowFileAccessFromExternalUrl( false );
1785 settings->AllowScriptsOpenWindows( false );
1787 // Check default value is true or not
1788 bool value = settings->IsTextAutosizingEnabled();
1789 DALI_TEST_CHECK( value );
1791 // Check Set/GetProperty
1792 settings->EnableTextAutosizing(false);
1793 value = settings->IsTextAutosizingEnabled();
1794 DALI_TEST_CHECK( !value );
1799 int UtcDaliWebSettingsCheckEnableArrowScroll(void)
1801 ToolkitTestApplication application;
1803 WebView view = WebView::New();
1804 DALI_TEST_CHECK( view );
1806 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1807 DALI_TEST_CHECK( settings != 0 );
1810 settings->AllowMixedContents( false );
1811 settings->EnableSpatialNavigation( false );
1812 settings->EnableWebSecurity( false );
1813 settings->EnableCacheBuilder( false );
1814 settings->EnableDoNotTrack( false );
1815 settings->UseScrollbarThumbFocusNotifications( false );
1816 settings->AllowFileAccessFromExternalUrl( false );
1817 settings->AllowScriptsOpenWindows( false );
1819 // Check default value is true or not
1820 bool value = settings->IsArrowScrollEnabled();
1821 DALI_TEST_CHECK( value );
1823 // Check Set/GetProperty
1824 settings->EnableArrowScroll(false);
1825 value = settings->IsArrowScrollEnabled();
1826 DALI_TEST_CHECK( !value );
1831 int UtcDaliWebSettingsCheckEnableClipboard(void)
1833 ToolkitTestApplication application;
1835 WebView view = WebView::New();
1836 DALI_TEST_CHECK( view );
1838 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1839 DALI_TEST_CHECK( settings != 0 );
1842 settings->AllowMixedContents( false );
1843 settings->EnableSpatialNavigation( false );
1844 settings->EnableWebSecurity( false );
1845 settings->EnableCacheBuilder( false );
1846 settings->EnableDoNotTrack( false );
1847 settings->UseScrollbarThumbFocusNotifications( false );
1848 settings->AllowFileAccessFromExternalUrl( false );
1849 settings->AllowScriptsOpenWindows( false );
1851 // Check default value is true or not
1852 bool value = settings->IsClipboardEnabled();
1853 DALI_TEST_CHECK( value );
1854 settings->EnableClipboard(false);
1855 value = settings->IsClipboardEnabled();
1856 DALI_TEST_CHECK( !value );
1860 int UtcDaliWebSettingsCheckEnableImePanel(void)
1862 ToolkitTestApplication application;
1864 WebView view = WebView::New();
1865 DALI_TEST_CHECK( view );
1867 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1868 DALI_TEST_CHECK( settings != 0 );
1871 settings->AllowMixedContents( false );
1872 settings->EnableSpatialNavigation( false );
1873 settings->EnableWebSecurity( false );
1874 settings->EnableCacheBuilder( false );
1875 settings->EnableDoNotTrack( false );
1876 settings->UseScrollbarThumbFocusNotifications( false );
1877 settings->AllowFileAccessFromExternalUrl( false );
1878 settings->AllowScriptsOpenWindows( false );
1880 // Check default value is true or not
1881 bool value = settings->IsImePanelEnabled();
1882 DALI_TEST_CHECK( value );
1884 // Check Set/GetProperty
1885 settings->EnableImePanel(false);
1886 value = settings->IsImePanelEnabled();
1887 DALI_TEST_CHECK( !value );
1892 int UtcDaliWebSettingsCheckAllowImagesLoadAutomatically(void)
1894 ToolkitTestApplication application;
1896 WebView view = WebView::New();
1897 DALI_TEST_CHECK( view );
1899 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1900 DALI_TEST_CHECK( settings != 0 )
1903 settings->AllowMixedContents( false );
1904 settings->EnableSpatialNavigation( false );
1905 settings->EnableWebSecurity( false );
1906 settings->EnableCacheBuilder( false );
1907 settings->EnableDoNotTrack( false );
1908 settings->UseScrollbarThumbFocusNotifications( false );
1909 settings->AllowFileAccessFromExternalUrl( false );
1910 settings->AllowScriptsOpenWindows( false );
1912 // Check default value is true or not
1913 bool value = settings->AreImagesLoadedAutomatically();
1914 DALI_TEST_CHECK( value );
1916 // Check Set/GetProperty
1917 settings->AllowImagesLoadAutomatically( false );
1918 value = settings->AreImagesLoadedAutomatically();
1919 DALI_TEST_CHECK( !value );
1924 int UtcDaliWebSettingsGetSetDefaultTextEncodingName(void)
1926 ToolkitTestApplication application;
1928 WebView view = WebView::New();
1929 DALI_TEST_CHECK( view );
1931 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1932 DALI_TEST_CHECK( settings != 0 )
1934 const std::string kDefaultValue;
1935 const std::string kTestValue = "UTF-8";
1938 settings->AllowMixedContents( false );
1939 settings->EnableSpatialNavigation( false );
1940 settings->EnableWebSecurity( false );
1941 settings->EnableCacheBuilder( false );
1942 settings->EnableDoNotTrack( false );
1943 settings->UseScrollbarThumbFocusNotifications( false );
1944 settings->AllowFileAccessFromExternalUrl( false );
1945 settings->AllowScriptsOpenWindows( false );
1947 // Check default value
1948 std::string value = settings->GetDefaultTextEncodingName();
1949 DALI_TEST_EQUALS( value, kDefaultValue, TEST_LOCATION );
1951 // Check Set/GetProperty
1952 settings->SetDefaultTextEncodingName( kTestValue );
1953 value = settings->GetDefaultTextEncodingName();
1954 DALI_TEST_EQUALS( value, kTestValue, TEST_LOCATION );