Changeset 142678 in webkit
- Timestamp:
- Feb 12, 2013 3:10:31 PM (11 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r142672 r142678 1 2013-02-12 Christophe Dumez <ch.dumez@sisa.samsung.com> 2 3 [EFL][WK2] Reenable ewk_auth_request API tests 4 https://bugs.webkit.org/show_bug.cgi?id=108451 5 6 Reviewed by Benjamin Poulain. 7 8 ewk_auth_request API tests were temporarily disabled after 9 the C API for resource loading was removed from WebKit2. 10 This patches updates the tests so that they no longer rely 11 on the resource loading events and renables them. 12 13 This patch also corrects the naming of the static variables 14 in the test to follow more closely the WebKit coding style. 15 16 * PlatformEfl.cmake: 17 * UIProcess/API/efl/tests/test_ewk2_auth_request.cpp: 18 (serverCallback): 19 (TEST_F): 20 (onLoadFinished): 21 1 22 2013-02-12 Anders Carlsson <andersca@apple.com> 2 23 -
trunk/Source/WebKit2/PlatformEfl.cmake
r141836 r142678 368 368 # will clash with tests from the WebKit 1 test suite. 369 369 set(EWK2UnitTests_BINARIES 370 test_ewk2_auth_request 370 371 test_ewk2_back_forward_list 371 372 test_ewk2_color_picker -
trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_auth_request.cpp
r135349 r142678 34 34 extern EWK2UnitTestEnvironment* environment; 35 35 36 static const char TEST_USERNAME[] = "username"; 37 static const char TEST_PASSWORD[] = "password"; 38 static const char EXPECTED_AUTHORIZATION[] = "Basic dXNlcm5hbWU6cGFzc3dvcmQ="; // Base64 encoding of "username:password". 39 static const char INDEX_HTML_STRING[] = 36 static const char testUsername[] = "username"; 37 static const char testPassword[] = "password"; 38 static const char expectedSuccessTitle[] = "EFLWebKit2 Authentication test"; 39 static const char expectedAuthorization[] = "Basic dXNlcm5hbWU6cGFzc3dvcmQ="; // Base64 encoding of "username:password". 40 static const char indexHTMLString[] = 40 41 "<html>" 41 42 "<head><title>EFLWebKit2 Authentication test</title></head>" … … 52 53 const char* authorization = soup_message_headers_get_one(message->request_headers, "Authorization"); 53 54 // Require authentication 54 if (authorization && !strcmp(authorization, EXPECTED_AUTHORIZATION)) {55 if (authorization && !strcmp(authorization, expectedAuthorization)) { 55 56 // Successful authentication. 56 57 soup_message_set_status(message, SOUP_STATUS_OK); 57 soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, INDEX_HTML_STRING, strlen(INDEX_HTML_STRING));58 soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, indexHTMLString, strlen(indexHTMLString)); 58 59 } else { 59 60 // No (valid) authorization header provided by the client, request authentication. … … 98 99 EXPECT_FALSE(ewk_auth_request_retrying_get(authenticationRequest)); 99 100 100 ASSERT_TRUE(ewk_auth_request_authenticate(authenticationRequest, TEST_USERNAME, TEST_PASSWORD));101 ASSERT_TRUE(ewk_auth_request_authenticate(authenticationRequest, testUsername, testPassword)); 101 102 102 103 ewk_object_unref(authenticationRequest); 103 104 104 ASSERT_TRUE(waitUntilTitleChangedTo( "EFLWebKit2 Authentication test"));105 ASSERT_TRUE(waitUntilTitleChangedTo(expectedSuccessTitle)); 105 106 } 106 107 … … 124 125 EXPECT_FALSE(ewk_auth_request_retrying_get(authenticationRequest)); 125 126 126 ASSERT_TRUE(ewk_auth_request_authenticate(authenticationRequest, TEST_USERNAME, "wrongpassword"));127 ASSERT_TRUE(ewk_auth_request_authenticate(authenticationRequest, testUsername, "wrongpassword")); 127 128 128 129 ewk_object_unref(authenticationRequest); … … 139 140 140 141 // Now provide the right password. 141 ASSERT_TRUE(ewk_auth_request_authenticate(authenticationRequest, TEST_USERNAME, TEST_PASSWORD));142 ASSERT_TRUE(ewk_auth_request_authenticate(authenticationRequest, testUsername, testPassword)); 142 143 143 144 ewk_object_unref(authenticationRequest); 144 145 145 ASSERT_TRUE(waitUntilTitleChangedTo( "EFLWebKit2 Authentication test"));146 ASSERT_TRUE(waitUntilTitleChangedTo(expectedSuccessTitle)); 146 147 } 147 148 148 static void on ResourceLoadResponse(void* userData, Evas_Object*, void* eventInfo)149 static void onLoadFinished(void* userData, Evas_Object*, void*) 149 150 { 150 int* statusCode = static_cast<int*>(userData);151 ASSERT_TRUE( statusCode);151 bool* isFinished = static_cast<bool*>(userData); 152 ASSERT_TRUE(isFinished); 152 153 153 Ewk_Resource_Load_Response* response = static_cast<Ewk_Resource_Load_Response*>(eventInfo); 154 ASSERT_TRUE(response); 155 156 if (!ewk_resource_main_resource_get(response->resource)) 157 return; 158 159 *statusCode = ewk_url_response_status_code_get(response->response); 154 *isFinished = true; 160 155 } 161 156 … … 180 175 EXPECT_FALSE(ewk_auth_request_retrying_get(authenticationRequest)); 181 176 182 int statusCode = 0;183 evas_object_smart_callback_add(webView(), " resource,request,response", onResourceLoadResponse, &statusCode);177 bool isFinished = false; 178 evas_object_smart_callback_add(webView(), "load,finished", onLoadFinished, &isFinished); 184 179 185 180 // Will attempt to continue without authentication by default. 186 181 ewk_object_unref(authenticationRequest); 187 182 188 while (! statusCode)183 while (!isFinished) 189 184 ecore_main_loop_iterate(); 190 185 191 // We should get a "402 Unauthorized" error. 192 EXPECT_EQ(SOUP_STATUS_UNAUTHORIZED, statusCode); 186 ASSERT_STRNE(expectedSuccessTitle, ewk_view_title_get(webView())); 193 187 194 evas_object_smart_callback_del(webView(), " resource,request,response", onResourceLoadResponse);188 evas_object_smart_callback_del(webView(), "load,finished", onLoadFinished); 195 189 }
Note: See TracChangeset
for help on using the changeset viewer.