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

Unified Diff: tests/html/interactive_test.dart

Issue 12695014: Enable getUserMedia to take constraints for its parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
Index: tests/html/interactive_test.dart
diff --git a/tests/html/interactive_test.dart b/tests/html/interactive_test.dart
index f688ee5bbe29a3cb8d3e94207e8ec0dcef1f1969..47bbe08475b4b8e2368c02e5c99d9a30192094af 100644
--- a/tests/html/interactive_test.dart
+++ b/tests/html/interactive_test.dart
@@ -15,7 +15,7 @@ main() {
useHtmlIndividualConfiguration();
group('Geolocation', () {
- futureTest('getCurrentPosition', () {
+ test('getCurrentPosition', () {
return window.navigator.geolocation.getCurrentPosition().then(
(position) {
expect(position.coords.latitude, isNotNull);
@@ -24,7 +24,7 @@ main() {
});
});
- futureTest('watchPosition', () {
+ test('watchPosition', () {
return window.navigator.geolocation.watchPosition().first.then(
(position) {
expect(position.coords.latitude, isNotNull);
@@ -36,7 +36,7 @@ main() {
group('MediaStream', () {
if (MediaStream.supported) {
- futureTest('getUserMedia', () {
+ test('getUserMedia', () {
return window.navigator.getUserMedia(video: true).then((stream) {
expect(stream, isNotNull);
@@ -60,6 +60,37 @@ main() {
return completer.future;
});
});
+
+ test('getUserMediaComplexConstructor', () {
+ return window.navigator.getUserMedia(
+ video: {'mandatory':
+ { 'minAspectRatio': 1.333, 'maxAspectRatio': 1.334 },
+ 'optional':
+ [{ 'minFrameRate': 60 },
+ { 'maxWidth': 640 }]
+ }).then((stream) {
+ expect(stream, isNotNull);
+
+ var url = Url.createObjectUrl(stream);
+ expect(url, isNotNull);
+
+ var video = new VideoElement()
+ ..autoplay = true;
+
+ var completer = new Completer();
+ video.onError.listen((e) {
+ completer.completeError(e);
+ });
+ video.onPlaying.first.then((e) {
+ completer.complete(video);
+ });
+
+ document.body.append(video);
+ video.src = url;
+
+ return completer.future;
+ });
+ });
}
});
}

Powered by Google App Engine
This is Rietveld 408576698