Title: [109938] trunk
Revision
109938
Author
[email protected]
Date
2012-03-06 11:23:15 -0800 (Tue, 06 Mar 2012)

Log Message

Speech _javascript_ API: add SpeechRecognitionError
https://bugs.webkit.org/show_bug.cgi?id=80410

Source/WebCore:

Reviewed by Adam Barth.

Add SpeechRecognitionError.

Test: fast/speech/scripted/speechrecognitionerror-basics.html

* Modules/speech/DOMWindowSpeech.idl: Added.
* Modules/speech/SpeechRecognitionError.cpp: Added.
(WebCore):
(WebCore::SpeechRecognitionError::create):
(WebCore::SpeechRecognitionError::SpeechRecognitionError):
* Modules/speech/SpeechRecognitionError.h: Added.
(WebCore):
(SpeechRecognitionError):
(WebCore::SpeechRecognitionError::code):
(WebCore::SpeechRecognitionError::message):
* Modules/speech/SpeechRecognitionError.idl: Added.
* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:

Tools:

Chromium: enable the runtime flag for scripted speech so we can run
the layout tests for it.

Reviewed by Adam Barth.

* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::TestShell):

LayoutTests:

Add a test for SpeechRecognitionError.

Reviewed by Adam Barth.

* fast/speech/scripted/speechrecognitionerror-basics.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (109937 => 109938)


--- trunk/LayoutTests/ChangeLog	2012-03-06 19:08:26 UTC (rev 109937)
+++ trunk/LayoutTests/ChangeLog	2012-03-06 19:23:15 UTC (rev 109938)
@@ -1,3 +1,14 @@
+2012-03-06  Hans Wennborg  <[email protected]>
+
+        Speech _javascript_ API: add SpeechRecognitionError
+        https://bugs.webkit.org/show_bug.cgi?id=80410
+
+        Add a test for SpeechRecognitionError.
+
+        Reviewed by Adam Barth.
+
+        * fast/speech/scripted/speechrecognitionerror-basics.html: Added.
+
 2012-03-06  Ryosuke Niwa  <[email protected]>
 
         select-line-break-with-opposite-directionality.html is flaky

Added: trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics-expected.txt (0 => 109938)


--- trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics-expected.txt	2012-03-06 19:23:15 UTC (rev 109938)
@@ -0,0 +1,20 @@
+Tests the basics of the SpeechRecognitionError interface
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'webkitSpeechRecognitionError' in window is true
+PASS webkitSpeechRecognitionError == null is false
+PASS webkitSpeechRecognitionError.OTHER is 0
+PASS webkitSpeechRecognitionError.NO_SPEECH is 1
+PASS webkitSpeechRecognitionError.ABORTED is 2
+PASS webkitSpeechRecognitionError.AUDIO_CAPTURE is 3
+PASS webkitSpeechRecognitionError.NETWORK is 4
+PASS webkitSpeechRecognitionError.NOT_ALLOWED is 5
+PASS webkitSpeechRecognitionError.SERVICE_NOT_ALLOWED is 6
+PASS webkitSpeechRecognitionError.BAD_GRAMMAR is 7
+PASS webkitSpeechRecognitionError.LANGUAGE_NOT_SUPPORTED is 8
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics.html (0 => 109938)


--- trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics.html	                        (rev 0)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics.html	2012-03-06 19:23:15 UTC (rev 109938)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script type="text/_javascript_">
+description('Tests the basics of the SpeechRecognitionError interface');
+
+function run() {
+    // Check availability of constructor.
+    shouldBeTrue("'webkitSpeechRecognitionError' in window");
+    shouldBeFalse("webkitSpeechRecognitionError == null");
+
+    // Check for members of SpeechRecognitionError.
+    shouldBe("webkitSpeechRecognitionError.OTHER", "0");
+    shouldBe("webkitSpeechRecognitionError.NO_SPEECH", "1");
+    shouldBe("webkitSpeechRecognitionError.ABORTED", "2");
+    shouldBe("webkitSpeechRecognitionError.AUDIO_CAPTURE", "3");
+    shouldBe("webkitSpeechRecognitionError.NETWORK", "4");
+    shouldBe("webkitSpeechRecognitionError.NOT_ALLOWED", "5");
+    shouldBe("webkitSpeechRecognitionError.SERVICE_NOT_ALLOWED", "6");
+    shouldBe("webkitSpeechRecognitionError.BAD_GRAMMAR", "7");
+    shouldBe("webkitSpeechRecognitionError.LANGUAGE_NOT_SUPPORTED", "8");
+
+    finishJSTest();
+}
+
+window._onload_ = run;
+window.jsTestIsAsync = true;
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (109937 => 109938)


--- trunk/Source/WebCore/ChangeLog	2012-03-06 19:08:26 UTC (rev 109937)
+++ trunk/Source/WebCore/ChangeLog	2012-03-06 19:23:15 UTC (rev 109938)
@@ -1,3 +1,28 @@
+2012-03-06  Hans Wennborg  <[email protected]>
+
+        Speech _javascript_ API: add SpeechRecognitionError
+        https://bugs.webkit.org/show_bug.cgi?id=80410
+
+        Reviewed by Adam Barth.
+
+        Add SpeechRecognitionError.
+
+        Test: fast/speech/scripted/speechrecognitionerror-basics.html
+
+        * Modules/speech/DOMWindowSpeech.idl: Added.
+        * Modules/speech/SpeechRecognitionError.cpp: Added.
+        (WebCore):
+        (WebCore::SpeechRecognitionError::create):
+        (WebCore::SpeechRecognitionError::SpeechRecognitionError):
+        * Modules/speech/SpeechRecognitionError.h: Added.
+        (WebCore):
+        (SpeechRecognitionError):
+        (WebCore::SpeechRecognitionError::code):
+        (WebCore::SpeechRecognitionError::message):
+        * Modules/speech/SpeechRecognitionError.idl: Added.
+        * WebCore.gyp/WebCore.gyp:
+        * WebCore.gypi:
+
 2012-03-06  David Corvoysier  <[email protected]>
 
         Unreleased gst_object_reference to audio sink in MediaPlayerPrivateGStreamer

Added: trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl (0 => 109938)


--- trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/speech/DOMWindowSpeech.idl	2012-03-06 19:23:15 UTC (rev 109938)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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.
+ */
+
+module window {
+    interface [
+        Conditional=SCRIPTED_SPEECH,
+        Supplemental=DOMWindow
+    ] DOMWindowSpeech {
+        attribute [V8EnabledAtRuntime] SpeechRecognitionErrorConstructor webkitSpeechRecognitionError;
+    };
+}

Added: trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.cpp (0 => 109938)


--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.cpp	                        (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.cpp	2012-03-06 19:23:15 UTC (rev 109938)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2012 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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"
+
+#if ENABLE(SCRIPTED_SPEECH)
+
+#include "SpeechRecognitionError.h"
+
+namespace WebCore {
+
+PassRefPtr<SpeechRecognitionError> SpeechRecognitionError::create(Code code, const String& message)
+{
+    return adoptRef(new SpeechRecognitionError(code, message));
+}
+
+SpeechRecognitionError::SpeechRecognitionError(Code code, const String& message)
+    : m_code(code)
+    , m_message(message)
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SCRIPTED_SPEECH)

Added: trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.h (0 => 109938)


--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.h	                        (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.h	2012-03-06 19:23:15 UTC (rev 109938)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 SpeechRecognitionError_h
+#define SpeechRecognitionError_h
+
+#if ENABLE(SCRIPTED_SPEECH)
+
+#include "PlatformString.h"
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class SpeechRecognitionError : public RefCounted<SpeechRecognitionError> {
+public:
+    enum Code {
+        OTHER = 0,
+        NO_SPEECH = 1,
+        ABORTED = 2,
+        AUDIO_CAPTURE = 3,
+        NETWORK = 4,
+        NOT_ALLOWED = 5,
+        SERVICE_NOT_ALLOWED = 6,
+        BAD_GRAMMAR = 7,
+        LANGUAGE_NOT_SUPPORTED = 8
+    };
+
+    static PassRefPtr<SpeechRecognitionError> create(Code, const String&);
+
+    Code code() { return m_code; }
+    const String& message() { return m_message; }
+
+private:
+    SpeechRecognitionError(Code, const String&);
+
+    Code m_code;
+    String m_message;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SCRIPTED_SPEECH)
+
+#endif // SpeechRecognitionError_h

Added: trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.idl (0 => 109938)


--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.idl	                        (rev 0)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.idl	2012-03-06 19:23:15 UTC (rev 109938)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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.
+ */
+
+module core {
+    interface [
+        Conditional=SCRIPTED_SPEECH
+    ] SpeechRecognitionError {
+        const unsigned short OTHER = 0;
+        const unsigned short NO_SPEECH = 1;
+        const unsigned short ABORTED = 2;
+        const unsigned short AUDIO_CAPTURE = 3;
+        const unsigned short NETWORK = 4;
+        const unsigned short NOT_ALLOWED = 5;
+        const unsigned short SERVICE_NOT_ALLOWED = 6;
+        const unsigned short BAD_GRAMMAR = 7;
+        const unsigned short LANGUAGE_NOT_SUPPORTED = 8;
+
+        readonly attribute unsigned short code;
+        readonly attribute DOMString message;
+    };
+}

Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (109937 => 109938)


--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-03-06 19:08:26 UTC (rev 109937)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2012-03-06 19:23:15 UTC (rev 109938)
@@ -56,6 +56,7 @@
       '../Modules/intents',
       '../Modules/indexeddb',
       '../Modules/mediastream',
+      '../Modules/speech',
       '../Modules/webdatabase',
       '../Modules/webdatabase/chromium',
       '../Modules/websockets',

Modified: trunk/Source/WebCore/WebCore.gypi (109937 => 109938)


--- trunk/Source/WebCore/WebCore.gypi	2012-03-06 19:08:26 UTC (rev 109937)
+++ trunk/Source/WebCore/WebCore.gypi	2012-03-06 19:23:15 UTC (rev 109938)
@@ -763,6 +763,8 @@
             'Modules/mediastream/NavigatorUserMediaSuccessCallback.idl',
             'Modules/mediastream/PeerConnection.idl',
             'Modules/mediastream/SignalingCallback.idl',
+            'Modules/speech/DOMWindowSpeech.idl',
+            'Modules/speech/SpeechRecognitionError.idl',
             'Modules/webdatabase/DOMWindowSQLDatabase.idl',
             'Modules/webdatabase/Database.idl',
             'Modules/webdatabase/DatabaseCallback.idl',
@@ -1402,6 +1404,8 @@
             'Modules/mediastream/UserMediaController.cpp',
             'Modules/mediastream/UserMediaRequest.cpp',
             'Modules/mediastream/UserMediaRequest.h',
+            'Modules/speech/SpeechRecognitionError.cpp',
+            'Modules/speech/SpeechRecognitionError.h',
             'Modules/webdatabase/AbstractDatabase.cpp',
             'Modules/webdatabase/ChangeVersionWrapper.cpp',
             'Modules/webdatabase/ChangeVersionWrapper.h',

Modified: trunk/Tools/ChangeLog (109937 => 109938)


--- trunk/Tools/ChangeLog	2012-03-06 19:08:26 UTC (rev 109937)
+++ trunk/Tools/ChangeLog	2012-03-06 19:23:15 UTC (rev 109938)
@@ -1,3 +1,16 @@
+2012-03-06  Hans Wennborg  <[email protected]>
+
+        Speech _javascript_ API: add SpeechRecognitionError
+        https://bugs.webkit.org/show_bug.cgi?id=80410
+
+        Chromium: enable the runtime flag for scripted speech so we can run
+        the layout tests for it.
+
+        Reviewed by Adam Barth.
+
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::TestShell):
+
 2012-03-06  Sami Kyostila  <[email protected]>
 
         Enable universal newlines in chromium android layout test runner

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.cpp (109937 => 109938)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2012-03-06 19:08:26 UTC (rev 109937)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2012-03-06 19:23:15 UTC (rev 109938)
@@ -130,6 +130,7 @@
     WebRuntimeFeatures::enableGamepad(true);
     WebRuntimeFeatures::enableShadowDOM(true);
     WebRuntimeFeatures::enableStyleScoped(true);
+    WebRuntimeFeatures::enableScriptedSpeech(true);
 
     m_webPermissions = adoptPtr(new WebPermissions(this));
     m_accessibilityController = adoptPtr(new AccessibilityController(this));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to