Title: [128326] trunk
Revision
128326
Author
commit-qu...@webkit.org
Date
2012-09-12 09:38:16 -0700 (Wed, 12 Sep 2012)

Log Message

[WK2][WKTR] TestRunner needs to implement dumpApplicationCacheDelegateCallbacks
https://bugs.webkit.org/show_bug.cgi?id=96374

Patch by Christophe Dumez <christophe.du...@intel.com> on 2012-09-12
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Add Bundle C API to reset the application cache quota
for a given origin.

Add new reachedApplicationCacheOriginQuota callback
to WKBundlePageUIClient which is called from
WebChromeClient::reachedApplicationCacheOriginQuota().

Those are needed by WebKitTestRunner to dump
information about the application cache callbacks
if instructed to.

* Shared/APIClientTraits.cpp:
(WebKit):
* Shared/APIClientTraits.h:
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetApplicationCacheOriginQuota):
(WKBundleResetApplicationCacheOriginQuota):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::resetApplicationCacheOriginQuota):
(WebKit):
* WebProcess/InjectedBundle/InjectedBundle.h:
(InjectedBundle):
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
(WebKit::InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota):
(WebKit):
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
(WebKit):
(InjectedBundlePageUIClient):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
* win/WebKit2.def:
* win/WebKit2CFLite.def:

Tools:

Implement support for dumpApplicationCacheDelegateCallbacks
and disallowIncreaseForApplicationCacheQuota in
WebKitTestRunner and properly dump the information
expected by the tests.

If the application cache quota is reached for a given
security origin, WebKitTestRunner will reset the quota
to its default value, unless intructed not to via
disallowIncreaseForApplicationCacheQuota().

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):
(WTR::InjectedBundlePage::didReachApplicationCacheOriginQuota):
(WTR):
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
(InjectedBundlePage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::TestRunner):
(WTR::TestRunner::disallowIncreaseForApplicationCacheQuota):
(WTR):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
(WTR::TestRunner::dumpApplicationCacheDelegateCallbacks):
(TestRunner):
(WTR::TestRunner::shouldDisallowIncreaseForApplicationCacheQuota):
(WTR::TestRunner::shouldDumpApplicationCacheDelegateCallbacks):

LayoutTests:

Unskip test cases that are passing now that WebKitTestRunner
implements dumpApplicationCacheDelegateCallbacks and
disallowIncreaseForApplicationCacheQuota.

* platform/efl-wk1/TestExpectations:
* platform/efl/Skipped:
* platform/wk2/Skipped:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (128325 => 128326)


--- trunk/LayoutTests/ChangeLog	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/LayoutTests/ChangeLog	2012-09-12 16:38:16 UTC (rev 128326)
@@ -1,3 +1,18 @@
+2012-09-12  Christophe Dumez  <christophe.du...@intel.com>
+
+        [WK2][WKTR] TestRunner needs to implement dumpApplicationCacheDelegateCallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=96374
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Unskip test cases that are passing now that WebKitTestRunner
+        implements dumpApplicationCacheDelegateCallbacks and
+        disallowIncreaseForApplicationCacheQuota.
+
+        * platform/efl-wk1/TestExpectations:
+        * platform/efl/Skipped:
+        * platform/wk2/Skipped:
+
 2012-09-12  Andrei Onea  <o...@adobe.com>
 
         [CSSRegions]Use RefPtr's instead of weak references on DOMNamedFlowCollection

Modified: trunk/LayoutTests/platform/efl/Skipped (128325 => 128326)


--- trunk/LayoutTests/platform/efl/Skipped	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/LayoutTests/platform/efl/Skipped	2012-09-12 16:38:16 UTC (rev 128326)
@@ -103,12 +103,6 @@
 # Fallback resource wasn't used for a redirect to a resource with another origin
 http/tests/appcache/fallback.html
 
-# EFL's LayoutTestController does not implement applicationCacheDiskUsageForOrigin
-http/tests/appcache/origin-usage.html
-
-# EFL's LayoutTestController does not implement originsWithApplicationCache
-http/tests/appcache/origins-with-appcache.html
-
 # EFL's LayoutTestController does not implement shadowPseudoId
 media/video-controls-transformed.html
 media/video-controls-visible-audio-only.html

Modified: trunk/LayoutTests/platform/efl-wk1/TestExpectations (128325 => 128326)


--- trunk/LayoutTests/platform/efl-wk1/TestExpectations	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/LayoutTests/platform/efl-wk1/TestExpectations	2012-09-12 16:38:16 UTC (rev 128326)
@@ -47,6 +47,12 @@
 // Custom font loading delaying text drawing on Canvas
 BUGWK87355 : canvas/philip/tests/2d.text.draw.fontface.notinpage.html = TEXT
 
+// EFL's TestRunner does not implement applicationCacheDiskUsageForOrigin
+BUGWK86460 : http/tests/appcache/origin-usage.html = TEXT
+
+// EFL's TestRunner does not implement originsWithApplicationCache
+BUGWK86498 : http/tests/appcache/origins-with-appcache.html = TEXT
+
 // Missing showModalDialog implementation
 BUGWK84589 : fast/animation/request-animation-frame-during-modal.html = TEXT
 BUGWK84589 : http/tests/security/cross-frame-access-call.html = TEXT

Modified: trunk/LayoutTests/platform/wk2/Skipped (128325 => 128326)


--- trunk/LayoutTests/platform/wk2/Skipped	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/LayoutTests/platform/wk2/Skipped	2012-09-12 16:38:16 UTC (rev 128326)
@@ -202,12 +202,7 @@
 fast/images/animated-gif-restored-from-bfcache.html
 fast/text/zero-font-size.html
 
-# WTR needs an implementation of dumpApplicationCacheDelegateCallbacks
-http/tests/appcache/origin-delete.html
-http/tests/appcache/origin-quota.html
-http/tests/appcache/origin-quota-continued-download.html
-http/tests/appcache/origin-quota-continued-download-multiple-manifests.html
-http/tests/appcache/origin-usage.html
+# WTR needs an implementation of originsWithApplicationCache
 http/tests/appcache/origins-with-appcache.html
 
 # WebKitTestRunner needs to support layoutTestController.dumpDOMAsWebArchive

Modified: trunk/Source/WebKit2/ChangeLog (128325 => 128326)


--- trunk/Source/WebKit2/ChangeLog	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/ChangeLog	2012-09-12 16:38:16 UTC (rev 128326)
@@ -1,3 +1,45 @@
+2012-09-12  Christophe Dumez  <christophe.du...@intel.com>
+
+        [WK2][WKTR] TestRunner needs to implement dumpApplicationCacheDelegateCallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=96374
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add Bundle C API to reset the application cache quota
+        for a given origin.
+
+        Add new reachedApplicationCacheOriginQuota callback
+        to WKBundlePageUIClient which is called from
+        WebChromeClient::reachedApplicationCacheOriginQuota().
+
+        Those are needed by WebKitTestRunner to dump
+        information about the application cache callbacks
+        if instructed to.
+
+        * Shared/APIClientTraits.cpp:
+        (WebKit):
+        * Shared/APIClientTraits.h:
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleSetApplicationCacheOriginQuota):
+        (WKBundleResetApplicationCacheOriginQuota):
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::resetApplicationCacheOriginQuota):
+        (WebKit):
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+        (InjectedBundle):
+        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
+        (WebKit::InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota):
+        (WebKit):
+        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
+        (WebKit):
+        (InjectedBundlePageUIClient):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::reachedApplicationCacheOriginQuota):
+        * win/WebKit2.def:
+        * win/WebKit2CFLite.def:
+
 2012-09-12  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r128280.

Modified: trunk/Source/WebKit2/Shared/APIClientTraits.cpp (128325 => 128326)


--- trunk/Source/WebKit2/Shared/APIClientTraits.cpp	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.cpp	2012-09-12 16:38:16 UTC (rev 128326)
@@ -75,6 +75,11 @@
     sizeof(WKBundlePageFormClient)
 };
 
+const size_t APIClientTraits<WKBundlePageUIClient>::interfaceSizesByVersion[] = {
+    offsetof(WKBundlePageUIClient, didReachApplicationCacheOriginQuota),
+    sizeof(WKBundlePageUIClient)
+};
+
 const size_t APIClientTraits<WKContextInjectedBundleClient>::interfaceSizesByVersion[] = {
     offsetof(WKContextInjectedBundleClient, getInjectedBundleInitializationUserData),
     sizeof(WKContextInjectedBundleClient)

Modified: trunk/Source/WebKit2/Shared/APIClientTraits.h (128325 => 128326)


--- trunk/Source/WebKit2/Shared/APIClientTraits.h	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.h	2012-09-12 16:38:16 UTC (rev 128326)
@@ -54,6 +54,10 @@
     static const size_t interfaceSizesByVersion[2];
 };
 
+template<> struct APIClientTraits<WKBundlePageUIClient> {
+    static const size_t interfaceSizesByVersion[2];
+};
+
 template<> struct APIClientTraits<WKPageContextMenuClient> {
     static const size_t interfaceSizesByVersion[3];
 };

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp (128325 => 128326)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2012-09-12 16:38:16 UTC (rev 128326)
@@ -248,9 +248,14 @@
 
 void WKBundleSetApplicationCacheOriginQuota(WKBundleRef bundleRef, WKStringRef origin, uint64_t bytes)
 {
-    return toImpl(bundleRef)->setApplicationCacheOriginQuota(toImpl(origin)->string(), bytes);
+    toImpl(bundleRef)->setApplicationCacheOriginQuota(toImpl(origin)->string(), bytes);
 }
 
+void WKBundleResetApplicationCacheOriginQuota(WKBundleRef bundleRef, WKStringRef origin)
+{
+    toImpl(bundleRef)->resetApplicationCacheOriginQuota(toImpl(origin)->string());
+}
+
 void WKBundleSetMinimumTimerInterval(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, double seconds)
 {
     toImpl(bundleRef)->setMinimumTimerInterval(toImpl(pageGroupRef), seconds);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h (128325 => 128326)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2012-09-12 16:38:16 UTC (rev 128326)
@@ -236,6 +236,7 @@
 typedef WKBundlePageUIElementVisibility (*WKBundlePageStatusBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
 typedef WKBundlePageUIElementVisibility (*WKBundlePageMenuBarIsVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
 typedef WKBundlePageUIElementVisibility (*WKBundlePageToolbarsAreVisibleCallback)(WKBundlePageRef page, const void *clientInfo);
+typedef void (*WKBundlePageReachedAppCacheOriginQuotaCallback)(WKBundlePageRef page, WKSecurityOriginRef origin, int64_t totalBytesNeeded, const void *clientInfo);
 
 struct WKBundlePageUIClient {
     int                                                                 version;
@@ -254,10 +255,13 @@
     WKBundlePageStatusBarIsVisibleCallback                              statusBarIsVisible;
     WKBundlePageMenuBarIsVisibleCallback                                menuBarIsVisible;
     WKBundlePageToolbarsAreVisibleCallback                              toolbarsAreVisible;
+
+    // Version 1.
+    WKBundlePageReachedAppCacheOriginQuotaCallback                      didReachApplicationCacheOriginQuota;
 };
 typedef struct WKBundlePageUIClient WKBundlePageUIClient;
 
-enum { kWKBundlePageUIClientCurrentVersion = 0 };
+enum { kWKBundlePageUIClientCurrentVersion = 1 };
 
 // Editor client
 typedef bool (*WKBundlePageShouldBeginEditingCallback)(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h (128325 => 128326)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2012-09-12 16:38:16 UTC (rev 128326)
@@ -99,6 +99,7 @@
 WK_EXPORT void WKBundleSetAppCacheMaximumSize(WKBundleRef bundle, uint64_t size);
 WK_EXPORT uint64_t WKBundleGetAppCacheUsageForOrigin(WKBundleRef bundle, WKStringRef origin);
 WK_EXPORT void WKBundleSetApplicationCacheOriginQuota(WKBundleRef bundle, WKStringRef origin, uint64_t bytes);
+WK_EXPORT void WKBundleResetApplicationCacheOriginQuota(WKBundleRef bundle, WKStringRef origin);
 
 // Garbage collection API
 WK_EXPORT void WKBundleGarbageCollectJavaScriptObjects(WKBundleRef bundle);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (128325 => 128326)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-09-12 16:38:16 UTC (rev 128326)
@@ -359,6 +359,12 @@
     cacheStorage().storeUpdatedQuotaForOrigin(origin.get(), bytes);
 }
 
+void InjectedBundle::resetApplicationCacheOriginQuota(const String& originString)
+{
+    RefPtr<SecurityOrigin> origin = SecurityOrigin::createFromString(originString);
+    cacheStorage().storeUpdatedQuotaForOrigin(origin.get(), cacheStorage().defaultOriginQuota());
+}
+
 int InjectedBundle::numberOfPages(WebFrame* frame, double pageWidthInPixels, double pageHeightInPixels)
 {
     Frame* coreFrame = frame ? frame->coreFrame() : 0;

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h (128325 => 128326)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2012-09-12 16:38:16 UTC (rev 128326)
@@ -150,6 +150,7 @@
     void setAppCacheMaximumSize(uint64_t);
     uint64_t appCacheUsageForOrigin(const String& origin);
     void setApplicationCacheOriginQuota(const String& origin, uint64_t);
+    void resetApplicationCacheOriginQuota(const String& origin);
 
     // Garbage collection API
     void garbageCollectJavaScriptObjects();

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp (128325 => 128326)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp	2012-09-12 16:38:16 UTC (rev 128326)
@@ -28,8 +28,9 @@
 
 #include "InjectedBundleHitTestResult.h"
 #include "WKAPICast.h"
+#include "WKBundleAPICast.h"
 #include "WebGraphicsContext.h"
-#include "WKBundleAPICast.h"
+#include "WebSecurityOrigin.h"
 #include <wtf/text/WTFString.h>
 
 using namespace WebCore;
@@ -146,4 +147,12 @@
     return m_client.toolbarsAreVisible(toAPI(page), m_client.clientInfo);
 }
 
+void InjectedBundlePageUIClient::didReachApplicationCacheOriginQuota(WebPage* page, WebSecurityOrigin* origin, int64_t totalBytesNeeded)
+{
+    if (!m_client.didReachApplicationCacheOriginQuota)
+        return;
+
+    m_client.didReachApplicationCacheOriginQuota(toAPI(page), toAPI(origin), totalBytesNeeded, m_client.clientInfo);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h (128325 => 128326)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h	2012-09-12 16:38:16 UTC (rev 128326)
@@ -42,6 +42,7 @@
 class APIObject;
 class WebFrame;
 class WebPage;
+class WebSecurityOrigin;
 
 class InjectedBundlePageUIClient : public APIClient<WKBundlePageUIClient, kWKBundlePageUIClientCurrentVersion> {
 public:
@@ -64,6 +65,8 @@
     WKBundlePageUIElementVisibility statusBarIsVisible(WebPage*);
     WKBundlePageUIElementVisibility menuBarIsVisible(WebPage*);
     WKBundlePageUIElementVisibility toolbarsAreVisible(WebPage*);
+
+    void didReachApplicationCacheOriginQuota(WebPage*, WebSecurityOrigin*, int64_t totalBytesNeeded);
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (128325 => 128326)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2012-09-12 16:38:16 UTC (rev 128326)
@@ -45,6 +45,7 @@
 #include "WebPreferencesStore.h"
 #include "WebProcess.h"
 #include "WebSearchPopupMenu.h"
+#include "WebSecurityOrigin.h"
 #include <WebCore/AXObjectCache.h>
 #include <WebCore/ColorChooser.h>
 #include <WebCore/DatabaseTracker.h>
@@ -549,9 +550,10 @@
     notImplemented();
 }
 
-void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t)
+void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin* origin, int64_t totalBytesNeeded)
 {
-    notImplemented();
+    RefPtr<WebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createFromString(origin->toString());
+    m_page->injectedBundleUIClient().didReachApplicationCacheOriginQuota(m_page, webSecurityOrigin.get(), totalBytesNeeded);
 }
 
 #if ENABLE(DASHBOARD_SUPPORT)

Modified: trunk/Source/WebKit2/win/WebKit2.def (128325 => 128326)


--- trunk/Source/WebKit2/win/WebKit2.def	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/win/WebKit2.def	2012-09-12 16:38:16 UTC (rev 128326)
@@ -195,6 +195,7 @@
         ?lastChild@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?next@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?previous@ComposedShadowTreeWalker@WebCore@@QAEXXZ
+        ?number@String@WTF@@SA?AV12@_J@Z
         ?number@String@WTF@@SA?AV12@_K@Z
         ?number@String@WTF@@SA?AV12@H@Z
         ?number@String@WTF@@SA?AV12@I@Z

Modified: trunk/Source/WebKit2/win/WebKit2CFLite.def (128325 => 128326)


--- trunk/Source/WebKit2/win/WebKit2CFLite.def	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Source/WebKit2/win/WebKit2CFLite.def	2012-09-12 16:38:16 UTC (rev 128326)
@@ -192,6 +192,7 @@
         ?lastChild@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?next@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?previous@ComposedShadowTreeWalker@WebCore@@QAEXXZ
+        ?number@String@WTF@@SA?AV12@_J@Z
         ?number@String@WTF@@SA?AV12@_K@Z
         ?number@String@WTF@@SA?AV12@H@Z
         ?number@String@WTF@@SA?AV12@I@Z

Modified: trunk/Tools/ChangeLog (128325 => 128326)


--- trunk/Tools/ChangeLog	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Tools/ChangeLog	2012-09-12 16:38:16 UTC (rev 128326)
@@ -1,3 +1,37 @@
+2012-09-12  Christophe Dumez  <christophe.du...@intel.com>
+
+        [WK2][WKTR] TestRunner needs to implement dumpApplicationCacheDelegateCallbacks
+        https://bugs.webkit.org/show_bug.cgi?id=96374
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Implement support for dumpApplicationCacheDelegateCallbacks
+        and disallowIncreaseForApplicationCacheQuota in
+        WebKitTestRunner and properly dump the information
+        expected by the tests.
+
+        If the application cache quota is reached for a given
+        security origin, WebKitTestRunner will reset the quota
+        to its default value, unless intructed not to via
+        disallowIncreaseForApplicationCacheQuota().
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::InjectedBundlePage):
+        (WTR::InjectedBundlePage::didReachApplicationCacheOriginQuota):
+        (WTR):
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.h:
+        (InjectedBundlePage):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::TestRunner):
+        (WTR::TestRunner::disallowIncreaseForApplicationCacheQuota):
+        (WTR):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        (WTR::TestRunner::dumpApplicationCacheDelegateCallbacks):
+        (TestRunner):
+        (WTR::TestRunner::shouldDisallowIncreaseForApplicationCacheQuota):
+        (WTR::TestRunner::shouldDumpApplicationCacheDelegateCallbacks):
+
 2012-09-12  Jochen Eisinger  <joc...@chromium.org>
 
         [chromium] remove deprecated and unused sets import from chromium_android driver

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (128325 => 128326)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2012-09-12 16:38:16 UTC (rev 128326)
@@ -47,6 +47,7 @@
         void dumpResourceLoadCallbacks();
         void dumpResourceResponseMIMETypes();
         void dumpWillCacheResponse();
+        void dumpApplicationCacheDelegateCallbacks();
 
         // Special options.
         void keepWebHistory();
@@ -113,6 +114,7 @@
         long long applicationCacheDiskUsageForOrigin(in DOMString origin);
         void clearApplicationCacheForOrigin(in DOMString name);
         void setApplicationCacheOriginQuota(in unsigned long long bytes);
+        void disallowIncreaseForApplicationCacheQuota();
 
         // Compositing testing.
         DOMString layerTreeAsText();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (128325 => 128326)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2012-09-12 16:38:16 UTC (rev 128326)
@@ -41,6 +41,8 @@
 #include <WebKit2/WKBundleNavigationAction.h>
 #include <WebKit2/WKBundleNodeHandlePrivate.h>
 #include <WebKit2/WKBundlePagePrivate.h>
+#include <WebKit2/WKBundlePrivate.h>
+#include <WebKit2/WKSecurityOrigin.h>
 #include <WebKit2/WKURLRequest.h>
 #include <wtf/HashMap.h>
 #include <wtf/text/CString.h>
@@ -349,6 +351,7 @@
         0, /*statusBarIsVisible*/
         0, /*menuBarIsVisible*/
         0, /*toolbarsAreVisible*/
+        didReachApplicationCacheOriginQuota,
     };
     WKBundlePageSetUIClient(m_page, &uiClient);
 
@@ -1318,6 +1321,11 @@
     static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->willRunJavaScriptPrompt(message, defaultValue, frame);
 }
 
+void InjectedBundlePage::didReachApplicationCacheOriginQuota(WKBundlePageRef page, WKSecurityOriginRef origin, int64_t totalBytesNeeded, const void* clientInfo)
+{
+    static_cast<InjectedBundlePage*>(const_cast<void*>(clientInfo))->didReachApplicationCacheOriginQuota(origin, totalBytesNeeded);
+}
+
 static WTF::String lastFileURLPathComponent(const WTF::String& path)
 {
     size_t pos = path.find("file://");
@@ -1402,6 +1410,34 @@
     InjectedBundle::shared().stringBuilder()->append("\n");
 }
 
+void InjectedBundlePage::didReachApplicationCacheOriginQuota(WKSecurityOriginRef origin, int64_t totalBytesNeeded)
+{
+    if (!InjectedBundle::shared().testRunner()->shouldDumpApplicationCacheDelegateCallbacks())
+        return;
+
+    // For example, numbers from 30000 - 39999 will output as 30000.
+    // Rounding up or down does not really matter for these tests. It's
+    // sufficient to just get a range of 10000 to determine if we were
+    // above or below a threshold.
+    int64_t truncatedSpaceNeeded = (totalBytesNeeded / 10000) * 10000;
+
+    InjectedBundle::shared().stringBuilder()->appendLiteral("UI DELEGATE APPLICATION CACHE CALLBACK: exceededApplicationCacheOriginQuotaForSecurityOrigin:{");
+    InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKSecurityOriginCopyProtocol(origin))));
+    InjectedBundle::shared().stringBuilder()->appendLiteral(", ");
+    InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKSecurityOriginCopyHost(origin))));
+    InjectedBundle::shared().stringBuilder()->appendLiteral(", ");
+    InjectedBundle::shared().stringBuilder()->append(WTF::String::number(WKSecurityOriginGetPort(origin)));
+    InjectedBundle::shared().stringBuilder()->appendLiteral("} totalSpaceNeeded:~");
+    InjectedBundle::shared().stringBuilder()->append(WTF::String::number(truncatedSpaceNeeded));
+    InjectedBundle::shared().stringBuilder()->append('\n');
+
+    if (InjectedBundle::shared().testRunner()->shouldDisallowIncreaseForApplicationCacheQuota())
+        return;
+
+    // Reset default application cache quota.
+    WKBundleResetApplicationCacheOriginQuota(InjectedBundle::shared().bundle(), adoptWK(WKSecurityOriginCopyToString(origin)).get());
+}
+
 // Editor Client Callbacks
 
 bool InjectedBundlePage::shouldBeginEditing(WKBundlePageRef page, WKBundleRangeHandleRef range, const void* clientInfo)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h (128325 => 128326)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.h	2012-09-12 16:38:16 UTC (rev 128326)
@@ -124,11 +124,13 @@
     static void willRunJavaScriptAlert(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo);
     static void willRunJavaScriptConfirm(WKBundlePageRef, WKStringRef message, WKBundleFrameRef frame, const void* clientInfo);
     static void willRunJavaScriptPrompt(WKBundlePageRef, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void* clientInfo);
+    static void didReachApplicationCacheOriginQuota(WKBundlePageRef, WKSecurityOriginRef, int64_t totalBytesNeeded, const void* clientInfo);
     void willAddMessageToConsole(WKStringRef message, uint32_t lineNumber);
     void willSetStatusbarText(WKStringRef statusbarText);
     void willRunJavaScriptAlert(WKStringRef message, WKBundleFrameRef);
     void willRunJavaScriptConfirm(WKStringRef message, WKBundleFrameRef);
     void willRunJavaScriptPrompt(WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef);
+    void didReachApplicationCacheOriginQuota(WKSecurityOriginRef, int64_t totalBytesNeeded);
 
 #if ENABLE(FULLSCREEN_API)
     // Full Screen client

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (128325 => 128326)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2012-09-12 16:38:16 UTC (rev 128326)
@@ -80,6 +80,8 @@
     , m_dumpResourceLoadCallbacks(false)
     , m_dumpResourceResponseMIMETypes(false)
     , m_dumpWillCacheResponse(false)
+    , m_dumpApplicationCacheDelegateCallbacks(false)
+    , m_disallowIncreaseForApplicationCacheQuota(false)
     , m_waitToDump(false)
     , m_testRepaint(false)
     , m_testRepaintSweepHorizontally(false)
@@ -323,6 +325,11 @@
     WKBundleSetApplicationCacheOriginQuota(InjectedBundle::shared().bundle(), origin.get(), bytes);
 }
 
+void TestRunner::disallowIncreaseForApplicationCacheQuota()
+{
+    m_disallowIncreaseForApplicationCacheQuota = true;
+}
+
 bool TestRunner::isCommandEnabled(JSStringRef name)
 {
     return WKBundlePageIsEditingCommandEnabled(InjectedBundle::shared().page()->page(), toWK(name).get());

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (128325 => 128326)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2012-09-12 16:30:04 UTC (rev 128325)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2012-09-12 16:38:16 UTC (rev 128326)
@@ -82,6 +82,7 @@
     void dumpResourceLoadCallbacks() { m_dumpResourceLoadCallbacks = true; }
     void dumpResourceResponseMIMETypes() { m_dumpResourceResponseMIMETypes = true; }
     void dumpWillCacheResponse() { m_dumpWillCacheResponse = true; }
+    void dumpApplicationCacheDelegateCallbacks() { m_dumpApplicationCacheDelegateCallbacks = true; }
 
     void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
     void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; }
@@ -149,6 +150,8 @@
     void setAppCacheMaximumSize(uint64_t);
     long long applicationCacheDiskUsageForOrigin(JSStringRef origin);
     void setApplicationCacheOriginQuota(unsigned long long);
+    void disallowIncreaseForApplicationCacheQuota();
+    bool shouldDisallowIncreaseForApplicationCacheQuota() { return m_disallowIncreaseForApplicationCacheQuota; }
 
     // Printing
     bool isPageBoxVisible(int pageIndex);
@@ -171,6 +174,7 @@
     bool shouldDumpResourceLoadCallbacks() const { return m_dumpResourceLoadCallbacks; }
     bool shouldDumpResourceResponseMIMETypes() const { return m_dumpResourceResponseMIMETypes; }
     bool shouldDumpWillCacheResponse() const { return m_dumpWillCacheResponse; }
+    bool shouldDumpApplicationCacheDelegateCallbacks() const { return m_dumpApplicationCacheDelegateCallbacks; }
 
     bool isPolicyDelegateEnabled() const { return m_policyDelegateEnabled; }
     bool isPolicyDelegatePermissive() const { return m_policyDelegatePermissive; }
@@ -267,6 +271,8 @@
     bool m_dumpResourceLoadCallbacks;
     bool m_dumpResourceResponseMIMETypes;
     bool m_dumpWillCacheResponse;
+    bool m_dumpApplicationCacheDelegateCallbacks;
+    bool m_disallowIncreaseForApplicationCacheQuota;
     bool m_waitToDump; // True if waitUntilDone() has been called, but notifyDone() has not yet been called.
     bool m_testRepaint;
     bool m_testRepaintSweepHorizontally;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to