summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-09-08 12:04:42 +0100
committerSteve Block <steveblock@google.com>2009-09-08 12:42:22 +0100
commit9c3710c76ea425248782469af80633fd63cb6f8d (patch)
tree1dfaee32b92c641accb4a2d95431e60a05f1cd96 /WebCore/platform
parent4bc61ed8a1dd316ae902cd9cfca5b7b2fb098159 (diff)
downloadexternal_webkit-9c3710c76ea425248782469af80633fd63cb6f8d.zip
external_webkit-9c3710c76ea425248782469af80633fd63cb6f8d.tar.gz
external_webkit-9c3710c76ea425248782469af80633fd63cb6f8d.tar.bz2
Updates mock Geolocation service to match final version submitted to WebKit.
See https://bugs.webkit.org/show_bug.cgi?id=28264. Change-Id: I30900239108ea699f194fceb30626f41c928c08e
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/GeolocationService.cpp8
-rw-r--r--WebCore/platform/GeolocationService.h1
-rw-r--r--[-rwxr-xr-x]WebCore/platform/mock/GeolocationServiceMock.cpp (renamed from WebCore/platform/MockGeolocationService.cpp)56
-rwxr-xr-xWebCore/platform/mock/GeolocationServiceMock.h (renamed from WebCore/platform/MockGeolocationService.h)20
4 files changed, 41 insertions, 44 deletions
diff --git a/WebCore/platform/GeolocationService.cpp b/WebCore/platform/GeolocationService.cpp
index 4fd678b..e60ef00 100644
--- a/WebCore/platform/GeolocationService.cpp
+++ b/WebCore/platform/GeolocationService.cpp
@@ -26,7 +26,7 @@
#include "config.h"
#include "GeolocationService.h"
#include "Geoposition.h"
-#include "MockGeolocationService.h"
+#include "GeolocationServiceMock.h"
#include "PositionError.h"
#include <wtf/CurrentTime.h>
@@ -35,12 +35,12 @@
namespace WebCore {
#if !ENABLE(GEOLOCATION)
-GeolocationService* createNullGeolocationService(GeolocationServiceClient*)
+static GeolocationService* createGeolocationServiceNull(GeolocationServiceClient*)
{
return 0;
}
-GeolocationService::FactoryFunction* GeolocationService::s_factoryFunction = &createNullGeolocationService;
+GeolocationService::FactoryFunction* GeolocationService::s_factoryFunction = &createGeolocationServiceNull;
#endif
GeolocationService* GeolocationService::create(GeolocationServiceClient* client)
@@ -50,7 +50,7 @@ GeolocationService* GeolocationService::create(GeolocationServiceClient* client)
void GeolocationService::useMock()
{
- s_factoryFunction = &MockGeolocationService::create;
+ s_factoryFunction = &GeolocationServiceMock::create;
}
GeolocationService::GeolocationService(GeolocationServiceClient* client)
diff --git a/WebCore/platform/GeolocationService.h b/WebCore/platform/GeolocationService.h
index a99523f..cebf313 100644
--- a/WebCore/platform/GeolocationService.h
+++ b/WebCore/platform/GeolocationService.h
@@ -27,7 +27,6 @@
#define GeolocationService_h
#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
namespace WebCore {
diff --git a/WebCore/platform/MockGeolocationService.cpp b/WebCore/platform/mock/GeolocationServiceMock.cpp
index b147f53..f187104 100755..100644
--- a/WebCore/platform/MockGeolocationService.cpp
+++ b/WebCore/platform/mock/GeolocationServiceMock.cpp
@@ -24,41 +24,43 @@
*/
#include "config.h"
-#include "MockGeolocationService.h"
+#include "GeolocationServiceMock.h"
+#include "Logging.h"
+#include "Geolocation.h"
#include "Geoposition.h"
#include "PositionError.h"
#include "PositionOptions.h"
namespace WebCore {
-MockGeolocationService::MockGeolocationServiceSet* MockGeolocationService::s_instances = 0;
-RefPtr<Geoposition>* MockGeolocationService::s_lastPosition;
-RefPtr<PositionError>* MockGeolocationService::s_lastError;
+GeolocationServiceMock::GeolocationServiceSet* GeolocationServiceMock::s_instances = 0;
+RefPtr<Geoposition>* GeolocationServiceMock::s_lastPosition;
+RefPtr<PositionError>* GeolocationServiceMock::s_lastError;
-GeolocationService* MockGeolocationService::create(GeolocationServiceClient* client)
+GeolocationService* GeolocationServiceMock::create(GeolocationServiceClient* client)
{
initStatics();
- return new MockGeolocationService(client);
+ return new GeolocationServiceMock(client);
}
-MockGeolocationService::MockGeolocationService(GeolocationServiceClient* client)
+GeolocationServiceMock::GeolocationServiceMock(GeolocationServiceClient* client)
: GeolocationService(client)
- , m_timer(this, &MockGeolocationService::timerFired)
+ , m_timer(this, &GeolocationServiceMock::timerFired)
, m_isActive(false)
{
s_instances->add(this);
}
-MockGeolocationService::~MockGeolocationService()
+GeolocationServiceMock::~GeolocationServiceMock()
{
- MockGeolocationServiceSet::iterator iter = s_instances->find(this);
+ GeolocationServiceSet::iterator iter = s_instances->find(this);
ASSERT(iter != s_instances->end());
s_instances->remove(iter);
cleanUpStatics();
}
-void MockGeolocationService::setPosition(PassRefPtr<Geoposition> position)
+void GeolocationServiceMock::setPosition(PassRefPtr<Geoposition> position)
{
initStatics();
GeolocationService::useMock();
@@ -67,7 +69,7 @@ void MockGeolocationService::setPosition(PassRefPtr<Geoposition> position)
makeGeolocationCallbackFromAllInstances();
}
-void MockGeolocationService::setError(PassRefPtr<PositionError> error)
+void GeolocationServiceMock::setError(PassRefPtr<PositionError> error)
{
initStatics();
GeolocationService::useMock();
@@ -76,56 +78,52 @@ void MockGeolocationService::setError(PassRefPtr<PositionError> error)
makeGeolocationCallbackFromAllInstances();
}
-bool MockGeolocationService::startUpdating(PositionOptions*)
+bool GeolocationServiceMock::startUpdating(PositionOptions*)
{
m_isActive = true;
m_timer.startOneShot(0);
return true;
}
-void MockGeolocationService::stopUpdating()
+void GeolocationServiceMock::stopUpdating()
{
m_isActive = false;
}
-void MockGeolocationService::timerFired(Timer<MockGeolocationService>* timer)
+void GeolocationServiceMock::timerFired(Timer<GeolocationServiceMock>* timer)
{
ASSERT_UNUSED(timer, timer == &m_timer);
makeGeolocationCallback();
}
-void MockGeolocationService::makeGeolocationCallbackFromAllInstances()
+void GeolocationServiceMock::makeGeolocationCallbackFromAllInstances()
{
- MockGeolocationServiceSet::const_iterator end = s_instances->end();
- for (MockGeolocationServiceSet::const_iterator iter = s_instances->begin();
- iter != end;
- ++iter) {
+ GeolocationServiceSet::const_iterator end = s_instances->end();
+ for (GeolocationServiceSet::const_iterator iter = s_instances->begin(); iter != end; ++iter)
(*iter)->makeGeolocationCallback();
- }
}
-void MockGeolocationService::makeGeolocationCallback()
+void GeolocationServiceMock::makeGeolocationCallback()
{
if (!m_isActive)
return;
- if (*s_lastPosition) {
+ if (*s_lastPosition)
positionChanged();
- } else if (*s_lastError) {
+ else if (*s_lastError)
errorOccurred();
- }
}
-void MockGeolocationService::initStatics()
+void GeolocationServiceMock::initStatics()
{
- if (s_instances == 0) {
- s_instances = new MockGeolocationServiceSet;
+ if (s_instances == 0) {
+ s_instances = new GeolocationServiceSet;
s_lastPosition = new RefPtr<Geoposition>;
s_lastError = new RefPtr<PositionError>;
}
}
-void MockGeolocationService::cleanUpStatics()
+void GeolocationServiceMock::cleanUpStatics()
{
if (s_instances->size() == 0) {
delete s_instances;
diff --git a/WebCore/platform/MockGeolocationService.h b/WebCore/platform/mock/GeolocationServiceMock.h
index 6cb2493..7d02797 100755
--- a/WebCore/platform/MockGeolocationService.h
+++ b/WebCore/platform/mock/GeolocationServiceMock.h
@@ -23,8 +23,8 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef MockGeolocationService_h
-#define MockGeolocationService_h
+#ifndef GeolocationServiceMock_h
+#define GeolocationServiceMock_h
#include "GeolocationService.h"
#include "Timer.h"
@@ -39,12 +39,12 @@ namespace WebCore {
// to be set manually using the setPosition and setError methods. Objects of
// this class call back to their respective GeolocationServiceClient with the
// position or error every time either of these is updated.
-class MockGeolocationService : public GeolocationService {
+class GeolocationServiceMock : public GeolocationService {
public:
static GeolocationService* create(GeolocationServiceClient*);
- MockGeolocationService(GeolocationServiceClient*);
- virtual ~MockGeolocationService();
+ GeolocationServiceMock(GeolocationServiceClient*);
+ virtual ~GeolocationServiceMock();
virtual bool startUpdating(PositionOptions*);
virtual void stopUpdating();
@@ -59,22 +59,22 @@ class MockGeolocationService : public GeolocationService {
static void makeGeolocationCallbackFromAllInstances();
void makeGeolocationCallback();
- void timerFired(Timer<MockGeolocationService>*);
+ void timerFired(Timer<GeolocationServiceMock>*);
static void initStatics();
static void cleanUpStatics();
- typedef HashSet<MockGeolocationService*> MockGeolocationServiceSet;
- static MockGeolocationServiceSet* s_instances;
+ typedef HashSet<GeolocationServiceMock*> GeolocationServiceSet;
+ static GeolocationServiceSet* s_instances;
static RefPtr<Geoposition>* s_lastPosition;
static RefPtr<PositionError>* s_lastError;
- Timer<MockGeolocationService> m_timer;
+ Timer<GeolocationServiceMock> m_timer;
bool m_isActive;
};
} // namespace WebCore
-#endif // MockGeolocationService_h
+#endif // GeolocationServiceMock_h