| Index: tests/lib_strong/html/interactive_test.dart
|
| diff --git a/tests/lib_strong/html/interactive_test.dart b/tests/lib_strong/html/interactive_test.dart
|
| index 82a879b89412e666e130c8f4fa67da3d4f8dfa6d..796b95cfd6ddecc245202c9a4c195695a437a8b5 100644
|
| --- a/tests/lib_strong/html/interactive_test.dart
|
| +++ b/tests/lib_strong/html/interactive_test.dart
|
| @@ -1,4 +1,4 @@
|
| - // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| @@ -10,27 +10,27 @@ import 'package:unittest/unittest.dart';
|
| import 'package:unittest/html_individual_config.dart';
|
| import 'utils.dart';
|
|
|
| -
|
| main() {
|
| useHtmlIndividualConfiguration();
|
|
|
| group('Geolocation', () {
|
| test('getCurrentPosition', () {
|
| - return window.navigator.geolocation.getCurrentPosition().then(
|
| - (position) {
|
| - expect(position.coords.latitude, isNotNull);
|
| - expect(position.coords.longitude, isNotNull);
|
| - expect(position.coords.accuracy, isNotNull);
|
| - });
|
| + return window.navigator.geolocation.getCurrentPosition().then((position) {
|
| + expect(position.coords.latitude, isNotNull);
|
| + expect(position.coords.longitude, isNotNull);
|
| + expect(position.coords.accuracy, isNotNull);
|
| + });
|
| });
|
|
|
| test('watchPosition', () {
|
| - return window.navigator.geolocation.watchPosition().first.then(
|
| - (position) {
|
| - expect(position.coords.latitude, isNotNull);
|
| - expect(position.coords.longitude, isNotNull);
|
| - expect(position.coords.accuracy, isNotNull);
|
| - });
|
| + return window.navigator.geolocation
|
| + .watchPosition()
|
| + .first
|
| + .then((position) {
|
| + expect(position.coords.latitude, isNotNull);
|
| + expect(position.coords.longitude, isNotNull);
|
| + expect(position.coords.accuracy, isNotNull);
|
| + });
|
| });
|
| });
|
|
|
| @@ -38,13 +38,12 @@ main() {
|
| if (MediaStream.supported) {
|
| test('getUserMedia', () {
|
| return window.navigator.getUserMedia(video: true).then((stream) {
|
| - expect(stream, isNotNull);
|
| + expect(stream, isNotNull);
|
|
|
| var url = Url.createObjectUrlFromStream(stream);
|
| - expect(url, isNotNull);
|
| + expect(url, isNotNull);
|
|
|
| - var video = new VideoElement()
|
| - ..autoplay = true;
|
| + var video = new VideoElement()..autoplay = true;
|
|
|
| var completer = new Completer();
|
| video.onError.listen((e) {
|
| @@ -62,20 +61,19 @@ main() {
|
| });
|
|
|
| test('getUserMediaComplexConstructor', () {
|
| - return window.navigator.getUserMedia(
|
| - video: {'mandatory':
|
| - { 'minAspectRatio': 1.333, 'maxAspectRatio': 1.334 },
|
| - 'optional':
|
| - [{ 'minFrameRate': 60 },
|
| - { 'maxWidth': 640 }]
|
| - }).then((stream) {
|
| - expect(stream, isNotNull);
|
| + 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.createObjectUrlFromStream(stream);
|
| - expect(url, isNotNull);
|
| + expect(url, isNotNull);
|
|
|
| - var video = new VideoElement()
|
| - ..autoplay = true;
|
| + var video = new VideoElement()..autoplay = true;
|
|
|
| var completer = new Completer();
|
| video.onError.listen((e) {
|
| @@ -101,23 +99,27 @@ main() {
|
| ' ${e.keyCode}<br />';
|
| expect(e.charCode, 0);
|
| }
|
| +
|
| keypressHandlerTest(KeyEvent e) {
|
| document.body.innerHtml =
|
| '${document.body.innerHtml}KeyPRESS: CharCode: ${e.charCode}, '
|
| 'KeyCode: ${e.keyCode}<br />';
|
| }
|
| +
|
| keyupHandlerTest(KeyEvent e) {
|
| document.body.innerHtml =
|
| '${document.body.innerHtml}KeyUP: CharCode: ${e.charCode}, KeyCode:'
|
| ' ${e.keyCode}<br />';
|
| expect(e.charCode, 0);
|
| }
|
| +
|
| keyupHandlerTest2(KeyEvent e) {
|
| document.body.innerHtml =
|
| '${document.body.innerHtml}A second KeyUP handler: CharCode: '
|
| '${e.charCode}, KeyCode: ${e.keyCode}<br />';
|
| expect(e.charCode, 0);
|
| }
|
| +
|
| test('keys', () {
|
| document.body.innerHtml =
|
| '${document.body.innerHtml}To test keyboard event values, press some '
|
| @@ -125,14 +127,10 @@ main() {
|
| ' should be 0, and the keycode should (generally) be populated with a'
|
| ' value. Keycode and charcode should both have values for the '
|
| 'keypress event.';
|
| - KeyboardEventStream.onKeyDown(document.body).listen(
|
| - keydownHandlerTest);
|
| - KeyboardEventStream.onKeyPress(document.body).listen(
|
| - keypressHandlerTest);
|
| - KeyboardEventStream.onKeyUp(document.body).listen(
|
| - keyupHandlerTest);
|
| - KeyboardEventStream.onKeyUp(document.body).listen(
|
| - keyupHandlerTest2);
|
| + KeyboardEventStream.onKeyDown(document.body).listen(keydownHandlerTest);
|
| + KeyboardEventStream.onKeyPress(document.body).listen(keypressHandlerTest);
|
| + KeyboardEventStream.onKeyUp(document.body).listen(keyupHandlerTest);
|
| + KeyboardEventStream.onKeyUp(document.body).listen(keyupHandlerTest2);
|
| });
|
| });
|
| }
|
|
|