[GTK] Clear application cache between tests in DumpRenderTree
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Sep 2012 12:43:18 +0000 (12:43 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Sep 2012 12:43:18 +0000 (12:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=96543

Reviewed by Philippe Normand.

Source/WebKit/gtk:

Add a method to the DumpRenderTreeSupportGtk class that upon calling
clears the application cache and vacuums the database file.

* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::clearApplicationCache):
* WebCoreSupport/DumpRenderTreeSupportGtk.h:
(DumpRenderTreeSupportGtk):

Tools:

Call the new DumpRenderTreeSupportGtk method to clear application cache
after each test in DumpRenderTree.

Set the XDG_CACHE_HOME environment variable when running DumpRenderTree
as well. It's now being set in XvfbDriver._start so that each driver is assigned
a cache directory that's constructed out of the driver's name and its worker
number. These directories are located in the layout tests results directory.
At least on the builders this ensures a driver-specific empty cache directory
with each test run.

* DumpRenderTree/gtk/DumpRenderTree.cpp:
(runTest):
* Scripts/webkitpy/layout_tests/port/gtk.py:
(GtkPort.setup_environ_for_server):
* Scripts/webkitpy/layout_tests/port/xvfbdriver.py:
(XvfbDriver._start):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@128596 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h
Tools/ChangeLog
Tools/DumpRenderTree/gtk/DumpRenderTree.cpp
Tools/Scripts/webkitpy/layout_tests/port/gtk.py
Tools/Scripts/webkitpy/layout_tests/port/xvfbdriver.py

index 30fb66c..57cb94a 100644 (file)
@@ -1,3 +1,18 @@
+2012-09-14  Zan Dobersek  <zandobersek@gmail.com>
+
+        [GTK] Clear application cache between tests in DumpRenderTree
+        https://bugs.webkit.org/show_bug.cgi?id=96543
+
+        Reviewed by Philippe Normand.
+
+        Add a method to the DumpRenderTreeSupportGtk class that upon calling
+        clears the application cache and vacuums the database file.
+
+        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
+        (DumpRenderTreeSupportGtk::clearApplicationCache):
+        * WebCoreSupport/DumpRenderTreeSupportGtk.h:
+        (DumpRenderTreeSupportGtk):
+
 2012-09-13  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r128453.
index 39b9ddc..e5d6989 100644 (file)
@@ -26,6 +26,7 @@
 #include "AXObjectCache.h"
 #include "AccessibilityObject.h"
 #include "AnimationController.h"
+#include "ApplicationCacheStorage.h"
 #include "CSSComputedStyleDeclaration.h"
 #include "Chrome.h"
 #include "ChromeClientGtk.h"
@@ -811,3 +812,9 @@ void DumpRenderTreeSupportGtk::clearMemoryCache()
 {
     memoryCache()->evictResources();
 }
+
+void DumpRenderTreeSupportGtk::clearApplicationCache()
+{
+    cacheStorage().empty();
+    cacheStorage().vacuumDatabaseFile();
+}
index 7e6e1fa..375020d 100644 (file)
@@ -128,6 +128,7 @@ public:
     static void resetTrackedRepaints(WebKitWebFrame*);
 
     static void clearMemoryCache();
+    static void clearApplicationCache();
 
 private:
     static bool s_drtRun;
index ed9b11c..cb97d86 100644 (file)
@@ -1,3 +1,27 @@
+2012-09-14  Zan Dobersek  <zandobersek@gmail.com>
+
+        [GTK] Clear application cache between tests in DumpRenderTree
+        https://bugs.webkit.org/show_bug.cgi?id=96543
+
+        Reviewed by Philippe Normand.
+
+        Call the new DumpRenderTreeSupportGtk method to clear application cache
+        after each test in DumpRenderTree.
+
+        Set the XDG_CACHE_HOME environment variable when running DumpRenderTree
+        as well. It's now being set in XvfbDriver._start so that each driver is assigned
+        a cache directory that's constructed out of the driver's name and its worker
+        number. These directories are located in the layout tests results directory.
+        At least on the builders this ensures a driver-specific empty cache directory
+        with each test run.
+
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (runTest):
+        * Scripts/webkitpy/layout_tests/port/gtk.py:
+        (GtkPort.setup_environ_for_server):
+        * Scripts/webkitpy/layout_tests/port/xvfbdriver.py:
+        (XvfbDriver._start):
+
 2012-09-14  Simon Hausmann  <simon.hausmann@nokia.com>
 
         [Qt] Fix linking on Windows
index dabb09d..eecade9 100644 (file)
@@ -770,6 +770,7 @@ static void runTest(const string& inputLine)
 
     WebCoreTestSupport::resetInternalsObject(webkit_web_frame_get_global_context(mainFrame));
     DumpRenderTreeSupportGtk::clearMemoryCache();
+    DumpRenderTreeSupportGtk::clearApplicationCache();
 
     // A blank load seems to be necessary to reset state after certain tests.
     webkit_web_view_open(webView, "about:blank");
index b4a4a29..3cc0ea5 100644 (file)
@@ -72,11 +72,6 @@ class GtkPort(Port, PulseAudioSanitizer):
                                                                     'Source', 'WebCore', 'platform',
                                                                     'audio', 'resources')
         self._copy_value_from_environ_if_set(environment, 'WEBKITOUTPUTDIR')
-        if self.get_option('webkit_test_runner'):
-            # FIXME: This is a workaround to ensure that testing with WebKitTestRunner is started with
-            # a non-existing cache. This should be removed when (and if) it will be possible to properly
-            # set the cache directory path through a WebKitWebContext.
-            environment['XDG_CACHE_HOME'] = self._filesystem.join(self.results_directory(), 'appcache')
         return environment
 
     def _generate_all_test_configurations(self):
index 281b217..7e386a1 100644 (file)
@@ -61,6 +61,8 @@ class XvfbDriver(Driver):
         environment = self._port.setup_environ_for_server(server_name)
         # We must do this here because the DISPLAY number depends on _worker_number
         environment['DISPLAY'] = ":%d" % display_id
+        # Drivers should use separate application cache locations
+        environment['XDG_CACHE_HOME'] = self._port.host.filesystem.join(self._port.results_directory(), '%s-appcache-%d' % (server_name, self._worker_number))
 
         self._crashed_process_name = None
         self._crashed_pid = None