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

Unified Diff: LayoutTests/webaudio/mediaelementaudiosourcenode.html

Issue 692213004: Use better error message for an HTMLMediaElement that has already been connected. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/webaudio/mediaelementaudiosourcenode-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/webaudio/mediaelementaudiosourcenode.html
diff --git a/LayoutTests/webaudio/mediaelementaudiosourcenode.html b/LayoutTests/webaudio/mediaelementaudiosourcenode.html
index 9747f2514d35e7d351032802c24c6d7158c2b25b..37f82ba63935de8f1d72e079a93de6af0d5f8526 100644
--- a/LayoutTests/webaudio/mediaelementaudiosourcenode.html
+++ b/LayoutTests/webaudio/mediaelementaudiosourcenode.html
@@ -15,70 +15,33 @@
description("Basic tests for MediaElementAudioSourceNode API.");
var context = 0;
+var audioElement = 0;
+var audioNode = 0;
function runTest() {
- if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
- }
-
window.jsTestIsAsync = true;
context = new AudioContext();
audioElement = new Audio();
mediaSource = context.createMediaElementSource(audioElement);
- window.audioNode = mediaSource;
+ audioNode = mediaSource;
// Check number of inputs and outputs.
- if (audioNode.numberOfInputs == 0)
- testPassed("Source AudioNode has no inputs.");
- else
- testFailed("Source AudioNode should not have inputs.");
-
- if (audioNode.numberOfOutputs == 1)
- testPassed("Source AudioNode has one output.");
- else
- testFailed("Source AudioNode should have one output.");
-
- // Try calling connect() method with illegal values.
-
- try {
- audioNode.connect(0, 0, 0);
- testFailed("connect() exception should be thrown for illegal destination AudioNode.");
- } catch(e) {
- testPassed("connect() exception thrown for illegal destination AudioNode.");
- }
-
- try {
- audioNode.connect(context.destination, 5, 0);
- testFailed("connect() exception should be thrown for illegal output index.");
- } catch(e) {
- testPassed("connect() exception thrown for illegal output index.");
- }
+ shouldBeEqualToNumber("audioNode.numberOfInputs", 0);
+ shouldBeEqualToNumber("audioNode.numberOfOutputs", 1);
- try {
- audioNode.connect(context.destination, 0, 5);
- testFailed("connect() exception should be thrown for illegal input index.");
- } catch(e) {
- testPassed("connect() exception thrown for illegal input index.");
- }
+ // Try calling connect() method with illegal values: illegal destination, illegal output index,
+ // and illegal input index.
+ shouldThrow("audioNode.connect(0, 0, 0)");
+ shouldThrow("audioNode.connect(context.destination, 5, 0)");
+ shouldThrow("audioNode.connect(context.destination, 0, 5)");
// Try calling connect() with proper values.
- try {
- audioNode.connect(context.destination, 0, 0);
- testPassed("audioNode.connect(context.destination) succeeded.");
- } catch(e) {
- testFailed("audioNode.connect(context.destination) failed.");
- }
+ shouldNotThrow("audioNode.connect(context.destination, 0, 0)");
// Try creating another MediaElementAudioSourceNode using the same audio element.
- try {
- mediaSource = context.createMediaElementSource(audioElement);
- testFailed("createMediaElementSource() should throw if called twice on same HTMLMediaElement.");
- } catch(e) {
- testPassed("createMediaElementSource() threw error when called twice on same HTMLMediaElement.");
- }
+ shouldThrow("context.createMediaElementSource(audioElement)");
finishJSTest();
}
« no previous file with comments | « no previous file | LayoutTests/webaudio/mediaelementaudiosourcenode-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698