Commit 16399b98 authored by cfleizach@apple.com's avatar cfleizach@apple.com
Browse files

WebSpeech: event.elapsedTime is always 1364484608

https://bugs.webkit.org/show_bug.cgi?id=114045

Reviewed by Tim Horton.

Source/WebCore:

We were calculating elapsed time incorrectly.

Test: platform/mac/fast/speechsynthesis/speech-synthesis-elapsed-time.html

* Modules/speech/SpeechSynthesis.cpp:
(WebCore::SpeechSynthesis::fireEvent):

LayoutTests:

* platform/mac/fast/speechsynthesis/speech-synthesis-elapsed-time-expected.txt: Added.
* platform/mac/fast/speechsynthesis/speech-synthesis-elapsed-time.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147801 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e73c07ab
2013-04-05 Chris Fleizach <cfleizach@apple.com>
WebSpeech: event.elapsedTime is always 1364484608
https://bugs.webkit.org/show_bug.cgi?id=114045
Reviewed by Tim Horton.
* platform/mac/fast/speechsynthesis/speech-synthesis-elapsed-time-expected.txt: Added.
* platform/mac/fast/speechsynthesis/speech-synthesis-elapsed-time.html: Added.
2013-04-05 Chris Fleizach <cfleizach@apple.com>
 
WebSpeech: crash at WebCore::SpeechSynthesis::speak
This tests that elapsed time is a number that is reasonable.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Our start time for speech should be very small.
PASS startTime < .5 is true
Word boundary received: startTime should be less than the current elapsed time.
PASS startTime < event.elapsedTime is true
Word boundary received: startTime should be less than the current elapsed time.
PASS startTime < event.elapsedTime is true
The finished elapsed time should be small and the startTime should have occurred before the end.
PASS startTime < event.elapsedTime is true
PASS event.elapsedTime < 1 is true
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../../fast/js/resources/js-test-pre.js"></script>
</head>
<body id="body">
<div id="console"></div>
<script>
if (window.internals)
window.internals.enableMockSpeechSynthesizer();
description("This tests that elapsed time is a number that is reasonable.");
if (window.testRunner)
testRunner.waitUntilDone();
window.jsTestIsAsync = true;
var u = new SpeechSynthesisUtterance("hello word");
var startTime = 0;
u.onstart = function(event) {
startTime = event.elapsedTime;
debug("Our start time for speech should be very small.");
shouldBeTrue("startTime < .5");
}
u.onboundary = function(event) {
debug("Word boundary received: startTime should be less than the current elapsed time.");
shouldBeTrue("startTime < event.elapsedTime");
}
u.onend = function(event) {
debug("The finished elapsed time should be small and the startTime should have occurred before the end.");
shouldBeTrue("startTime < event.elapsedTime");
shouldBeTrue("event.elapsedTime < 1");
finishJSTest();
}
speechSynthesis.speak(u);
</script>
<script src="../../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>
2013-04-05 Chris Fleizach <cfleizach@apple.com>
WebSpeech: event.elapsedTime is always 1364484608
https://bugs.webkit.org/show_bug.cgi?id=114045
Reviewed by Tim Horton.
We were calculating elapsed time incorrectly.
Test: platform/mac/fast/speechsynthesis/speech-synthesis-elapsed-time.html
* Modules/speech/SpeechSynthesis.cpp:
(WebCore::SpeechSynthesis::fireEvent):
2013-04-05 Chris Fleizach <cfleizach@apple.com>
 
WebSpeech: crash at WebCore::SpeechSynthesis::speak
......@@ -140,7 +140,7 @@ void SpeechSynthesis::resume()
void SpeechSynthesis::fireEvent(const AtomicString& type, SpeechSynthesisUtterance* utterance, unsigned long charIndex, const String& name)
{
utterance->dispatchEvent(SpeechSynthesisEvent::create(type, charIndex, (currentTime() - utterance->startTime()), name));
utterance->dispatchEvent(SpeechSynthesisEvent::create(type, charIndex, (monotonicallyIncreasingTime() - utterance->startTime()), name));
}
void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utterance, bool errorOccurred)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment