[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 16:24:14 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 1eb6bc1e9c1b09cfa802a9e7a6f80ba01aefad46
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 23 04:43:16 2010 +0000
2010-11-22 John Knottenbelt <jknotten at chromium.org>
Reviewed by Steve Block.
Implement mocks for client-based Geolocation.
https://bugs.webkit.org/show_bug.cgi?id=49258
* Android.mk:
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* platform/mock/GeolocationClientMock.cpp: Added.
(WebCore::GeolocationClientMock::GeolocationClientMock):
(WebCore::GeolocationClientMock::~GeolocationClientMock):
(WebCore::GeolocationClientMock::setController):
(WebCore::GeolocationClientMock::setPosition):
(WebCore::GeolocationClientMock::setError):
(WebCore::GeolocationClientMock::geolocationDestroyed):
(WebCore::GeolocationClientMock::startUpdating):
(WebCore::GeolocationClientMock::stopUpdating):
(WebCore::GeolocationClientMock::setEnableHighAccuracy):
(WebCore::GeolocationClientMock::lastPosition):
(WebCore::GeolocationClientMock::timerFired):
(WebCore::GeolocationClientMock::makeGeolocationCallback):
* platform/mock/GeolocationClientMock.h: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index 23c59b4..1544679 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -578,6 +578,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
platform/image-decoders/gif/GIFImageReader.cpp \
\
platform/mock/DeviceOrientationClientMock.cpp \
+ platform/mock/GeolocationClientMock.cpp \
platform/mock/GeolocationServiceMock.cpp \
platform/mock/SpeechInputClientMock.cpp \
\
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index f39556d..5890b05 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -1362,6 +1362,7 @@ SET(WebCore_SOURCES
platform/image-decoders/webp/WEBPImageDecoder.cpp
platform/mock/DeviceOrientationClientMock.cpp
+ platform/mock/GeolocationClientMock.cpp
platform/mock/GeolocationServiceMock.cpp
platform/network/AuthenticationChallengeBase.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 1be2566..3e2978a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2010-11-22 John Knottenbelt <jknotten at chromium.org>
+
+ Reviewed by Steve Block.
+
+ Implement mocks for client-based Geolocation.
+ https://bugs.webkit.org/show_bug.cgi?id=49258
+
+ * Android.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/mock/GeolocationClientMock.cpp: Added.
+ (WebCore::GeolocationClientMock::GeolocationClientMock):
+ (WebCore::GeolocationClientMock::~GeolocationClientMock):
+ (WebCore::GeolocationClientMock::setController):
+ (WebCore::GeolocationClientMock::setPosition):
+ (WebCore::GeolocationClientMock::setError):
+ (WebCore::GeolocationClientMock::geolocationDestroyed):
+ (WebCore::GeolocationClientMock::startUpdating):
+ (WebCore::GeolocationClientMock::stopUpdating):
+ (WebCore::GeolocationClientMock::setEnableHighAccuracy):
+ (WebCore::GeolocationClientMock::lastPosition):
+ (WebCore::GeolocationClientMock::timerFired):
+ (WebCore::GeolocationClientMock::makeGeolocationCallback):
+ * platform/mock/GeolocationClientMock.h: Added.
+
2010-11-22 Tony Gentilcore <tonyg at chromium.org>
Reviewed by Adam Barth.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index ec2c5c1..f196449 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2400,6 +2400,8 @@ webcore_sources += \
WebCore/platform/MIMETypeRegistry.h \
WebCore/platform/mock/DeviceOrientationClientMock.cpp \
WebCore/platform/mock/DeviceOrientationClientMock.h \
+ WebCore/platform/mock/GeolocationClientMock.cpp \
+ WebCore/platform/mock/GeolocationClientMock.h \
WebCore/platform/mock/GeolocationServiceMock.cpp \
WebCore/platform/mock/GeolocationServiceMock.h \
WebCore/platform/mock/SpeechInputClientMock.cpp \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 0011516..d255129 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3359,6 +3359,8 @@
'platform/MIMETypeRegistry.h',
'platform/mock/DeviceOrientationClientMock.cpp',
'platform/mock/DeviceOrientationClientMock.h',
+ 'platform/mock/GeolocationClientMock.cpp',
+ 'platform/mock/GeolocationClientMock.h',
'platform/mock/GeolocationServiceMock.cpp',
'platform/mock/GeolocationServiceMock.h',
'platform/mock/SpeechInputClientMock.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 8648650..95a4e5b 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -1195,6 +1195,7 @@ SOURCES += \
platform/Logging.cpp \
platform/MIMETypeRegistry.cpp \
platform/mock/DeviceOrientationClientMock.cpp \
+ platform/mock/GeolocationClientMock.cpp \
platform/mock/GeolocationServiceMock.cpp \
platform/mock/SpeechInputClientMock.cpp \
platform/network/AuthenticationChallengeBase.cpp \
@@ -2039,6 +2040,7 @@ HEADERS += \
platform/GeolocationService.h \
platform/image-decoders/ImageDecoder.h \
platform/mock/DeviceOrientationClientMock.h \
+ platform/mock/GeolocationClientMock.cpp \
platform/mock/GeolocationServiceMock.h \
platform/mock/SpeechInputClientMock.h \
platform/graphics/BitmapImage.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index b03d898..3f8c1b1 100755
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -30154,6 +30154,14 @@
>
</File>
<File
+ RelativePath="..\platform\mock\GeolocationClientMock.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\mock\GeolocationClientMock.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\mock\GeolocationServiceMock.cpp"
>
</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 8531d74..43d3743 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -36,6 +36,8 @@
0014628A103CD1DE000B20DB /* OriginAccessEntry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00146288103CD1DE000B20DB /* OriginAccessEntry.cpp */; };
0014628B103CD1DE000B20DB /* OriginAccessEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 00146289103CD1DE000B20DB /* OriginAccessEntry.h */; };
003F1FEA11E6AB43008258D9 /* UserContentTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 003F1FE911E6AB43008258D9 /* UserContentTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 052BFCE9128ABF1500FD338D /* GeolocationClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 052BFCE8128ABF1500FD338D /* GeolocationClientMock.cpp */; };
+ 052BFCEB128ABF2100FD338D /* GeolocationClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 052BFCEA128ABF2100FD338D /* GeolocationClientMock.h */; settings = {ATTRIBUTES = (Private, ); }; };
05FD69E012845D4300B2BEB3 /* DOMTimeStamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 05FD69DF12845D4300B2BEB3 /* DOMTimeStamp.h */; settings = {ATTRIBUTES = (Private, ); }; };
06027CAD0B1CBFC000884B2D /* ContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
06027CB30B1CC03D00884B2D /* ContextMenuItemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 06027CB20B1CC03D00884B2D /* ContextMenuItemMac.mm */; };
@@ -6072,6 +6074,8 @@
00146288103CD1DE000B20DB /* OriginAccessEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OriginAccessEntry.cpp; sourceTree = "<group>"; };
00146289103CD1DE000B20DB /* OriginAccessEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OriginAccessEntry.h; sourceTree = "<group>"; };
003F1FE911E6AB43008258D9 /* UserContentTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserContentTypes.h; sourceTree = "<group>"; };
+ 052BFCE8128ABF1500FD338D /* GeolocationClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GeolocationClientMock.cpp; path = mock/GeolocationClientMock.cpp; sourceTree = "<group>"; };
+ 052BFCEA128ABF2100FD338D /* GeolocationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GeolocationClientMock.h; path = mock/GeolocationClientMock.h; sourceTree = "<group>"; };
05FD69DF12845D4300B2BEB3 /* DOMTimeStamp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMTimeStamp.h; sourceTree = "<group>"; };
06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ContextMenuItem.h; sourceTree = "<group>"; };
06027CB20B1CC03D00884B2D /* ContextMenuItemMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuItemMac.mm; sourceTree = "<group>"; };
@@ -12950,6 +12954,8 @@
children = (
59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */,
59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */,
+ 052BFCE8128ABF1500FD338D /* GeolocationClientMock.cpp */,
+ 052BFCEA128ABF2100FD338D /* GeolocationClientMock.h */,
7535BC9212020CFF0037EC45 /* SpeechInputClientMock.cpp */,
7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */,
);
@@ -19652,6 +19658,7 @@
A622A8FF122C44A600A785B3 /* GenericBinding.h in Headers */,
FE80D7C60E9C1F25000D6F75 /* Geolocation.h in Headers */,
BC56CB2310D5AC8000A77C64 /* GeolocationClient.h in Headers */,
+ 052BFCEB128ABF2100FD338D /* GeolocationClientMock.h in Headers */,
BC56CB2210D5AC8000A77C64 /* GeolocationController.h in Headers */,
BC56CB2410D5AC8000A77C64 /* GeolocationError.h in Headers */,
BC56CB2510D5AC8000A77C64 /* GeolocationPosition.h in Headers */,
@@ -22291,6 +22298,7 @@
1432E8490C51493F00B1500F /* GCController.cpp in Sources */,
BCE04C940DAFF902007A0F41 /* GeneratedImage.cpp in Sources */,
FE80D7C50E9C1F25000D6F75 /* Geolocation.cpp in Sources */,
+ 052BFCE9128ABF1500FD338D /* GeolocationClientMock.cpp in Sources */,
BC56CB2110D5AC8000A77C64 /* GeolocationController.cpp in Sources */,
596229781133EFD700DC4CBB /* GeolocationPositionCache.cpp in Sources */,
B2C3DA6D0D006CD600EF6F26 /* GlyphPageTreeNode.cpp in Sources */,
diff --git a/WebCore/platform/mock/GeolocationClientMock.cpp b/WebCore/platform/mock/GeolocationClientMock.cpp
new file mode 100644
index 0000000..3c4697f
--- /dev/null
+++ b/WebCore/platform/mock/GeolocationClientMock.cpp
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GeolocationClientMock.h"
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+
+#include "GeolocationController.h"
+#include "GeolocationError.h"
+#include "GeolocationPosition.h"
+
+namespace WebCore {
+
+GeolocationClientMock::GeolocationClientMock()
+ : m_controller(0)
+ , m_timer(this, &GeolocationClientMock::timerFired)
+ , m_isActive(false)
+{
+}
+
+GeolocationClientMock::~GeolocationClientMock()
+{
+ ASSERT(!m_isActive);
+}
+
+void GeolocationClientMock::setController(GeolocationController *controller)
+{
+ ASSERT(controller && !m_controller);
+ m_controller = controller;
+}
+
+void GeolocationClientMock::setPosition(PassRefPtr<GeolocationPosition> position)
+{
+ m_lastPosition = position;
+ m_lastError = 0;
+ asyncUpdateController();
+}
+
+void GeolocationClientMock::setError(PassRefPtr<GeolocationError> error)
+{
+ m_lastError = error;
+ m_lastPosition = 0;
+ asyncUpdateController();
+}
+
+void GeolocationClientMock::reset()
+{
+ m_lastPosition = 0;
+ m_lastError = 0;
+}
+
+void GeolocationClientMock::geolocationDestroyed()
+{
+ ASSERT(!m_isActive);
+}
+
+void GeolocationClientMock::startUpdating()
+{
+ ASSERT(!m_isActive);
+ m_isActive = true;
+ asyncUpdateController();
+}
+
+void GeolocationClientMock::stopUpdating()
+{
+ ASSERT(m_isActive);
+ m_isActive = false;
+ m_timer.stop();
+}
+
+void GeolocationClientMock::setEnableHighAccuracy(bool)
+{
+ // FIXME: We need to add some tests regarding "high accuracy" mode.
+ // See https://bugs.webkit.org/show_bug.cgi?id=49438
+}
+
+GeolocationPosition* GeolocationClientMock::lastPosition()
+{
+ return m_lastPosition.get();
+}
+
+void GeolocationClientMock::asyncUpdateController()
+{
+ ASSERT(m_controller);
+ if (m_isActive && !m_timer.isActive())
+ m_timer.startOneShot(0);
+}
+
+void GeolocationClientMock::timerFired(Timer<GeolocationClientMock>* timer)
+{
+ ASSERT_UNUSED(timer, timer == &m_timer);
+ updateController();
+}
+
+void GeolocationClientMock::updateController()
+{
+ ASSERT(m_controller);
+
+ if (m_lastPosition.get())
+ m_controller->positionChanged(m_lastPosition.get());
+ else if (m_lastError.get())
+ m_controller->errorOccurred(m_lastError.get());
+}
+
+} // WebCore
+
+#endif // ENABLE(CLIENT_BASED_GEOLOCATION)
diff --git a/WebCore/platform/mock/GeolocationClientMock.h b/WebCore/platform/mock/GeolocationClientMock.h
new file mode 100644
index 0000000..f57afa9
--- /dev/null
+++ b/WebCore/platform/mock/GeolocationClientMock.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GeolocationClientMock_h
+#define GeolocationClientMock_h
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+
+#include "GeolocationClient.h"
+#include "PlatformString.h"
+#include "Timer.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class GeolocationController;
+class GeolocationPosition;
+class GeolocationError;
+
+// Provides a mock object for the geolocation client
+class GeolocationClientMock : public GeolocationClient {
+public:
+ GeolocationClientMock();
+ virtual ~GeolocationClientMock();
+
+ void reset();
+ void setController(GeolocationController*);
+
+ void setError(PassRefPtr<GeolocationError>);
+ void setPosition(PassRefPtr<GeolocationPosition>);
+
+ // GeolocationClient
+ virtual void geolocationDestroyed();
+ virtual void startUpdating();
+ virtual void stopUpdating();
+ virtual void setEnableHighAccuracy(bool);
+ virtual GeolocationPosition* lastPosition();
+
+private:
+ void timerFired(Timer<GeolocationClientMock>*);
+ void asyncUpdateController();
+ void updateController();
+
+ GeolocationController* m_controller;
+ RefPtr<GeolocationPosition> m_lastPosition;
+ RefPtr<GeolocationError> m_lastError;
+ Timer<GeolocationClientMock> m_timer;
+ bool m_isActive;
+};
+
+}
+
+#endif // ENABLE(CLIENT_BASED_GEOLOCATION)
+
+#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list