Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/speechsynthesis/speech-synthesis-speak-multiple.html

Issue 2540623002: Fix speech-synthesis-speak-multiple.html flakiness. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML> 1 <!DOCTYPE HTML>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 description("This tests that multiple speak utterances are handled in sequen ce."); 8 description("This tests that multiple speak utterances are handled in sequen ce.");
9 9
10 if (window.internals) 10 if (window.internals)
11 window.internals.enableMockSpeechSynthesizer(document); 11 window.internals.enableMockSpeechSynthesizer(document);
12 12
13 if (window.testRunner) 13 if (window.testRunner)
14 testRunner.waitUntilDone(); 14 testRunner.waitUntilDone();
15 15
16 window.jsTestIsAsync = true; 16 window.jsTestIsAsync = true;
17 17
18 var count = 3; 18 var count = 3;
19 var i = 0; 19 var i = 0;
20 20
21 // Start a very short speaking job that will finish quickly. 21 // Start a very short speaking job that will finish quickly.
22 var u = new SpeechSynthesisUtterance(" "); 22 var u = new SpeechSynthesisUtterance(" ");
23 u.onstart = function(event) { 23 u.onstart = function(event) {
24 shouldBeTrue("event.elapsedTime > 0"); 24 shouldBeTrue("event.elapsedTime >= 0");
25 shouldBeTrue("event.elapsedTime < 1000");
25 shouldBeTrue("speechSynthesis.speaking"); 26 shouldBeTrue("speechSynthesis.speaking");
26 }; 27 };
27 u.onend = function(event) { 28 u.onend = function(event) {
28 shouldBeGreaterThanOrEqual("count", "i"); 29 shouldBeGreaterThanOrEqual("count", "i");
29 shouldBeTrue("event.elapsedTime > 0"); 30 shouldBeTrue("event.elapsedTime > 0");
31 shouldBeTrue("event.elapsedTime < 10000");
30 shouldBeTrue("speechSynthesis.speaking"); 32 shouldBeTrue("speechSynthesis.speaking");
31 if (++i == count) { 33 if (++i == count) {
32 speechSynthesis.cancel(); 34 speechSynthesis.cancel();
33 // Add a new utterance just after the cancel() to signal test comple tion. 35 // Add a new utterance just after the cancel() to signal test comple tion.
34 speechSynthesis.speak(finishingUtterance); 36 speechSynthesis.speak(finishingUtterance);
35 } 37 }
36 }; 38 };
37 39
38 var finishingUtterance = new SpeechSynthesisUtterance(" "); 40 var finishingUtterance = new SpeechSynthesisUtterance(" ");
39 finishingUtterance.onend = finishJSTest; 41 finishingUtterance.onend = finishJSTest;
40 42
41 shouldBeFalse("speechSynthesis.speaking"); 43 shouldBeFalse("speechSynthesis.speaking");
42 // Issue more utterances than where we break off. 44 // Issue more utterances than where we break off.
43 for (var j = 0; j < count + 2; ++j) 45 for (var j = 0; j < count + 2; ++j)
44 speechSynthesis.speak(u); 46 speechSynthesis.speak(u);
45 </script> 47 </script>
46 </body> 48 </body>
47 </html> 49 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698