summaryrefslogtreecommitdiff
path: root/Source/WebKit/gtk/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
commit284837daa07b29d6a63a748544a90b1f5842ac5c (patch)
treeecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/WebKit/gtk/tests
parent2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff)
downloadqtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/WebKit/gtk/tests')
-rw-r--r--Source/WebKit/gtk/tests/testatk.c11
-rw-r--r--Source/WebKit/gtk/tests/testglobals.c54
2 files changed, 62 insertions, 3 deletions
diff --git a/Source/WebKit/gtk/tests/testatk.c b/Source/WebKit/gtk/tests/testatk.c
index 759da1771..cc90d9472 100644
--- a/Source/WebKit/gtk/tests/testatk.c
+++ b/Source/WebKit/gtk/tests/testatk.c
@@ -562,6 +562,10 @@ static void testWebkitAtkComboBox()
g_assert(selectedItem == item1);
g_object_unref(selectedItem);
+ /* Check that the menu popup has 0 links and doesn't crash from checking. */
+ gint nLinks = atk_hypertext_get_n_links(ATK_HYPERTEXT(menuPopup));
+ g_assert_cmpint(nLinks, ==, 0);
+
/* Check the implementations of the AtkAction interface. */
g_assert(ATK_IS_ACTION(comboBox));
AtkAction* atkAction = ATK_ACTION(comboBox);
@@ -1867,17 +1871,18 @@ static void testWebkitAtkTextChangedNotifications()
GINT_TO_POINTER(TEXT_CHANGE_REMOVE));
pos = 0;
+ /* A single bullet character is '\342\200\242' */
atk_editable_text_insert_text(ATK_EDITABLE_TEXT(passwordEntry), "foobar", 6, &pos);
g_assert_cmpstr(textChangedResult, ==, "|1|0|6|'\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242'|");
text = atk_text_get_text(ATK_TEXT(passwordEntry), 0, -1);
- g_assert_cmpstr(text, ==, "\303\242\302\200\302\242\303\242\302\200\302\242");
+ g_assert_cmpstr(text, ==, "\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242");
g_free(text);
atk_editable_text_delete_text(ATK_EDITABLE_TEXT(passwordEntry), 2, 4);
g_assert_cmpstr(textChangedResult, ==, "|2|2|2|'\342\200\242\342\200\242'|");
text = atk_text_get_text(ATK_TEXT(passwordEntry), 0, -1);
- g_assert_cmpstr(text, ==, "\303\242\302\200\302\242\303\242");
+ g_assert_cmpstr(text, ==, "\342\200\242\342\200\242\342\200\242\342\200\242");
g_free(text);
pos = 3;
@@ -1885,7 +1890,7 @@ static void testWebkitAtkTextChangedNotifications()
g_assert_cmpstr(textChangedResult, ==, "|1|3|3|'\342\200\242\342\200\242\342\200\242'|");
text = atk_text_get_text(ATK_TEXT(passwordEntry), 0, -1);
- g_assert_cmpstr(text, ==, "\303\242\302\200\302\242\303\242\302\200\302\242\303\242");
+ g_assert_cmpstr(text, ==, "\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242\342\200\242");
g_free(text);
g_free(textChangedResult);
diff --git a/Source/WebKit/gtk/tests/testglobals.c b/Source/WebKit/gtk/tests/testglobals.c
index 509c3bf76..f32605025 100644
--- a/Source/WebKit/gtk/tests/testglobals.c
+++ b/Source/WebKit/gtk/tests/testglobals.c
@@ -45,6 +45,58 @@ static void test_globals_default_session()
g_assert(soup_session_get_feature(session, WEBKIT_TYPE_SOUP_AUTH_DIALOG) == NULL);
}
+static void test_globals_security_policy()
+{
+ // Check default policy for well known schemes.
+ WebKitSecurityPolicy policy = webkit_get_security_policy_for_uri_scheme("http");
+ guint mask = WEBKIT_SECURITY_POLICY_CORS_ENABLED;
+ g_assert_cmpuint(policy & mask, ==, mask);
+
+ policy = webkit_get_security_policy_for_uri_scheme("https");
+ mask = WEBKIT_SECURITY_POLICY_SECURE | WEBKIT_SECURITY_POLICY_CORS_ENABLED;
+ g_assert_cmpuint(policy & mask, ==, mask);
+
+ policy = webkit_get_security_policy_for_uri_scheme("file");
+ mask = WEBKIT_SECURITY_POLICY_LOCAL;
+ g_assert_cmpuint(policy & mask, ==, mask);
+
+ policy = webkit_get_security_policy_for_uri_scheme("data");
+ mask = WEBKIT_SECURITY_POLICY_NO_ACCESS_TO_OTHER_SCHEME | WEBKIT_SECURITY_POLICY_SECURE;
+ g_assert_cmpuint(policy & mask, ==, mask);
+
+ policy = webkit_get_security_policy_for_uri_scheme("about");
+ mask = WEBKIT_SECURITY_POLICY_NO_ACCESS_TO_OTHER_SCHEME | WEBKIT_SECURITY_POLICY_SECURE | WEBKIT_SECURITY_POLICY_EMPTY_DOCUMENT;
+ g_assert_cmpuint(policy & mask, ==, mask);
+
+ // Custom scheme.
+ policy = webkit_get_security_policy_for_uri_scheme("foo");
+ g_assert(!policy);
+
+ policy |= WEBKIT_SECURITY_POLICY_LOCAL;
+ webkit_set_security_policy_for_uri_scheme("foo", policy);
+ g_assert_cmpuint(webkit_get_security_policy_for_uri_scheme("foo"), ==, policy);
+
+ policy |= WEBKIT_SECURITY_POLICY_NO_ACCESS_TO_OTHER_SCHEME;
+ webkit_set_security_policy_for_uri_scheme("foo", policy);
+ g_assert_cmpuint(webkit_get_security_policy_for_uri_scheme("foo"), ==, policy);
+
+ policy |= WEBKIT_SECURITY_POLICY_DISPLAY_ISOLATED;
+ webkit_set_security_policy_for_uri_scheme("foo", policy);
+ g_assert_cmpuint(webkit_get_security_policy_for_uri_scheme("foo"), ==, policy);
+
+ policy |= WEBKIT_SECURITY_POLICY_SECURE;
+ webkit_set_security_policy_for_uri_scheme("foo", policy);
+ g_assert_cmpuint(webkit_get_security_policy_for_uri_scheme("foo"), ==, policy);
+
+ policy |= WEBKIT_SECURITY_POLICY_CORS_ENABLED;
+ webkit_set_security_policy_for_uri_scheme("foo", policy);
+ g_assert_cmpuint(webkit_get_security_policy_for_uri_scheme("foo"), ==, policy);
+
+ policy |= WEBKIT_SECURITY_POLICY_EMPTY_DOCUMENT;
+ webkit_set_security_policy_for_uri_scheme("foo", policy);
+ g_assert_cmpuint(webkit_get_security_policy_for_uri_scheme("foo"), ==, policy);
+}
+
int main(int argc, char** argv)
{
gtk_test_init(&argc, &argv, NULL);
@@ -52,6 +104,8 @@ int main(int argc, char** argv)
g_test_bug_base("https://bugs.webkit.org/");
g_test_add_func("/webkit/globals/default_session",
test_globals_default_session);
+ g_test_add_func("/webkit/globals/security-policy",
+ test_globals_security_policy);
return g_test_run();
}