[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 11:36:07 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit e56afe0e5d4d0ee9c357223a1cef484df463db76
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 30 12:21:56 2010 +0000

    2010-07-30  Satish Sampath  <satish at chromium.org>
    
            Reviewed by Jeremy Orlow.
    
            Add a mock in WebCore for testing speech input
            https://bugs.webkit.org/show_bug.cgi?id=42603
    
            Layout tests will be added in a subsequent patch using this mock.
    
            * Android.mk:
            * GNUmakefile.am:
            * WebCore.gypi:
            * WebCore.pro:
            * WebCore.vcproj/WebCore.vcproj:
            * WebCore.xcodeproj/project.pbxproj:
            * platform/mock/SpeechInputClientMock.cpp: Added.
            (WebCore::SpeechInputClientMock::SpeechInputClientMock):
            (WebCore::SpeechInputClientMock::startRecognition):
            (WebCore::SpeechInputClientMock::stopRecording):
            (WebCore::SpeechInputClientMock::cancelRecognition):
            (WebCore::SpeechInputClientMock::setRecognitionResult):
            (WebCore::SpeechInputClientMock::timerFired):
            * platform/mock/SpeechInputClientMock.h: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64351 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/Android.mk b/WebCore/Android.mk
index e48ff2c..280af55 100644
--- a/WebCore/Android.mk
+++ b/WebCore/Android.mk
@@ -517,6 +517,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
 	platform/image-decoders/gif/GIFImageReader.cpp \
 	\
 	platform/mock/GeolocationServiceMock.cpp \
+	platform/mock/SpeechInputClientMock.cpp \
 	\
 	platform/network/AuthenticationChallengeBase.cpp \
 	platform/network/Credential.cpp \
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8313409..ac9ede7 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-07-30  Satish Sampath  <satish at chromium.org>
+
+        Reviewed by Jeremy Orlow.
+
+        Add a mock in WebCore for testing speech input
+        https://bugs.webkit.org/show_bug.cgi?id=42603
+
+        Layout tests will be added in a subsequent patch using this mock.
+
+        * Android.mk:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/mock/SpeechInputClientMock.cpp: Added.
+        (WebCore::SpeechInputClientMock::SpeechInputClientMock):
+        (WebCore::SpeechInputClientMock::startRecognition):
+        (WebCore::SpeechInputClientMock::stopRecording):
+        (WebCore::SpeechInputClientMock::cancelRecognition):
+        (WebCore::SpeechInputClientMock::setRecognitionResult):
+        (WebCore::SpeechInputClientMock::timerFired):
+        * platform/mock/SpeechInputClientMock.h: Added.
+
 2010-07-30  Nikolas Zimmermann  <nzimmermann at rim.com>
 
         Reviewed by Dirk Schulze.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 2c72483..effa220 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -1899,6 +1899,8 @@ webcore_sources += \
 	WebCore/platform/MIMETypeRegistry.h \
 	WebCore/platform/mock/GeolocationServiceMock.cpp \
 	WebCore/platform/mock/GeolocationServiceMock.h \
+	WebCore/platform/mock/SpeechInputClientMock.cpp \
+	WebCore/platform/mock/SpeechInputClientMock.h \
 	WebCore/platform/NotImplemented.h \
 	WebCore/platform/Pasteboard.h \
 	WebCore/platform/PlatformKeyboardEvent.h \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 5e1f650..848aa11 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3014,6 +3014,8 @@
             'platform/MIMETypeRegistry.h',
             'platform/mock/GeolocationServiceMock.cpp',
             'platform/mock/GeolocationServiceMock.h',
+            'platform/mock/SpeechInputClientMock.cpp',
+            'platform/mock/SpeechInputClientMock.h',
             'platform/NotImplemented.h',
             'platform/Pasteboard.h',
             'platform/PlatformKeyboardEvent.h',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 565b4aa..65c285e 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -913,6 +913,7 @@ SOURCES += \
     platform/Logging.cpp \
     platform/MIMETypeRegistry.cpp \
     platform/mock/GeolocationServiceMock.cpp \
+    platform/mock/SpeechInputClientMock.cpp \
     platform/network/AuthenticationChallengeBase.cpp \
     platform/network/Credential.cpp \
     platform/network/FormData.cpp \
@@ -1631,6 +1632,7 @@ HEADERS += \
     platform/GeolocationService.h \
     platform/image-decoders/ImageDecoder.h \
     platform/mock/GeolocationServiceMock.h \
+    platform/mock/SpeechInputClientMock.h \
     platform/graphics/BitmapImage.h \
     platform/graphics/Color.h \
     platform/graphics/filters/FEBlend.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index c2aff4a..5855fa1 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -28179,6 +28179,14 @@
 					RelativePath="..\platform\mock\GeolocationServiceMock.h"
 					>
 				</File>
+				<File
+					RelativePath="..\platform\mock\SpeechInputClientMock.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\platform\mock\SpeechInputClientMock.h"
+					>
+				</File>
 			</Filter>
 		</Filter>
 		<Filter
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index c62322d..6a3e101 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1349,6 +1349,8 @@
 		750D029311D0E7F300BD1B27 /* RenderInputSpeech.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */; };
 		750D029411D0E7F300BD1B27 /* RenderInputSpeech.h in Headers */ = {isa = PBXBuildFile; fileRef = 750D029211D0E7F300BD1B27 /* RenderInputSpeech.h */; };
 		750D02C111D0EE7D00BD1B27 /* inputSpeech.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 750D02C011D0EE7D00BD1B27 /* inputSpeech.tiff */; };
+		7535BC9412020CFF0037EC45 /* SpeechInputClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7535BC9212020CFF0037EC45 /* SpeechInputClientMock.cpp */; };
+		7535BC9512020CFF0037EC45 /* SpeechInputClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */; };
 		754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 754133A7102E00E800075D00 /* InspectorTimelineAgent.h */; };
 		754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */; };
 		7553CFE8108F473F00EA281E /* TimelineRecordFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */; };
@@ -7128,6 +7130,8 @@
 		750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderInputSpeech.cpp; sourceTree = "<group>"; };
 		750D029211D0E7F300BD1B27 /* RenderInputSpeech.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderInputSpeech.h; sourceTree = "<group>"; };
 		750D02C011D0EE7D00BD1B27 /* inputSpeech.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = inputSpeech.tiff; sourceTree = "<group>"; };
+		7535BC9212020CFF0037EC45 /* SpeechInputClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SpeechInputClientMock.cpp; path = mock/SpeechInputClientMock.cpp; sourceTree = "<group>"; };
+		7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpeechInputClientMock.h; path = mock/SpeechInputClientMock.h; sourceTree = "<group>"; };
 		754133A7102E00E800075D00 /* InspectorTimelineAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorTimelineAgent.h; sourceTree = "<group>"; };
 		754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorTimelineAgent.cpp; sourceTree = "<group>"; };
 		7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineRecordFactory.h; sourceTree = "<group>"; };
@@ -12044,6 +12048,8 @@
 		59C77F101054591C00506104 /* mock */ = {
 			isa = PBXGroup;
 			children = (
+				7535BC9212020CFF0037EC45 /* SpeechInputClientMock.cpp */,
+				7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */,
 			);
 			name = mock;
 			sourceTree = "<group>";
@@ -19871,6 +19877,7 @@
 				084D0E3D11F5816100081E1A /* SVGResources.h in Headers */,
 				084D0E3F11F5816100081E1A /* SVGResourcesCache.h in Headers */,
 				085B05C311FAE16C004D65F6 /* SVGResourcesCycleSolver.h in Headers */,
+				7535BC9512020CFF0037EC45 /* SpeechInputClientMock.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -22270,6 +22277,7 @@
 				084D0E3E11F5816100081E1A /* SVGResourcesCache.cpp in Sources */,
 				086A400611F6D6B7002CEC53 /* RenderSVGResourceContainer.cpp in Sources */,
 				085B05C211FAE16C004D65F6 /* SVGResourcesCycleSolver.cpp in Sources */,
+				7535BC9412020CFF0037EC45 /* SpeechInputClientMock.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/platform/mock/SpeechInputClientMock.cpp b/WebCore/platform/mock/SpeechInputClientMock.cpp
new file mode 100644
index 0000000..74a3151
--- /dev/null
+++ b/WebCore/platform/mock/SpeechInputClientMock.cpp
@@ -0,0 +1,95 @@
+/*
+ * 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 "SpeechInputClientMock.h"
+
+#if ENABLE(INPUT_SPEECH)
+
+#include "SpeechInputListener.h"
+
+namespace WebCore {
+
+SpeechInputClientMock::SpeechInputClientMock()
+    : m_recording(false)
+    , m_timer(this, &SpeechInputClientMock::timerFired)
+    , m_listener(0)
+{
+}
+
+bool SpeechInputClientMock::startRecognition(SpeechInputListener* listener)
+{
+    if (m_timer.isActive())
+        return false;
+    m_listener = listener;
+    m_recording = true;
+    m_timer.startOneShot(0);
+    return true;
+}
+
+void SpeechInputClientMock::stopRecording()
+{
+    if (m_timer.isActive() && m_recording) {
+        m_timer.stop();
+        timerFired(&m_timer);
+    }
+}
+
+void SpeechInputClientMock::cancelRecognition()
+{
+    if (m_timer.isActive()) {
+        m_timer.stop();
+        m_recording = false;
+        m_listener->didCompleteRecognition();
+        m_listener = 0;
+    }
+}
+
+void SpeechInputClientMock::setRecognitionResult(const String& result)
+{
+    m_recognitionResult = result;
+}
+
+void SpeechInputClientMock::timerFired(WebCore::Timer<SpeechInputClientMock>*)
+{
+    if (m_recording) {
+        m_recording = false;
+        m_listener->didCompleteRecording();
+        m_timer.startOneShot(0);
+    } else {
+        m_listener->setRecognitionResult(m_recognitionResult);
+        m_listener->didCompleteRecognition();
+        m_listener = 0;
+    }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INPUT_SPEECH)
diff --git a/WebCore/platform/mock/SpeechInputClientMock.h b/WebCore/platform/mock/SpeechInputClientMock.h
new file mode 100644
index 0000000..faca444
--- /dev/null
+++ b/WebCore/platform/mock/SpeechInputClientMock.h
@@ -0,0 +1,69 @@
+/*
+ * 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 SpeechInputClientMock_h
+#define SpeechInputClientMock_h
+
+#include "PlatformString.h"
+#include "SpeechInputClient.h"
+#include "Timer.h"
+
+#if ENABLE(INPUT_SPEECH)
+
+namespace WebCore {
+
+class SpeechInputListener;
+
+// Provides a mock object for the speech input embedder API called by WebCore.
+class SpeechInputClientMock : public SpeechInputClient {
+public:
+    SpeechInputClientMock();
+
+    void setRecognitionResult(const String& result);
+
+    // SpeechInputClient methods.
+    bool startRecognition(SpeechInputListener*);
+    void stopRecording();
+    void cancelRecognition();
+
+private:
+    void timerFired(Timer<SpeechInputClientMock>*);
+
+    bool m_recording;
+    Timer<SpeechInputClientMock> m_timer;
+    SpeechInputListener* m_listener;
+    String m_recognitionResult;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INPUT_SPEECH)
+
+#endif // SpeechInputClientMock_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list