Title: [139872] trunk/Tools
Revision
139872
Author
[email protected]
Date
2013-01-16 04:41:47 -0800 (Wed, 16 Jan 2013)

Log Message

[chromium] route more webkit_support and webviewhost callbacks through WebTestDelegate
https://bugs.webkit.org/show_bug.cgi?id=106904

Reviewed by Adam Barth.

* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::DRTTestRunner):
(DRTTestRunner::notifyDone):
(DRTTestRunner::reset):
* DumpRenderTree/chromium/DRTTestRunner.h:
(DRTTestRunner):
* DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
(WebTestRunner::WebTestDelegate::setDeviceScaleFactor):
(WebTestRunner::WebTestDelegate::setFocus):
(WebTestRunner::WebTestDelegate::setAcceptAllCookies):
(WebTestRunner::WebTestDelegate::pathToLocalResource):
(WebTestRunner::WebTestDelegate::setLocale):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::TestRunner):
(WebTestRunner::TestRunner::reset):
(WebTestRunner::TestRunner::setAlwaysAcceptCookies):
(WebTestRunner):
(WebTestRunner::TestRunner::setWindowIsKey):
(WebTestRunner::TestRunner::pathToLocalResource):
(WebTestRunner::TestRunner::setBackingScaleFactor):
(WebTestRunner::TestRunner::setPOSIXLocale):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(WebTestRunner::TestRunner::taskList):
(TestRunner):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::setDeviceScaleFactor):
(WebViewHost::setFocus):
(WebViewHost::setAcceptAllCookies):
(WebViewHost::pathToLocalResource):
(WebViewHost::setLocale):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (139871 => 139872)


--- trunk/Tools/ChangeLog	2013-01-16 12:16:41 UTC (rev 139871)
+++ trunk/Tools/ChangeLog	2013-01-16 12:41:47 UTC (rev 139872)
@@ -1,3 +1,43 @@
+2013-01-16  Jochen Eisinger  <[email protected]>
+
+        [chromium] route more webkit_support and webviewhost callbacks through WebTestDelegate
+        https://bugs.webkit.org/show_bug.cgi?id=106904
+
+        Reviewed by Adam Barth.
+
+        * DumpRenderTree/chromium/DRTTestRunner.cpp:
+        (DRTTestRunner::DRTTestRunner):
+        (DRTTestRunner::notifyDone):
+        (DRTTestRunner::reset):
+        * DumpRenderTree/chromium/DRTTestRunner.h:
+        (DRTTestRunner):
+        * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
+        (WebTestRunner::WebTestDelegate::setDeviceScaleFactor):
+        (WebTestRunner::WebTestDelegate::setFocus):
+        (WebTestRunner::WebTestDelegate::setAcceptAllCookies):
+        (WebTestRunner::WebTestDelegate::pathToLocalResource):
+        (WebTestRunner::WebTestDelegate::setLocale):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
+        (WebTestRunner::TestRunner::TestRunner):
+        (WebTestRunner::TestRunner::reset):
+        (WebTestRunner::TestRunner::setAlwaysAcceptCookies):
+        (WebTestRunner):
+        (WebTestRunner::TestRunner::setWindowIsKey):
+        (WebTestRunner::TestRunner::pathToLocalResource):
+        (WebTestRunner::TestRunner::setBackingScaleFactor):
+        (WebTestRunner::TestRunner::setPOSIXLocale):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
+        (WebTestRunner::TestRunner::taskList):
+        (TestRunner):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::setDeviceScaleFactor):
+        (WebViewHost::setFocus):
+        (WebViewHost::setAcceptAllCookies):
+        (WebViewHost::pathToLocalResource):
+        (WebViewHost::setLocale):
+        * DumpRenderTree/chromium/WebViewHost.h:
+        (WebViewHost):
+
 2013-01-16  Sergio Villar Senin  <[email protected]>
 
         [GTK] build-webkit fails if the jhbuild wrapper is not used

Modified: trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp (139871 => 139872)


--- trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp	2013-01-16 12:16:41 UTC (rev 139871)
+++ trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp	2013-01-16 12:41:47 UTC (rev 139872)
@@ -68,7 +68,6 @@
 #include "webkit/support/webkit_support.h"
 #include <algorithm>
 #include <cctype>
-#include <clocale>
 #include <cstdlib>
 #include <limits>
 #include <sstream>
@@ -116,7 +115,6 @@
 #endif
     bindMethod("notifyDone", &DRTTestRunner::notifyDone);
     bindMethod("numberOfPendingGeolocationPermissionRequests", &DRTTestRunner:: numberOfPendingGeolocationPermissionRequests);
-    bindMethod("pathToLocalResource", &DRTTestRunner::pathToLocalResource);
     bindMethod("queueBackNavigation", &DRTTestRunner::queueBackNavigation);
     bindMethod("queueForwardNavigation", &DRTTestRunner::queueForwardNavigation);
     bindMethod("queueLoadingScript", &DRTTestRunner::queueLoadingScript);
@@ -124,7 +122,6 @@
     bindMethod("queueLoadHTMLString", &DRTTestRunner::queueLoadHTMLString);
     bindMethod("queueNonLoadingScript", &DRTTestRunner::queueNonLoadingScript);
     bindMethod("queueReload", &DRTTestRunner::queueReload);
-    bindMethod("setAlwaysAcceptCookies", &DRTTestRunner::setAlwaysAcceptCookies);
     bindMethod("setCloseRemainingWindowsWhenComplete", &DRTTestRunner::setCloseRemainingWindowsWhenComplete);
     bindMethod("setCustomPolicyDelegate", &DRTTestRunner::setCustomPolicyDelegate);
     bindMethod("setGeolocationPermission", &DRTTestRunner::setGeolocationPermission);
@@ -135,12 +132,9 @@
     bindMethod("setPointerLockWillRespondAsynchronously", &DRTTestRunner::setPointerLockWillRespondAsynchronously);
     bindMethod("setPointerLockWillFailSynchronously", &DRTTestRunner::setPointerLockWillFailSynchronously);
 #endif
-    bindMethod("setPOSIXLocale", &DRTTestRunner::setPOSIXLocale);
-    bindMethod("setBackingScaleFactor", &DRTTestRunner::setBackingScaleFactor);
     bindMethod("setWillSendRequestClearHeader", &DRTTestRunner::setWillSendRequestClearHeader);
     bindMethod("setWillSendRequestReturnsNull", &DRTTestRunner::setWillSendRequestReturnsNull);
     bindMethod("setWillSendRequestReturnsNullOnRedirect", &DRTTestRunner::setWillSendRequestReturnsNullOnRedirect);
-    bindMethod("setWindowIsKey", &DRTTestRunner::setWindowIsKey);
 #if ENABLE(NOTIFICATIONS)
     bindMethod("simulateLegacyWebNotificationClick", &DRTTestRunner::simulateLegacyWebNotificationClick);
 #endif
@@ -218,7 +212,7 @@
 void DRTTestRunner::notifyDone(const CppArgumentList&, CppVariant* result)
 {
     // Test didn't timeout. Kill the timeout timer.
-    m_taskList.revokeAll();
+    taskList()->revokeAll();
 
     completeNotifyDone(false);
     result->setNull();
@@ -389,22 +383,15 @@
 void DRTTestRunner::reset()
 {
     TestRunner::reset();
-    if (m_shell)
-        m_shell->webViewHost()->setDeviceScaleFactor(1);
     m_waitUntilDone = false;
     m_webHistoryItemCount.set(0);
     m_interceptPostMessage.set(false);
 
-    webkit_support::SetAcceptAllCookies(false);
-
-    setlocale(LC_ALL, "");
-
     if (m_closeRemainingWindows)
         m_shell->closeRemainingWindows();
     else
         m_closeRemainingWindows = true;
     m_workQueue.reset();
-    m_taskList.revokeAll();
 }
 
 void DRTTestRunner::locationChangeDone()
@@ -437,20 +424,6 @@
     result->setNull();
 }
 
-void DRTTestRunner::setAlwaysAcceptCookies(const CppArgumentList& arguments, CppVariant* result)
-{
-    if (arguments.size() > 0)
-        webkit_support::SetAcceptAllCookies(cppVariantToBool(arguments[0]));
-    result->setNull();
-}
-
-void DRTTestRunner::setWindowIsKey(const CppArgumentList& arguments, CppVariant* result)
-{
-    if (arguments.size() > 0 && arguments[0].isBool())
-        m_shell->setFocus(m_shell->webView(), arguments[0].value.boolValue);
-    result->setNull();
-}
-
 void DRTTestRunner::setCustomPolicyDelegate(const CppArgumentList& arguments, CppVariant* result)
 {
     if (arguments.size() > 0 && arguments[0].isBool()) {
@@ -494,45 +467,7 @@
     result->setNull();
 }
 
-void DRTTestRunner::pathToLocalResource(const CppArgumentList& arguments, CppVariant* result)
-{
-    result->setNull();
-    if (arguments.size() <= 0 || !arguments[0].isString())
-        return;
 
-    string url = ""
-#if OS(WINDOWS)
-    if (!url.find("/tmp/")) {
-        // We want a temp file.
-        const unsigned tempPrefixLength = 5;
-        size_t bufferSize = MAX_PATH;
-        OwnArrayPtr<WCHAR> tempPath = adoptArrayPtr(new WCHAR[bufferSize]);
-        DWORD tempLength = ::GetTempPathW(bufferSize, tempPath.get());
-        if (tempLength + url.length() - tempPrefixLength + 1 > bufferSize) {
-            bufferSize = tempLength + url.length() - tempPrefixLength + 1;
-            tempPath = adoptArrayPtr(new WCHAR[bufferSize]);
-            tempLength = GetTempPathW(bufferSize, tempPath.get());
-            ASSERT(tempLength < bufferSize);
-        }
-        string resultPath(WebString(tempPath.get(), tempLength).utf8());
-        resultPath.append(url.substr(tempPrefixLength));
-        result->set(resultPath);
-        return;
-    }
-#endif
-
-    // Some layout tests use file://// which we resolve as a UNC path. Normalize
-    // them to just file:///.
-    string lowerUrl = url;
-    transform(lowerUrl.begin(), lowerUrl.end(), lowerUrl.begin(), ::tolower);
-    while (!lowerUrl.find("file:////")) {
-        url = "" 8) + url.substr(9);
-        lowerUrl = lowerUrl.substr(0, 8) + lowerUrl.substr(9);
-    }
-    result->set(webkit_support::RewriteLayoutTestsURL(url).spec());
-}
-
-
 #if ENABLE(NOTIFICATIONS)
 void DRTTestRunner::grantWebNotificationPermission(const CppArgumentList& arguments, CppVariant* result)
 {
@@ -580,13 +515,6 @@
     result->setNull();
 }
 
-void DRTTestRunner::setPOSIXLocale(const CppArgumentList& arguments, CppVariant* result)
-{
-    result->setNull();
-    if (arguments.size() == 1 && arguments[0].isString())
-        setlocale(LC_ALL, arguments[0].toString().c_str());
-}
-
 void DRTTestRunner::numberOfPendingGeolocationPermissionRequests(const CppArgumentList& arguments, CppVariant* result)
 {
     result->setNull();
@@ -702,40 +630,6 @@
 }
 #endif
 
-class InvokeCallbackTask : public WebMethodTask<DRTTestRunner> {
-public:
-    InvokeCallbackTask(DRTTestRunner* object, PassOwnArrayPtr<CppVariant> callbackArguments, uint32_t numberOfArguments)
-        : WebMethodTask<DRTTestRunner>(object)
-        , m_callbackArguments(callbackArguments)
-        , m_numberOfArguments(numberOfArguments)
-    {
-    }
-
-    virtual void runIfValid()
-    {
-        CppVariant invokeResult;
-        m_callbackArguments[0].invokeDefault(m_callbackArguments.get(), m_numberOfArguments, invokeResult);
-    }
-
-private:
-    OwnArrayPtr<CppVariant> m_callbackArguments;
-    uint32_t m_numberOfArguments;
-};
-
-void DRTTestRunner::setBackingScaleFactor(const CppArgumentList& arguments, CppVariant* result)
-{
-    if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isObject())
-        return;
-    
-    float value = arguments[0].value.doubleValue;
-    m_shell->webViewHost()->setDeviceScaleFactor(value);
-
-    OwnArrayPtr<CppVariant> callbackArguments = adoptArrayPtr(new CppVariant[1]);
-    callbackArguments[0].set(arguments[1]);
-    result->setNull();
-    postTask(new InvokeCallbackTask(this, callbackArguments.release(), 1));
-}
-
 #if ENABLE(POINTER_LOCK)
 void DRTTestRunner::didAcquirePointerLock(const CppArgumentList&, CppVariant* result)
 {

Modified: trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h (139871 => 139872)


--- trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h	2013-01-16 12:16:41 UTC (rev 139871)
+++ trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h	2013-01-16 12:41:47 UTC (rev 139872)
@@ -93,13 +93,7 @@
     void queueLoad(const CppArgumentList&, CppVariant*);
     void queueLoadHTMLString(const CppArgumentList&, CppVariant*);
 
-    // Changes the cookie policy from the default to allow all cookies.
-    void setAlwaysAcceptCookies(const CppArgumentList&, CppVariant*);
 
-    // Gives focus to the window.
-    void setWindowIsKey(const CppArgumentList&, CppVariant*);
-
-
     // Causes navigation actions just printout the intended navigation instead
     // of taking you to the page. This is used for cases like mailto, where you
     // don't actually want to open the mail program.
@@ -117,9 +111,6 @@
     // Causes WillSendRequest to return an empty request.
     void setWillSendRequestReturnsNull(const CppArgumentList&, CppVariant*);
 
-    // Converts a URL starting with file:///tmp/ to the local mapping.
-    void pathToLocalResource(const CppArgumentList&, CppVariant*);
-
 #if ENABLE(NOTIFICATIONS)
     // Grants permission for desktop notifications to an origin
     void grantWebNotificationPermission(const CppArgumentList&, CppVariant*);
@@ -130,10 +121,6 @@
     void display(const CppArgumentList&, CppVariant*);
     void displayInvalidatedRegion(const CppArgumentList&, CppVariant*);
 
-    // Calls setlocale(LC_ALL, ...) for a specified locale.
-    // Resets between tests.
-    void setPOSIXLocale(const CppArgumentList&, CppVariant*);
-
     // Gets the number of geolocation permissions requests pending.
     void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*);
 
@@ -164,9 +151,6 @@
     void setPointerLockWillRespondAsynchronously(const CppArgumentList&, CppVariant*);
 #endif
 
-    // Used to set the device scale factor.
-    void setBackingScaleFactor(const CppArgumentList&, CppVariant*);
-
 public:
     // The following methods are not exposed to _javascript_.
     void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
@@ -198,8 +182,6 @@
         virtual bool run(TestShell*) = 0;
     };
 
-    WebTaskList* taskList() { return &m_taskList; }
-
 private:
     friend class WorkItem;
     friend class WorkQueue;
@@ -241,9 +223,6 @@
         virtual void runIfValid() { m_object->completeNotifyDone(true); }
     };
 
-    // Used for test timeouts.
-    WebTaskList m_taskList;
-
     // Non-owning pointer. The DRTTestRunner is owned by the host.
     TestShell* m_shell;
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h (139871 => 139872)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-01-16 12:16:41 UTC (rev 139871)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-01-16 12:41:47 UTC (rev 139872)
@@ -87,6 +87,11 @@
     virtual void evaluateInWebInspector(long, const std::string&) { }
     virtual void clearAllDatabases() { }
     virtual void setDatabaseQuota(int) { }
+    virtual void setDeviceScaleFactor(float) { }
+    virtual void setFocus(bool) { }
+    virtual void setAcceptAllCookies(bool) { }
+    virtual std::string pathToLocalResource(const std::string& resource) { return std::string(); }
+    virtual void setLocale(const std::string&) { }
 };
 
 }

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp (139871 => 139872)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-16 12:16:41 UTC (rev 139871)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-16 12:41:47 UTC (rev 139872)
@@ -47,12 +47,14 @@
 #include "WebSecurityPolicy.h"
 #include "WebSettings.h"
 #include "WebSurroundingText.h"
+#include "WebTask.h"
 #include "WebTestDelegate.h"
 #include "WebView.h"
 #include "WebWorkerInfo.h"
 #include "platform/WebPoint.h"
 #include "platform/WebSerializedScriptValue.h"
 #include "v8/include/v8.h"
+#include <wtf/OwnArrayPtr.h>
 #include <wtf/text/WTFString.h>
 
 #if OS(LINUX) || OS(ANDROID)
@@ -76,6 +78,26 @@
     virtual void destroy() { }
 };
 
+class InvokeCallbackTask : public WebMethodTask<TestRunner> {
+public:
+    InvokeCallbackTask(TestRunner* object, PassOwnArrayPtr<CppVariant> callbackArguments, uint32_t numberOfArguments)
+        : WebMethodTask<TestRunner>(object)
+        , m_callbackArguments(callbackArguments)
+        , m_numberOfArguments(numberOfArguments)
+    {
+    }
+
+    virtual void runIfValid()
+    {
+        CppVariant invokeResult;
+        m_callbackArguments[0].invokeDefault(m_callbackArguments.get(), m_numberOfArguments, invokeResult);
+    }
+
+private:
+    OwnArrayPtr<CppVariant> m_callbackArguments;
+    uint32_t m_numberOfArguments;
+};
+
 }
 
 TestRunner::TestRunner()
@@ -180,6 +202,11 @@
     bindMethod("evaluateInWebInspector", &TestRunner::evaluateInWebInspector);
     bindMethod("clearAllDatabases", &TestRunner::clearAllDatabases);
     bindMethod("setDatabaseQuota", &TestRunner::setDatabaseQuota);
+    bindMethod("setAlwaysAcceptCookies", &TestRunner::setAlwaysAcceptCookies);
+    bindMethod("setWindowIsKey", &TestRunner::setWindowIsKey);
+    bindMethod("pathToLocalResource", &TestRunner::pathToLocalResource);
+    bindMethod("setBackingScaleFactor", &TestRunner::setBackingScaleFactor);
+    bindMethod("setPOSIXLocale", &TestRunner::setPOSIXLocale);
 
     // Properties.
     bindProperty("workerThreadCount", &TestRunner::workerThreadCount);
@@ -249,6 +276,9 @@
 
     // Reset the default quota for each origin to 5MB
     m_delegate->setDatabaseQuota(5 * 1024 * 1024);
+    m_delegate->setDeviceScaleFactor(1);
+    m_delegate->setAcceptAllCookies(false);
+    m_delegate->setLocale("");
 
     m_dumpEditingCallbacks = false;
     m_dumpAsText = false;
@@ -282,6 +312,8 @@
     m_userStyleSheetLocation = WebURL();
 
     m_webPermissions->reset();
+
+    m_taskList.revokeAll();
 }
 
 void TestRunner::setTestIsRunning(bool running)
@@ -1320,6 +1352,50 @@
         m_delegate->setDatabaseQuota(arguments[0].toInt32());
 }
 
+void TestRunner::setAlwaysAcceptCookies(const CppArgumentList& arguments, CppVariant* result)
+{
+    if (arguments.size() > 0)
+        m_delegate->setAcceptAllCookies(cppVariantToBool(arguments[0]));
+    result->setNull();
+}
+
+void TestRunner::setWindowIsKey(const CppArgumentList& arguments, CppVariant* result)
+{
+    if (arguments.size() > 0 && arguments[0].isBool())
+        m_delegate->setFocus(arguments[0].value.boolValue);
+    result->setNull();
+}
+
+void TestRunner::pathToLocalResource(const CppArgumentList& arguments, CppVariant* result)
+{
+    result->setNull();
+    if (arguments.size() <= 0 || !arguments[0].isString())
+        return;
+
+    result->set(m_delegate->pathToLocalResource(arguments[0].toString()));
+}
+
+void TestRunner::setBackingScaleFactor(const CppArgumentList& arguments, CppVariant* result)
+{
+    if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isObject())
+        return;
+
+    float value = arguments[0].value.doubleValue;
+    m_delegate->setDeviceScaleFactor(value);
+
+    OwnArrayPtr<CppVariant> callbackArguments = adoptArrayPtr(new CppVariant[1]);
+    callbackArguments[0].set(arguments[1]);
+    result->setNull();
+    m_delegate->postTask(new InvokeCallbackTask(this, callbackArguments.release(), 1));
+}
+
+void TestRunner::setPOSIXLocale(const CppArgumentList& arguments, CppVariant* result)
+{
+    result->setNull();
+    if (arguments.size() == 1 && arguments[0].isString())
+        m_delegate->setLocale(arguments[0].toString());
+}
+
 void TestRunner::dumpEditingCallbacks(const CppArgumentList&, CppVariant* result)
 {
     m_dumpEditingCallbacks = true;

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h (139871 => 139872)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-16 12:16:41 UTC (rev 139871)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-16 12:41:47 UTC (rev 139872)
@@ -34,6 +34,7 @@
 
 #include "CppBoundClass.h"
 #include "WebDeliveredIntentClient.h"
+#include "WebTask.h"
 #include "WebTestRunner.h"
 #include "platform/WebArrayBufferView.h"
 #include "platform/WebURL.h"
@@ -59,6 +60,8 @@
 
     void reset();
 
+    WebTaskList* taskList() { return &m_taskList; }
+
     // WebTestRunner implementation.
     virtual void setTestIsRunning(bool) OVERRIDE;
     virtual bool shouldDumpEditingCallbacks() const OVERRIDE;
@@ -337,11 +340,27 @@
     // Sets the default quota for all origins
     void setDatabaseQuota(const CppArgumentList&, CppVariant*);
 
+    // Changes the cookie policy from the default to allow all cookies.
+    void setAlwaysAcceptCookies(const CppArgumentList&, CppVariant*);
+
+    // Gives focus to the window.
+    void setWindowIsKey(const CppArgumentList&, CppVariant*);
+
+    // Converts a URL starting with file:///tmp/ to the local mapping.
+    void pathToLocalResource(const CppArgumentList&, CppVariant*);
+
+    // Used to set the device scale factor.
+    void setBackingScaleFactor(const CppArgumentList&, CppVariant*);
+
+    // Calls setlocale(LC_ALL, ...) for a specified locale.
+    // Resets between tests.
+    void setPOSIXLocale(const CppArgumentList&, CppVariant*);
+
     ///////////////////////////////////////////////////////////////////////////
     // Properties
     void workerThreadCount(CppVariant*);
 
-    ///////////////////////////////////////////////////////////////////////////
+    //////////////////////////////////////////////////////////////////////////
     // Fallback and stub methods
 
     // The fallback method is called when a nonexistent method is called on
@@ -466,6 +485,9 @@
     // WAV audio data is stored here.
     WebKit::WebArrayBufferView m_audioData;
 
+    // Used for test timeouts.
+    WebTaskList m_taskList;
+
     WebTestDelegate* m_delegate;
     WebKit::WebView* m_webView;
 

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (139871 => 139872)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-01-16 12:16:41 UTC (rev 139871)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-01-16 12:41:47 UTC (rev 139872)
@@ -70,6 +70,8 @@
 #include "skia/ext/platform_canvas.h"
 #include "webkit/support/test_media_stream_client.h"
 #include "webkit/support/webkit_support.h"
+#include <cctype>
+#include <clocale>
 #include <public/WebCString.h>
 #include <public/WebCompositorOutputSurface.h>
 #include <public/WebCompositorSupport.h>
@@ -81,6 +83,7 @@
 #include <public/WebURLResponse.h>
 
 #include <wtf/Assertions.h>
+#include <wtf/OwnArrayPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
 
@@ -1078,6 +1081,60 @@
     webkit_support::SetDatabaseQuota(quota);
 }
 
+void WebViewHost::setDeviceScaleFactor(float deviceScaleFactor)
+{
+    webView()->setDeviceScaleFactor(deviceScaleFactor);
+    discardBackingStore();
+}
+
+void WebViewHost::setFocus(bool focused)
+{
+    m_shell->setFocus(m_shell->webView(), focused);
+}
+
+void WebViewHost::setAcceptAllCookies(bool acceptCookies)
+{
+    webkit_support::SetAcceptAllCookies(acceptCookies);
+}
+
+string WebViewHost::pathToLocalResource(const string& url)
+{
+#if OS(WINDOWS)
+    if (!url.find("/tmp/")) {
+        // We want a temp file.
+        const unsigned tempPrefixLength = 5;
+        size_t bufferSize = MAX_PATH;
+        OwnArrayPtr<WCHAR> tempPath = adoptArrayPtr(new WCHAR[bufferSize]);
+        DWORD tempLength = ::GetTempPathW(bufferSize, tempPath.get());
+        if (tempLength + url.length() - tempPrefixLength + 1 > bufferSize) {
+            bufferSize = tempLength + url.length() - tempPrefixLength + 1;
+            tempPath = adoptArrayPtr(new WCHAR[bufferSize]);
+            tempLength = GetTempPathW(bufferSize, tempPath.get());
+            ASSERT(tempLength < bufferSize);
+        }
+        string resultPath(WebString(tempPath.get(), tempLength).utf8());
+        resultPath.append(url.substr(tempPrefixLength));
+        return resultPath;
+    }
+#endif
+
+    // Some layout tests use file://// which we resolve as a UNC path. Normalize
+    // them to just file:///.
+    string lowerUrl = url;
+    string result = url;
+    transform(lowerUrl.begin(), lowerUrl.end(), lowerUrl.begin(), ::tolower);
+    while (!lowerUrl.find("file:////")) {
+        result = result.substr(0, 8) + result.substr(9);
+        lowerUrl = lowerUrl.substr(0, 8) + lowerUrl.substr(9);
+    }
+    return webkit_support::RewriteLayoutTestsURL(result).spec();
+}
+
+void WebViewHost::setLocale(const std::string& locale)
+{
+    setlocale(LC_ALL, locale.c_str());
+}
+
 // Public functions -----------------------------------------------------------
 
 WebViewHost::WebViewHost(TestShell* shell)
@@ -1401,12 +1458,6 @@
     m_pendingExtraData = extraData;
 }
 
-void WebViewHost::setDeviceScaleFactor(float deviceScaleFactor)
-{
-    webView()->setDeviceScaleFactor(deviceScaleFactor);
-    discardBackingStore();
-}
-
 void WebViewHost::setPageTitle(const WebString&)
 {
     // Nothing to do in layout test.

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (139871 => 139872)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-01-16 12:16:41 UTC (rev 139871)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-01-16 12:41:47 UTC (rev 139872)
@@ -96,7 +96,6 @@
     void setBlockRedirects(bool block) { m_blocksRedirects = block; }
     void setRequestReturnNull(bool returnNull) { m_requestReturnNull = returnNull; }
     void setPendingExtraData(PassOwnPtr<TestShellExtraData>);
-    void setDeviceScaleFactor(float);
 
     void paintRect(const WebKit::WebRect&);
     void paintInvalidatedRegion();
@@ -156,6 +155,11 @@
     virtual void evaluateInWebInspector(long, const std::string&) OVERRIDE;
     virtual void clearAllDatabases() OVERRIDE;
     virtual void setDatabaseQuota(int) OVERRIDE;
+    virtual void setDeviceScaleFactor(float) OVERRIDE;
+    virtual void setFocus(bool) OVERRIDE;
+    virtual void setAcceptAllCookies(bool) OVERRIDE;
+    virtual std::string pathToLocalResource(const std::string& url) OVERRIDE;
+    virtual void setLocale(const std::string&) OVERRIDE;
 
     // NavigationHost
     virtual bool navigate(const TestNavigationEntry&, bool reload);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to