Changeset 88065 in webkit
- Timestamp:
- Jun 3, 2011 2:53:04 PM (13 years ago)
- Location:
- trunk/Source/WebKit/qt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/qt/ChangeLog
r88052 r88065 1 2011-06-03 Rafael Brandao <rafael.lobo@openbossa.org> 2 3 Reviewed by Andreas Kling. 4 5 [Qt] It made two Qt API tests fail 6 https://bugs.webkit.org/show_bug.cgi?id=58847 7 8 Modified failing test's base url so it could get a valid origin 9 and make use of local storage. Also added another test that checks 10 local storage visibility in both scenarios. 11 12 * tests/qwebpage/tst_qwebpage.cpp: 13 (tst_QWebPage::testOptionalJSObjects): 14 (checkLocalStorageVisibility): 15 (tst_QWebPage::testLocalStorageVisibility): 16 1 17 2011-06-03 Alexis Menard <alexis.menard@openbossa.org> 2 18 -
trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
r86951 r88065 120 120 void localURLSchemes(); 121 121 void testOptionalJSObjects(); 122 void testLocalStorageVisibility(); 122 123 void testEnablePersistentStorage(); 123 124 void consoleOutput(); … … 2329 2330 QWebPage webPage2; 2330 2331 2331 webPage1.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl( ));2332 webPage2.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl( ));2332 webPage1.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("http://www.example.com/")); 2333 webPage2.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("http://www.example.com/")); 2333 2334 2334 2335 QEXPECT_FAIL("","Feature enabled/disabled checking problem. Look at bugs.webkit.org/show_bug.cgi?id=29867", Continue); … … 2340 2341 2341 2342 QCOMPARE(testFlag(webPage1, QWebSettings::LocalStorageEnabled, "localStorage", false), false); 2342 QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=61045", Continue);2343 2343 QCOMPARE(testFlag(webPage2, QWebSettings::LocalStorageEnabled, "localStorage", true), true); 2344 2344 QCOMPARE(testFlag(webPage1, QWebSettings::LocalStorageEnabled, "localStorage", false), false); 2345 QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=61045", Continue);2346 2345 QCOMPARE(testFlag(webPage2, QWebSettings::LocalStorageEnabled, "localStorage", false), true); 2346 } 2347 2348 static inline bool checkLocalStorageVisibility(QWebPage& webPage, bool localStorageEnabled) 2349 { 2350 webPage.settings()->setAttribute(QWebSettings::LocalStorageEnabled, localStorageEnabled); 2351 return webPage.mainFrame()->evaluateJavaScript(QString("(window.localStorage != undefined)")).toBool(); 2352 } 2353 2354 void tst_QWebPage::testLocalStorageVisibility() 2355 { 2356 // Local storage's visibility depends on its security origin, which depends on base url. 2357 // Initially, it will test it with base urls that get a globally unique origin, which may not 2358 // be able to use local storage even if the feature is enabled. Then later the same test is 2359 // done but with urls that would get a valid origin, so local storage could be used. 2360 // Before every test case it checks if local storage is not already visible. 2361 2362 QWebPage webPage; 2363 2364 webPage.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl()); 2365 2366 QCOMPARE(checkLocalStorageVisibility(webPage, false), false); 2367 QCOMPARE(checkLocalStorageVisibility(webPage, true), false); 2368 2369 webPage.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("invalid")); 2370 2371 QCOMPARE(checkLocalStorageVisibility(webPage, false), false); 2372 QCOMPARE(checkLocalStorageVisibility(webPage, true), false); 2373 2374 webPage.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("://misparsed.com")); 2375 2376 QCOMPARE(checkLocalStorageVisibility(webPage, false), false); 2377 QCOMPARE(checkLocalStorageVisibility(webPage, true), false); 2378 2379 webPage.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("http://")); 2380 2381 QCOMPARE(checkLocalStorageVisibility(webPage, false), false); 2382 QCOMPARE(checkLocalStorageVisibility(webPage, true), false); 2383 2384 webPage.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("about:blank")); 2385 2386 QCOMPARE(checkLocalStorageVisibility(webPage, false), false); 2387 QCOMPARE(checkLocalStorageVisibility(webPage, true), false); 2388 2389 webPage.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("data:text/html,test")); 2390 2391 QCOMPARE(checkLocalStorageVisibility(webPage, false), false); 2392 QCOMPARE(checkLocalStorageVisibility(webPage, true), false); 2393 2394 webPage.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("file:///")); 2395 2396 QCOMPARE(checkLocalStorageVisibility(webPage, false), false); 2397 QCOMPARE(checkLocalStorageVisibility(webPage, true), false); 2398 2399 webPage.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("http://www.example.com")); 2400 2401 QCOMPARE(checkLocalStorageVisibility(webPage, false), false); 2402 QCOMPARE(checkLocalStorageVisibility(webPage, true), true); 2403 2404 webPage.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("https://www.example.com")); 2405 2406 QCOMPARE(checkLocalStorageVisibility(webPage, false), false); 2407 QCOMPARE(checkLocalStorageVisibility(webPage, true), true); 2408 2409 webPage.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("ftp://files.example.com")); 2410 2411 QCOMPARE(checkLocalStorageVisibility(webPage, false), false); 2412 QCOMPARE(checkLocalStorageVisibility(webPage, true), true); 2413 2414 webPage.currentFrame()->setHtml(QString("<html><body>test</body></html>"), QUrl("file:///path/to/index.html")); 2415 2416 QCOMPARE(checkLocalStorageVisibility(webPage, false), false); 2417 QCOMPARE(checkLocalStorageVisibility(webPage, true), true); 2347 2418 } 2348 2419
Note: See TracChangeset
for help on using the changeset viewer.