Title: [140269] trunk/Tools
Revision
140269
Author
[email protected]
Date
2013-01-20 01:40:09 -0800 (Sun, 20 Jan 2013)

Log Message

[chromium] move geolocation related methods to TestRunner
https://bugs.webkit.org/show_bug.cgi?id=107267

Reviewed by Adam Barth.

* DumpRenderTree/chromium/DRTTestRunner.cpp:
(DRTTestRunner::DRTTestRunner):
* DumpRenderTree/chromium/DRTTestRunner.h:
(DRTTestRunner):
* DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
(WebTestRunner::WebTestDelegate::numberOfPendingGeolocationPermissionRequests):
(WebTestRunner::WebTestDelegate::setGeolocationPermission):
(WebTestRunner::WebTestDelegate::setMockGeolocationPosition):
(WebTestRunner::WebTestDelegate::setMockGeolocationPositionUnavailableError):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
(WebTestRunner::TestRunner::TestRunner):
(WebTestRunner::TestRunner::numberOfPendingGeolocationPermissionRequests):
(WebTestRunner):
(WebTestRunner::TestRunner::setGeolocationPermission):
(WebTestRunner::TestRunner::setMockGeolocationPosition):
(WebTestRunner::TestRunner::setMockGeolocationPositionUnavailableError):
* DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
(TestRunner):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::numberOfPendingGeolocationPermissionRequests):
(WebViewHost::setGeolocationPermission):
(WebViewHost::setMockGeolocationPosition):
(WebViewHost::setMockGeolocationPositionUnavailableError):
* DumpRenderTree/chromium/WebViewHost.h:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (140268 => 140269)


--- trunk/Tools/ChangeLog	2013-01-20 07:14:27 UTC (rev 140268)
+++ trunk/Tools/ChangeLog	2013-01-20 09:40:09 UTC (rev 140269)
@@ -1,3 +1,35 @@
+2013-01-20  Jochen Eisinger  <[email protected]>
+
+        [chromium] move geolocation related methods to TestRunner
+        https://bugs.webkit.org/show_bug.cgi?id=107267
+
+        Reviewed by Adam Barth.
+
+        * DumpRenderTree/chromium/DRTTestRunner.cpp:
+        (DRTTestRunner::DRTTestRunner):
+        * DumpRenderTree/chromium/DRTTestRunner.h:
+        (DRTTestRunner):
+        * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h:
+        (WebTestRunner::WebTestDelegate::numberOfPendingGeolocationPermissionRequests):
+        (WebTestRunner::WebTestDelegate::setGeolocationPermission):
+        (WebTestRunner::WebTestDelegate::setMockGeolocationPosition):
+        (WebTestRunner::WebTestDelegate::setMockGeolocationPositionUnavailableError):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp:
+        (WebTestRunner::TestRunner::TestRunner):
+        (WebTestRunner::TestRunner::numberOfPendingGeolocationPermissionRequests):
+        (WebTestRunner):
+        (WebTestRunner::TestRunner::setGeolocationPermission):
+        (WebTestRunner::TestRunner::setMockGeolocationPosition):
+        (WebTestRunner::TestRunner::setMockGeolocationPositionUnavailableError):
+        * DumpRenderTree/chromium/TestRunner/src/TestRunner.h:
+        (TestRunner):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::numberOfPendingGeolocationPermissionRequests):
+        (WebViewHost::setGeolocationPermission):
+        (WebViewHost::setMockGeolocationPosition):
+        (WebViewHost::setMockGeolocationPositionUnavailableError):
+        * DumpRenderTree/chromium/WebViewHost.h:
+
 2013-01-19  Zan Dobersek  <[email protected]>
 
         Unreviewed build fix for Qt WK2 after r140258.

Modified: trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp (140268 => 140269)


--- trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp	2013-01-20 07:14:27 UTC (rev 140268)
+++ trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp	2013-01-20 09:40:09 UTC (rev 140269)
@@ -45,7 +45,6 @@
 #include "WebElement.h"
 #include "WebFindOptions.h"
 #include "WebFrame.h"
-#include "WebGeolocationClientMock.h"
 #include "WebIDBFactory.h"
 #include "WebInputElement.h"
 #include "WebKit.h"
@@ -107,7 +106,6 @@
     bindMethod("grantWebNotificationPermission", &DRTTestRunner::grantWebNotificationPermission);
 #endif
     bindMethod("notifyDone", &DRTTestRunner::notifyDone);
-    bindMethod("numberOfPendingGeolocationPermissionRequests", &DRTTestRunner:: numberOfPendingGeolocationPermissionRequests);
     bindMethod("queueBackNavigation", &DRTTestRunner::queueBackNavigation);
     bindMethod("queueForwardNavigation", &DRTTestRunner::queueForwardNavigation);
     bindMethod("queueLoadingScript", &DRTTestRunner::queueLoadingScript);
@@ -117,9 +115,6 @@
     bindMethod("queueReload", &DRTTestRunner::queueReload);
     bindMethod("setCloseRemainingWindowsWhenComplete", &DRTTestRunner::setCloseRemainingWindowsWhenComplete);
     bindMethod("setCustomPolicyDelegate", &DRTTestRunner::setCustomPolicyDelegate);
-    bindMethod("setGeolocationPermission", &DRTTestRunner::setGeolocationPermission);
-    bindMethod("setMockGeolocationPositionUnavailableError", &DRTTestRunner::setMockGeolocationPositionUnavailableError);
-    bindMethod("setMockGeolocationPosition", &DRTTestRunner::setMockGeolocationPosition);
     bindMethod("setWillSendRequestClearHeader", &DRTTestRunner::setWillSendRequestClearHeader);
     bindMethod("setWillSendRequestReturnsNull", &DRTTestRunner::setWillSendRequestReturnsNull);
     bindMethod("setWillSendRequestReturnsNullOnRedirect", &DRTTestRunner::setWillSendRequestReturnsNullOnRedirect);
@@ -503,49 +498,6 @@
     result->setNull();
 }
 
-void DRTTestRunner::numberOfPendingGeolocationPermissionRequests(const CppArgumentList& arguments, CppVariant* result)
-{
-    result->setNull();
-    Vector<WebViewHost*> windowList = m_shell->windowList();
-    int numberOfRequests = 0;
-    for (size_t i = 0; i < windowList.size(); i++)
-        numberOfRequests += windowList[i]->geolocationClientMock()->numberOfPendingPermissionRequests();
-    result->set(numberOfRequests);
-}
-
-// FIXME: For greater test flexibility, we should be able to set each page's geolocation mock individually.
-// https://bugs.webkit.org/show_bug.cgi?id=52368
-void DRTTestRunner::setGeolocationPermission(const CppArgumentList& arguments, CppVariant* result)
-{
-    result->setNull();
-    if (arguments.size() < 1 || !arguments[0].isBool())
-        return;
-    Vector<WebViewHost*> windowList = m_shell->windowList();
-    for (size_t i = 0; i < windowList.size(); i++)
-        windowList[i]->geolocationClientMock()->setPermission(arguments[0].toBoolean());
-}
-
-void DRTTestRunner::setMockGeolocationPosition(const CppArgumentList& arguments, CppVariant* result)
-{
-    result->setNull();
-    if (arguments.size() < 3 || !arguments[0].isNumber() || !arguments[1].isNumber() || !arguments[2].isNumber())
-        return;
-    Vector<WebViewHost*> windowList = m_shell->windowList();
-    for (size_t i = 0; i < windowList.size(); i++)
-        windowList[i]->geolocationClientMock()->setPosition(arguments[0].toDouble(), arguments[1].toDouble(), arguments[2].toDouble());
-}
-
-void DRTTestRunner::setMockGeolocationPositionUnavailableError(const CppArgumentList& arguments, CppVariant* result)
-{
-    result->setNull();
-    if (arguments.size() != 1 || !arguments[0].isString())
-        return;
-    Vector<WebViewHost*> windowList = m_shell->windowList();
-    // FIXME: Benjamin
-    for (size_t i = 0; i < windowList.size(); i++)
-        windowList[i]->geolocationClientMock()->setPositionUnavailableError(cppVariantToWebString(arguments[0]));
-}
-
 #if ENABLE(INPUT_SPEECH)
 void DRTTestRunner::addMockSpeechInputResult(const CppArgumentList& arguments, CppVariant* result)
 {

Modified: trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h (140268 => 140269)


--- trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h	2013-01-20 07:14:27 UTC (rev 140268)
+++ trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h	2013-01-20 09:40:09 UTC (rev 140269)
@@ -50,10 +50,6 @@
 #include <wtf/Deque.h>
 #include <wtf/OwnPtr.h>
 
-namespace WebKit {
-class WebGeolocationClientMock;
-}
-
 namespace webkit_support {
 class ScopedTempDirectory;
 }
@@ -121,14 +117,6 @@
     void display(const CppArgumentList&, CppVariant*);
     void displayInvalidatedRegion(const CppArgumentList&, CppVariant*);
 
-    // Gets the number of geolocation permissions requests pending.
-    void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*);
-
-    // Geolocation related functions.
-    void setGeolocationPermission(const CppArgumentList&, CppVariant*);
-    void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
-    void setMockGeolocationPositionUnavailableError(const CppArgumentList&, CppVariant*);
-
     // Speech input related functions.
 #if ENABLE(INPUT_SPEECH)
     void addMockSpeechInputResult(const CppArgumentList&, CppVariant*);

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


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-01-20 07:14:27 UTC (rev 140268)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h	2013-01-20 09:40:09 UTC (rev 140269)
@@ -99,6 +99,10 @@
     virtual void didLosePointerLock() { }
     virtual void setPointerLockWillRespondAsynchronously() { }
     virtual void setPointerLockWillFailSynchronously() { }
+    virtual int numberOfPendingGeolocationPermissionRequests() { return 0; }
+    virtual void setGeolocationPermission(bool) { }
+    virtual void setMockGeolocationPosition(double, double, double) { }
+    virtual void setMockGeolocationPositionUnavailableError(const std::string&) { }
 };
 
 }

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp (140268 => 140269)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-20 07:14:27 UTC (rev 140268)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp	2013-01-20 09:40:09 UTC (rev 140269)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2010 Google Inc. All rights reserved.
  * Copyright (C) 2010 Pawel Hajdan ([email protected])
+ * Copyright (C) 2012 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -216,6 +217,10 @@
     bindMethod("pathToLocalResource", &TestRunner::pathToLocalResource);
     bindMethod("setBackingScaleFactor", &TestRunner::setBackingScaleFactor);
     bindMethod("setPOSIXLocale", &TestRunner::setPOSIXLocale);
+    bindMethod("numberOfPendingGeolocationPermissionRequests", &TestRunner:: numberOfPendingGeolocationPermissionRequests);
+    bindMethod("setGeolocationPermission", &TestRunner::setGeolocationPermission);
+    bindMethod("setMockGeolocationPositionUnavailableError", &TestRunner::setMockGeolocationPositionUnavailableError);
+    bindMethod("setMockGeolocationPosition", &TestRunner::setMockGeolocationPosition);
 
     // Properties.
     bindProperty("workerThreadCount", &TestRunner::workerThreadCount);
@@ -1426,6 +1431,37 @@
         m_delegate->setLocale(arguments[0].toString());
 }
 
+void TestRunner::numberOfPendingGeolocationPermissionRequests(const CppArgumentList& arguments, CppVariant* result)
+{
+    result->set(m_delegate->numberOfPendingGeolocationPermissionRequests());
+}
+
+// FIXME: For greater test flexibility, we should be able to set each page's geolocation mock individually.
+// https://bugs.webkit.org/show_bug.cgi?id=52368
+void TestRunner::setGeolocationPermission(const CppArgumentList& arguments, CppVariant* result)
+{
+    result->setNull();
+    if (arguments.size() < 1 || !arguments[0].isBool())
+        return;
+    m_delegate->setGeolocationPermission(arguments[0].toBoolean());
+}
+
+void TestRunner::setMockGeolocationPosition(const CppArgumentList& arguments, CppVariant* result)
+{
+    result->setNull();
+    if (arguments.size() < 3 || !arguments[0].isNumber() || !arguments[1].isNumber() || !arguments[2].isNumber())
+        return;
+    m_delegate->setMockGeolocationPosition(arguments[0].toDouble(), arguments[1].toDouble(), arguments[2].toDouble());
+}
+
+void TestRunner::setMockGeolocationPositionUnavailableError(const CppArgumentList& arguments, CppVariant* result)
+{
+    result->setNull();
+    if (arguments.size() != 1 || !arguments[0].isString())
+        return;
+    m_delegate->setMockGeolocationPositionUnavailableError(arguments[0].toString());
+}
+
 void TestRunner::dumpEditingCallbacks(const CppArgumentList&, CppVariant* result)
 {
     m_dumpEditingCallbacks = true;

Modified: trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h (140268 => 140269)


--- trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-20 07:14:27 UTC (rev 140268)
+++ trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h	2013-01-20 09:40:09 UTC (rev 140269)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2010 Google Inc. All rights reserved.
  * Copyright (C) 2010 Pawel Hajdan ([email protected])
+ * Copyright (C) 2012 Apple Inc. All Rights Reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -367,6 +368,14 @@
     // Resets between tests.
     void setPOSIXLocale(const CppArgumentList&, CppVariant*);
 
+    // Gets the number of geolocation permissions requests pending.
+    void numberOfPendingGeolocationPermissionRequests(const CppArgumentList&, CppVariant*);
+
+    // Geolocation related functions.
+    void setGeolocationPermission(const CppArgumentList&, CppVariant*);
+    void setMockGeolocationPosition(const CppArgumentList&, CppVariant*);
+    void setMockGeolocationPositionUnavailableError(const CppArgumentList&, CppVariant*);
+
     ///////////////////////////////////////////////////////////////////////////
     // Properties
     void workerThreadCount(CppVariant*);

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (140268 => 140269)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-01-20 07:14:27 UTC (rev 140268)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2013-01-20 09:40:09 UTC (rev 140269)
@@ -1140,6 +1140,37 @@
     deviceOrientationClientMock()->setOrientation(orientation);
 }
 
+int WebViewHost::numberOfPendingGeolocationPermissionRequests()
+{
+    Vector<WebViewHost*> windowList = m_shell->windowList();
+    int numberOfRequests = 0;
+    for (size_t i = 0; i < windowList.size(); i++)
+        numberOfRequests += windowList[i]->geolocationClientMock()->numberOfPendingPermissionRequests();
+    return numberOfRequests;
+}
+
+void WebViewHost::setGeolocationPermission(bool allowed)
+{
+    Vector<WebViewHost*> windowList = m_shell->windowList();
+    for (size_t i = 0; i < windowList.size(); i++)
+        windowList[i]->geolocationClientMock()->setPermission(allowed);
+}
+
+void WebViewHost::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
+{
+    Vector<WebViewHost*> windowList = m_shell->windowList();
+    for (size_t i = 0; i < windowList.size(); i++)
+        windowList[i]->geolocationClientMock()->setPosition(latitude, longitude, accuracy);
+}
+
+void WebViewHost::setMockGeolocationPositionUnavailableError(const std::string& message)
+{
+    Vector<WebViewHost*> windowList = m_shell->windowList();
+    // FIXME: Benjamin
+    for (size_t i = 0; i < windowList.size(); i++)
+        windowList[i]->geolocationClientMock()->setPositionUnavailableError(WebString::fromUTF8(message));
+}
+
 // Public functions -----------------------------------------------------------
 
 WebViewHost::WebViewHost(TestShell* shell)

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.h (140268 => 140269)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-01-20 07:14:27 UTC (rev 140268)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.h	2013-01-20 09:40:09 UTC (rev 140269)
@@ -160,6 +160,10 @@
     virtual void setPointerLockWillRespondAsynchronously() OVERRIDE { m_pointerLockPlannedResult = PointerLockWillRespondAsync; }
     virtual void setPointerLockWillFailSynchronously() OVERRIDE { m_pointerLockPlannedResult = PointerLockWillFailSync; }
 #endif
+    virtual int numberOfPendingGeolocationPermissionRequests() OVERRIDE;
+    virtual void setGeolocationPermission(bool) OVERRIDE;
+    virtual void setMockGeolocationPosition(double, double, double) OVERRIDE;
+    virtual void setMockGeolocationPositionUnavailableError(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