2 * Copyright (c) 2024 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"
24 #include <dali-toolkit/devel-api/controls/web-view/web-back-forward-list.h>
25 #include <dali-toolkit/devel-api/controls/web-view/web-settings.h>
26 #include <dali-toolkit/devel-api/controls/web-view/web-view.h>
27 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
28 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
30 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-certificate.h>
31 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-console-message.h>
32 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-context-menu-item.h>
33 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-context-menu.h>
34 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-context.h>
35 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-cookie-manager.h>
36 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-form-repost-decision.h>
37 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-frame.h>
38 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-hit-test.h>
39 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-http-auth-handler.h>
40 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-load-error.h>
41 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-policy-decision.h>
42 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-request-interceptor.h>
43 #include <dali/devel-api/adaptor-framework/web-engine/web-engine-security-origin.h>
44 #include <dali/integration-api/events/hover-event-integ.h>
45 #include <dali/integration-api/events/key-event-integ.h>
46 #include <dali/integration-api/events/touch-event-integ.h>
47 #include <dali/integration-api/events/wheel-event-integ.h>
48 #include <dali/public-api/images/pixel-data.h>
51 using namespace Toolkit;
55 const char* const TEST_URL1("http://www.somewhere.valid1.com");
56 const char* const TEST_URL2("http://www.somewhere.valid2.com");
58 static int gPageLoadStartedCallbackCalled = 0;
59 static int gPageLoadInProgressCallbackCalled = 0;
60 static int gPageLoadFinishedCallbackCalled = 0;
61 static int gPageLoadErrorCallbackCalled = 0;
62 static std::unique_ptr<Dali::WebEngineLoadError> gPageLoadErrorInstance = nullptr;
63 static int gScrollEdgeReachedCallbackCalled = 0;
64 static int gUrlChangedCallbackCalled = 0;
65 static int gEvaluateJavaScriptCallbackCalled = 0;
66 static int gJavaScriptAlertCallbackCalled = 0;
67 static int gJavaScriptConfirmCallbackCalled = 0;
68 static int gJavaScriptPromptCallbackCalled = 0;
69 static int gScreenshotCapturedCallbackCalled = 0;
70 static int gVideoPlayingCallbackCalled = 0;
71 static int gGeolocationPermissionCallbackCalled = 0;
72 static bool gTouched = false;
73 static bool gHovered = false;
74 static bool gWheelEventHandled = false;
75 static int gFormRepostDecidedCallbackCalled = 0;
76 static std::unique_ptr<Dali::WebEngineFormRepostDecision> gFormRepostDecidedInstance = nullptr;
77 static int gFrameRenderedCallbackCalled = 0;
78 static int gConsoleMessageCallbackCalled = 0;
79 static std::unique_ptr<Dali::WebEngineConsoleMessage> gConsoleMessageInstance = nullptr;
80 static int gResponsePolicyDecidedCallbackCalled = 0;
81 static int gNavigationPolicyDecidedCallbackCalled = 0;
82 static int gNewWindowCreatedCallbackCalled = 0;
83 static std::unique_ptr<Dali::WebEnginePolicyDecision> gResponsePolicyDecisionInstance = nullptr;
84 static int gCertificateConfirmCallbackCalled = 0;
85 static std::unique_ptr<Dali::WebEngineCertificate> gCertificateConfirmInstance = nullptr;
86 static int gSslCertificateChangedCallbackCalled = 0;
87 static std::unique_ptr<Dali::WebEngineCertificate> gSslCertificateInstance = nullptr;
88 static int gHttpAuthHandlerCallbackCalled = 0;
89 static std::unique_ptr<Dali::WebEngineHttpAuthHandler> gHttpAuthInstance = nullptr;
90 static int gSecurityOriginsAcquiredCallbackCalled = 0;
91 static int gStorageUsageAcquiredCallbackCalled = 0;
92 static int gFormPasswordsAcquiredCallbackCalled = 0;
93 static int gDownloadStartedCallbackCalled = 0;
94 static int gMimeOverriddenCallbackCalled = 0;
95 static int gRequestInterceptedCallbackCalled = 0;
96 static Dali::WebEngineRequestInterceptorPtr gRequestInterceptorInstance = nullptr;
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 static int gPlainTextReceivedCallbackCalled = 0;
106 static int gNewWindowPolicyDecidedCallbackCalled = 0;
107 static int gFullscreenEnteredCallbackCalled = 0;
108 static int gFullscreenExitedCallbackCalled = 0;
109 static int gTextFoundCallbackCalled = 0;
111 struct CallbackFunctor
113 CallbackFunctor(bool* callbackFlag)
114 : mCallbackFlag(callbackFlag)
120 *mCallbackFlag = true;
125 static void OnPageLoadStarted(const std::string& url)
127 gPageLoadStartedCallbackCalled++;
130 static void OnPageLoadInProgress(const std::string& url)
132 gPageLoadInProgressCallbackCalled++;
135 static void OnPageLoadFinished(const std::string& url)
137 gPageLoadFinishedCallbackCalled++;
140 static void OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge)
142 gScrollEdgeReachedCallbackCalled++;
145 static void OnResponsePolicyDecided(std::unique_ptr<Dali::WebEnginePolicyDecision> decision)
147 gResponsePolicyDecidedCallbackCalled++;
148 gResponsePolicyDecisionInstance = std::move(decision);
151 static void OnNavigationPolicyDecided(std::unique_ptr<Dali::WebEnginePolicyDecision> decision)
153 gNavigationPolicyDecidedCallbackCalled++;
156 static void OnNewWindowCreated(Dali::WebEnginePlugin*& outPlugin)
158 gNewWindowCreatedCallbackCalled++;
159 WebView newView = WebView::New();
160 outPlugin = newView.GetPlugin();
163 static void OnUrlChanged(const std::string& url)
165 gUrlChangedCallbackCalled++;
168 static bool OnHitTestCreated(std::unique_ptr<Dali::WebEngineHitTest> test)
170 gHitTestCreatedCallbackCalled++;
174 static bool OnPlainTextReceived(const std::string& plainText)
176 gPlainTextReceivedCallbackCalled++;
180 static void OnPageLoadError(std::unique_ptr<Dali::WebEngineLoadError> error)
182 gPageLoadErrorCallbackCalled++;
183 gPageLoadErrorInstance = std::move(error);
186 static void OnEvaluateJavaScript(const std::string& result)
188 gEvaluateJavaScriptCallbackCalled++;
191 static bool OnJavaScriptAlert(const std::string& result)
193 gJavaScriptAlertCallbackCalled++;
197 static bool OnJavaScriptConfirm(const std::string& result)
199 gJavaScriptConfirmCallbackCalled++;
203 static bool OnJavaScriptPrompt(const std::string& meesage1, const std::string& message2)
205 gJavaScriptPromptCallbackCalled++;
209 static void OnScreenshotCaptured(Dali::Toolkit::ImageView)
211 gScreenshotCapturedCallbackCalled++;
214 static void OnVideoPlaying(bool isPlaying)
216 gVideoPlayingCallbackCalled++;
219 static bool OnGeolocationPermission(const std::string&, const std::string&)
221 gGeolocationPermissionCallbackCalled++;
225 static bool OnTouched(Actor actor, const Dali::TouchEvent& touch)
231 static void OnChangesWatch()
233 gCookieManagerChangsWatchCallbackCalled++;
236 static bool OnHovered(Actor actor, const Dali::HoverEvent& hover)
242 static bool OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel)
244 gWheelEventHandled = true;
248 static void OnFormRepostDecided(std::unique_ptr<Dali::WebEngineFormRepostDecision> decision)
250 gFormRepostDecidedCallbackCalled++;
251 gFormRepostDecidedInstance = std::move(decision);
254 static void OnFrameRendered()
256 gFrameRenderedCallbackCalled++;
259 static void OnConsoleMessage(std::unique_ptr<Dali::WebEngineConsoleMessage> message)
261 gConsoleMessageCallbackCalled++;
262 gConsoleMessageInstance = std::move(message);
265 static void OnCertificateConfirm(std::unique_ptr<Dali::WebEngineCertificate> certificate)
267 gCertificateConfirmCallbackCalled++;
268 gCertificateConfirmInstance = std::move(certificate);
271 static void OnSslCertificateChanged(std::unique_ptr<Dali::WebEngineCertificate> certificate)
273 gSslCertificateChangedCallbackCalled++;
274 gSslCertificateInstance = std::move(certificate);
277 static void OnHttpAuthHandler(std::unique_ptr<Dali::WebEngineHttpAuthHandler> hander)
279 gHttpAuthHandlerCallbackCalled++;
280 gHttpAuthInstance = std::move(hander);
283 static void OnSecurityOriginsAcquired(std::vector<std::unique_ptr<Dali::WebEngineSecurityOrigin>>& origins)
285 gSecurityOriginsAcquiredCallbackCalled++;
286 gSecurityOriginList.clear();
287 gSecurityOriginList.swap(origins);
290 static void OnStorageUsageAcquired(uint64_t usage)
292 gStorageUsageAcquiredCallbackCalled++;
295 static void OnFormPasswordsAcquired(std::vector<std::unique_ptr<Dali::WebEngineContext::PasswordData>>& passwords)
297 gFormPasswordsAcquiredCallbackCalled++;
298 gPasswordDataList.clear();
299 gPasswordDataList.swap(passwords);
302 static void OnDownloadStarted(const std::string& url)
304 gDownloadStartedCallbackCalled++;
307 static bool OnMimeOverridden(const std::string&, const std::string&, std::string&)
309 gMimeOverriddenCallbackCalled++;
313 static bool OnRequestIntercepted(Dali::WebEngineRequestInterceptorPtr interceptor)
315 gRequestInterceptedCallbackCalled++;
316 gRequestInterceptorInstance = interceptor;
320 static void OnContextMenuShown(std::unique_ptr<Dali::WebEngineContextMenu> menu)
322 gContextMenuShownCallbackCalled++;
323 gContextMenuShownInstance = std::move(menu);
326 static void OnContextMenuHidden(std::unique_ptr<Dali::WebEngineContextMenu> menu)
328 gContextMenuHiddenCallbackCalled++;
329 gContextMenuHiddenInstance = std::move(menu);
332 static void OnNewWindowPolicyDecided(std::unique_ptr<Dali::WebEnginePolicyDecision> decision)
334 gNewWindowPolicyDecidedCallbackCalled++;
337 static void OnFullscreenEntered()
339 gFullscreenEnteredCallbackCalled++;
342 static void OnFullscreenExited()
344 gFullscreenExitedCallbackCalled++;
347 static void OnTextFound(uint32_t arg)
349 gTextFoundCallbackCalled++;
354 void web_view_startup(void)
356 test_return_value = TET_UNDEF;
359 void web_view_cleanup(void)
361 test_return_value = TET_PASS;
364 int UtcDaliWebViewBasics(void)
366 ToolkitTestApplication application;
368 // Copy and Assignment Test
369 tet_infoline("UtcDaliWebViewBasic Copy and Assignment Test");
370 WebView view = WebView::New();
371 DALI_TEST_CHECK(view);
374 DALI_TEST_CHECK(view == copy);
377 DALI_TEST_CHECK(!assign);
380 DALI_TEST_CHECK(assign == view);
383 tet_infoline("UtcDaliWebViewBasic DownCast Test");
384 BaseHandle handle(view);
386 WebView view2 = WebView::DownCast(handle);
387 DALI_TEST_CHECK(view);
388 DALI_TEST_CHECK(view2);
389 DALI_TEST_CHECK(view == view2);
392 tet_infoline("UtcDaliWebViewBasic TypeRegistry Test");
393 TypeRegistry typeRegistry = TypeRegistry::Get();
394 DALI_TEST_CHECK(typeRegistry);
396 TypeInfo typeInfo = typeRegistry.GetTypeInfo("WebView");
397 DALI_TEST_CHECK(typeInfo);
399 BaseHandle handle2 = typeInfo.CreateInstance();
400 DALI_TEST_CHECK(handle2);
402 WebView view3 = WebView::DownCast(handle2);
403 DALI_TEST_CHECK(view3);
408 int UtcDaliWebViewPageNavigation(void)
410 ToolkitTestApplication application;
412 WebView view = WebView::New();
413 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
414 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
415 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
416 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
417 application.GetScene().Add(view);
418 application.SendNotification();
419 application.Render();
420 DALI_TEST_CHECK(view);
422 view.RegisterPageLoadStartedCallback(&OnPageLoadStarted);
423 view.RegisterPageLoadInProgressCallback(&OnPageLoadInProgress);
424 view.RegisterPageLoadFinishedCallback(&OnPageLoadFinished);
425 view.RegisterUrlChangedCallback(&OnUrlChanged);
426 DALI_TEST_EQUALS(gPageLoadStartedCallbackCalled, 0, TEST_LOCATION);
427 DALI_TEST_EQUALS(gPageLoadInProgressCallbackCalled, 0, TEST_LOCATION);
428 DALI_TEST_EQUALS(gPageLoadFinishedCallbackCalled, 0, TEST_LOCATION);
429 DALI_TEST_EQUALS(gUrlChangedCallbackCalled, 0, TEST_LOCATION);
431 view.LoadUrl(TEST_URL1);
432 view.GetNaturalSize();
433 Test::EmitGlobalTimerSignal();
434 DALI_TEST_EQUALS(view.CanGoBack(), false, TEST_LOCATION);
435 DALI_TEST_EQUALS(gPageLoadStartedCallbackCalled, 1, TEST_LOCATION);
436 DALI_TEST_EQUALS(gPageLoadInProgressCallbackCalled, 1, TEST_LOCATION);
437 DALI_TEST_EQUALS(gPageLoadFinishedCallbackCalled, 1, TEST_LOCATION);
438 DALI_TEST_EQUALS(gUrlChangedCallbackCalled, 1, TEST_LOCATION);
440 view.LoadUrl(TEST_URL2);
442 view.SetProperty(Actor::Property::SIZE, Vector2(400, 300));
443 application.SendNotification();
444 application.Render();
445 Test::EmitGlobalTimerSignal();
447 DALI_TEST_EQUALS(view.CanGoBack(), true, TEST_LOCATION);
448 DALI_TEST_EQUALS(view.CanGoForward(), false, TEST_LOCATION);
449 DALI_TEST_EQUALS(gPageLoadStartedCallbackCalled, 2, TEST_LOCATION);
450 DALI_TEST_EQUALS(gPageLoadInProgressCallbackCalled, 2, TEST_LOCATION);
451 DALI_TEST_EQUALS(gPageLoadFinishedCallbackCalled, 2, TEST_LOCATION);
452 DALI_TEST_EQUALS(gUrlChangedCallbackCalled, 2, TEST_LOCATION);
455 Test::EmitGlobalTimerSignal();
456 DALI_TEST_CHECK(!view.CanGoBack());
457 DALI_TEST_CHECK(view.CanGoForward());
460 Test::EmitGlobalTimerSignal();
461 DALI_TEST_CHECK(view.CanGoBack());
462 DALI_TEST_CHECK(!view.CanGoForward());
467 Test::EmitGlobalTimerSignal();
468 DALI_TEST_CHECK(!view.CanGoBack());
469 DALI_TEST_CHECK(!view.CanGoForward());
474 int UtcDaliWebViewPageLoadErrorConsoleMessage(void)
476 ToolkitTestApplication application;
478 WebView view = WebView::New();
479 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
480 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
481 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
482 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
483 application.GetScene().Add(view);
484 application.SendNotification();
485 application.Render();
486 DALI_TEST_CHECK(view);
488 view.RegisterPageLoadErrorCallback(&OnPageLoadError);
489 view.RegisterConsoleMessageReceivedCallback(&OnConsoleMessage);
490 DALI_TEST_EQUALS(gPageLoadErrorCallbackCalled, 0, TEST_LOCATION);
491 DALI_TEST_EQUALS(gConsoleMessageCallbackCalled, 0, TEST_LOCATION);
493 view.LoadUrl(TEST_URL1);
494 Test::EmitGlobalTimerSignal();
495 DALI_TEST_EQUALS(gPageLoadErrorCallbackCalled, 1, TEST_LOCATION);
496 DALI_TEST_EQUALS(gConsoleMessageCallbackCalled, 1, TEST_LOCATION);
499 DALI_TEST_CHECK(gPageLoadErrorInstance);
500 DALI_TEST_EQUALS(gPageLoadErrorInstance->GetUrl(), TEST_URL1, TEST_LOCATION);
501 DALI_TEST_EQUALS(gPageLoadErrorInstance->GetCode(), Dali::WebEngineLoadError::ErrorCode::UNKNOWN, TEST_LOCATION);
502 std::string testErrorDescription("This is an error.");
503 DALI_TEST_EQUALS(gPageLoadErrorInstance->GetDescription(), testErrorDescription, TEST_LOCATION);
504 DALI_TEST_EQUALS(gPageLoadErrorInstance->GetType(), Dali::WebEngineLoadError::ErrorType::NONE, TEST_LOCATION);
507 DALI_TEST_CHECK(gConsoleMessageInstance);
508 std::string testConsoleSource("source");
509 DALI_TEST_EQUALS(gConsoleMessageInstance->GetSource(), testConsoleSource, TEST_LOCATION);
510 DALI_TEST_EQUALS(gConsoleMessageInstance->GetLine(), 10, TEST_LOCATION);
511 DALI_TEST_EQUALS(gConsoleMessageInstance->GetSeverityLevel(), Dali::WebEngineConsoleMessage::SeverityLevel::EMPTY, TEST_LOCATION);
512 std::string testConsoleText("This is a text.");
513 DALI_TEST_EQUALS(gConsoleMessageInstance->GetText(), testConsoleText, TEST_LOCATION);
516 gPageLoadErrorInstance = nullptr;
517 gConsoleMessageInstance = nullptr;
522 int UtcDaliWebViewTouchAndKeys(void)
524 ToolkitTestApplication application;
526 WebView view = WebView::New();
527 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
528 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
529 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
530 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
532 application.GetScene().Add(view);
533 application.SendNotification();
534 application.Render();
536 view.GetNaturalSize();
537 view.TouchedSignal().Connect(&OnTouched);
540 Dali::Integration::TouchEvent event;
541 Dali::Integration::Point pointDown, pointUp;
543 event = Dali::Integration::TouchEvent();
544 pointDown.SetState(PointState::DOWN);
545 pointDown.SetScreenPosition(Vector2(10, 10));
546 event.AddPoint(pointDown);
547 application.ProcessEvent(event);
549 event = Dali::Integration::TouchEvent();
550 pointUp.SetState(PointState::UP);
551 pointUp.SetScreenPosition(Vector2(10, 10));
552 event.AddPoint(pointUp);
553 application.ProcessEvent(event);
556 Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(view);
557 application.ProcessEvent(Integration::KeyEvent("", "", "", DALI_KEY_ESCAPE, 0, 0, Integration::KeyEvent::DOWN, "", "", Device::Class::NONE, Device::Subclass::NONE));
558 application.SendNotification();
560 DALI_TEST_CHECK(gTouched);
561 DALI_TEST_CHECK(view);
566 int UtcDaliWebViewFocusGainedAndLost(void)
568 ToolkitTestApplication application;
570 WebView view = WebView::New();
571 DALI_TEST_CHECK(view);
573 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
574 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
575 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
576 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
578 application.GetScene().Add(view);
579 application.SendNotification();
580 application.Render();
582 view.SetKeyInputFocus();
583 DALI_TEST_CHECK(view.HasKeyInputFocus());
586 view.ClearKeyInputFocus();
587 DALI_TEST_CHECK(!view.HasKeyInputFocus());
592 int UtcDaliWebViewPropertyPageZoomFactor(void)
594 ToolkitTestApplication application;
596 WebView view = WebView::New();
597 DALI_TEST_CHECK(view);
599 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
600 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
601 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
602 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
604 application.GetScene().Add(view);
605 application.SendNotification();
606 application.Render();
608 view.SetProperty(WebView::Property::PAGE_ZOOM_FACTOR, 1.5f);
609 float zoomFactor = view.GetProperty<float>(WebView::Property::PAGE_ZOOM_FACTOR);
610 DALI_TEST_EQUALS(zoomFactor, 1.5f, TEST_LOCATION);
612 view.SetProperty(WebView::Property::PAGE_ZOOM_FACTOR, 1.0f);
613 zoomFactor = view.GetProperty<float>(WebView::Property::PAGE_ZOOM_FACTOR);
614 DALI_TEST_EQUALS(zoomFactor, 1.0f, TEST_LOCATION);
619 int UtcDaliWebViewPropertyTextZoomFactor(void)
621 ToolkitTestApplication application;
623 WebView view = WebView::New();
624 DALI_TEST_CHECK(view);
626 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
627 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
628 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
629 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
631 application.GetScene().Add(view);
632 application.SendNotification();
633 application.Render();
635 view.SetProperty(WebView::Property::TEXT_ZOOM_FACTOR, 1.5f);
636 float zoomFactor = view.GetProperty<float>(WebView::Property::TEXT_ZOOM_FACTOR);
637 DALI_TEST_EQUALS(zoomFactor, 1.5f, TEST_LOCATION);
639 view.SetProperty(WebView::Property::TEXT_ZOOM_FACTOR, 1.0f);
640 zoomFactor = view.GetProperty<float>(WebView::Property::TEXT_ZOOM_FACTOR);
641 DALI_TEST_EQUALS(zoomFactor, 1.0f, TEST_LOCATION);
646 int UtcDaliWebViewPropertyLoadProgressPercentage(void)
648 ToolkitTestApplication application;
650 WebView view = WebView::New();
651 DALI_TEST_CHECK(view);
653 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
654 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
655 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
656 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
658 application.GetScene().Add(view);
659 application.SendNotification();
660 application.Render();
662 float percentage = view.GetProperty<float>(WebView::Property::LOAD_PROGRESS_PERCENTAGE);
663 DALI_TEST_EQUALS(percentage, 0.5f, TEST_LOCATION);
668 int UtcDaliWebViewMove(void)
670 ToolkitTestApplication application;
672 WebView view = WebView::New();
673 DALI_TEST_CHECK(view);
675 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
676 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
677 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
678 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
680 application.GetScene().Add(view);
681 application.SendNotification();
682 application.Render();
684 view.SetProperty(Actor::Property::POSITION, Vector2(100, 100));
685 Vector3 viewPos = view.GetProperty<Vector3>(Actor::Property::POSITION);
686 DALI_TEST_EQUALS(viewPos, Vector3(100, 100, 0), TEST_LOCATION);
691 int UtcDaliWebViewPropertyVideoHoleEnabled(void)
693 ToolkitTestApplication application;
695 WebView view = WebView::New();
696 DALI_TEST_CHECK(view);
698 const bool kDefaultValue = false;
699 const bool kTestValue = true;
701 // Check default value
703 Property::Value value = view.GetProperty(WebView::Property::VIDEO_HOLE_ENABLED);
704 DALI_TEST_CHECK(value.Get(output));
705 DALI_TEST_EQUALS(output, kDefaultValue, TEST_LOCATION);
707 // Check Set/GetProperty
708 view.SetProperty(WebView::Property::VIDEO_HOLE_ENABLED, kTestValue);
709 value = view.GetProperty(WebView::Property::VIDEO_HOLE_ENABLED);
710 DALI_TEST_CHECK(value.Get(output));
711 DALI_TEST_EQUALS(output, kTestValue, TEST_LOCATION);
716 int UtcDaliWebViewPropertyMouseEventsEnabled(void)
718 ToolkitTestApplication application;
720 WebView view = WebView::New();
721 DALI_TEST_CHECK(view);
723 const bool kDefaultValue = true;
724 const bool kTestValue = false;
726 // Check default value
728 Property::Value value = view.GetProperty(WebView::Property::MOUSE_EVENTS_ENABLED);
729 DALI_TEST_CHECK(value.Get(output));
730 DALI_TEST_EQUALS(output, kDefaultValue, TEST_LOCATION);
732 // Check Set/GetProperty
733 view.SetProperty(WebView::Property::MOUSE_EVENTS_ENABLED, kTestValue);
734 value = view.GetProperty(WebView::Property::MOUSE_EVENTS_ENABLED);
735 DALI_TEST_CHECK(value.Get(output));
736 DALI_TEST_EQUALS(output, kTestValue, TEST_LOCATION);
741 int UtcDaliWebViewPropertyKeyEventsEnabled(void)
743 ToolkitTestApplication application;
745 WebView view = WebView::New();
746 DALI_TEST_CHECK(view);
748 const bool kDefaultValue = true;
749 const bool kTestValue = false;
751 // Check default value
753 Property::Value value = view.GetProperty(WebView::Property::KEY_EVENTS_ENABLED);
754 DALI_TEST_CHECK(value.Get(output));
755 DALI_TEST_EQUALS(output, kDefaultValue, TEST_LOCATION);
757 // Check Set/GetProperty
758 view.SetProperty(WebView::Property::KEY_EVENTS_ENABLED, kTestValue);
759 value = view.GetProperty(WebView::Property::KEY_EVENTS_ENABLED);
760 DALI_TEST_CHECK(value.Get(output));
761 DALI_TEST_EQUALS(output, kTestValue, TEST_LOCATION);
766 int UtcDaliWebViewHoverAndWheel(void)
768 ToolkitTestApplication application;
770 WebView view = WebView::New();
771 DALI_TEST_CHECK(view);
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));
777 application.GetScene().Add(view);
778 application.SendNotification();
779 application.Render();
781 view.GetNaturalSize();
782 view.HoveredSignal().Connect(&OnHovered);
783 view.WheelEventSignal().Connect(&OnWheelEvent);
786 Dali::Integration::HoverEvent event = Dali::Integration::HoverEvent();
787 Dali::Integration::Point pointDown;
788 pointDown.SetState(PointState::DOWN);
789 pointDown.SetScreenPosition(Vector2(10, 10));
790 event.AddPoint(pointDown);
791 application.ProcessEvent(event);
793 event = Dali::Integration::HoverEvent();
794 Dali::Integration::Point pointUp;
795 pointUp.SetState(PointState::UP);
796 pointUp.SetScreenPosition(Vector2(10, 10));
797 event.AddPoint(pointUp);
798 application.ProcessEvent(event);
800 event = Dali::Integration::HoverEvent();
801 Dali::Integration::Point pointMotion;
802 pointUp.SetState(PointState::MOTION);
803 pointUp.SetScreenPosition(Vector2(10, 10));
804 event.AddPoint(pointMotion);
805 application.ProcessEvent(event);
808 Dali::Integration::WheelEvent wheelEvent;
809 wheelEvent.type = Dali::Integration::WheelEvent::Type::MOUSE_WHEEL;
810 wheelEvent.direction = 0;
811 wheelEvent.point = Vector2(20, 20);
812 wheelEvent.delta = 10;
813 application.ProcessEvent(wheelEvent);
814 application.SendNotification();
816 DALI_TEST_CHECK(gHovered);
817 DALI_TEST_CHECK(gWheelEventHandled);
822 int UtcDaliWebViewFormRepostDecidedFrameRendering(void)
824 ToolkitTestApplication application;
826 WebView view = WebView::New();
827 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
828 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
829 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
830 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
831 application.GetScene().Add(view);
832 application.SendNotification();
833 application.Render();
834 DALI_TEST_CHECK(view);
836 view.RegisterFormRepostDecidedCallback(&OnFormRepostDecided);
837 view.RegisterFrameRenderedCallback(&OnFrameRendered);
838 DALI_TEST_EQUALS(gFormRepostDecidedCallbackCalled, 0, TEST_LOCATION);
839 DALI_TEST_EQUALS(gFrameRenderedCallbackCalled, 0, TEST_LOCATION);
841 view.LoadUrl(TEST_URL1);
842 Test::EmitGlobalTimerSignal();
843 DALI_TEST_EQUALS(gFormRepostDecidedCallbackCalled, 1, TEST_LOCATION);
844 DALI_TEST_EQUALS(gFrameRenderedCallbackCalled, 1, TEST_LOCATION);
846 // form repost decision.
847 DALI_TEST_CHECK(gFormRepostDecidedInstance);
848 gFormRepostDecidedInstance->Reply(true);
851 gFormRepostDecidedInstance = nullptr;
856 int UtcDaliWebViewSslCertificateHttpAuthentication(void)
858 ToolkitTestApplication application;
860 WebView view = WebView::New();
861 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
862 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
863 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
864 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
865 application.GetScene().Add(view);
866 application.SendNotification();
867 application.Render();
868 DALI_TEST_CHECK(view);
870 view.RegisterCertificateConfirmedCallback(&OnCertificateConfirm);
871 view.RegisterSslCertificateChangedCallback(&OnSslCertificateChanged);
872 view.RegisterHttpAuthHandlerCallback(&OnHttpAuthHandler);
873 DALI_TEST_EQUALS(gCertificateConfirmCallbackCalled, 0, TEST_LOCATION);
874 DALI_TEST_EQUALS(gSslCertificateChangedCallbackCalled, 0, TEST_LOCATION);
875 DALI_TEST_EQUALS(gHttpAuthHandlerCallbackCalled, 0, TEST_LOCATION);
877 view.LoadUrl(TEST_URL1);
878 Test::EmitGlobalTimerSignal();
879 DALI_TEST_EQUALS(gCertificateConfirmCallbackCalled, 1, TEST_LOCATION);
880 DALI_TEST_EQUALS(gSslCertificateChangedCallbackCalled, 1, TEST_LOCATION);
881 DALI_TEST_EQUALS(gHttpAuthHandlerCallbackCalled, 1, TEST_LOCATION);
884 DALI_TEST_CHECK(gCertificateConfirmInstance);
885 gCertificateConfirmInstance->Allow(true);
886 DALI_TEST_CHECK(gCertificateConfirmInstance->IsFromMainFrame());
888 DALI_TEST_CHECK(gSslCertificateInstance);
889 DALI_TEST_EQUALS(gSslCertificateInstance->GetPem(), "abc", TEST_LOCATION);
890 DALI_TEST_CHECK(gSslCertificateInstance->IsContextSecure());
891 DALI_TEST_EQUALS(gSslCertificateInstance->GetPolicyDecisionError(), 1, TEST_LOCATION);
892 DALI_TEST_CHECK(gSslCertificateInstance->SuspendPolicyDecision());
894 // http authentication.
895 DALI_TEST_CHECK(gHttpAuthInstance);
896 gHttpAuthInstance->Suspend();
897 gHttpAuthInstance->UseCredential("", "");
898 gHttpAuthInstance->CancelCredential();
899 DALI_TEST_EQUALS(gHttpAuthInstance->GetRealm(), "test", TEST_LOCATION);
902 gCertificateConfirmInstance = nullptr;
903 gSslCertificateInstance = nullptr;
904 gHttpAuthInstance = nullptr;
909 int UtcDaliWebViewGetWebBackForwardList(void)
911 ToolkitTestApplication application;
913 WebView view = WebView::New();
914 DALI_TEST_CHECK(view);
916 Dali::Toolkit::WebBackForwardList* bfList = view.GetBackForwardList();
917 DALI_TEST_CHECK(bfList != 0);
922 int UtcDaliWebViewGetWebContext(void)
924 ToolkitTestApplication application;
926 Dali::WebEngineContext* context = WebView::GetContext();
927 DALI_TEST_CHECK(context != nullptr);
932 int UtcDaliWebViewGetWebCookieManager(void)
934 ToolkitTestApplication application;
936 Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
937 DALI_TEST_CHECK(cookieManager != 0);
942 int UtcDaliWebViewGetWebSettings(void)
944 ToolkitTestApplication application;
946 WebView view = WebView::New();
947 DALI_TEST_CHECK(view);
949 Dali::Toolkit::WebSettings* settings = view.GetSettings();
950 DALI_TEST_CHECK(settings != 0);
955 int UtcDaliWebViewProperty1(void)
958 ToolkitTestApplication application;
960 WebView view = WebView::New();
961 DALI_TEST_CHECK(view);
964 view.SetProperty(WebView::Property::URL, TEST_URL1);
965 Property::Value val = view.GetProperty(WebView::Property::URL);
966 DALI_TEST_CHECK(val.Get(local));
967 DALI_TEST_EQUALS(local, TEST_URL1, TEST_LOCATION);
972 int UtcDaliWebViewProperty4(void)
975 ToolkitTestApplication application;
977 WebView view = WebView::New();
978 DALI_TEST_CHECK(view);
980 const std::string kDefaultValue;
981 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";
983 // Check default value
985 Property::Value value = view.GetProperty(WebView::Property::USER_AGENT);
986 DALI_TEST_CHECK(value.Get(output));
987 DALI_TEST_EQUALS(output, kDefaultValue, TEST_LOCATION);
989 // Check Set/GetProperty
990 view.SetProperty(WebView::Property::USER_AGENT, kTestValue);
991 value = view.GetProperty(WebView::Property::USER_AGENT);
992 DALI_TEST_CHECK(value.Get(output));
993 DALI_TEST_EQUALS(output, kTestValue, TEST_LOCATION);
998 int UtcDaliWebViewProperty9(void)
1001 ToolkitTestApplication application;
1003 WebView view = WebView::New();
1004 DALI_TEST_CHECK(view);
1006 // Check default value
1007 Dali::Vector2 output = Dali::Vector2::ONE;
1008 view.GetProperty(WebView::Property::SCROLL_POSITION).Get(output);
1009 DALI_TEST_CHECK(output.x == 0 && output.y == 0);
1011 // Check Set/GetProperty
1012 Dali::Vector2 testValue = Dali::Vector2(100, 100);
1013 view.SetProperty(WebView::Property::SCROLL_POSITION, testValue);
1014 view.GetProperty(WebView::Property::SCROLL_POSITION).Get(output);
1015 DALI_TEST_EQUALS(output, testValue, TEST_LOCATION);
1017 // Check default value of scroll size
1018 output = Dali::Vector2::ONE;
1019 view.GetProperty(WebView::Property::SCROLL_SIZE).Get(output);
1020 DALI_TEST_CHECK(output.x == 500 && output.y == 500);
1022 // Check default value of content size
1023 output = Dali::Vector2::ONE;
1024 view.GetProperty(WebView::Property::CONTENT_SIZE).Get(output);
1025 DALI_TEST_CHECK(output.x == 500 && output.y == 500);
1030 int UtcDaliWebViewPropertyBackgroundColorSelectedTextEtc(void)
1032 ToolkitTestApplication application;
1034 WebView view = WebView::New();
1035 DALI_TEST_CHECK(view);
1037 Dali::Vector4 testValue = Dali::Vector4(0.0f, 0.0f, 0.0f, 0.0f);
1038 view.SetProperty(WebView::Property::DOCUMENT_BACKGROUND_COLOR, testValue);
1039 view.SetProperty(WebView::Property::TILES_CLEARED_WHEN_HIDDEN, true);
1040 view.SetProperty(WebView::Property::TILE_COVER_AREA_MULTIPLIER, 1.0f);
1041 view.SetProperty(WebView::Property::CURSOR_ENABLED_BY_CLIENT, true);
1043 // Check default value
1044 std::string testText("test");
1046 view.GetProperty(WebView::Property::SELECTED_TEXT).Get(output);
1047 DALI_TEST_EQUALS(output, testText, TEST_LOCATION);
1052 int UtcDaliWebViewPropertyTitleFavicon(void)
1054 ToolkitTestApplication application;
1056 char argv[] = "--test";
1057 WebView view = WebView::New(1, (char**)&argv);
1058 DALI_TEST_CHECK(view);
1061 view.ClearAllTilesResources();
1063 // Check default value of title
1064 std::string testValue("title");
1066 view.GetProperty(WebView::Property::TITLE).Get(output);
1067 DALI_TEST_EQUALS(output, testValue, TEST_LOCATION);
1069 // Check the case that favicon is not null.
1070 Dali::Toolkit::ImageView favicon = view.GetFavicon();
1071 DALI_TEST_CHECK(favicon);
1072 Dali::Vector3 iconsize = favicon.GetProperty<Vector3>(Dali::Actor::Property::SIZE);
1073 DALI_TEST_CHECK((int)iconsize.width == 2 && (int)iconsize.height == 2);
1075 // Check the case that favicon is null.
1076 favicon = view.GetFavicon();
1077 DALI_TEST_CHECK(!favicon);
1082 int UtcDaliWebViewContextMenuShownAndHidden(void)
1084 ToolkitTestApplication application;
1086 WebView view = WebView::New();
1087 DALI_TEST_CHECK(view);
1090 view.RegisterContextMenuShownCallback(&OnContextMenuShown);
1091 view.RegisterContextMenuHiddenCallback(&OnContextMenuHidden);
1092 DALI_TEST_EQUALS(gContextMenuShownCallbackCalled, 0, TEST_LOCATION);
1093 DALI_TEST_EQUALS(gContextMenuHiddenCallbackCalled, 0, TEST_LOCATION);
1094 DALI_TEST_CHECK(gContextMenuShownInstance == 0);
1095 DALI_TEST_CHECK(gContextMenuHiddenInstance == 0);
1097 view.LoadUrl(TEST_URL1);
1098 Test::EmitGlobalTimerSignal();
1099 DALI_TEST_EQUALS(gContextMenuShownCallbackCalled, 1, TEST_LOCATION);
1100 DALI_TEST_EQUALS(gContextMenuHiddenCallbackCalled, 1, TEST_LOCATION);
1102 // check context meun & its items.
1103 DALI_TEST_CHECK(gContextMenuShownInstance != 0);
1104 std::unique_ptr<Dali::WebEngineContextMenuItem> item = gContextMenuShownInstance->GetItemAt(0);
1105 DALI_TEST_CHECK(item.get() != 0);
1106 std::vector<std::unique_ptr<Dali::WebEngineContextMenuItem>> itemList = gContextMenuShownInstance->GetItemList();
1107 DALI_TEST_CHECK(itemList.size() == 1);
1108 DALI_TEST_CHECK(gContextMenuShownInstance->RemoveItem(*(item.get())));
1109 DALI_TEST_CHECK(gContextMenuShownInstance->AppendItemAsAction(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", false));
1110 DALI_TEST_CHECK(gContextMenuShownInstance->AppendItem(WebEngineContextMenuItem::ItemTag::NO_ACTION, "", "", false));
1111 DALI_TEST_CHECK(gContextMenuShownInstance->SelectItem(*(item.get())));
1112 DALI_TEST_CHECK(gContextMenuShownInstance->Hide());
1114 Dali::WebEngineContextMenuItem::ItemTag testItemTag = Dali::WebEngineContextMenuItem::ItemTag::NO_ACTION;
1115 DALI_TEST_EQUALS(item->GetTag(), testItemTag, TEST_LOCATION);
1116 Dali::WebEngineContextMenuItem::ItemType testItemType = Dali::WebEngineContextMenuItem::ItemType::ACTION;
1117 DALI_TEST_EQUALS(item->GetType(), testItemType, TEST_LOCATION);
1118 DALI_TEST_CHECK(item->IsEnabled());
1119 std::string testLinkUrl("http://test.html");
1120 DALI_TEST_EQUALS(item->GetLinkUrl(), testLinkUrl, TEST_LOCATION);
1121 std::string testImageUrl("http://test.jpg");
1122 DALI_TEST_EQUALS(item->GetImageUrl(), testImageUrl, TEST_LOCATION);
1123 std::string testTitle("title");
1124 DALI_TEST_EQUALS(item->GetTitle(), testTitle, TEST_LOCATION);
1125 DALI_TEST_CHECK(item->GetParentMenu().get() == 0);
1127 DALI_TEST_CHECK(gContextMenuHiddenInstance != 0);
1129 gContextMenuShownInstance = nullptr;
1130 gContextMenuHiddenInstance = nullptr;
1135 int UtcDaliWebViewScrollBy(void)
1137 ToolkitTestApplication application;
1139 WebView view = WebView::New();
1140 DALI_TEST_CHECK(view);
1143 view.RegisterScrollEdgeReachedCallback(&OnScrollEdgeReached);
1144 DALI_TEST_EQUALS(gScrollEdgeReachedCallbackCalled, 0, TEST_LOCATION);
1146 view.LoadUrl(TEST_URL1);
1147 Test::EmitGlobalTimerSignal();
1149 // set scroll position.
1150 Dali::Vector2 output = Dali::Vector2::ONE;
1151 Dali::Vector2 testValue = Dali::Vector2(100, 100);
1152 view.SetProperty(WebView::Property::SCROLL_POSITION, testValue);
1153 view.GetProperty(WebView::Property::SCROLL_POSITION).Get(output);
1154 DALI_TEST_EQUALS(output, testValue, TEST_LOCATION);
1156 // scroll by and trigger scrollEdgeReached event.
1157 view.ScrollBy(50, 50);
1158 Test::EmitGlobalTimerSignal();
1160 view.GetProperty(WebView::Property::SCROLL_POSITION).Get(output);
1161 DALI_TEST_CHECK(output.x == 150 && output.y == 150);
1162 DALI_TEST_EQUALS(gScrollEdgeReachedCallbackCalled, 1, TEST_LOCATION);
1164 // scroll by and trigger scrollEdgeReached event.
1165 bool result = view.ScrollEdgeBy(50, 50);
1166 DALI_TEST_CHECK(result);
1167 Test::EmitGlobalTimerSignal();
1169 view.GetProperty(WebView::Property::SCROLL_POSITION).Get(output);
1170 DALI_TEST_CHECK(output.x == 200 && output.y == 200);
1171 DALI_TEST_EQUALS(gScrollEdgeReachedCallbackCalled, 2, TEST_LOCATION);
1176 int UtcDaliWebViewSetGetScaleFactorActivateAccessibility(void)
1178 ToolkitTestApplication application;
1180 WebView view = WebView::New();
1181 DALI_TEST_CHECK(view);
1183 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1184 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1185 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
1186 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
1188 application.GetScene().Add(view);
1189 application.SendNotification();
1190 application.Render();
1192 view.ActivateAccessibility(true);
1193 view.AddDynamicCertificatePath("host", "test/to/path");
1194 bool found = view.HighlightText("test", Dali::WebEnginePlugin::FindOption::CASE_INSENSITIVE, 2);
1195 DALI_TEST_CHECK(found);
1197 view.SetScaleFactor(1.5f, Dali::Vector2(0.0f, 0.0f));
1198 float result = view.GetScaleFactor();
1199 DALI_TEST_EQUALS(result, 1.5f, TEST_LOCATION);
1201 view.SetScaleFactor(1.0f, Dali::Vector2(0.0f, 0.0f));
1202 result = view.GetScaleFactor();
1203 DALI_TEST_EQUALS(result, 1.0f, TEST_LOCATION);
1208 int UtcDaliWebViewGetScreenshotSyncAndAsync(void)
1211 ToolkitTestApplication application;
1213 char argv[] = "--test";
1214 WebView view = WebView::New(1, (char**)&argv);
1215 DALI_TEST_CHECK(view);
1217 // Check GetScreenshot
1218 Dali::Rect<int> viewArea;
1221 viewArea.width = 10;
1222 viewArea.height = 10;
1223 Dali::Toolkit::ImageView screenshot = view.GetScreenshot(viewArea, 1.0f);
1224 DALI_TEST_CHECK(screenshot);
1225 Dali::Vector3 shotsize = screenshot.GetProperty<Vector3>(Dali::Actor::Property::SIZE);
1226 DALI_TEST_CHECK((int)shotsize.width == viewArea.width && (int)shotsize.height == viewArea.height);
1228 // Check GetScreenshotAsynchronously
1231 viewArea.width = 100;
1232 viewArea.height = 100;
1233 bool result = view.GetScreenshotAsynchronously(viewArea, 1.0f, &OnScreenshotCaptured);
1234 DALI_TEST_CHECK(result);
1236 Test::EmitGlobalTimerSignal();
1238 Test::EmitGlobalTimerSignal();
1239 DALI_TEST_EQUALS(gScreenshotCapturedCallbackCalled, 1, TEST_LOCATION);
1244 int UtcDaliWebViewVideoPlayingGeolocationPermission(void)
1247 ToolkitTestApplication application;
1249 char argv[] = "--test";
1250 WebView view = WebView::New(1, (char**)&argv);
1251 DALI_TEST_CHECK(view);
1253 // Check CheckVideoPlayingAsynchronously
1254 bool result = view.CheckVideoPlayingAsynchronously(&OnVideoPlaying);
1255 DALI_TEST_CHECK(result);
1256 Test::EmitGlobalTimerSignal();
1257 DALI_TEST_EQUALS(gVideoPlayingCallbackCalled, 1, TEST_LOCATION);
1259 // Check RegisterGeolocationPermissionCallback
1260 view.RegisterGeolocationPermissionCallback(&OnGeolocationPermission);
1261 Test::EmitGlobalTimerSignal();
1262 DALI_TEST_EQUALS(gGeolocationPermissionCallbackCalled, 1, TEST_LOCATION);
1267 int UtcDaliWebViewResponsePolicyDecisionRequest(void)
1269 ToolkitTestApplication application;
1271 WebView view = WebView::New();
1272 DALI_TEST_CHECK(view);
1275 view.RegisterResponsePolicyDecidedCallback(&OnResponsePolicyDecided);
1276 DALI_TEST_EQUALS(gResponsePolicyDecidedCallbackCalled, 0, TEST_LOCATION);
1277 DALI_TEST_CHECK(gResponsePolicyDecisionInstance == 0);
1279 view.LoadUrl(TEST_URL1);
1280 Test::EmitGlobalTimerSignal();
1281 DALI_TEST_EQUALS(gResponsePolicyDecidedCallbackCalled, 1, TEST_LOCATION);
1283 // check response policy decision & its frame.
1284 DALI_TEST_CHECK(gResponsePolicyDecisionInstance != 0);
1285 std::string testUrl("http://test.html");
1286 DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetUrl(), testUrl, TEST_LOCATION);
1287 std::string testCookie("test:abc");
1288 DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetCookie(), testCookie, TEST_LOCATION);
1289 Dali::WebEnginePolicyDecision::DecisionType testDecisionType = Dali::WebEnginePolicyDecision::DecisionType::USE;
1290 DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetDecisionType(), testDecisionType, TEST_LOCATION);
1291 std::string testResponseMime("txt/xml");
1292 DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetResponseMime(), testResponseMime, TEST_LOCATION);
1293 int32_t ResponseStatusCode = 500;
1294 DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetResponseStatusCode(), ResponseStatusCode, TEST_LOCATION);
1295 Dali::WebEnginePolicyDecision::NavigationType testNavigationType = Dali::WebEnginePolicyDecision::NavigationType::LINK_CLICKED;
1296 DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetNavigationType(), testNavigationType, TEST_LOCATION);
1297 std::string testScheme("test");
1298 DALI_TEST_EQUALS(gResponsePolicyDecisionInstance->GetScheme(), testScheme, TEST_LOCATION);
1299 DALI_TEST_CHECK(gResponsePolicyDecisionInstance->Use());
1300 DALI_TEST_CHECK(gResponsePolicyDecisionInstance->Ignore());
1301 DALI_TEST_CHECK(gResponsePolicyDecisionInstance->Suspend());
1303 Dali::WebEngineFrame* webFrame = &(gResponsePolicyDecisionInstance->GetFrame());
1304 DALI_TEST_CHECK(webFrame);
1305 DALI_TEST_CHECK(webFrame->IsMainFrame());
1307 gResponsePolicyDecisionInstance = nullptr;
1312 int UtcDaliWebViewNavigationPolicyDecisionRequest(void)
1314 ToolkitTestApplication application;
1316 WebView view = WebView::New();
1317 DALI_TEST_CHECK(view);
1320 view.RegisterNavigationPolicyDecidedCallback(&OnNavigationPolicyDecided);
1321 DALI_TEST_EQUALS(gNavigationPolicyDecidedCallbackCalled, 0, TEST_LOCATION);
1323 view.LoadUrl(TEST_URL1);
1324 Test::EmitGlobalTimerSignal();
1325 DALI_TEST_EQUALS(gNavigationPolicyDecidedCallbackCalled, 1, TEST_LOCATION);
1330 int UtcDaliWebViewNewWindowCreated(void)
1332 ToolkitTestApplication application;
1334 WebView view = WebView::New();
1335 DALI_TEST_CHECK(view);
1338 view.RegisterNewWindowCreatedCallback(&OnNewWindowCreated);
1339 DALI_TEST_EQUALS(gNewWindowCreatedCallbackCalled, 0, TEST_LOCATION);
1341 view.LoadUrl(TEST_URL1);
1342 Test::EmitGlobalTimerSignal();
1343 DALI_TEST_EQUALS(gNewWindowCreatedCallbackCalled, 1, TEST_LOCATION);
1348 int UtcDaliWebViewHitTest(void)
1350 ToolkitTestApplication application;
1352 WebView view = WebView::New();
1353 DALI_TEST_CHECK(view);
1356 view.LoadUrl(TEST_URL1);
1359 std::unique_ptr<Dali::WebEngineHitTest> hitTest = view.CreateHitTest(100, 100, Dali::WebEngineHitTest::HitTestMode::DEFAULT);
1360 DALI_TEST_CHECK(hitTest != 0);
1361 DALI_TEST_EQUALS(hitTest->GetResultContext(), Dali::WebEngineHitTest::ResultContext::DOCUMENT, TEST_LOCATION);
1362 std::string testLinkUri("http://test.html");
1363 DALI_TEST_EQUALS(hitTest->GetLinkUri(), testLinkUri, TEST_LOCATION);
1364 std::string testLinkTitle("test");
1365 DALI_TEST_EQUALS(hitTest->GetLinkTitle(), testLinkTitle, TEST_LOCATION);
1366 std::string testLinkLabel("label");
1367 DALI_TEST_EQUALS(hitTest->GetLinkLabel(), testLinkLabel, TEST_LOCATION);
1368 std::string testImageUri("http://test.jpg");
1369 DALI_TEST_EQUALS(hitTest->GetImageUri(), testImageUri, TEST_LOCATION);
1370 std::string testMediaUri("http://test.mp4");
1371 DALI_TEST_EQUALS(hitTest->GetMediaUri(), testMediaUri, TEST_LOCATION);
1372 std::string testTagName("img");
1373 DALI_TEST_EQUALS(hitTest->GetTagName(), testTagName, TEST_LOCATION);
1374 std::string testNodeValue("test");
1375 DALI_TEST_EQUALS(hitTest->GetNodeValue(), testNodeValue, TEST_LOCATION);
1376 Dali::Property::Map testMap = hitTest->GetAttributes();
1377 DALI_TEST_EQUALS(testMap.Count(), 0, TEST_LOCATION);
1378 std::string testImageFileNameExtension("jpg");
1379 DALI_TEST_EQUALS(hitTest->GetImageFileNameExtension(), testImageFileNameExtension, TEST_LOCATION);
1380 Dali::PixelData testImageBuffer = hitTest->GetImageBuffer();
1381 DALI_TEST_CHECK((int)testImageBuffer.GetWidth() == 2 && (int)testImageBuffer.GetHeight() == 2);
1384 bool result = view.CreateHitTestAsynchronously(100, 100, Dali::WebEngineHitTest::HitTestMode::DEFAULT, &OnHitTestCreated);
1385 DALI_TEST_CHECK(result);
1386 Test::EmitGlobalTimerSignal();
1387 DALI_TEST_EQUALS(gHitTestCreatedCallbackCalled, 1, TEST_LOCATION);
1392 int UtcDaliWebViewEvaluteJavaScript(void)
1394 ToolkitTestApplication application;
1396 WebView view = WebView::New("ko-KR", "Asia/Seoul");
1398 view.LoadHtmlString("<body>Hello World!</body>");
1399 view.EvaluateJavaScript("jsObject.postMessage('Hello')");
1400 view.EvaluateJavaScript("jsObject.postMessage('World')", OnEvaluateJavaScript);
1401 Test::EmitGlobalTimerSignal();
1403 DALI_TEST_EQUALS(gEvaluateJavaScriptCallbackCalled, 1, TEST_LOCATION);
1408 int UtcDaliWebViewJavaScriptAlertConfirmPrompt(void)
1410 ToolkitTestApplication application;
1412 WebView view = WebView::New("ko-KR", "Asia/Seoul");
1414 view.RegisterJavaScriptAlertCallback(&OnJavaScriptAlert);
1415 view.LoadHtmlString("<head><script type='text/javascript'>alert('this is an alert popup.');</script></head><body>Hello World!</body>");
1416 view.JavaScriptAlertReply();
1417 Test::EmitGlobalTimerSignal();
1418 DALI_TEST_EQUALS(gJavaScriptAlertCallbackCalled, 1, TEST_LOCATION);
1420 view.RegisterJavaScriptConfirmCallback(&OnJavaScriptConfirm);
1421 view.LoadHtmlString("<head><script type='text/javascript'>confirm('this is a confirm popup.');</script></head><body>Hello World!</body>");
1422 view.JavaScriptConfirmReply(true);
1423 Test::EmitGlobalTimerSignal();
1424 DALI_TEST_EQUALS(gJavaScriptConfirmCallbackCalled, 1, TEST_LOCATION);
1426 view.RegisterJavaScriptPromptCallback(&OnJavaScriptPrompt);
1427 view.LoadHtmlString("<head><script type='text/javascript'>prompt('this is a prompt popup.');</script></head><body>Hello World!</body>");
1428 view.JavaScriptPromptReply("it is a prompt.");
1429 Test::EmitGlobalTimerSignal();
1430 DALI_TEST_EQUALS(gJavaScriptPromptCallbackCalled, 1, TEST_LOCATION);
1435 int UtcDaliWebViewLoadHtmlStringOverrideCurrentEntryAndContents(void)
1437 ToolkitTestApplication application;
1439 WebView view = WebView::New("ko-KR", "Asia/Seoul");
1440 DALI_TEST_CHECK(view);
1442 std::string html("<body>Hello World!</body>");
1443 std::string basicUri("http://basicurl");
1444 std::string unreachableUrl("http://unreachableurl");
1445 bool result = view.LoadHtmlStringOverrideCurrentEntry(html, basicUri, unreachableUrl);
1446 DALI_TEST_CHECK(result);
1448 application.SendNotification();
1449 application.Render();
1450 Test::EmitGlobalTimerSignal();
1452 result = view.LoadContents((const int8_t*)html.c_str(), html.length(), "html/text", "utf-8", basicUri);
1453 DALI_TEST_CHECK(result);
1458 int UtcDaliWebViewReloadSuspendResumeNetworkLoadingCustomHeader(void)
1460 ToolkitTestApplication application;
1462 WebView view = WebView::New();
1463 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
1464 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
1465 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
1466 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
1468 application.GetScene().Add(view);
1469 application.SendNotification();
1470 application.Render();
1471 DALI_TEST_CHECK(view);
1473 view.LoadUrl("http://test.html");
1474 bool result = view.AddCustomHeader("key", "value");
1475 DALI_TEST_CHECK(result);
1477 result = view.ReloadWithoutCache();
1478 DALI_TEST_CHECK(result);
1480 uint32_t portNumber = view.StartInspectorServer(5000);
1481 DALI_TEST_EQUALS(portNumber, 5000, TEST_LOCATION);
1483 application.SendNotification();
1484 application.Render();
1485 Test::EmitGlobalTimerSignal();
1487 result = view.StopInspectorServer();
1488 DALI_TEST_CHECK(result);
1490 view.SuspendNetworkLoading();
1492 result = view.RemoveCustomHeader("key");
1493 DALI_TEST_CHECK(result);
1495 view.ResumeNetworkLoading();
1500 int UtcDaliWebViewMethodsForCoverage(void)
1502 ToolkitTestApplication application;
1504 WebView view = WebView::New("ko-KR", "Asia/Seoul");
1506 view.LoadHtmlString("<body>Hello World!</body>");
1507 view.AddJavaScriptMessageHandler("jsObject",
1508 [](const std::string& arg) {
1511 view.AddJavaScriptEntireMessageHandler("jsObject2",
1512 [](const std::string& arg, const std::string& arg2) {
1515 view.SetTtsFocus(true);
1517 //view.ChangeOrientation(90);
1519 DALI_TEST_CHECK(view);
1521 //view.ExitFullscreen();
1526 // test cases for web backforward list.
1528 int UtcDaliWebBackForwardListCheckItem(void)
1530 ToolkitTestApplication application;
1532 WebView view = WebView::New();
1533 DALI_TEST_CHECK(view);
1535 Dali::Toolkit::WebBackForwardList* bfList = view.GetBackForwardList();
1536 DALI_TEST_CHECK(bfList != 0)
1538 unsigned int itemCount = bfList->GetItemCount();
1539 DALI_TEST_CHECK(itemCount == 1)
1541 std::unique_ptr<Dali::WebEngineBackForwardListItem> citem = bfList->GetCurrentItem();
1542 DALI_TEST_CHECK(citem != 0);
1544 std::unique_ptr<Dali::WebEngineBackForwardListItem> citemP = bfList->GetPreviousItem();
1545 DALI_TEST_CHECK(citemP != 0);
1547 std::unique_ptr<Dali::WebEngineBackForwardListItem> citemN = bfList->GetNextItem();
1548 DALI_TEST_CHECK(citemN != 0);
1550 const std::string kDefaultUrl("http://url");
1551 std::string testValue = citem->GetUrl();
1552 DALI_TEST_EQUALS(testValue, kDefaultUrl, TEST_LOCATION);
1554 const std::string kDefaultTitle("title");
1555 testValue = citem->GetTitle();
1556 DALI_TEST_EQUALS(testValue, kDefaultTitle, TEST_LOCATION);
1558 const std::string kDefaultOriginalUrl("http://originalurl");
1559 testValue = citem->GetOriginalUrl();
1560 DALI_TEST_EQUALS(testValue, kDefaultOriginalUrl, TEST_LOCATION);
1562 std::unique_ptr<Dali::WebEngineBackForwardListItem> item = bfList->GetItemAtIndex(0);
1563 DALI_TEST_CHECK(item != 0);
1565 std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> vecBack = bfList->GetBackwardItems(-1);
1566 DALI_TEST_CHECK(vecBack.size() == 1);
1568 std::vector<std::unique_ptr<Dali::WebEngineBackForwardListItem>> vecForward = bfList->GetForwardItems(-1);
1569 DALI_TEST_CHECK(vecForward.size() == 1);
1574 // test cases for web context.
1576 int UtcDaliWebContextGetSetCacheModelEtc(void)
1578 ToolkitTestApplication application;
1580 Dali::WebEngineContext* context = WebView::GetContext();
1581 DALI_TEST_CHECK(context != 0)
1583 std::string kDefaultValue;
1586 context->SetAppId("id");
1587 context->SetApplicationType(Dali::WebEngineContext::ApplicationType::OTHER);
1588 context->SetTimeOffset(0);
1589 context->SetTimeZoneOffset(0, 0);
1590 context->SetDefaultProxyAuth(kDefaultValue, kDefaultValue);
1591 context->DeleteAllWebDatabase();
1592 context->DeleteAllWebStorage();
1593 context->DeleteLocalFileSystem();
1594 context->ClearCache();
1595 context->DeleteAllFormPasswordData();
1596 context->DeleteAllFormCandidateData();
1598 // Check default value
1599 Dali::WebEngineContext::CacheModel value = context->GetCacheModel();
1600 DALI_TEST_CHECK(value == Dali::WebEngineContext::CacheModel::DOCUMENT_VIEWER);
1602 // Check Set/GetProperty
1603 context->SetCacheModel(Dali::WebEngineContext::CacheModel::DOCUMENT_BROWSER);
1604 value = context->GetCacheModel();
1605 DALI_TEST_CHECK(value == Dali::WebEngineContext::CacheModel::DOCUMENT_BROWSER);
1607 // Get cache enabled
1608 context->EnableCache(true);
1609 DALI_TEST_CHECK(context->IsCacheEnabled());
1612 context->SetCertificateFilePath("test");
1613 std::string str = context->GetCertificateFilePath();
1614 DALI_TEST_EQUALS(str, "test", TEST_LOCATION);
1617 DALI_TEST_CHECK(context->SetAppVersion("test"));
1620 std::vector<std::string> temp;
1621 context->RegisterUrlSchemesAsCorsEnabled(temp);
1622 context->RegisterJsPluginMimeTypes(temp);
1623 context->DeleteFormPasswordDataList(temp);
1626 context->SetDefaultZoomFactor(1.0f);
1627 DALI_TEST_EQUALS(context->GetDefaultZoomFactor(), float(1.0f), TEST_LOCATION);
1629 // Delete cache and database
1630 DALI_TEST_CHECK(context->DeleteAllApplicationCache());
1631 DALI_TEST_CHECK(context->DeleteAllWebIndexedDatabase());
1634 context->SetProxyUri("test");
1635 DALI_TEST_EQUALS(context->GetProxyUri(), "test", TEST_LOCATION);
1636 context->SetProxyBypassRule("", "test");
1637 DALI_TEST_EQUALS(context->GetProxyBypassRule(), "test", TEST_LOCATION);
1640 DALI_TEST_CHECK(context->FreeUnusedMemory());
1645 int UtcDaliWebContextGetWebDatabaseStorageOrigins(void)
1647 ToolkitTestApplication application;
1649 Dali::WebEngineContext* context = WebView::GetContext();
1650 DALI_TEST_CHECK(context != 0)
1652 std::string kDefaultValue;
1654 // get origins of web database
1655 bool result = context->GetWebDatabaseOrigins(&OnSecurityOriginsAcquired);
1656 DALI_TEST_CHECK(result);
1658 Test::EmitGlobalTimerSignal();
1659 DALI_TEST_EQUALS(gSecurityOriginsAcquiredCallbackCalled, 1, TEST_LOCATION);
1660 DALI_TEST_CHECK(gSecurityOriginList.size() == 1);
1662 Dali::WebEngineSecurityOrigin* origin = gSecurityOriginList[0].get();
1663 DALI_TEST_CHECK(origin);
1665 result = context->DeleteWebDatabase(*origin);
1666 DALI_TEST_CHECK(result);
1668 // get origins of web storage
1669 result = context->GetWebStorageOrigins(&OnSecurityOriginsAcquired);
1670 DALI_TEST_CHECK(result);
1672 Test::EmitGlobalTimerSignal();
1673 DALI_TEST_EQUALS(gSecurityOriginsAcquiredCallbackCalled, 2, TEST_LOCATION);
1674 DALI_TEST_CHECK(gSecurityOriginList.size() == 1);
1676 origin = gSecurityOriginList[0].get();
1677 DALI_TEST_CHECK(origin);
1679 result = context->GetWebStorageUsageForOrigin(*origin, &OnStorageUsageAcquired);
1680 DALI_TEST_CHECK(result);
1681 Test::EmitGlobalTimerSignal();
1682 DALI_TEST_EQUALS(gStorageUsageAcquiredCallbackCalled, 1, TEST_LOCATION);
1684 result = context->DeleteWebStorage(*origin);
1685 DALI_TEST_CHECK(result);
1687 result = context->DeleteApplicationCache(*origin);
1688 DALI_TEST_CHECK(result);
1690 // form passwords, download state, mime type.
1691 context->GetFormPasswordList(&OnFormPasswordsAcquired);
1692 Test::EmitGlobalTimerSignal();
1693 DALI_TEST_EQUALS(gFormPasswordsAcquiredCallbackCalled, 1, TEST_LOCATION);
1694 DALI_TEST_CHECK(gPasswordDataList.size() == 1);
1695 DALI_TEST_EQUALS(gPasswordDataList[0]->url, "http://test.html", TEST_LOCATION);
1696 DALI_TEST_CHECK(gPasswordDataList[0]->useFingerprint == false);
1698 context->RegisterDownloadStartedCallback(&OnDownloadStarted);
1699 Test::EmitGlobalTimerSignal();
1700 DALI_TEST_EQUALS(gDownloadStartedCallbackCalled, 1, TEST_LOCATION);
1702 context->RegisterMimeOverriddenCallback(&OnMimeOverridden);
1703 Test::EmitGlobalTimerSignal();
1704 DALI_TEST_EQUALS(gMimeOverriddenCallbackCalled, 1, TEST_LOCATION);
1706 gSecurityOriginList.clear();
1707 gPasswordDataList.clear();
1712 int UtcDaliWebContextHttpRequestInterceptor(void)
1714 ToolkitTestApplication application;
1716 Dali::WebEngineContext* context = WebView::GetContext();
1717 DALI_TEST_CHECK(context != 0)
1719 WebView view = WebView::New();
1720 DALI_TEST_CHECK(view);
1722 // Check if web view is found or not when plugin is null.
1723 DALI_TEST_CHECK(!WebView::FindWebView(nullptr));
1726 context->RegisterRequestInterceptedCallback(&OnRequestIntercepted);
1727 DALI_TEST_EQUALS(gRequestInterceptedCallbackCalled, 0, TEST_LOCATION);
1728 DALI_TEST_CHECK(!gRequestInterceptorInstance);
1730 Test::EmitGlobalTimerSignal();
1731 DALI_TEST_EQUALS(gRequestInterceptedCallbackCalled, 1, TEST_LOCATION);
1733 // check request interceptor.
1734 DALI_TEST_CHECK(gRequestInterceptorInstance);
1735 DALI_TEST_CHECK(gRequestInterceptorInstance->Ignore());
1736 DALI_TEST_CHECK(gRequestInterceptorInstance->SetResponseStatus(400, "error"));
1737 DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseHeader("key1", "value1"));
1738 Dali::Property::Map testHeaders;
1739 testHeaders.Insert("key2", "value2");
1740 DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseHeaders(testHeaders));
1741 DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponseBody((const int8_t*)"test", 4));
1742 DALI_TEST_CHECK(gRequestInterceptorInstance->AddResponse("key:value", (const int8_t*)"test", 4));
1743 DALI_TEST_CHECK(gRequestInterceptorInstance->WriteResponseChunk((const int8_t*)"test", 4));
1745 DALI_TEST_CHECK(gRequestInterceptorInstance->GetWebEngine());
1746 // Check if web view is found or not when plugin is not null.
1747 DALI_TEST_CHECK(WebView::FindWebView(gRequestInterceptorInstance->GetWebEngine()));
1749 std::string testUrl("http://test.html");
1750 DALI_TEST_EQUALS(gRequestInterceptorInstance->GetUrl(), testUrl, TEST_LOCATION);
1751 std::string testMethod("GET");
1752 DALI_TEST_EQUALS(gRequestInterceptorInstance->GetMethod(), testMethod, TEST_LOCATION);
1753 Dali::Property::Map resultHeaders = gRequestInterceptorInstance->GetHeaders();
1754 DALI_TEST_EQUALS(resultHeaders.Count(), 2, TEST_LOCATION);
1756 // Destroy web view.
1758 gRequestInterceptorInstance = nullptr;
1763 // test cases for web cookie manager.
1765 int UtcDaliWebCookieManagerGetSetCookieAcceptPolicy(void)
1767 ToolkitTestApplication application;
1769 Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
1770 DALI_TEST_CHECK(cookieManager != 0)
1772 const std::string kDefaultValue;
1775 cookieManager->SetPersistentStorage(kDefaultValue, Dali::WebEngineCookieManager::CookiePersistentStorage::SQLITE);
1776 cookieManager->ClearCookies();
1778 // Check default value
1779 Dali::WebEngineCookieManager::CookieAcceptPolicy value = cookieManager->GetCookieAcceptPolicy();
1780 DALI_TEST_CHECK(value == Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY);
1782 // Check Set/GetProperty
1783 cookieManager->SetCookieAcceptPolicy(Dali::WebEngineCookieManager::CookieAcceptPolicy::ALWAYS);
1784 value = cookieManager->GetCookieAcceptPolicy();
1785 DALI_TEST_CHECK(value == Dali::WebEngineCookieManager::CookieAcceptPolicy::ALWAYS);
1790 int UtcDaliWebCookieManagerChangesWatch(void)
1792 ToolkitTestApplication application;
1794 Dali::WebEngineCookieManager* cookieManager = WebView::GetCookieManager();
1795 DALI_TEST_CHECK(cookieManager != 0)
1797 cookieManager->ChangesWatch(&OnChangesWatch);
1798 Test::EmitGlobalTimerSignal();
1799 DALI_TEST_EQUALS(gCookieManagerChangsWatchCallbackCalled, 1, TEST_LOCATION);
1804 // test cases for web settings.
1806 int UtcDaliWebSettingsGetSetDefaultFontSize(void)
1808 ToolkitTestApplication application;
1810 WebView view = WebView::New();
1811 DALI_TEST_CHECK(view);
1813 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1814 DALI_TEST_CHECK(settings != 0)
1817 settings->AllowMixedContents(false);
1818 settings->EnableSpatialNavigation(false);
1819 settings->EnableWebSecurity(false);
1820 settings->EnableCacheBuilder(false);
1821 settings->EnableDoNotTrack(false);
1822 settings->UseScrollbarThumbFocusNotifications(false);
1823 settings->AllowFileAccessFromExternalUrl(false);
1824 settings->AllowScriptsOpenWindows(false);
1826 // Check default value
1827 int value = settings->GetDefaultFontSize();
1828 DALI_TEST_CHECK(value == 16);
1830 // Check Set/GetProperty
1831 settings->SetDefaultFontSize(20);
1832 value = settings->GetDefaultFontSize();
1833 DALI_TEST_CHECK(value == 20);
1838 int UtcDaliWebSettingsCheckEnableJavaScript(void)
1840 ToolkitTestApplication application;
1842 WebView view = WebView::New();
1843 DALI_TEST_CHECK(view);
1845 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1846 DALI_TEST_CHECK(settings != 0)
1849 settings->AllowMixedContents(false);
1850 settings->EnableSpatialNavigation(false);
1851 settings->EnableWebSecurity(false);
1852 settings->EnableCacheBuilder(false);
1853 settings->EnableDoNotTrack(false);
1854 settings->UseScrollbarThumbFocusNotifications(false);
1855 settings->AllowFileAccessFromExternalUrl(false);
1856 settings->AllowScriptsOpenWindows(false);
1858 // Check default value is true or not
1859 bool value = settings->IsJavaScriptEnabled();
1860 DALI_TEST_CHECK(value);
1862 // Check Set/GetProperty
1863 settings->EnableJavaScript(false);
1864 value = settings->IsJavaScriptEnabled();
1865 DALI_TEST_CHECK(!value);
1870 int UtcDaliWebSettingsCheckEnableAutoFitting(void)
1872 ToolkitTestApplication application;
1874 WebView view = WebView::New();
1875 DALI_TEST_CHECK(view);
1877 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1878 DALI_TEST_CHECK(settings != 0)
1881 settings->AllowMixedContents(false);
1882 settings->EnableSpatialNavigation(false);
1883 settings->EnableWebSecurity(false);
1884 settings->EnableCacheBuilder(false);
1885 settings->EnableDoNotTrack(false);
1886 settings->UseScrollbarThumbFocusNotifications(false);
1887 settings->AllowFileAccessFromExternalUrl(false);
1888 settings->AllowScriptsOpenWindows(false);
1890 // Check default value is true or not
1891 bool value = settings->IsAutoFittingEnabled();
1892 DALI_TEST_CHECK(value);
1894 // Check Set/GetProperty
1895 settings->EnableAutoFitting(false);
1896 value = settings->IsAutoFittingEnabled();
1897 DALI_TEST_CHECK(!value);
1902 int UtcDaliWebSettingsCheckEnablePlugins(void)
1904 ToolkitTestApplication application;
1906 WebView view = WebView::New();
1907 DALI_TEST_CHECK(view);
1909 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1910 DALI_TEST_CHECK(settings != 0)
1913 settings->AllowMixedContents(false);
1914 settings->EnableSpatialNavigation(false);
1915 settings->EnableWebSecurity(false);
1916 settings->EnableCacheBuilder(false);
1917 settings->EnableDoNotTrack(false);
1918 settings->UseScrollbarThumbFocusNotifications(false);
1919 settings->AllowFileAccessFromExternalUrl(false);
1920 settings->AllowScriptsOpenWindows(false);
1922 // Check default value is true or not
1923 bool value = settings->ArePluginsEnabled();
1924 DALI_TEST_CHECK(value);
1926 // Check Set/GetProperty
1927 settings->EnablePlugins(false);
1928 value = settings->ArePluginsEnabled();
1929 DALI_TEST_CHECK(!value);
1934 int UtcDaliWebSettingsCheckEnablePrivateBrowsing(void)
1936 ToolkitTestApplication application;
1938 WebView view = WebView::New();
1939 DALI_TEST_CHECK(view);
1941 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1942 DALI_TEST_CHECK(settings != 0)
1945 settings->AllowMixedContents(false);
1946 settings->EnableSpatialNavigation(false);
1947 settings->EnableWebSecurity(false);
1948 settings->EnableCacheBuilder(false);
1949 settings->EnableDoNotTrack(false);
1950 settings->UseScrollbarThumbFocusNotifications(false);
1951 settings->AllowFileAccessFromExternalUrl(false);
1952 settings->AllowScriptsOpenWindows(false);
1954 // Check default value is true or not
1955 bool value = settings->IsPrivateBrowsingEnabled();
1956 DALI_TEST_CHECK(value);
1958 // Check Set/GetProperty
1959 settings->EnablePrivateBrowsing(false);
1960 value = settings->IsPrivateBrowsingEnabled();
1961 DALI_TEST_CHECK(!value);
1966 int UtcDaliWebSettingsCheckEnableLinkMagnifier(void)
1968 ToolkitTestApplication application;
1970 WebView view = WebView::New();
1971 DALI_TEST_CHECK(view);
1973 Dali::Toolkit::WebSettings* settings = view.GetSettings();
1974 DALI_TEST_CHECK(settings != 0)
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);
1986 // Check default value is true or not
1987 bool value = settings->IsLinkMagnifierEnabled();
1988 DALI_TEST_CHECK(value);
1990 // Check Set/GetProperty
1991 settings->EnableLinkMagnifier(false);
1992 value = settings->IsLinkMagnifierEnabled();
1993 DALI_TEST_CHECK(!value);
1998 int UtcDaliWebSettingsCheckUseKeypadWithoutUserAction(void)
2000 ToolkitTestApplication application;
2002 WebView view = WebView::New();
2003 DALI_TEST_CHECK(view);
2005 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2006 DALI_TEST_CHECK(settings != 0)
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);
2018 // Check default value is true or not
2019 bool value = settings->IsKeypadWithoutUserActionUsed();
2020 DALI_TEST_CHECK(value);
2022 // Check Set/GetProperty
2023 settings->UseKeypadWithoutUserAction(false);
2024 value = settings->IsKeypadWithoutUserActionUsed();
2025 DALI_TEST_CHECK(!value);
2030 int UtcDaliWebSettingsCheckEnableAutofillPasswordForm(void)
2032 ToolkitTestApplication application;
2034 WebView view = WebView::New();
2035 DALI_TEST_CHECK(view);
2037 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2038 DALI_TEST_CHECK(settings != 0)
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);
2050 // Check default value is true or not
2051 bool value = settings->IsAutofillPasswordFormEnabled();
2052 DALI_TEST_CHECK(value);
2053 settings->EnableAutofillPasswordForm(false);
2054 value = settings->IsAutofillPasswordFormEnabled();
2055 DALI_TEST_CHECK(!value);
2059 int UtcDaliWebSettingsCheckEnableFormCandidateData(void)
2061 ToolkitTestApplication application;
2063 WebView view = WebView::New();
2064 DALI_TEST_CHECK(view);
2066 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2067 DALI_TEST_CHECK(settings != 0);
2070 settings->AllowMixedContents(false);
2071 settings->EnableSpatialNavigation(false);
2072 settings->EnableWebSecurity(false);
2073 settings->EnableCacheBuilder(false);
2074 settings->EnableDoNotTrack(false);
2075 settings->UseScrollbarThumbFocusNotifications(false);
2076 settings->AllowFileAccessFromExternalUrl(false);
2077 settings->AllowScriptsOpenWindows(false);
2079 // Check default value is true or not
2080 bool value = settings->IsFormCandidateDataEnabled();
2081 DALI_TEST_CHECK(value);
2083 // Check Set/GetProperty
2084 settings->EnableFormCandidateData(false);
2085 value = settings->IsFormCandidateDataEnabled();
2086 DALI_TEST_CHECK(!value);
2091 int UtcDaliWebSettingsCheckEnableTextSelection(void)
2093 ToolkitTestApplication application;
2095 WebView view = WebView::New();
2096 DALI_TEST_CHECK(view);
2098 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2099 DALI_TEST_CHECK(settings != 0);
2102 settings->AllowMixedContents(false);
2103 settings->EnableSpatialNavigation(false);
2104 settings->EnableWebSecurity(false);
2105 settings->EnableCacheBuilder(false);
2106 settings->EnableDoNotTrack(false);
2107 settings->UseScrollbarThumbFocusNotifications(false);
2108 settings->AllowFileAccessFromExternalUrl(false);
2109 settings->AllowScriptsOpenWindows(false);
2111 // Check default value is true or not
2112 bool value = settings->IsTextSelectionEnabled();
2113 DALI_TEST_CHECK(value);
2115 //Check Set/GetProperty
2116 settings->EnableTextSelection(false);
2117 value = settings->IsTextSelectionEnabled();
2118 DALI_TEST_CHECK(!value);
2123 int UtcDaliWebSettingsCheckEnableTextAutosizing(void)
2125 ToolkitTestApplication application;
2127 WebView view = WebView::New();
2128 DALI_TEST_CHECK(view);
2130 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2131 DALI_TEST_CHECK(settings != 0);
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);
2143 // Check default value is true or not
2144 bool value = settings->IsTextAutosizingEnabled();
2145 DALI_TEST_CHECK(value);
2147 // Check Set/GetProperty
2148 settings->EnableTextAutosizing(false);
2149 value = settings->IsTextAutosizingEnabled();
2150 DALI_TEST_CHECK(!value);
2155 int UtcDaliWebSettingsCheckEnableArrowScroll(void)
2157 ToolkitTestApplication application;
2159 WebView view = WebView::New();
2160 DALI_TEST_CHECK(view);
2162 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2163 DALI_TEST_CHECK(settings != 0);
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);
2175 // Check default value is true or not
2176 bool value = settings->IsArrowScrollEnabled();
2177 DALI_TEST_CHECK(value);
2179 // Check Set/GetProperty
2180 settings->EnableArrowScroll(false);
2181 value = settings->IsArrowScrollEnabled();
2182 DALI_TEST_CHECK(!value);
2187 int UtcDaliWebSettingsCheckEnableClipboard(void)
2189 ToolkitTestApplication application;
2191 WebView view = WebView::New();
2192 DALI_TEST_CHECK(view);
2194 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2195 DALI_TEST_CHECK(settings != 0);
2198 settings->AllowMixedContents(false);
2199 settings->EnableSpatialNavigation(false);
2200 settings->EnableWebSecurity(false);
2201 settings->EnableCacheBuilder(false);
2202 settings->EnableDoNotTrack(false);
2203 settings->UseScrollbarThumbFocusNotifications(false);
2204 settings->AllowFileAccessFromExternalUrl(false);
2205 settings->AllowScriptsOpenWindows(false);
2207 // Check default value is true or not
2208 bool value = settings->IsClipboardEnabled();
2209 DALI_TEST_CHECK(value);
2210 settings->EnableClipboard(false);
2211 value = settings->IsClipboardEnabled();
2212 DALI_TEST_CHECK(!value);
2216 int UtcDaliWebSettingsCheckEnableImePanel(void)
2218 ToolkitTestApplication application;
2220 WebView view = WebView::New();
2221 DALI_TEST_CHECK(view);
2223 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2224 DALI_TEST_CHECK(settings != 0);
2227 settings->AllowMixedContents(false);
2228 settings->EnableSpatialNavigation(false);
2229 settings->EnableWebSecurity(false);
2230 settings->EnableCacheBuilder(false);
2231 settings->EnableDoNotTrack(false);
2232 settings->UseScrollbarThumbFocusNotifications(false);
2233 settings->AllowFileAccessFromExternalUrl(false);
2234 settings->AllowScriptsOpenWindows(false);
2236 // Check default value is true or not
2237 bool value = settings->IsImePanelEnabled();
2238 DALI_TEST_CHECK(value);
2240 // Check Set/GetProperty
2241 settings->EnableImePanel(false);
2242 value = settings->IsImePanelEnabled();
2243 DALI_TEST_CHECK(!value);
2248 int UtcDaliWebSettingsCheckAllowImagesLoadAutomatically(void)
2250 ToolkitTestApplication application;
2252 WebView view = WebView::New();
2253 DALI_TEST_CHECK(view);
2255 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2256 DALI_TEST_CHECK(settings != 0)
2259 settings->AllowMixedContents(false);
2260 settings->EnableSpatialNavigation(false);
2261 settings->EnableWebSecurity(false);
2262 settings->EnableCacheBuilder(false);
2263 settings->EnableDoNotTrack(false);
2264 settings->UseScrollbarThumbFocusNotifications(false);
2265 settings->AllowFileAccessFromExternalUrl(false);
2266 settings->AllowScriptsOpenWindows(false);
2268 // Check default value is true or not
2269 bool value = settings->AreImagesLoadedAutomatically();
2270 DALI_TEST_CHECK(value);
2272 // Check Set/GetProperty
2273 settings->AllowImagesLoadAutomatically(false);
2274 value = settings->AreImagesLoadedAutomatically();
2275 DALI_TEST_CHECK(!value);
2280 int UtcDaliWebSettingsGetSetDefaultTextEncodingName(void)
2282 ToolkitTestApplication application;
2284 WebView view = WebView::New();
2285 DALI_TEST_CHECK(view);
2287 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2288 DALI_TEST_CHECK(settings != 0)
2290 const std::string kDefaultValue;
2291 const std::string kTestValue = "UTF-8";
2294 settings->AllowMixedContents(false);
2295 settings->EnableSpatialNavigation(false);
2296 settings->EnableWebSecurity(false);
2297 settings->EnableCacheBuilder(false);
2298 settings->EnableDoNotTrack(false);
2299 settings->UseScrollbarThumbFocusNotifications(false);
2300 settings->AllowFileAccessFromExternalUrl(false);
2301 settings->AllowScriptsOpenWindows(false);
2303 // Check default value
2304 std::string value = settings->GetDefaultTextEncodingName();
2305 DALI_TEST_EQUALS(value, kDefaultValue, TEST_LOCATION);
2307 // Check Set/GetProperty
2308 settings->SetDefaultTextEncodingName(kTestValue);
2309 value = settings->GetDefaultTextEncodingName();
2310 DALI_TEST_EQUALS(value, kTestValue, TEST_LOCATION);
2315 int UtcDaliWebSettingsSetViewportMetaTag(void)
2317 ToolkitTestApplication application;
2319 WebView view = WebView::New();
2320 DALI_TEST_CHECK(view);
2322 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2323 DALI_TEST_CHECK(settings != 0)
2325 // Check the value is true or not
2326 bool value = settings->SetViewportMetaTag(true);
2327 DALI_TEST_CHECK(value);
2332 int UtcDaliWebSettingsSetForceZoom(void)
2334 ToolkitTestApplication application;
2336 WebView view = WebView::New();
2337 DALI_TEST_CHECK(view);
2339 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2340 DALI_TEST_CHECK(settings != 0)
2342 // Check the value is true or not
2343 bool value = settings->SetForceZoom(true);
2344 DALI_TEST_CHECK(value);
2346 value = settings->IsZoomForced();
2347 DALI_TEST_CHECK(value);
2352 int UtcDaliWebSettingsSetTextZoomEnabled(void)
2354 ToolkitTestApplication application;
2356 WebView view = WebView::New();
2357 DALI_TEST_CHECK(view);
2359 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2360 DALI_TEST_CHECK(settings != 0)
2362 // Check the value is true or not
2363 bool value = settings->SetTextZoomEnabled(true);
2364 DALI_TEST_CHECK(value);
2366 value = settings->IsTextZoomEnabled();
2367 DALI_TEST_CHECK(value);
2372 int UtcDaliWebSettingsSetExtraFeature(void)
2374 ToolkitTestApplication application;
2376 WebView view = WebView::New();
2377 DALI_TEST_CHECK(view);
2379 Dali::Toolkit::WebSettings* settings = view.GetSettings();
2380 DALI_TEST_CHECK(settings != 0)
2382 // Check the value is true or not
2383 settings->SetExtraFeature("test", true);
2384 bool value = settings->IsExtraFeatureEnabled("test");
2385 DALI_TEST_CHECK(value);
2390 int UtcDaliWebViewGetPlainText(void)
2392 ToolkitTestApplication application;
2394 WebView view = WebView::New();
2395 DALI_TEST_CHECK(view);
2397 view.LoadUrl(TEST_URL1);
2399 view.GetPlainTextAsynchronously(&OnPlainTextReceived);
2400 Test::EmitGlobalTimerSignal();
2401 DALI_TEST_EQUALS(gPlainTextReceivedCallbackCalled, 1, TEST_LOCATION);
2406 int UtcDaliWebViewVisibilityChange(void)
2408 ToolkitTestApplication application;
2410 WebView view = WebView::New();
2411 Control dummy = Control::New();
2412 DALI_TEST_CHECK(view);
2413 DALI_TEST_CHECK(dummy);
2415 view.LoadUrl(TEST_URL1);
2418 auto window = application.GetWindow();
2421 application.SendNotification();
2422 application.Render();
2426 // TODO : There is no way to check visiblity setting result from web engine.
2427 // Just call API and exception check.
2428 view.SetProperty(Actor::Property::VISIBLE, false);
2429 view.SetProperty(Actor::Property::VISIBLE, true);
2430 dummy.SetProperty(Actor::Property::VISIBLE, false);
2431 dummy.SetProperty(Actor::Property::VISIBLE, true);
2438 dummy.SetProperty(Actor::Property::VISIBLE, false);
2439 view.SetProperty(Actor::Property::VISIBLE, false);
2440 dummy.SetProperty(Actor::Property::VISIBLE, true);
2441 view.SetProperty(Actor::Property::VISIBLE, true);
2442 tet_result(TET_PASS);
2446 // Should not throw exception
2447 tet_result(TET_FAIL);
2453 int UtcDaliWebViewMethodsForCoverage2(void)
2455 ToolkitTestApplication application;
2457 WebView view = WebView::New();
2458 view.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
2459 view.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
2460 view.SetProperty(Actor::Property::POSITION, Vector2(0, 0));
2461 view.SetProperty(Actor::Property::SIZE, Vector2(800, 600));
2463 application.GetScene().Add(view);
2464 application.SendNotification();
2465 application.Render();
2466 DALI_TEST_CHECK(view);
2470 // Just call API and exception check.
2471 view.ChangeOrientation(90);
2472 view.ExitFullscreen();
2473 tet_result(TET_PASS);
2477 // Should not throw exception
2478 tet_result(TET_FAIL);
2484 int UtcDaliWebViewRegisterNewWindowPolicyDecidedCallback(void)
2486 ToolkitTestApplication application;
2488 WebView view = WebView::New();
2489 DALI_TEST_CHECK(view);
2491 view.RegisterNewWindowPolicyDecidedCallback(&OnNewWindowPolicyDecided);
2492 DALI_TEST_EQUALS(gNewWindowPolicyDecidedCallbackCalled, 0, TEST_LOCATION);
2494 view.LoadUrl(TEST_URL1);
2495 Test::EmitGlobalTimerSignal();
2496 DALI_TEST_EQUALS(gNewWindowPolicyDecidedCallbackCalled, 1, TEST_LOCATION);
2500 int UtcDaliWebViewRegisterFullscreenEnteredCallback(void)
2502 ToolkitTestApplication application;
2504 WebView view = WebView::New();
2505 DALI_TEST_CHECK(view);
2507 view.RegisterFullscreenEnteredCallback(&OnFullscreenEntered);
2508 DALI_TEST_EQUALS(gFullscreenEnteredCallbackCalled, 0, TEST_LOCATION);
2510 view.LoadUrl(TEST_URL1);
2511 Test::EmitGlobalTimerSignal();
2512 DALI_TEST_EQUALS(gFullscreenEnteredCallbackCalled, 1, TEST_LOCATION);
2516 int UtcDaliWebViewRegisterFullscreenExitedCallback(void)
2518 ToolkitTestApplication application;
2520 WebView view = WebView::New();
2521 DALI_TEST_CHECK(view);
2523 view.RegisterFullscreenExitedCallback(&OnFullscreenExited);
2524 DALI_TEST_EQUALS(gFullscreenExitedCallbackCalled, 0, TEST_LOCATION);
2526 view.LoadUrl(TEST_URL1);
2527 Test::EmitGlobalTimerSignal();
2528 DALI_TEST_EQUALS(gFullscreenExitedCallbackCalled, 1, TEST_LOCATION);
2532 int UtcDaliWebViewRegisterTextFoundCallback(void)
2534 ToolkitTestApplication application;
2536 WebView view = WebView::New();
2537 DALI_TEST_CHECK(view);
2539 view.RegisterTextFoundCallback(&OnTextFound);
2540 DALI_TEST_EQUALS(gTextFoundCallbackCalled, 0, TEST_LOCATION);
2542 view.LoadUrl(TEST_URL1);
2543 Test::EmitGlobalTimerSignal();
2544 DALI_TEST_EQUALS(gTextFoundCallbackCalled, 1, TEST_LOCATION);