Title: [125762] trunk/Source/WebKit2
Revision
125762
Author
[email protected]
Date
2012-08-16 02:12:57 -0700 (Thu, 16 Aug 2012)

Log Message

[EFL][WK2] Add unit tests for Web intent registration
https://bugs.webkit.org/show_bug.cgi?id=94133

Patch by Christophe Dumez <[email protected]> on 2012-08-16
Reviewed by Kenneth Rohde Christiansen.

Add unit tests for Web Intent service registration.
This tests the "intent,service,register" signaling
on the Ewk_View as well as Ewk_Intent_Service.

* PlatformEfl.cmake:
* UIProcess/API/efl/tests/resources/intent-service.html: Added.
* UIProcess/API/efl/tests/test_ewk2_intents.cpp: Added.
(onIntentServiceRegistration):
(TEST_F):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (125761 => 125762)


--- trunk/Source/WebKit2/ChangeLog	2012-08-16 09:09:42 UTC (rev 125761)
+++ trunk/Source/WebKit2/ChangeLog	2012-08-16 09:12:57 UTC (rev 125762)
@@ -1,3 +1,20 @@
+2012-08-16  Christophe Dumez  <[email protected]>
+
+        [EFL][WK2] Add unit tests for Web intent registration
+        https://bugs.webkit.org/show_bug.cgi?id=94133
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add unit tests for Web Intent service registration.
+        This tests the "intent,service,register" signaling
+        on the Ewk_View as well as Ewk_Intent_Service.
+
+        * PlatformEfl.cmake:
+        * UIProcess/API/efl/tests/resources/intent-service.html: Added.
+        * UIProcess/API/efl/tests/test_ewk2_intents.cpp: Added.
+        (onIntentServiceRegistration):
+        (TEST_F):
+
 2012-08-16  Marja Hölttä  <[email protected]>
 
         FormController, WebHistoryItem: Enable reading selected file names from document state

Modified: trunk/Source/WebKit2/PlatformEfl.cmake (125761 => 125762)


--- trunk/Source/WebKit2/PlatformEfl.cmake	2012-08-16 09:09:42 UTC (rev 125761)
+++ trunk/Source/WebKit2/PlatformEfl.cmake	2012-08-16 09:12:57 UTC (rev 125762)
@@ -268,6 +268,7 @@
     test_ewk2_context
     test_ewk2_cookie_manager
     test_ewk2_download_job
+    test_ewk2_intents
     test_ewk2_view
 )
 

Added: trunk/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-service.html (0 => 125762)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-service.html	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/resources/intent-service.html	2012-08-16 09:12:57 UTC (rev 125762)
@@ -0,0 +1,9 @@
+<html>
+<head>
+<title>Web Intent service registration test</title>
+</head>
+  <body>
+    <intent action="" type="type" title="Title" href="" disposition="inline"></intent>
+    Registered Intent Service.
+  </body>
+</html>

Added: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp (0 => 125762)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp	2012-08-16 09:12:57 UTC (rev 125762)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "UnitTestUtils/EWK2UnitTestBase.h"
+#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
+#include "UnitTestUtils/EWK2UnitTestServer.h"
+#include <EWebKit2.h>
+
+using namespace EWK2UnitTest;
+
+extern EWK2UnitTestEnvironment* environment;
+
+static void onIntentServiceRegistration(void* userData, Evas_Object*, void* eventInfo)
+{
+    bool* intentRegistered = static_cast<bool*>(userData);
+    ASSERT_FALSE(*intentRegistered);
+    *intentRegistered = true;
+
+    Ewk_Intent_Service* service = static_cast<Ewk_Intent_Service*>(eventInfo);
+    ASSERT_TRUE(service);
+    EXPECT_STREQ(ewk_intent_service_action_get(service), "action");
+    EXPECT_STREQ(ewk_intent_service_type_get(service), "type");
+    EXPECT_STREQ(ewk_intent_service_title_get(service), "Title");
+    EXPECT_STREQ(ewk_intent_service_href_get(service), "http://example.com/service");
+    EXPECT_STREQ(ewk_intent_service_disposition_get(service), "inline");
+}
+
+TEST_F(EWK2UnitTestBase, ewk_intent_service_registration)
+{
+    bool intentRegistered = false;
+    evas_object_smart_callback_add(webView(), "intent,service,register", onIntentServiceRegistration, &intentRegistered);
+    loadUrlSync(environment->urlForResource("intent-service.html").data());
+    evas_object_smart_callback_del(webView(), "intent,service,register", onIntentServiceRegistration);
+    ASSERT_TRUE(intentRegistered);
+}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to