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

Side by Side Diff: tests/html/interactive_test.dart

Issue 12274002: Fixing Geolocation on Firefox (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding manual test Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library interactive_test;
6
7 import 'dart:async';
8 import 'dart:html';
9 import '../../pkg/unittest/lib/unittest.dart';
10 import '../../pkg/unittest/lib/html_individual_config.dart';
11 import 'utils.dart';
12
13
14 main() {
15 useHtmlIndividualConfiguration();
16
17 group('Geolocation', () {
18 futureTest('getCurrentPosition', () {
19 return window.navigator.geolocation.getCurrentPosition().then(
20 (position) {
21 expect(position.coords.latitude, isNotNull);
22 expect(position.coords.longitude, isNotNull);
23 expect(position.coords.accuracy, isNotNull);
24 });
25 });
26
27 futureTest('watchPosition', () {
28 return window.navigator.geolocation.watchPosition().first.then(
29 (position) {
30 expect(position.coords.latitude, isNotNull);
31 expect(position.coords.longitude, isNotNull);
32 expect(position.coords.accuracy, isNotNull);
33 });
34 });
35 });
36
37 group('MediaStream', () {
38 if (MediaStream.supported) {
39 futureTest('getUserMedia', () {
40 return window.navigator.getUserMedia(video: true).then((stream) {
41 expect(stream, isNotNull);
42
43 var url = Url.createObjectUrl(stream);
44 expect(url, isNotNull);
45
46 var video = new VideoElement()
47 ..autoplay = true;
48
49 var completer = new Completer();
50 video.onError.listen((e) {
51 completer.completeError(e);
52 });
53 video.onPlaying.first.then((e) {
54 completer.complete(video);
55 });
56
57 document.body.append(video);
58 video.src = url;
59
60 return completer.future;
61 });
62 });
63 }
64 });
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698