Diff
Modified: trunk/LayoutTests/ChangeLog (136845 => 136846)
--- trunk/LayoutTests/ChangeLog 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/LayoutTests/ChangeLog 2012-12-06 16:59:58 UTC (rev 136846)
@@ -1,3 +1,20 @@
+2012-12-06 Tommy Widenflycht <[email protected]>
+
+ Speech Recognition API: Change the error code to a string on SpeechRecognitionError
+ https://bugs.webkit.org/show_bug.cgi?id=104254
+
+ Reviewed by Adam Barth.
+
+ Adjusting tests.
+
+ * fast/events/constructors/speech-recognition-error-constructor-expected.txt:
+ * fast/events/constructors/speech-recognition-error-constructor.html:
+ * fast/speech/scripted/speechrecognition-errors-expected.txt:
+ * fast/speech/scripted/speechrecognition-errors.html:
+ * fast/speech/scripted/speechrecognitionerror-basics-expected.txt:
+ * fast/speech/scripted/speechrecognitionerror-basics.html:
+ * platform/chromium/fast/events/constructors/speech-recognition-error-constructor-expected.txt:
+
2012-12-06 Stephen Chenney <[email protected]>
SVG <use> element inside an svg-as-image fails
Modified: trunk/LayoutTests/fast/events/constructors/speech-recognition-error-constructor-expected.txt (136845 => 136846)
--- trunk/LayoutTests/fast/events/constructors/speech-recognition-error-constructor-expected.txt 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/LayoutTests/fast/events/constructors/speech-recognition-error-constructor-expected.txt 2012-12-06 16:59:58 UTC (rev 136846)
@@ -5,13 +5,12 @@
FAIL new webkitSpeechRecognitionError('eventType').bubbles should be false. Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
FAIL new webkitSpeechRecognitionError('eventType').cancelable should be false. Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
-FAIL new webkitSpeechRecognitionError('eventType').code should be 0. Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
+FAIL new webkitSpeechRecognitionError('eventType').error should be . Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
FAIL new webkitSpeechRecognitionError('eventType').message should be . Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
FAIL new webkitSpeechRecognitionError('eventType', { bubbles: false }).bubbles should be false. Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
FAIL new webkitSpeechRecognitionError('eventType', { bubbles: true }).bubbles should be true. Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
FAIL new webkitSpeechRecognitionError('eventType', { cancelable: false }).cancelable should be false. Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
FAIL new webkitSpeechRecognitionError('eventType', { cancelable: true }).cancelable should be true. Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
-FAIL new webkitSpeechRecognitionError('eventType', { code: 1 }).code should be 1. Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
-FAIL new webkitSpeechRecognitionError('eventType', { code: 12345 }).code should be 12345. Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
+FAIL new webkitSpeechRecognitionError('eventType', { error: 'bar' }).error should be bar. Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
FAIL new webkitSpeechRecognitionError('eventType', { message: 'foo' }).message should be foo. Threw exception ReferenceError: Can't find variable: webkitSpeechRecognitionError
Modified: trunk/LayoutTests/fast/events/constructors/speech-recognition-error-constructor.html (136845 => 136846)
--- trunk/LayoutTests/fast/events/constructors/speech-recognition-error-constructor.html 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/LayoutTests/fast/events/constructors/speech-recognition-error-constructor.html 2012-12-06 16:59:58 UTC (rev 136846)
@@ -13,7 +13,7 @@
// Test constructor without initializer.
shouldBe("new webkitSpeechRecognitionError('eventType').bubbles", "false");
shouldBe("new webkitSpeechRecognitionError('eventType').cancelable", "false");
-shouldBe("new webkitSpeechRecognitionError('eventType').code", "0");
+shouldBeEqualToString("new webkitSpeechRecognitionError('eventType').error", "");
shouldBeEqualToString("new webkitSpeechRecognitionError('eventType').message", "");
// Test passing bubbles in the initializer.
@@ -25,8 +25,7 @@
shouldBe("new webkitSpeechRecognitionError('eventType', { cancelable: true }).cancelable", "true");
// Test passing code in the initializer.
-shouldBe("new webkitSpeechRecognitionError('eventType', { code: 1 }).code", "1");
-shouldBe("new webkitSpeechRecognitionError('eventType', { code: 12345 }).code", "12345");
+shouldBeEqualToString("new webkitSpeechRecognitionError('eventType', { error: 'bar' }).error", "bar");
// Test passing message in the initializer.
shouldBeEqualToString("new webkitSpeechRecognitionError('eventType', { message: 'foo' }).message", "foo");
Modified: trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors-expected.txt (136845 => 136846)
--- trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors-expected.txt 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors-expected.txt 2012-12-06 16:59:58 UTC (rev 136846)
@@ -9,7 +9,7 @@
notAllowedTest():
onerror
PASS count is 0
-PASS event.code is webkitSpeechRecognitionError.NOT_ALLOWED
+PASS event.error is "not-allowed"
PASS event.message is "not allowed"
PASS event.type is "error"
onend
Modified: trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors.html (136845 => 136846)
--- trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors.html 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognition-errors.html 2012-12-06 16:59:58 UTC (rev 136846)
@@ -33,14 +33,14 @@
window.count = 0;
r.start();
- testRunner.setMockSpeechRecognitionError(webkitSpeechRecognitionError.NOT_ALLOWED, "not allowed");
+ testRunner.setMockSpeechRecognitionError("NotAllowedError", "not allowed");
// Check that we get an error event.
r._onerror_ = function() {
debug('onerror');
shouldBe('count', '0');
count++;
- shouldBe('event.code', 'webkitSpeechRecognitionError.NOT_ALLOWED');
+ shouldBeEqualToString('event.error', 'not-allowed');
shouldBeEqualToString('event.message', 'not allowed');
shouldBeEqualToString('event.type', 'error');
}
Modified: trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics-expected.txt (136845 => 136846)
--- trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics-expected.txt 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics-expected.txt 2012-12-06 16:59:58 UTC (rev 136846)
@@ -5,15 +5,6 @@
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
Modified: trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics.html (136845 => 136846)
--- trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics.html 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/LayoutTests/fast/speech/scripted/speechrecognitionerror-basics.html 2012-12-06 16:59:58 UTC (rev 136846)
@@ -12,17 +12,6 @@
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();
}
Modified: trunk/LayoutTests/platform/chromium/fast/events/constructors/speech-recognition-error-constructor-expected.txt (136845 => 136846)
--- trunk/LayoutTests/platform/chromium/fast/events/constructors/speech-recognition-error-constructor-expected.txt 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/LayoutTests/platform/chromium/fast/events/constructors/speech-recognition-error-constructor-expected.txt 2012-12-06 16:59:58 UTC (rev 136846)
@@ -5,13 +5,12 @@
PASS new webkitSpeechRecognitionError('eventType').bubbles is false
PASS new webkitSpeechRecognitionError('eventType').cancelable is false
-PASS new webkitSpeechRecognitionError('eventType').code is 0
+PASS new webkitSpeechRecognitionError('eventType').error is ""
PASS new webkitSpeechRecognitionError('eventType').message is ""
PASS new webkitSpeechRecognitionError('eventType', { bubbles: false }).bubbles is false
PASS new webkitSpeechRecognitionError('eventType', { bubbles: true }).bubbles is true
PASS new webkitSpeechRecognitionError('eventType', { cancelable: false }).cancelable is false
PASS new webkitSpeechRecognitionError('eventType', { cancelable: true }).cancelable is true
-PASS new webkitSpeechRecognitionError('eventType', { code: 1 }).code is 1
-PASS new webkitSpeechRecognitionError('eventType', { code: 12345 }).code is 12345
+PASS new webkitSpeechRecognitionError('eventType', { error: 'bar' }).error is "bar"
PASS new webkitSpeechRecognitionError('eventType', { message: 'foo' }).message is "foo"
Modified: trunk/Source/WebCore/ChangeLog (136845 => 136846)
--- trunk/Source/WebCore/ChangeLog 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/Source/WebCore/ChangeLog 2012-12-06 16:59:58 UTC (rev 136846)
@@ -1,3 +1,28 @@
+2012-12-06 Tommy Widenflycht <[email protected]>
+
+ Speech Recognition API: Change the error code to a string on SpeechRecognitionError
+ https://bugs.webkit.org/show_bug.cgi?id=104254
+
+ Reviewed by Adam Barth.
+
+ SpeechRecognitionError::code (numeric value) has been changed to SpeechRecognitionError::error (string)
+ in the latest specification.
+
+ http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#speechreco-error
+
+ Existing tests modified to cover this patch.
+
+ * Modules/speech/SpeechRecognitionError.cpp:
+ (WebCore::ErrorCodeToString):
+ (WebCore):
+ (WebCore::SpeechRecognitionError::create):
+ (WebCore::SpeechRecognitionError::SpeechRecognitionError):
+ * Modules/speech/SpeechRecognitionError.h:
+ (SpeechRecognitionErrorInit):
+ (WebCore::SpeechRecognitionError::error):
+ (SpeechRecognitionError):
+ * Modules/speech/SpeechRecognitionError.idl:
+
2012-12-06 Stephen Chenney <[email protected]>
SVG <use> element inside an svg-as-image fails
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.cpp (136845 => 136846)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.cpp 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.cpp 2012-12-06 16:59:58 UTC (rev 136846)
@@ -31,26 +31,58 @@
namespace WebCore {
-PassRefPtr<SpeechRecognitionError> SpeechRecognitionError::create(Code code, const String& message)
+static String ErrorCodeToString(SpeechRecognitionError::ErrorCode code)
{
- return adoptRef(new SpeechRecognitionError(code, message));
+ switch (code) {
+ case SpeechRecognitionError::ErrorCodeOther:
+ return ASCIILiteral("other");
+ case SpeechRecognitionError::ErrorCodeNoSpeech:
+ return ASCIILiteral("no-speech");
+ case SpeechRecognitionError::ErrorCodeAborted:
+ return ASCIILiteral("aborted");
+ case SpeechRecognitionError::ErrorCodeAudioCapture:
+ return ASCIILiteral("audio-capture");
+ case SpeechRecognitionError::ErrorCodeNetwork:
+ return ASCIILiteral("network");
+ case SpeechRecognitionError::ErrorCodeNotAllowed:
+ return ASCIILiteral("not-allowed");
+ case SpeechRecognitionError::ErrorCodeServiceNotAllowed:
+ return ASCIILiteral("service-not-allowed");
+ case SpeechRecognitionError::ErrorCodeBadGrammar:
+ return ASCIILiteral("bad-grammar");
+ case SpeechRecognitionError::ErrorCodeLanguageNotSupported:
+ return ASCIILiteral("language-not-supported");
+ }
+
+ ASSERT_NOT_REACHED();
+ return String();
}
+PassRefPtr<SpeechRecognitionError> SpeechRecognitionError::create(ErrorCode code, const String& message)
+{
+ return adoptRef(new SpeechRecognitionError(ErrorCodeToString(code), message));
+}
+
+PassRefPtr<SpeechRecognitionError> SpeechRecognitionError::create()
+{
+ return adoptRef(new SpeechRecognitionError(emptyString(), emptyString()));
+}
+
PassRefPtr<SpeechRecognitionError> SpeechRecognitionError::create(const AtomicString& eventName, const SpeechRecognitionErrorInit& initializer)
{
return adoptRef(new SpeechRecognitionError(eventName, initializer));
}
-SpeechRecognitionError::SpeechRecognitionError(Code code, const String& message)
+SpeechRecognitionError::SpeechRecognitionError(const String& error, const String& message)
: Event(eventNames().errorEvent, /*canBubble=*/false, /*cancelable=*/false)
- , m_code(static_cast<unsigned short>(code))
+ , m_error(error)
, m_message(message)
{
}
SpeechRecognitionError::SpeechRecognitionError(const AtomicString& eventName, const SpeechRecognitionErrorInit& initializer)
: Event(eventName, initializer)
- , m_code(initializer.code)
+ , m_error(initializer.error)
, m_message(initializer.message)
{
}
@@ -61,7 +93,6 @@
}
SpeechRecognitionErrorInit::SpeechRecognitionErrorInit()
- : code(0)
{
}
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.h (136845 => 136846)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.h 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.h 2012-12-06 16:59:58 UTC (rev 136846)
@@ -37,38 +37,40 @@
struct SpeechRecognitionErrorInit : public EventInit {
SpeechRecognitionErrorInit();
- unsigned short code;
+ String error;
String message;
};
class SpeechRecognitionError : public Event {
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
+ enum ErrorCode {
+ // FIXME: This is an unspecified error and Chromium should stop using it.
+ ErrorCodeOther = 0,
+
+ ErrorCodeNoSpeech = 1,
+ ErrorCodeAborted = 2,
+ ErrorCodeAudioCapture = 3,
+ ErrorCodeNetwork = 4,
+ ErrorCodeNotAllowed = 5,
+ ErrorCodeServiceNotAllowed = 6,
+ ErrorCodeBadGrammar = 7,
+ ErrorCodeLanguageNotSupported = 8
};
- static PassRefPtr<SpeechRecognitionError> create(Code, const String&);
- static PassRefPtr<SpeechRecognitionError> create() { return create(OTHER, emptyString()); }
+ static PassRefPtr<SpeechRecognitionError> create(ErrorCode, const String&);
+ static PassRefPtr<SpeechRecognitionError> create();
static PassRefPtr<SpeechRecognitionError> create(const AtomicString&, const SpeechRecognitionErrorInit&);
- unsigned short code() { return m_code; }
+ const String& error() { return m_error; }
const String& message() { return m_message; }
virtual const AtomicString& interfaceName() const OVERRIDE;
private:
- SpeechRecognitionError(Code, const String&);
+ SpeechRecognitionError(const String&, const String&);
SpeechRecognitionError(const AtomicString&, const SpeechRecognitionErrorInit&);
- unsigned short m_code;
+ String m_error;
String m_message;
};
Modified: trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.idl (136845 => 136846)
--- trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.idl 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/Source/WebCore/Modules/speech/SpeechRecognitionError.idl 2012-12-06 16:59:58 UTC (rev 136846)
@@ -27,16 +27,6 @@
Conditional=SCRIPTED_SPEECH,
ConstructorTemplate=Event
] interface SpeechRecognitionError : Event {
- 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;
-
- [InitializedByEventConstructor] readonly attribute unsigned short code;
+ [InitializedByEventConstructor] readonly attribute DOMString error;
[InitializedByEventConstructor] readonly attribute DOMString message;
};
Modified: trunk/Source/WebKit/chromium/ChangeLog (136845 => 136846)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-12-06 16:59:58 UTC (rev 136846)
@@ -1,3 +1,16 @@
+2012-12-06 Tommy Widenflycht <[email protected]>
+
+ Speech Recognition API: Change the error code to a string on SpeechRecognitionError
+ https://bugs.webkit.org/show_bug.cgi?id=104254
+
+ Reviewed by Adam Barth.
+
+ Minor WebCore type changes.
+
+ * src/AssertMatchingEnums.cpp:
+ * src/SpeechRecognitionClientProxy.cpp:
+ (WebKit::SpeechRecognitionClientProxy::didReceiveError):
+
2012-12-06 Sheriff Bot <[email protected]>
Unreviewed, rolling out r136784 and r136802.
Modified: trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp (136845 => 136846)
--- trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/Source/WebKit/chromium/src/AssertMatchingEnums.cpp 2012-12-06 16:59:58 UTC (rev 136846)
@@ -593,15 +593,15 @@
#endif
#if ENABLE(SCRIPTED_SPEECH)
-COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::OtherError, SpeechRecognitionError::OTHER);
-COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NoSpeechError, SpeechRecognitionError::NO_SPEECH);
-COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::AbortedError, SpeechRecognitionError::ABORTED);
-COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::AudioCaptureError, SpeechRecognitionError::AUDIO_CAPTURE);
-COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NetworkError, SpeechRecognitionError::NETWORK);
-COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NotAllowedError, SpeechRecognitionError::NOT_ALLOWED);
-COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::ServiceNotAllowedError, SpeechRecognitionError::SERVICE_NOT_ALLOWED);
-COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::BadGrammarError, SpeechRecognitionError::BAD_GRAMMAR);
-COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::LanguageNotSupportedError, SpeechRecognitionError::LANGUAGE_NOT_SUPPORTED);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::OtherError, SpeechRecognitionError::ErrorCodeOther);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NoSpeechError, SpeechRecognitionError::ErrorCodeNoSpeech);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::AbortedError, SpeechRecognitionError::ErrorCodeAborted);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::AudioCaptureError, SpeechRecognitionError::ErrorCodeAudioCapture);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NetworkError, SpeechRecognitionError::ErrorCodeNetwork);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::NotAllowedError, SpeechRecognitionError::ErrorCodeNotAllowed);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::ServiceNotAllowedError, SpeechRecognitionError::ErrorCodeServiceNotAllowed);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::BadGrammarError, SpeechRecognitionError::ErrorCodeBadGrammar);
+COMPILE_ASSERT_MATCHING_ENUM(WebSpeechRecognizerClient::LanguageNotSupportedError, SpeechRecognitionError::ErrorCodeLanguageNotSupported);
#endif
COMPILE_ASSERT_MATCHING_ENUM(WebReferrerPolicyAlways, ReferrerPolicyAlways);
Modified: trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp (136845 => 136846)
--- trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp 2012-12-06 16:59:58 UTC (rev 136846)
@@ -137,7 +137,7 @@
void SpeechRecognitionClientProxy::didReceiveError(const WebSpeechRecognitionHandle& handle, const WebString& message, WebSpeechRecognizerClient::ErrorCode code)
{
RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle);
- SpeechRecognitionError::Code errorCode = static_cast<SpeechRecognitionError::Code>(code);
+ SpeechRecognitionError::ErrorCode errorCode = static_cast<SpeechRecognitionError::ErrorCode>(code);
recognition->didReceiveError(SpeechRecognitionError::create(errorCode, message));
}
Modified: trunk/Tools/ChangeLog (136845 => 136846)
--- trunk/Tools/ChangeLog 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/Tools/ChangeLog 2012-12-06 16:59:58 UTC (rev 136846)
@@ -1,3 +1,20 @@
+2012-12-06 Tommy Widenflycht <[email protected]>
+
+ Speech Recognition API: Change the error code to a string on SpeechRecognitionError
+ https://bugs.webkit.org/show_bug.cgi?id=104254
+
+ Reviewed by Adam Barth.
+
+ Changes the mock error function to take a string instead of an int.
+
+ * DumpRenderTree/chromium/DRTTestRunner.cpp:
+ (DRTTestRunner::setMockSpeechRecognitionError):
+ * DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp:
+ (WebTestRunner::ErrorTask::ErrorTask):
+ (MockWebSpeechRecognizer::setError):
+ * DumpRenderTree/chromium/MockWebSpeechRecognizer.h:
+ (MockWebSpeechRecognizer):
+
2012-12-06 Andras Becsi <[email protected]>
[Qt][Mac] Fix libxslt and libxml2 config tests
Modified: trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp (136845 => 136846)
--- trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp 2012-12-06 16:59:58 UTC (rev 136846)
@@ -1036,11 +1036,11 @@
void DRTTestRunner::setMockSpeechRecognitionError(const CppArgumentList& arguments, CppVariant* result)
{
result->setNull();
- if (arguments.size() < 2 || !arguments[0].isNumber() || !arguments[1].isString())
+ if (arguments.size() != 2 || !arguments[0].isString() || !arguments[1].isString())
return;
if (MockWebSpeechRecognizer* recognizer = m_shell->webViewHost()->mockSpeechRecognizer())
- recognizer->setError(arguments[0].toInt32(), cppVariantToWebString(arguments[1]));
+ recognizer->setError(cppVariantToWebString(arguments[0]), cppVariantToWebString(arguments[1]));
}
void DRTTestRunner::wasMockSpeechRecognitionAborted(const CppArgumentList&, CppVariant* result)
Modified: trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp (136845 => 136846)
--- trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.cpp 2012-12-06 16:59:58 UTC (rev 136846)
@@ -91,17 +91,17 @@
// Task for delivering an error event.
class ErrorTask : public MockWebSpeechRecognizer::Task {
public:
- ErrorTask(MockWebSpeechRecognizer* mock, int code, const WebString& message)
+ ErrorTask(MockWebSpeechRecognizer* mock, WebSpeechRecognizerClient::ErrorCode code, const WebString& message)
: MockWebSpeechRecognizer::Task(mock)
, m_code(code)
, m_message(message)
{
}
- virtual void run() OVERRIDE { m_recognizer->client()->didReceiveError(m_recognizer->handle(), m_message, static_cast<WebSpeechRecognizerClient::ErrorCode>(m_code)); }
+ virtual void run() OVERRIDE { m_recognizer->client()->didReceiveError(m_recognizer->handle(), m_message, m_code); }
private:
- int m_code;
+ WebSpeechRecognizerClient::ErrorCode m_code;
WebString m_message;
};
@@ -166,8 +166,30 @@
m_mockConfidences.append(confidence);
}
-void MockWebSpeechRecognizer::setError(int code, const WebString& message)
+void MockWebSpeechRecognizer::setError(const WebString& error, const WebString& message)
{
+ WebSpeechRecognizerClient::ErrorCode code;
+ if (error == "OtherError")
+ code = WebSpeechRecognizerClient::OtherError;
+ else if (error == "NoSpeechError")
+ code = WebSpeechRecognizerClient::NoSpeechError;
+ else if (error == "AbortedError")
+ code = WebSpeechRecognizerClient::AbortedError;
+ else if (error == "AudioCaptureError")
+ code = WebSpeechRecognizerClient::AudioCaptureError;
+ else if (error == "NetworkError")
+ code = WebSpeechRecognizerClient::NetworkError;
+ else if (error == "NotAllowedError")
+ code = WebSpeechRecognizerClient::NotAllowedError;
+ else if (error == "ServiceNotAllowedError")
+ code = WebSpeechRecognizerClient::ServiceNotAllowedError;
+ else if (error == "BadGrammarError")
+ code = WebSpeechRecognizerClient::BadGrammarError;
+ else if (error == "LanguageNotSupportedError")
+ code = WebSpeechRecognizerClient::LanguageNotSupportedError;
+ else
+ return;
+
clearTaskQueue();
m_taskQueue.append(adoptPtr(new ErrorTask(this, code, message)));
m_taskQueue.append(adoptPtr(new ClientCallTask(this, &WebSpeechRecognizerClient::didEnd)));
Modified: trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h (136845 => 136846)
--- trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h 2012-12-06 16:53:10 UTC (rev 136845)
+++ trunk/Tools/DumpRenderTree/chromium/MockWebSpeechRecognizer.h 2012-12-06 16:59:58 UTC (rev 136846)
@@ -52,7 +52,7 @@
// Methods accessed by layout tests:
void addMockResult(const WebKit::WebString& transcript, float confidence);
- void setError(int code, const WebKit::WebString& message);
+ void setError(const WebKit::WebString& error, const WebKit::WebString& message);
bool wasAborted() const { return m_wasAborted; }
// Methods accessed from Task objects: