-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MediaStream API: Patch #3 of implementing navigator.getMediaDevices
Adds idl files and tests. Initial patch (1) by tommyw@ from https://codereview.chromium.org/145583015/ BUG=338511 Review URL: https://codereview.chromium.org/286673003 git-svn-id: svn://svn.chromium.org/blink/trunk@175469 bbb929c8-8fbe-4397-9dbb-9b2b20218538
- Loading branch information
1 parent
c841600
commit 70b600d
Showing
6 changed files
with
157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Tests navigator.getMediaDevices | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS navigator.getMediaDevices(devicesCallback); did not throw exception. | ||
PASS After getMediaDevices | ||
PASS Devices returned. | ||
PASS devices.length is 3 | ||
PASS devices[0].deviceId.length is > 0 | ||
PASS devices[1].deviceId.length is > 0 | ||
PASS devices[2].deviceId.length is > 0 | ||
PASS devices[0].deviceId is not devices[1].deviceId | ||
PASS devices[0].deviceId is not devices[2].deviceId | ||
PASS devices[1].deviceId is not devices[2].deviceId | ||
PASS devices[0].kind is "audioinput" | ||
PASS devices[1].kind is "audiooutput" | ||
PASS devices[2].kind is "videoinput" | ||
PASS devices[0].label.length is > 0 | ||
PASS devices[1].label.length is > 0 | ||
PASS devices[2].label.length is > 0 | ||
PASS devices[0].label is not devices[1].label | ||
PASS devices[0].label is not devices[2].label | ||
PASS devices[1].label is not devices[2].label | ||
PASS devices[0].groupId.length is > 0 | ||
PASS devices[1].groupId.length is > 0 | ||
PASS devices[2].groupId.length is > 0 | ||
PASS devices[0].groupId is devices[1].groupId | ||
PASS devices[0].groupId is not devices[2].groupId | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
description("Tests navigator.getMediaDevices"); | ||
|
||
var devices = null; | ||
|
||
function devicesCallback(d) { | ||
devices = d; | ||
testPassed('Devices returned.'); | ||
shouldBe('devices.length', '3'); | ||
|
||
shouldBeGreaterThan('devices[0].deviceId.length', '0'); | ||
shouldBeGreaterThan('devices[1].deviceId.length', '0'); | ||
shouldBeGreaterThan('devices[2].deviceId.length', '0'); | ||
shouldNotBe('devices[0].deviceId', 'devices[1].deviceId'); | ||
shouldNotBe('devices[0].deviceId', 'devices[2].deviceId'); | ||
shouldNotBe('devices[1].deviceId', 'devices[2].deviceId'); | ||
|
||
shouldBeEqualToString('devices[0].kind', 'audioinput'); | ||
shouldBeEqualToString('devices[1].kind', 'audiooutput'); | ||
shouldBeEqualToString('devices[2].kind', 'videoinput'); | ||
|
||
shouldBeGreaterThan('devices[0].label.length', '0'); | ||
shouldBeGreaterThan('devices[1].label.length', '0'); | ||
shouldBeGreaterThan('devices[2].label.length', '0'); | ||
shouldNotBe('devices[0].label', 'devices[1].label'); | ||
shouldNotBe('devices[0].label', 'devices[2].label'); | ||
shouldNotBe('devices[1].label', 'devices[2].label'); | ||
|
||
shouldBeGreaterThan('devices[0].groupId.length', '0'); | ||
shouldBeGreaterThan('devices[1].groupId.length', '0'); | ||
shouldBeGreaterThan('devices[2].groupId.length', '0'); | ||
shouldBe('devices[0].groupId', 'devices[1].groupId'); | ||
shouldNotBe('devices[0].groupId', 'devices[2].groupId'); | ||
|
||
finishJSTest(); | ||
} | ||
|
||
shouldNotThrow("navigator.getMediaDevices(devicesCallback);"); | ||
testPassed('After getMediaDevices'); | ||
|
||
window.jsTestIsAsync = true; | ||
window.successfullyParsed = true; | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (C) 2014 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: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. 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 GOOGLE INC. ``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 GOOGLE INC. 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. | ||
*/ | ||
|
||
enum MediaDeviceKind { | ||
"audioinput", | ||
"audiooutput", | ||
"videoinput" | ||
}; | ||
|
||
[ | ||
WillBeGarbageCollected, | ||
NoInterfaceObject | ||
] interface MediaDeviceInfo { | ||
readonly attribute DOMString deviceId; | ||
readonly attribute MediaDeviceKind kind; | ||
readonly attribute DOMString label; | ||
readonly attribute DOMString groupId; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright (C) 2014 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: | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. 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 GOOGLE INC. ``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 GOOGLE INC. 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. | ||
*/ | ||
|
||
callback interface MediaDeviceInfoCallback { | ||
void handleEvent(sequence<MediaDeviceInfo> devices); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters