Title: [141237] trunk/Tools
Revision
141237
Author
[email protected]
Date
2013-01-30 02:13:22 -0800 (Wed, 30 Jan 2013)

Log Message

[chromium] move methods from WebTestDelegate to WebTestRunner
https://bugs.webkit.org/show_bug.cgi?id=108309

Reviewed by Adam Barth.

By moving more logic to the TestRunner library, we can share more
code with content shell.

* DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
* DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:
(WebTestProxyBase):
(WebTestRunner::WebTestProxy::createView):
(WebTestRunner::WebTestProxy::isSmartInsertDeleteEnabled):
(WebTestRunner::WebTestProxy::isSelectTrailingWhitespaceEnabled):
* DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h:
(WebTestRunner::WebTestRunner::isSmartInsertDeleteEnabled):
(WebTestRunner::WebTestRunner::isSelectTrailingWhitespaceEnabled):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::reset):
(WebTestRunner::TestRunner::isSmartInsertDeleteEnabled):
(WebTestRunner):
(WebTestRunner::TestRunner::isSelectTrailingWhitespaceEnabled):
(WebTestRunner::TestRunner::setSmartInsertDeleteEnabled):
(WebTestRunner::TestRunner::setSelectTrailingWhitespaceEnabled):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(TestRunner):
* DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:
(WebTestRunner::WebTestProxyBase::createView):
(WebTestRunner::WebTestProxyBase::isSmartInsertDeleteEnabled):
(WebTestRunner):
(WebTestRunner::WebTestProxyBase::isSelectTrailingWhitespaceEnabled):
* DumpRenderTree/chromium/TestShell.h:
(TestShell):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::createView):
(WebViewHost::didStartLoading):
(WebViewHost::didStopLoading):
(WebViewHost::isSmartInsertDeleteEnabled):
(WebViewHost::isSelectTrailingWhitespaceEnabled):
(WebViewHost::reset):
* DumpRenderTree/chromium/WebViewHost.h:
(WebViewHost):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (141236 => 141237)


--- trunk/Tools/ChangeLog	2013-01-30 09:50:30 UTC (rev 141236)
+++ trunk/Tools/ChangeLog	2013-01-30 10:13:22 UTC (rev 141237)
@@ -1,3 +1,48 @@
+2013-01-30  Jochen Eisinger  <[email protected]>
+
+        [chromium] move methods from WebTestDelegate to WebTestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=108309
+
+        Reviewed by Adam Barth.
+
+        By moving more logic to the TestRunner library, we can share more
+        code with content shell.
+
+        * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
+        * DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h:
+        (WebTestProxyBase):
+        (WebTestRunner::WebTestProxy::createView):
+        (WebTestRunner::WebTestProxy::isSmartInsertDeleteEnabled):
+        (WebTestRunner::WebTestProxy::isSelectTrailingWhitespaceEnabled):
+        * DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h:
+        (WebTestRunner::WebTestRunner::isSmartInsertDeleteEnabled):
+        (WebTestRunner::WebTestRunner::isSelectTrailingWhitespaceEnabled):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
+        (WebTestRunner::TestRunner::reset):
+        (WebTestRunner::TestRunner::isSmartInsertDeleteEnabled):
+        (WebTestRunner):
+        (WebTestRunner::TestRunner::isSelectTrailingWhitespaceEnabled):
+        (WebTestRunner::TestRunner::setSmartInsertDeleteEnabled):
+        (WebTestRunner::TestRunner::setSelectTrailingWhitespaceEnabled):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
+        (TestRunner):
+        * DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp:
+        (WebTestRunner::WebTestProxyBase::createView):
+        (WebTestRunner::WebTestProxyBase::isSmartInsertDeleteEnabled):
+        (WebTestRunner):
+        (WebTestRunner::WebTestProxyBase::isSelectTrailingWhitespaceEnabled):
+        * DumpRenderTree/chromium/TestShell.h:
+        (TestShell):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::createView):
+        (WebViewHost::didStartLoading):
+        (WebViewHost::didStopLoading):
+        (WebViewHost::isSmartInsertDeleteEnabled):
+        (WebViewHost::isSelectTrailingWhitespaceEnabled):
+        (WebViewHost::reset):
+        * DumpRenderTree/chromium/WebViewHost.h:
+        (WebViewHost):
+
 2013-01-30  Kwang Yul Seo  <[email protected]>
 
         Unreviewed. Add Jae Hyun Park to contributor list.

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


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-01-30 09:50:30 UTC (rev 141236)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-01-30 10:13:22 UTC (rev 141237)
@@ -81,8 +81,6 @@
     virtual std::string makeURLErrorDescription(const WebKit::WebURLError&) { return std::string(); }
     virtual std::string normalizeLayoutTestURL(const std::string&) { return std::string(); }
     virtual void setClientWindowRect(const WebKit::WebRect&) { }
-    virtual void setSelectTrailingWhitespaceEnabled(bool) { }
-    virtual void setSmartInsertDeleteEnabled(bool) { }
     virtual void showDevTools() { }
     virtual void closeDevTools() { }
     virtual void evaluateInWebInspector(long, const std::string&) { }

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h (141236 => 141237)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h	2013-01-30 09:50:30 UTC (rev 141236)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h	2013-01-30 10:13:22 UTC (rev 141237)
@@ -113,9 +113,11 @@
     void didEndEditing();
     void registerIntentService(WebKit::WebFrame*, const WebKit::WebIntentServiceInfo&);
     void dispatchIntent(WebKit::WebFrame* source, const WebKit::WebIntentRequest&);
-    WebKit::WebView* createView(WebKit::WebFrame* creator, const WebKit::WebURLRequest&, const WebKit::WebWindowFeatures&, const WebKit::WebString& frameName, WebKit::WebNavigationPolicy);
+    bool createView(WebKit::WebFrame* creator, const WebKit::WebURLRequest&, const WebKit::WebWindowFeatures&, const WebKit::WebString& frameName, WebKit::WebNavigationPolicy);
     void setStatusText(const WebKit::WebString&);
     void didStopLoading();
+    bool isSmartInsertDeleteEnabled();
+    bool isSelectTrailingWhitespaceEnabled();
 
     void willPerformClientRedirect(WebKit::WebFrame*, const WebKit::WebURL& from, const WebKit::WebURL& to, double interval, double fire_time);
     void didCancelClientRedirect(WebKit::WebFrame*);
@@ -284,7 +286,8 @@
     }
     virtual WebKit::WebView* createView(WebKit::WebFrame* creator, const WebKit::WebURLRequest& request, const WebKit::WebWindowFeatures& features, const WebKit::WebString& frameName, WebKit::WebNavigationPolicy policy)
     {
-        WebTestProxyBase::createView(creator, request, features, frameName, policy);
+        if (!WebTestProxyBase::createView(creator, request, features, frameName, policy))
+            return 0;
         return Base::createView(creator, request, features, frameName, policy);
     }
     virtual void setStatusText(const WebKit::WebString& text)
@@ -297,6 +300,14 @@
         WebTestProxyBase::didStopLoading();
         Base::didStopLoading();
     }
+    virtual bool isSmartInsertDeleteEnabled()
+    {
+        return WebTestProxyBase::isSmartInsertDeleteEnabled();
+    }
+    virtual bool isSelectTrailingWhitespaceEnabled()
+    {
+        return WebTestProxyBase::isSelectTrailingWhitespaceEnabled();
+    }
 
     // WebFrameClient implementation.
     virtual void willPerformClientRedirect(WebKit::WebFrame* frame, const WebKit::WebURL& from, const WebKit::WebURL& to, double interval, double fireTime)

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h (141236 => 141237)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h	2013-01-30 09:50:30 UTC (rev 141236)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h	2013-01-30 10:13:22 UTC (rev 141237)
@@ -84,6 +84,8 @@
     virtual WebKit::WebFrame* topLoadingFrame() const { return 0; }
     virtual void policyDelegateDone() { }
     virtual bool shouldInterceptPostMessage() const { return false; }
+    virtual bool isSmartInsertDeleteEnabled() const { return true; }
+    virtual bool isSelectTrailingWhitespaceEnabled() const { return false; }
 };
 
 }

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp (141236 => 141237)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-30 09:50:30 UTC (rev 141236)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-30 10:13:22 UTC (rev 141237)
@@ -415,6 +415,12 @@
     m_shouldStayOnPageAfterHandlingBeforeUnload = false;
     m_shouldBlockRedirects = false;
     m_willSendRequestShouldReturnNull = false;
+    m_smartInsertDeleteEnabled = true;
+#if OS(WINDOWS)
+    m_selectTrailingWhitespaceEnabled = true;
+#else
+    m_selectTrailingWhitespaceEnabled = false;
+#endif
 
     m_httpHeadersToClear.clear();
 
@@ -636,6 +642,16 @@
     return m_interceptPostMessage.isBool() && m_interceptPostMessage.toBoolean();
 }
 
+bool TestRunner::isSmartInsertDeleteEnabled() const
+{
+    return m_smartInsertDeleteEnabled;
+}
+
+bool TestRunner::isSelectTrailingWhitespaceEnabled() const
+{
+    return m_selectTrailingWhitespaceEnabled;
+}
+
 void TestRunner::waitUntilDone(const CppArgumentList&, CppVariant* result)
 {
     if (!m_delegate->isBeingDebugged())
@@ -1471,14 +1487,14 @@
 void TestRunner::setSmartInsertDeleteEnabled(const CppArgumentList& arguments, CppVariant* result)
 {
     if (arguments.size() > 0 && arguments[0].isBool())
-        m_delegate->setSmartInsertDeleteEnabled(arguments[0].value.boolValue);
+        m_smartInsertDeleteEnabled = arguments[0].value.boolValue;
     result->setNull();
 }
 
 void TestRunner::setSelectTrailingWhitespaceEnabled(const CppArgumentList& arguments, CppVariant* result)
 {
     if (arguments.size() > 0 && arguments[0].isBool())
-        m_delegate->setSelectTrailingWhitespaceEnabled(arguments[0].value.boolValue);
+        m_selectTrailingWhitespaceEnabled = arguments[0].value.boolValue;
     result->setNull();
 }
 

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h (141236 => 141237)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-30 09:50:30 UTC (rev 141236)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-30 10:13:22 UTC (rev 141237)
@@ -102,6 +102,8 @@
     virtual WebKit::WebFrame* topLoadingFrame() const OVERRIDE;
     virtual void policyDelegateDone() OVERRIDE;
     virtual bool shouldInterceptPostMessage() const OVERRIDE;
+    virtual bool isSmartInsertDeleteEnabled() const OVERRIDE;
+    virtual bool isSelectTrailingWhitespaceEnabled() const OVERRIDE;
 
     // A single item in the work queue.
     class WorkItem {
@@ -639,6 +641,10 @@
 
     bool m_willSendRequestShouldReturnNull;
 
+    bool m_smartInsertDeleteEnabled;
+
+    bool m_selectTrailingWhitespaceEnabled;
+
     std::set<std::string> m_httpHeadersToClear;
 
     // WAV audio data is stored here.

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp (141236 => 141237)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp	2013-01-30 09:50:30 UTC (rev 141236)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp	2013-01-30 10:13:22 UTC (rev 141237)
@@ -544,13 +544,13 @@
         m_delegate->printMessage(string("Have suggestion ") + suggestions[i].spec().data() + "\n");
 }
 
-WebView* WebTestProxyBase::createView(WebFrame*, const WebURLRequest& request, const WebWindowFeatures&, const WebString&, WebNavigationPolicy)
+bool WebTestProxyBase::createView(WebFrame*, const WebURLRequest& request, const WebWindowFeatures&, const WebString&, WebNavigationPolicy)
 {
     if (!m_testInterfaces->testRunner() || !m_testInterfaces->testRunner()->canOpenWindows())
-        return 0;
+        return false;
     if (m_testInterfaces->testRunner()->shouldDumpCreateView())
         m_delegate->printMessage(string("createView(") + URLDescription(request.url()) + ")\n");
-    return 0;
+    return true;
 }
 
 void WebTestProxyBase::setStatusText(const WebString& text)
@@ -566,6 +566,20 @@
         m_delegate->printMessage("postProgressFinishedNotification\n");
 }
 
+bool WebTestProxyBase::isSmartInsertDeleteEnabled()
+{
+    if (m_testInterfaces->testRunner())
+        return m_testInterfaces->testRunner()->isSmartInsertDeleteEnabled();
+    return true;
+}
+
+bool WebTestProxyBase::isSelectTrailingWhitespaceEnabled()
+{
+    if (m_testInterfaces->testRunner())
+        return m_testInterfaces->testRunner()->isSelectTrailingWhitespaceEnabled();
+    return false;
+}
+
 void WebTestProxyBase::willPerformClientRedirect(WebFrame* frame, const WebURL&, const WebURL& to, double, double)
 {
     if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) {

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.h (141236 => 141237)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.h	2013-01-30 09:50:30 UTC (rev 141236)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.h	2013-01-30 10:13:22 UTC (rev 141237)
@@ -111,7 +111,6 @@
     bool shouldDumpResourceRequestCallbacks() const { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpResourceRequestCallbacks(); }
     bool shouldDumpResourceLoadCallbacks() const  { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpResourceLoadCallbacks(); }
     bool shouldDumpResourceResponseMIMETypes() const  { return (m_testIsPreparing || m_testIsPending) && testRunner()->shouldDumpResourceResponseMIMETypes(); }
-    void setIsLoading(bool flag) { m_isLoading = flag; }
 
     // Called by the DRTTestRunner to signal test completion.
     void testFinished();
@@ -200,7 +199,6 @@
 
     bool m_testIsPending;
     bool m_testIsPreparing;
-    bool m_isLoading;
     WebKit::WebView* m_webView;
     WebKit::WebWidget* m_focusedWidget;
     WebViewHost* m_devTools;

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (141236 => 141237)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-01-30 09:50:30 UTC (rev 141236)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-01-30 10:13:22 UTC (rev 141237)
@@ -152,8 +152,6 @@
 
 WebView* WebViewHost::createView(WebFrame* creator, const WebURLRequest&, const WebWindowFeatures&, const WebString&, WebNavigationPolicy)
 {
-    if (!testRunner()->canOpenWindows())
-        return 0;
     creator->consumeUserGesture();
     return m_shell->createNewWindow(WebURL())->webView();
 }
@@ -203,12 +201,10 @@
 
 void WebViewHost::didStartLoading()
 {
-    m_shell->setIsLoading(true);
 }
 
 void WebViewHost::didStopLoading()
 {
-    m_shell->setIsLoading(false);
 }
 
 bool WebViewHost::shouldBeginEditing(const WebRange& range)
@@ -249,12 +245,16 @@
 
 bool WebViewHost::isSmartInsertDeleteEnabled()
 {
-    return m_smartInsertDeleteEnabled;
+    return true;
 }
 
 bool WebViewHost::isSelectTrailingWhitespaceEnabled()
 {
-    return m_selectTrailingWhitespaceEnabled;
+#if OS(WINDOWS)
+    return true;
+#else
+    return false;
+#endif
 }
 
 bool WebViewHost::handleCurrentKeyboardEvent()
@@ -1190,12 +1190,6 @@
     m_lastPageIdUpdated = -1;
     m_hasWindow = false;
     m_inModalLoop = false;
-    m_smartInsertDeleteEnabled = true;
-#if OS(WINDOWS)
-    m_selectTrailingWhitespaceEnabled = true;
-#else
-    m_selectTrailingWhitespaceEnabled = false;
-#endif
     m_isPainting = false;
     m_canvas.clear();
 #if ENABLE(POINTER_LOCK)
@@ -1229,22 +1223,6 @@
     }
 }
 
-void WebViewHost::setSelectTrailingWhitespaceEnabled(bool enabled)
-{
-    m_selectTrailingWhitespaceEnabled = enabled;
-    // In upstream WebKit, smart insert/delete is mutually exclusive with select
-    // trailing whitespace, however, we allow both because Chromium on Windows
-    // allows both.
-}
-
-void WebViewHost::setSmartInsertDeleteEnabled(bool enabled)
-{
-    m_smartInsertDeleteEnabled = enabled;
-    // In upstream WebKit, smart insert/delete is mutually exclusive with select
-    // trailing whitespace, however, we allow both because Chromium on Windows
-    // allows both.
-}
-
 void WebViewHost::setClientWindowRect(const WebKit::WebRect& rect)
 {
     setWindowRect(rect);

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (141236 => 141237)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-01-30 09:50:30 UTC (rev 141236)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-01-30 10:13:22 UTC (rev 141237)
@@ -129,8 +129,6 @@
     virtual WebKit::WebIntentRequest* currentWebIntentRequest() OVERRIDE;
     virtual std::string makeURLErrorDescription(const WebKit::WebURLError&) OVERRIDE;
     virtual std::string normalizeLayoutTestURL(const std::string&) OVERRIDE;
-    virtual void setSelectTrailingWhitespaceEnabled(bool) OVERRIDE;
-    virtual void setSmartInsertDeleteEnabled(bool) OVERRIDE;
     virtual void setClientWindowRect(const WebKit::WebRect&) OVERRIDE;
     virtual void showDevTools() OVERRIDE;
     virtual void closeDevTools() OVERRIDE;
@@ -367,12 +365,6 @@
 
     WebKit::WebRect m_windowRect;
 
-    // true if we want to enable smart insert/delete.
-    bool m_smartInsertDeleteEnabled;
-
-    // true if we want to enable selection of trailing whitespaces
-    bool m_selectTrailingWhitespaceEnabled;
-
     // Edit command associated to the current keyboard event.
     std::string m_editCommandName;
     std::string m_editCommandValue;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to