OLD | NEW |
---|---|
1 library WebSocketTest; | 1 library WebSocketTest; |
2 import 'package:unittest/unittest.dart'; | 2 import 'package:unittest/unittest.dart'; |
3 import 'package:unittest/html_individual_config.dart'; | 3 import 'package:unittest/html_individual_config.dart'; |
4 import 'dart:html'; | 4 import 'dart:html'; |
5 | 5 |
6 main() { | 6 main() { |
7 | 7 |
8 useHtmlIndividualConfiguration(); | 8 useHtmlIndividualConfiguration(); |
9 | 9 |
10 group('supported', () { | 10 group('supported', () { |
(...skipping 17 matching lines...) Expand all Loading... | |
28 if (WebSocket.supported) { | 28 if (WebSocket.supported) { |
29 test('echo', () { | 29 test('echo', () { |
30 var socket = new WebSocket('ws://${window.location.host}/ws'); | 30 var socket = new WebSocket('ws://${window.location.host}/ws'); |
31 | 31 |
32 socket.onOpen.first.then((_) { | 32 socket.onOpen.first.then((_) { |
33 socket.send('hello!'); | 33 socket.send('hello!'); |
34 }); | 34 }); |
35 | 35 |
36 return socket.onMessage.first.then((MessageEvent e) { | 36 return socket.onMessage.first.then((MessageEvent e) { |
37 expect(e.data, 'hello!'); | 37 expect(e.data, 'hello!'); |
38 socket.close(); | |
39 }); | |
40 }); | |
41 | |
42 test('error', () { | |
43 // The server supports ws, but not wss, this will yeild an error that we | |
sra1
2015/12/10 05:30:38
yield
Siggi Cherem (dart-lang)
2015/12/10 20:27:39
Done.
| |
44 // expect to catch below. | |
45 var socket = new WebSocket('wss://${window.location.host}/ws'); | |
46 socket.onOpen.first.then((_) => socket.send('hello!')); | |
47 return socket.onError.first.then((e) { | |
48 // This test checks fo regressions of issue #19137: on Safari 7 an | |
49 // error like this one would be seen, but dart2js's logic to provide | |
50 // an interceptor failed while trying to compute the name of the | |
51 // constructor. | |
sra1
2015/12/10 05:30:38
I'm not clear how this fails / passes. Can you exp
Siggi Cherem (dart-lang)
2015/12/10 20:27:39
Done - added more details.
I was not able to veri
| |
52 print('$e was caught'); | |
53 socket.close(); | |
38 }); | 54 }); |
39 }); | 55 }); |
40 } | 56 } |
41 }); | 57 }); |
42 } | 58 } |
OLD | NEW |